Operating system calls are made through the Trap function (Assembly: TRAP opcode: 50). The second byte specifies which operating system function is called. The current calls are as follows:
| Assembly | Machine Code | Arguments | Return Values | Notes |
|---|---|---|---|---|
| TRAP SCROLL_LEFT | 50 01 | none | none | Scroll the screen left one pixel. |
| TRAP SCROLL_RIGHT | 50 02 | none | none | Scroll the screen right one pixel. |
| TRAP DRAW_CHAR | 50 03 |
Reg B: character index. Characters assumed to be 16 pixels high by 8 pixels wide. First character is referenced with a value of 0001 in Reg B. Reg C: x position at which to begin drawing character. Color is stored in memory. (27F4: red; 27F6: green; 27F8: blue) Base address of character set is stored in memory at 27F2. |
none |
Draw the character (from character set loaded into memory) specified in Reg B at the position specified in Reg C in the color specified in memory.
First character in character set is referenced with the value 1 in Reg B. |
| TRAP CLEAR_SCREEN | 50 04 | none | none | Clear all pixels on the screen (set them all to black). |
| TRAP FILL_SCREEN | 50 05 | Color is stored in memory. (27F4: red; 27F6: green; 27F8: blue) | none | Fill the screen with a specified color. |
| TRAP INVERT_SCREEN | 50 06 | none | none | Invert the colors on the screen by XORing all of the bytes in the screen memory with FF. Calling this trap twice will always return the screen to its original state. |
| TRAP COLOR_SWAP | 50 08 |
Colors are stored in memory.
Color1: 27F4: red; 27F6: green; 27F8: blue Color2: 27F5: red; 27F7: green; 27F9: blue |
none | Replace all occurences on the screen of Color1 with Color2. |
| TRAP COLOR_SWAP2 | 50 09 |
Colors are stored in memory.
Color1: 27F4: red; 27F6: green; 27F8: blue Color2: 27F5: red; 27F7: green; 27F9: blue |
none | Replace all occurences on the screen of Color2 with Color1. |
| TRAP DRAW_OFF | 50 0A | none | none | Suspend redrawing of the screen after trap calls. |
| TRAP DRAW_ON | 50 0B | none | none | Resume redrawing of the screen after trap calls including this one. |
| TRAP LOAD_COLORS | 50 0C |
Reg A: address of 6 bytes of color data. |
Draw Color: 27F4: red; 27F6: green; 27F8: blue |
Move 6 bytes of color data from the specified address into the Draw Color reserved memory starting at 27F4. |
| TRAP TRAP_GET_TIME | 50 20 | none |
Reg A: tens digit of hour.
Reg B: ones digit of hour. Reg C: tens digit of minute. Reg D: ones digit of minute. |
Get the time of day. |
| TRAP TRAP_TIME_TIL_TRAIN | 50 21 | none | Reg A: number of minutes until next train. | Get number of minutes until the next train. |