MascOS uses some custom interrupts to allow external programs to use useful stuff like printing a string or colouring a line. Here's the list of the interrupts and what they do.
End of program interrupt. This interrupt gets invoked whenever an external program ends it's job and wants to pass control to the kernel. Doesn't expect any input, just call the interrupt.
This is the same interrupt as the MS DOS one. You can find the list of the functions of this interrupt online. Here's the first one I found online.
I only have implemented the functions for ah set to 0x1 to 0xa exluding 0x5, then 0xd, 0x19, 0x25, 0x2a, 0x2c, 0x35, 0x4c, 0x56.
Disk routines for searching, loading files by messing with the FAT12 file system.
Finds a file in the root directory of FAT12, returning the pointer of the entry.
ah
= 0
ds:si
= pointer to file name. Needs to be a zero terminated string of 11 characters.
Output
carry flag
= clear for success, set for error
si
= pointer to entry in root dir
Loads a file at the specified offset in memory. The offset is specified by es:bx
.
Just don't write mistakenly(or on purpose?) write over the kernel or at any lower memory offset.
ah
= 1
ds:si
= offset to entry in root dir
es:bx
= offset to read to
Gets the name and file extension of a file, via the specified pointer to the entry in the root directory.
ah
= 2
ds:si
= pointer to string to output name to. Needs to be 12 characters because remember the 0 at the end.
Gets the file size and returns the value in kilobytes(KB).
ah
= 3
ds:si
= pointer to entry in root directory
Output
ax
= file size in KB
dx
= remainder in bytes
Renames a file including the extension. To rename a file you need a valid FAT12 file name, so 8 bytes for the name and 3 for the extension.
ah
= 4
ds:si
= pointer to file to rename
es:di
= pointer to new file name
Output
carry flag
= set for invalid file name, clear for success
Screen output throught VGA driver.
Prints a string at cursor position. Automatically scrolls if the text goes out of the screen.
ah
= 0
ds:si
= pointer to string
al
= attribute(foreground and background colour)
Prints a single character at cursor position.
ah
= 1
al
= character to print
bl
= attribute byte
Adds the specified number of new lines, changing the cursor position.
ah
= 2
al
= number of new lines
Moves the cursor to a specified line.
ah
= 3
al
= line to go to
Clears out a single line, attribute byte too.
ah
= 4
al
= line to clear
Changes the attribute byte of a specified chunk of screen estate.
ah
= 5
al
= attribute byte, colour
cx
= how many columns to change colour to
bh
= y position(max 24)
bl
= x position(max 80)
Yup, it clears the screen.
ah
= 6
Deletes the last character. Added this because it was needed by Edit program, the text editor.
ah
= 7
This function will return the colours that are currently used for printing text and stuff.
ah
= 8
Output
bl
= text colour, the one used for almost everything
bh
= accent colour, for example this is used for the command prompt arrow thinghy
Changes the cursor position to the specified position onto the screen.
ah
= 9
bh
= y position(max 24)
bl
= x position(max 80)
Used to play and stop sound using the pc speaker.
Plays a sound of the specified frequency.
ah
= 0
bx
= frequency(minimum 80 or you won't hear anything)
Plays a series of frequencies to mimic a music track. The track must be null-terminated. A single frequency is 2 bytes large.
ah
= 1
ds:si
= pointer to null-terminated track.
Shuts up the pc speaker.
ah
= 2
This is only used to launch a program from another one, so one doesn't need to pass control again to the kernel when switching programs.
si
= pointer to file name, must be 11 characters with the last 3 being the extension