| CB2 micro Technical manual | 




| connection | signal | 
| 1 | Video blue | 
| 2 | Video red | 
| 3 | Video green | 
| 4 | VSYNC | 
| 5 | HSYNC / CSYNC | 
| 6 | + 5V | 
| 7 | Audio | 
| 8 | Video BAS | 
| 9 | Clock Sync | 
| casing | GND (0V) | 






| start address | end address | bytes | function | 
| 0 | 689 | 690 | character | 
| 690 | 1379 | 690 | attributes | 
| 1380 | 2759 | 1380 | Backup for monitor | 


| start address | end address | bytes | function | 
| 0 | 2435 | 2436 | pixel information | 
| 2436 | 2750 | 315 | attributes | 
| 2751 | 2759 | 9 | unused | 


| start address | end address | bytes | function | 
| 0 | 2279 | 2280 | pixel information | 
| 2280 | 2759 | 480 | unused | 

| start address | end address | bytes | function | 
| 0 | 2435 | 2436 | pixel information | 
| 2436 | 2759 | 324 | unused | 

| start address | end address | bytes | function | 
| 0 | 689 | 690 | character | 
| 690 | 1379 | 690 | attributes | 
| 1448 | 2727 | 1280 | character set | 
| 2728 | 2759 | 32 | unused | 



| start address | end address | bytes | function | 
| 0 | 1023 | 1024 | pixel information | 
| 1024 | 2759 | 1736 | Backup for monitor | 

| start address | end address | bytes | function | 
| 0 | 689 | 690 | character | 
| 690 | 2609 | 1920 | character set | 
| 2610 | 2759 | 150 | unused | 


| .include "M644Pdef.inc" | 
| .include "M644Pdef.inc" | 
| bit | Surname | function | 
| 7 | --- | currently not used | 
| 6 | UPAR | 0 = driver uses parallel port | 
| 5 | ISLIB | 0 = program is a library | 
| 4 | EXEC | 0 = Program can be started from the main menu | 
| 3 ... 0 | ICOL | ICON foreground color | 
| color code | colour | file type | 
| 0000 | black | not used (invisible) | 
| x001 | blue | not used (lack of contrast) | 
| X010 | red | Reserved for loader | 
| x011 | magenta | Default for drivers | 
| x100 | green | Default for libraries | 
| x101 | cyan | Default for binary programs | 
| x110 | yellow | Reserved for non-bootable BASIC programs (text) | 
| x111 | White | Reserved for BASIC programs | 
| Type | flag byte | program type | 
| "B" | 0xF7 | dates | 
| "N" | 0xE5 | binary | 
| "N" | 0xd4 | Binary library | 
| "N" | 0xf3 | driver | 
| "N" | 0xB3 | Driver, uses parallel port | 
| "L" | 0xF2 | Loader | 
| bit | function | 
| 7 | Not occupied | 
| 6 | Program contains a font | 
| 5 | Program contains a file system driver | 
| 4 | Program contains drivers for external / internal memory | 
| 3 | Program contains BASIC extension | 
| 2 | Program contains sound routines | 
| 1 | Program contains cyclic routine called in every frame | 
| 0 | Program contains video drivers | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x00 | 0x00 | 12 | program name | 
| --- | 0x0c | 1 | "N" as identifier for binary programs | 
| --- | 0x0d | 1 | Flagbyte 1, usually 0xe5 | 
| --- | 0x0e | 1 | Flagbyte 2, usually 0xff | 
| --- | 0x0f | 1 | Library number, should be 0xff | 
| 0x08 | 0x10 | 12 | Icon data | 
| 0x0e | 0x1c | 2 | can be used arbitrarily | 
| 0x0f | 0x1e | 2 | can be used arbitrarily | 
| 0x10 | 0x20 | 2 | Start the program | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x00 | 0x00 | 12 | program name | 
| --- | 0x0c | 1 | "N" as identifier for binary programs | 
| --- | 0x0d | 1 | Flag byte 1 = 0xd4 | 
| --- | 0x0e | 1 | Flagbyte 2 = 0xff or additional functions | 
| --- | 0x0f | 1 | library number | 
| 0x08 | 0x10 | 12 | Icon data | 
| 0x0e | 0x1c | 2 | can be used arbitrarily | 
| 0x0f | 0x1e | 2 | can be used arbitrarily | 
| 0x10 | 0x20 | 2 | Jump to the routine Nr.0 | 
| 0x11 | 0x22 | 2 | Jump to the routine Nr.1 | 
| 0x12 | 0x24 | 2 | Jump to routine no.2, further routines up to 119 possible | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x00 | 0x00 | 12 | program name | 
| --- | 0x0c | 1 | "N" as identifier for binary programs | 
| --- | 0x0d | 1 | Flagbyte 1 = 0xf4 | 
| --- | 0x0e | 1 | Flag byte 2 = 0xf7 | 
| --- | 0x0f | 1 | library number | 
| 0x08 | 0x10 | 12 | Icon data | 
| 0x0e | 0x1c | 2 | should be 0xffff | 
| 0x0f | 0x1e | 2 | should be 0xffff | 
| 0x10 | 0x20 | 2 | (Jump to) parser routine | 
| 0x11 | 0x22 | 2 | Jump to the routine Nr.1 | 
| 0x12 | 0x24 | 2 | Jump to routine no.2, further routines up to 119 possible | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x00 | 0x00 | 12 | program name | 
| --- | 0x0c | 1 | "N" as identifier for binary programs | 
| --- | 0x0d | 1 | Flag byte 1 = 0xd3 | 
| --- | 0x0e | 1 | Flag byte 2 = 0xfe | 
| --- | 0x0f | 1 | library number | 
| 0x08 | 0x10 | 12 | Icon data | 
| 0x0e | 0x1c | 2 | Jump to IN expansion or R24 (ereg) set to 40 | 
| 0x0f | 0x1e | 2 | Jump to OUT expansion or R24 (ereg) set to 40 | 
| 0x10 | 0x20 | 2 | Jump to the (demo) application if program can be started | 
| 0x11 | 0x22 | 2 | Jump to INIT video mode (T flag set) or EXIT video mode (T flag cleared) | 
| 0x12 | 0x24 | 2 | Jump to the CLS routine | 
| 0x13 | 0x26 | 2 | Jump to the character output, characters in R20 | 
| 0x14 | 0x28 | 2 | Jump to the routine to set cursor position to XH: XL | 
| 0x15 | 0x2a | 2 | Jump to the plot XH: XL | 
| 0x16 | 0x2c | 2 | Jump to the newline routine, cursor to the beginning of the next line | 
| 0x17 | 0x2e | 2 | Jump to the video output routine | 
| 0x18 | 0x30 | 2 | Jump to init routine at system startup | 
| 0x19 | 0x32 | 2 | Jump to routine # 9, can go to 119 | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x19 | 0x32 | 2 | Jump to the array READ routine (Page / R20 = pointer, XL = data) | 
| 0x1a | 0x34 | 2 | Jump to array WRITE routine (Page / R20 = pointer, XL = data) | 
| 0x1b | 0x36 | 2 | Jump to byte READ routine (X +) -> r18 | 
| 0x1c | 0x38 | 2 | Jump to byte WRITE routine r18 -> (X +) | 
| 0x1d | 0x3a | 2 | Jump to the Word-READ routine (X +) -> r19 / r18 | 
| 0x1e | 0x3c | 2 | Jump to Word-WRITE routine r19 / r18 -> (X +) | 
| 0x1f | 0x3E | 2 | Jump to the XMEM-CHEXK routine (X = address of the last memory cell or 0 if no XMEM exists) | 
| 0x20 | 0x40 | 2 | Jump to the XMEM-CLEAR routine (describes complete XMEM with 0x00) | 
| 0x21 | 0x42 | 2 | Jump to routine No.17, can go to 119 | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x21 | 0x42 | 2 | Jump to the frame-INT routine | 
| WORD Offset | BYTE offset | Length (bytes) | function | 
| 0x22 | 0x44 | 2 | Jump to Envelope Routine (at the end of the frame) | 
| 0x23 | 0x46 | 2 | Jump to the notes routine | 
| offset | format | content | 
| 0 | INTEGER | Return value of the function | 
| 2 | INTEGER | Call parameter 1 | 
| 4 | INTEGER | Call parameter 2 | 
| 6 | INTEGER | Call parameter 3 | 
| 8 | INTEGER | Call parameter 4 | 
| 10 | INTEGER | Call parameter 5 | 
| 12 | BYTE | Number of transferred parameters | 
| start address | end address | meaning | 
| 0x800 | 0x809 | Level of usable output pins when I / O is disabled (0/1) | 
| 0x810 | 0x819 | Data direction of the usable output pins when I / O is disabled (0/1) | 
| 0x900 | 0xbff | Driver specific I / O | 
| 0x0c00 | 0xffff | currently not used | 
| Function name | Name of the API function, also corresponds to the macro call | 
| Call without macro | Calling the function when working without macros | 
| function Description | Brief description of the function | 
| Parameter | Register assignment to the parameters | 
| Return values | Register assignment to the return values | 
| Register | Registers whose content is changed (except return values) | 
| Video Modes | Video modes in which the function is useful. If this table row is missing, the function is applicable in all video modes. | 
| function name | api_pushxyz | 
| Call without macro | call api_pushxyz | 
| function Description | saves the registers X, Y and Z on the stack | 
| parameter | --- | 
| return values | --- | 
| register | R0, R1 | 
| function name | api_popxyz | 
| Call without macro | jmp api_popxyz | 
| function Description | gets the registers X, Y and Z from the stack and executes a RET | 
| parameter | --- | 
| return values | --- | 
| register | X, Y, Z | 
| function name | api_pushregs | 
| Call without macro | call api_pushregs | 
| function Description | saves the registers X, Y and Z as well as R20-R23 on the stack | 
| parameter | --- | 
| return values | --- | 
| register | R0, R1 | 
| function name | api_popxyz | 
| Call without macro | jmp api_popregs | 
| function Description | gets the registers X, Y and Z as well as R20-R23 from the stack and executes a RET | 
| parameter | --- | 
| return values | --- | 
| register | X, Y, Z, R20, R21, R22, R23 | 
| function name | api_add | 
| Call without macro | call api_add | 
| function Description | X = X + R16 / R17 | 
| parameter | X, R16, R17 | 
| return values | X | 
| register | R18 | 
| function name | api_sub | 
| Call without macro | call api_sub | 
| function Description | X = X - R16 / R17 | 
| parameter | X, R16, R17 | 
| return values | X | 
| register | R16 / R17 = -R16 / R17 | 
| function name | api_mul | 
| Call without macro | call api_mul | 
| function Description | X = X * R16 / R17 | 
| parameter | X, R16, R17 | 
| return values | X | 
| register | R16 ... R21 | 
| function name | api_div | 
| Call without macro | call api_div | 
| function Description | X = X / R16 / R17 | 
| parameter | X, R16, R17 | 
| return values | X = quotient, R18 / R19 = remainder | 
| register | R20, R21 | 
| function name | api_sin | 
| Call without macro | call api_sin | 
| function Description | X = 256 * SIN (X) | 
| parameter | X (in degrees) | 
| return values | X | 
| register | Z, R16, R17 | 
| function name | api_cos | 
| Call without macro | call api_cos | 
| function Description | X = 256 * COS (X) | 
| parameter | X (in degrees) | 
| return values | X | 
| register | Z, R16, R17 | 
| function name | api_eq | 
| Call without macro | call api_eq | 
| function Description | returns 1 if X == R16 / R17, otherwise 0 | 
| parameter | X, R16, R17 | 
| return values | X | 
| register | --- | 
| function name | api_gt | 
| Call without macro | call api_gt | 
| function Description | returns 1 if X> R16 / R17, otherwise 0 | 
| parameter | X, R16, R17 | 
| return values | X | 
| register | --- | 
| function name | api_lt | 
| Call without macro | call api_lt | 
| function Description | returns 1 if X <R16 / R17, otherwise 0 | 
| parameter | X, R16, R17 | 
| return values | X | 
| register | --- | 
| function name | api_sqr | 
| Call without macro | call api_sqr | 
| function Description | returns the square root of X, in this case X is unsigned | 
| parameter | X | 
| return values | X | 
| register | R16, R17, R18, R19 | 
| function name | api_abs | 
| Call without macro | call api_abs | 
| function Description | returns the absolute value of X | 
| parameter | X | 
| return values | X | 
| register | --- | 
| function name | api_rnd | 
| Call without macro | call api_rnd | 
| function Description | returns a random number between 0 and X-1 | 
| parameter | X | 
| return values | X | 
| register | R16 ... R19 | 
| function name | api_dbit | 
| Call without macro | call api_dbit | 
| function Description | calculates bit patterns for fonts in video mode 4, corresponds to the DBIT () function in BASIC | 
| parameter | X | 
| return values | X | 
| register | --- | 
| function name | api_adc | 
| Call without macro | call api_adc | 
| function Description | starts the ADC and returns the ADC value. | 
| parameter | X = channel (0 ... 7) | 
| return values | X = ADC value | 
| register | --- | 
| function name | api_scale | 
| Call without macro | call api_scale | 
| function Description | scaling function | 
| parameter | The parameters are in the range defined with api_getpartab | 
| return values | R16 / R17 = result | 
| register | R4-R7, R18, R19 | 
| offset | parameter | 
| 0 | Y0 | 
| 2 | Y1 | 
| 4 | X0 | 
| 6 | X | 
| 8th | X1 | 
| function name | api_sync | 
| Call without macro | call api_sync | 
| function Description | waiting for the end of the currently displayed field (lower edge of the used area) | 
| parameter | --- | 
| return values | --- | 
| register | --- | 
| function name | api_fast | 
| Call without macro | call api_fast | 
| function Description | turns off the picture output | 
| parameter | --- | 
| return values | --- | 
| register | --- | 
| function name | api_slow | 
| Call without macro | call api_slow | 
| function Description | turns on the picture output | 
| parameter | --- | 
| return values | --- | 
| register | --- | 
| function name | api_wpage | 
| Call without macro | call api_wpage | 
| function Description | writes a flash page | 
| parameter | Y = RAM address, Z = flash address | 
| return values | --- | 
| register | R20 ... R23, X, Y, Z | 
| function name | api_version | 
| Call without macro | call api_version | 
| function Description | determines the API version | 
| parameter | --- | 
| return values | R20 = API version (currently 6) | 
| register | --- | 
| function name | api_getvram | 
| Call without macro | call api_getvram | 
| function Description | determines the start address of the image memory | 
| parameter | --- | 
| return values | Y points to the beginning of the image memory | 
| register | --- | 
| function name | api_getsysram | 
| Call without macro | call api_getsysram | 
| function Description | determines the start address of the system memory | 
| parameter | --- | 
| return values | Y points to the beginning of the system memory | 
| register | --- | 
| function name | api_getpal | 
| Call without macro | call api_getpal | 
| function Description | determines the start address of the pallet memory | 
| parameter | --- | 
| return values | Y points to the beginning of the pallet memory | 
| register | --- | 
| function name | api_getarray | 
| Call without macro | call api_getarray | 
| function Description | determines the start address of the array | 
| parameter | --- | 
| return values | Y points to the beginning of the array | 
| register | --- | 
| function name | api_getvar | 
| Call without macro | call api_getvar | 
| function Description | determines the start address of the BASIC variable | 
| parameter | --- | 
| return values | Y points to the beginning of the BASIC variable (variable "A") | 
| register | --- | 
| function name | api_getprg | 
| Call without macro | call api_getprg | 
| function Description | determines the start address of the program assignment | 
| parameter | --- | 
| return values | Y points to the beginning of the assignment table (Word) | 
| register | --- | 
| function name | api_getvalues | 
| Call without macro | call api_getvalues | 
| function Description | determines the start address of the function parameter block | 
| parameter | --- | 
| return values | Y points to the beginning of the block | 
| register | --- | 
| function name | api_getpartab | 
| Call without macro | call api_getpartab | 
| function Description | determines the start address of the (internal) parameter block | 
| parameter | --- | 
| return values | Y points to the beginning of the block | 
| register | --- | 
| function name | api_getchart0 | 
| Call without macro | call api_getchart0 | 
| function Description | determines the starting address of the character table for font 0 in Flash | 
| parameter | --- | 
| return values | Z points to the beginning of the character table for font 0 | 
| register | --- | 
| function name | api_getchart1 | 
| Call without macro | call api_getchart1 | 
| function Description | determines the starting address of the character map for font 1 in Flash | 
| parameter | --- | 
| return values | Z points to the beginning of the character map for font 1 | 
| register | --- | 
| function name | api_getbuffer | 
| Call without macro | call api_getbuffer | 
| function Description | determines the start address of the two BASIC buffers | 
| parameter | --- | 
| return values | Y points to the beginning of the two memory areas | 
| register | --- | 
| function name | api_getprog | 
| Call without macro | call api_getprog | 
| function Description | determines the number of the calling program in Flash | 
| parameter | --- | 
| return values | ZL = program number (0 ... 7) | 
| register | ZH | 
| function name | api_getbase | 
| Call without macro | call api_getbase | 
| function Description | determines the start address of the calling program in Flash | 
| parameter | --- | 
| return values | Z points to the beginning of the calling program | 
| register | --- | 
| function name | api_dataptr | 
| Call without macro | call api_dataptr | 
| function Description | determines the address of a data block in the calling program | 
| parameter | X = offset | 
| return values | Z points to the absolute address of a data block in the calling program | 
| register | --- | 
| function name | api_drvcode | 
| Call without macro | call api_drvcode | 
| function Description | determines the flagbyte and drivercode of a loaded driver | 
| parameter | --- | 
| return values | R20 = flagbyte, R21 = drivercode | 
| register | --- | 
| function name | api_waitkey | 
| Call without macro | call api_waitkey | 
| function Description | waits for a keystroke (except SHIFT, CTRL, ALT) | 
| parameter | --- | 
| return values | R20 = Keycode of the pressed key | 
| register | --- | 
| function name | api_nokey | 
| Call without macro | call api_nokey | 
| function Description | waits until no key is pressed (except SHIFT, CTRL, ALT) | 
| parameter | --- | 
| return values | --- | 
| register | --- | 
| function name | api_kstate | 
| Call without macro | call api_kstate | 
| function Description | returns the current state of the SHIFT, CTRL and ALT keys | 
| parameter | --- | 
| return values | R20 (Bit0 = LSHIFT, Bit1 = RSHIFT, Bit2 = LCTRL, Bit3 = RCTRL, Bit4 = ALT) | 
| register | --- | 
| function name | api_keycode | 
| Call without macro | call api_keycode | 
| function Description | returns the keycode of the key being pressed or 0x00 (no key pressed) | 
| parameter | --- | 
| return values | R20 = Keycode | 
| register | --- | 
| function name | api_lastkey | 
| Call without macro | call api_lastkey | 
| function Description | returns the keycode of the last pressed key or 0x00 (no key pressed yet) | 
| parameter | --- | 
| return values | R20 = Keycode | 
| register | --- | 
| function name | api_scancode | 
| Call without macro | call api_scancode | 
| function Description | returns the scan code of the last key pressed | 
| parameter | --- | 
| return values | R20 = scan code | 
| register | --- | 
| function name | api_clrscr | 
| Call without macro | call api_clrscr | 
| function Description | clears the screen with the current color setting | 
| parameter | --- | 
| return values | --- | 
| register | R20 | 
| Video Modes | 0 ... 6 | 
| function name | api_clearvec | 
| Call without macro | call api_clearvec | 
| function Description | deletes the vector area in graphic mode 7 | 
| parameter | --- | 
| return values | --- | 
| register | --- | 
| Video Modes | 7 | 
| function name | api_cleartext | 
| Call without macro | call api_cleartext | 
| function Description | deletes the text area in graphic mode 7 with the current color setting | 
| parameter | --- | 
| return values | --- | 
| register | --- | 
| Video Modes | 7 | 
| function name | api_gotoxy | 
| Call without macro | call api_gotoxy | 
| function Description | sets the position of the text cursor (also in the graphics modes) | 
| parameter | XL = X position, XH = Y position, in the graphics modes as pixel position | 
| return values | --- | 
| register | In text mode, XL and XH are limited to the maximum screen coordinates | 
| Video Modes | all | 
| function name | api_outchar | 
| Call without macro | call api_outchar | 
| function Description | gives a sign | 
| parameter | R20 = character, R25 = mode | 
| return values | --- | 
| register | R20, R21 | 
| Video Modes | all | 
| function name | api_newline | 
| Call without macro | call api_newline | 
| function Description | returns a line feed | 
| parameter | --- | 
| return values | --- | 
| register | R20, R21 | 
| Video Modes | 0, 4, 6 | 
| function name | api_outdez | 
| Call without macro | call api_outdez | 
| function Description | outputs the contents of X decimal (-32768 ... 32767) | 
| parameter | X = 16-bit value, R25 = mode / format | 
| return values | --- | 
| register | R20, R21 | 
| Video Modes | all | 
| function name | api_outhex | 
| Call without macro | call api_outhex | 
| function Description | outputs the contents of X hexadecimal (00 ... FF or 0000 ... FFFF) | 
| parameter | X = 16-bit value, R25 = mode / format | 
| return values | --- | 
| register | R20, R21 | 
| Video Modes | all | 
| function name | api_romtext | 
| Call without macro | call api_romtext | 
| function Description | returns a null-terminated string from the flash | 
| parameter | Z = Pointer to the string in Flash | 
| return values | --- | 
| register | Z, R20, R21 | 
| Video Modes | all | 
| function name | api_thistext | 
| Call without macro | call api_thistext | 
| function Description | returns a null-terminated string from the Flash that immediately follows the call. | 
| parameter | If the first byte is 0xFF, the string to be output directly follows, otherwise the first byte is evaluated as the Y coordinate and the second as the X coordinate before the actual string follows. | 
| return values | --- | 
| register | Z, R20, R21 | 
| Video Modes | all | 
| function name | api_cbox | 
| Call without macro | call api_cbox | 
| function Description | Deletes a rectangular area with the set color | 
| parameter | YL = X1, YH = Y1, ZL = X2, ZH = Y2 | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 4 | 
| function name | api_ibox | 
| Call without macro | call api_ibox | 
| function Description | Inverts a rectangular area (exchanges foreground with background color) | 
| parameter | YL = X1, YH = Y1, ZL = X2, ZH = Y2 | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 4 | 
| function name | api_scroll | 
| Call without macro | call api_scroll | 
| function Description | Scrolls the inner screen area, see SCROLL command | 
| parameter | R20 = direction (0 = up, 1 = to the right, 2 = down, 3 = to the left) | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 4, 6 | 
| function name | api_sprite | 
| Call without macro | call api_sprite | 
| function Description | represents a sprite (see BASIC Reference) | 
| parameter | XL = X, XH = Y, Y = pointer to sprite data | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 4, 6 | 
| function name | api_copychar4 | 
| Call without macro | call api_copychar4 | 
| function Description | copies a character from the system character set into the user character set for video mode 4 | 
| parameter | R20 = system character, R21 = user character (0 ... 127) | 
| return values | --- | 
| register | --- | 
| Video Modes | 4 | 
| function name | api_copychar6 | 
| Call without macro | call api_copychar6 | 
| function Description | copies a character from the system character set into the user character set for video mode 6 | 
| parameter | R20 = system character, R21 = user character (0 ... 63), R22 = VG / HG color | 
| return values | --- | 
| register | --- | 
| Video Modes | 6 | 
| function name | api_sbackup | 
| Call without macro | call api_sbackup | 
| function Description | copies the visible screen area to the monitor backup screen | 
| parameter | --- | 
| return values | --- | 
| register | R20, X, Y, Z | 
| Video Modes | only useful at 1 and 5 | 
| function name | api_srestore | 
| Call without macro | call api_srestore | 
| function Description | copies the monitor backup screen to the visible screen area | 
| parameter | --- | 
| return values | --- | 
| register | R20, X, Y, Z | 
| Video Modes | only useful at 1 and 5 | 
| function name | api_plot | 
| Call without macro | call api_plot | 
| function Description | Draws a point in the set foreground color | 
| parameter | XL = X, XH = Y | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 2, 3, (4), 5 | 
| function name | api_draw | 
| Call without macro | call api_draw | 
| function Description | Draws a line in the set foreground color | 
| parameter | YL = X1, YH = Y1, ZL = X2, ZH = Y2 | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 2, 3, (4), 5 | 
| function name | api_box | 
| Call without macro | call api_box | 
| function Description | Draws a rectangle in the foreground color | 
| parameter | YL = X1, YH = Y1, ZL = X2, ZH = Y2 | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 2, 3, (4), 5 | 
| function name | api_fbox | 
| Call without macro | call api_fbox | 
| function Description | Draws a filled rectangle in the set foreground color | 
| parameter | YL = X1, YH = Y1, ZL = X2, ZH = Y2 | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 2, 3, (4), 5 | 
| function name | api_circle | 
| Call without macro | call api_circle | 
| function Description | Draw a circle / ellipse in the set foreground color | 
| parameter | YL = X, YH = Y, ZL = RX, ZH = RY | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 2, 3, (4), 5 | 
| function name | api_fcircle | 
| Call without macro | call api_fcircle | 
| function Description | Draw a filled circle in the set foreground color | 
| parameter | YL = X, YH = Y, ZL = RX, ZH = RY | 
| return values | --- | 
| register | --- | 
| Video Modes | 0, 1, 2, 3, (4), 5 | 
| function name | api_bcopy1 | 
| Call without macro | call api_bcopy1 | 
| function Description | Copies a screen section to another location | 
| parameter | YL = SRCX, YH = SRCY, ZL = DESTX, ZH = DESTY, R21 = bytes / line, R22 = lines | 
| return values | --- | 
| register | R4ldotsR7 | 
| Video Modes | 1, 2, 3, 5 | 
| function name | api_bcopy2 | 
| Call without macro | call api_bcopy2 | 
| function Description | Copies a screen section from the image memory to the RAM | 
| parameter | YL = SRCX, YH = SRCY, Z = RAM address, R21 = bytes / line, R22 = lines | 
| return values | --- | 
| register | R4ldotsR7 | 
| Video Modes | 1, 2, 3, 5 | 
| function name | api_bcopy3 | 
| Call without macro | call api_bcopy3 | 
| function Description | Copies a screen section RAM into the image memory | 
| parameter | YL = DESTX, YH = DESTY, Z = RAM address | 
| return values | --- | 
| register | R4ldotsR7 | 
| Video Modes | 1, 2, 3, 5 | 
| function name | api_putpar | 
| Call without macro | call api_putpar | 
| function Description | Outputs a character via the parallel interface | 
| parameter | R20 = characters | 
| return values | --- | 
| register | --- | 
| function name | api_getser | 
| Call without macro | call api_getser | 
| function Description | waits for a character from the serial interface, no abort option | 
| parameter | --- | 
| return values | R20 = characters | 
| register | --- | 
| function name | api_getserb | 
| Call without macro | call api_getserb | 
| function Description | waiting for a character from the serial interface, abort with ESC possible | 
| parameter | --- | 
| return values | R20 = character or 0x1B (if canceled with ESC) | 
| register | --- | 
| function name | api_putser | 
| Call without macro | call api_putser | 
| function Description | Outputs a character via the serial interface | 
| parameter | R20 = characters | 
| return values | --- | 
| register | --- | 
| function name | api_putsernl | 
| Call without macro | call api_putsernl | 
| function Description | outputs a line feed via the serial interface | 
| parameter | --- | 
| return values | --- | 
| register | Y = Y + 128 | 
| function name | api_hexline | 
| Call without macro | call api_hexline | 
| function Description | outputs a memory area as a hex string with a final line feed via the serial interface | 
| parameter | Y = address RAM block, ZL = number of bytes | 
| return values | --- | 
| register | ZL, R20, Y = Y + 128 | 
| function name | api_putxm | 
| Call without macro | call api_putxm | 
| function Description | outputs an X-Modem block via the serial interface | 
| parameter | R22 = block number, Y = address RAM block | 
| return values | --- | 
| register | Y = Y + 128 | 
| function name | api_getxm | 
| Call without macro | call api_getxm | 
| function Description | reads in an X-Modem block via the serial interface | 
| parameter | Y = address RAM block | 
| return values | R22 = block number | 
| register | Y = Y + 128 | 
| function name | api_preceive | 
| Call without macro | call api_preceive | 
| function Description | loads a program (in binary mode) via the X-Modem protocol | 
| parameter | R15 = program number 1 (0 ... 7] | 
| return values | |
| register | R20 ... R23, X, Y, Z | 
| function name | api_psend | 
| Call without macro | call api_psend | 
| function Description | sends a program (in binary mode) via the X-modem protocol | 
| parameter | R15 = program number 1 (0 ... 7] | 
| return values | |
| register | R20 ... R23, X, Y, Z | 
| function name | api_note | 
| Call without macro | call api_note | 
| function Description | Plays a note at the current volume | 
| parameter | XL = note value, according to the BASIC command note | 
| return values | --- | 
| register | --- | 
| function name | api_setvolume | 
| Call without macro | call api_setvolume | 
| function Description | sets the global volume | 
| parameter | XL = volume value (0 ... 15) | 
| return values | --- | 
| register | --- | 
| function name | api_startseq | 
| Call without macro | call api_startseq | 
| function Description | starts the sequencer | 
| parameter | --- | 
| return values | Y = start address (RAM), Z = end address + 1 (RAM), XL = speed, XH = number of cycles | 
| register | --- | 
| function name | api_setseq | 
| Call without macro | call api_setseq | 
| function Description | sets the cyclic error of the sequencer | 
| parameter | XL = new cycle value | 
| return values | --- | 
| register | --- | 
| function name | api_getseq | 
| Call without macro | call api_getseq | 
| function Description | reads the cyclic error of the sequencer | 
| parameter | XL = current cycle value | 
| return values | --- | 
| register | --- | 
| function name | api_eep_read | 
| Call without macro | call api_eep_read | 
| function Description | reads a byte from the internal EEPROM | 
| parameter | Y = Address | 
| return values | R20 = Byte | 
| register | Y = Y + 1 | 
| function name | api_eep_write | 
| Call without macro | call api_eep_write | 
| function Description | writes a byte to the internal EEPROM | 
| parameter | Y = address, R20 = byte | 
| return values | --- | 
| register | Y = Y + 1 | 
| function name | api_i2c_start | 
| Call without macro | call api_i2c_start | 
| function Description | creates a start condition on the I2C bus | 
| parameter | --- | 
| return values | --- | 
| register | R20 | 
| function name | api_i2c_stop | 
| Call without macro | call api_i2c_stop | 
| function Description | creates a stop condition on the I2C bus | 
| parameter | --- | 
| return values | --- | 
| register | R20 | 
| function name | api_i2c_rbyte | 
| Call without macro | call api_i2c_rbyte | 
| function Description | reads a byte from the I2C bus and sends an ACK | 
| parameter | --- | 
| return values | R21 = byte, R22 = I2C status register | 
| register | R20 | 
| function name | api_i2c_rbyten | 
| Call without macro | call api_i2c_rbyten | 
| function Description | reads a byte from the I2C bus without sending an ACK | 
| parameter | --- | 
| return values | R21 = byte, R22 = I2C status register | 
| register | R20 | 
| function name | api_i2c_wbyte | 
| Call without macro | call api_i2c_wbyte | 
| function Description | sends a byte to the I2C bus and waits for ACK / NAK | 
| parameter | R21 = Byte | 
| return values | R22 = I2C status register | 
| register | R20 | 
| function name | api_i2c_read | 
| Call without macro | call api_i2c_read | 
| function Description | reads in a data byte from an external EEPROM | 
| parameter | X = memory address in EEPROM, R23 = EEPROM address (0 ... 7) | 
| return values | R21 = byte R24 = error status | 
| register | X = X + 1, R20, R22 | 
| function name | api_i2c_write | 
| Call without macro | call api_i2c_write | 
| function Description | writes a byte of data to an external EEPROM | 
| parameter | R21 = byte X = memory address in EEPROM, R23 = EEPROM address (0 ... 7) | 
| return values | R24 = Error Status | 
| register | X = X + 1, R20, R22 | 
| function name | api_i2c_rlm75 | 
| Call without macro | call api_i2c_rlm75 | 
| function Description | reads the temperature value from a connected LM75 temperature sensor | 
| parameter | R23 = LM75 address (0 ... 7) | 
| return values | R24 = error status, X = temperature value in 1/2 degree | 
| register | R20, R21, R22 | 
| function name | api_alert | 
| Call without macro | call api_alert | 
| function Description | outputs an alert box, after ENTER the screen is restored | 
| parameter | Y points to color byte (FG / HG) and zero-terminated text in RAM | 
| return values | --- | 
| register | R20 | 
| function name | api_alert_nb | 
| Call without macro | call api_alert_nb | 
| function Description | outputs an alert box, after ENTER the screen is NOT restored | 
| parameter | Y points to color byte (FG / HG) and zero-terminated text in RAM | 
| return values | --- | 
| register | R20 | 
| function name | api_alertthis | 
| Call without macro | call api_alertthis | 
| function Description | outputs an alert box, after ENTER the screen is restored | 
| parameter | the color byte and the text are null terminated after the call | 
| return values | --- | 
| register | R20 | 
| function name | api_alertthis_nb | 
| Call without macro | call api_alertthis_nb | 
| function Description | outputs an alert box, after ENTER the screen is NOT restored | 
| parameter | the color byte and the text are null terminated after the call | 
| return values | --- | 
| register | R20 | 
| function name | api_ask | 
| Call without macro | call api_ask | 
| function Description | outputs a question box, after Y / N / ENTER / ESC the screen is restored | 
| parameter | Y points to color byte (FG / HG) and zero-terminated text in RAM | 
| return values | T flag is set at Y / ENTER | 
| register | R20 | 
| function name | api_ask_nb | 
| Call without macro | call api_ask_nb | 
| function Description | outputs a question box, after Y / N / ENTER / ESC the screen is NOT restored | 
| parameter | Y points to color byte (FG / HG) and zero-terminated text in RAM | 
| return values | T flag is set at Y / ENTER | 
| register | R20 | 
| function name | api_askthis | 
| Call without macro | call api_askthis | 
| function Description | outputs a question box, after Y / N / ENTER / ESC the screen is restored | 
| parameter | the color byte and the text are null terminated after the call | 
| return values | T flag is set at Y / ENTER | 
| register | R20 | 
| function name | api_askthis_nb | 
| Call without macro | call api_askthis_nb | 
| function Description | outputs a question box, after Y / N / ENTER / ESC the screen is NOT restored | 
| parameter | the color byte and the text are null terminated after the call | 
| return values | T flag is set at Y / ENTER | 
| register | R20 | 
| function name | api_fs_size | 
| Call without macro | call api_fs_size | 
| function Description | determines the size of the connected Dataflash module | 
| parameter | --- | 
| return values | R20 = (number of sectors / 256) or 0 | 
| register | --- | 
| function name | api_fs_create | 
| Call without macro | call api_fs_create | 
| function Description | creates a file | 
| parameter | R20 = file number, R21 = number of sectors, R22 = file type | 
| return values | R24 (error code or 0) | 
| register | Array (512-767) | 
| function name | api_fs_delete | 
| Call without macro | call api_fs_delete | 
| function Description | deletes a file | 
| parameter | R20 = file number | 
| return values | R24 (error code or 0) | 
| register | --- | 
| function name | api_fs_read | 
| Call without macro | call api_fs_read | 
| function Description | reads a file sector into an area of the array | 
| parameter | R20 = file number, R21 = sector number, R22 = array third (0,1,2) | 
| return values | R24 (error code or 0) | 
| register | --- | 
| function name | api_fs_write | 
| Call without macro | call api_fs_write | 
| function Description | writes a file sector from an area of the array | 
| parameter | R20 = file number, R21 = sector number, R22 = array third (0,1,2) | 
| return values | R24 (error code or 0) | 
| register | --- | 
| function name | api_fs_cfree | 
| Call without macro | call api_fs_cfree | 
| function Description | Counts the free program slots and data sectors | 
| parameter | --- | 
| return values | Z = free program slots, Y = free data sectors | 
| register | --- | 
| function name | api_fs_checkf | 
| Call without macro | call api_fs_checkf | 
| function Description | determines if the Dataflash module is formatted | 
| parameter | --- | 
| return values | R20 (1 = formatted, otherwise 0) | 
| register | --- | 
| function name | api_fs_gettype | 
| Call without macro | call api_fs_gettype | 
| function Description | determines the file type of a file | 
| parameter | R20 = file number | 
| return values | R20 = File Type Code | 
| register | --- | 
| function name | api_fs_fsize | 
| Call without macro | call api_fs_fsize | 
| function Description | determines the size of a file (in pages) or the free space on the Dataflash module | 
| parameter | X = file number or -1 (free files) or -2 (free pages) | 
| return values | X = number of pages / files | 
| register | Y Z | 
| function name | api_fs_ffind | 
| Call without macro | call api_fs_ffind | 
| function Description | searches for a file | 
| parameter | X = Arrayposition (see FFIND function) | 
| return values | X = file number or -1 | 
| register | Y Z | 
| function name | api_fs_check | 
| Call without macro | call api_fs_check | 
| function Description | tests the dataflash for a valid file system | 
| parameter | |
| return values | |
| register | R20 | 
| function name | api_fs_fsel | 
| Call without macro | call api_fs_fsel | 
| function Description | calls the Fileselectorbox (only in video mode 0) | 
| parameter | the header is null terminated after the call | 
| return values | R23 = file number, R20 = file type | 
| register | --- | 
| function name | api_fs_fsel_nb | 
| Call without macro | call api_fs_fsel_nb | 
| function Description | calls the Fileselectorbox without screen backup (only in video mode 0) | 
| parameter | the header is null terminated after the call | 
| return values | R23 = file number, R20 = file type | 
| register | --- | 
| function name | api_fs_rread | 
| Call without macro | call api_fs_rread | 
| function Description | reads a sector from the dataflash | 
| parameter | X = sector number, Y = address in RAM | 
| return values | R24 (error code or 0) | 
| register | Y = Y + 256 | 
| function name | api_fs_rwrite | 
| Call without macro | call api_fs_rwritw | 
| function Description | writes a sector in the dataflash | 
| parameter | X = sector number, Y = address in RAM | 
| return values | R24 (error code or 0) | 
| register | Y = Y + 256 | 
| function name | api_lfind | 
| Call without macro | call api_lfind | 
| function Description | searches the system for a library | 
| parameter | X = library code | 
| return values | R21 = program slot (1 ... 8) or 0 for not found | 
| register | Z, R22-R23 | 
| function name | api_lcall | 
| Call without macro | call api_lcall | 
| function Description | Invokes a function in a Libarary | 
| parameter | R20 = library (1 ... 8), R21 = function number | 
| return values | possibly from called function | 
| register | Z, R0, R1 and registers of the function call | 
| function name | api_token | 
| Call without macro | call api_token | 
| function Description | tokenizes a line from the source buffer into the code buffer | 
| parameter | Source text in the source buffer | 
| return values | tokenized line in the code buffer | 
| register | X, Y, Z, R20-R23 | 
| function name | api_untoken | 
| Call without macro | call api_untoken | 
| function Description | translates a tokenized line back into the source code | 
| parameter | tokenized line in the code buffer | 
| return values | Source text in the source buffer | 
| register | X, Y, Z, R20 ... R23 | 
| function name | api_basrun | 
| Call without macro | call api_basrun | 
| function Description | executes the line in the code buffer | 
| parameter | R12 = line number, R13 = first statement, line in the code buffer | 
| return values | --- | 
| register | X, Y, Z, R4 ... R7, R20 ... R23 | 
| function name | api_exparser | 
| Call without macro | call api_exparser | 
| function Description | interprets a formula in text format | 
| parameter | Z = Pointer to function text | 
| return values | X = result (16 bit signed) | 
| register | Y, Z, R4 ... R7, R20 ... R23 | 
| function name | api_tparser | 
| Call without macro | call api_tparser | 
| function Description | provides a token parser | 
| parameter | Z = pointer to token table in flash, Y = pointer to text in RAM, R22 = length of an entry in bytes | 
| return values | R20 = found token or 0 | 
| register | Y stands behind the found text | 
| tokentab: | 
| function name | api_arrview | 
| Call without macro | call api_arrview | 
| function Description | Array View | 
| parameter | R23 = display position (* 64) | 
| return values | --- | 
| register | --- | 
| function name | api_vm0cls | 
| Call without macro | jmp api_vm0cls | 
| function Description | jumps to the CLS routine of video mode 0 | 
| parameter | usable only in drivers | 
| return values | --- | 
| register | --- | 
| function name | api_vm0char | 
| Call without macro | jmp api_vm0char | 
| function Description | jumps to the character output routine of video mode 0 | 
| parameter | usable only in drivers | 
| return values | --- | 
| register | --- | 
| function name | api_vm0gotoxy | 
| Call without macro | jmp api_vm0gotoxy | 
| function Description | jumps to the positioning routine of video mode 0 | 
| parameter | usable only in drivers | 
| return values | --- | 
| register | --- | 
| function name | api_vm0plot | 
| Call without macro | jmp api_vm0plot | 
| function Description | jumps to pixel network routine of video mode 0 | 
| parameter | usable only in drivers | 
| return values | --- | 
| register | --- | 
| function name | api_vm0line | 
| Call without macro | jmp api_vm0line | 
| function Description | outputs a pixel line in video mode 0 | 
| parameter | usable only in drivers | 
| return values | --- | 
| register | --- | 
| function name | api_vm0newline | 
| Call without macro | jmp api_vm0newline | 
| function Description | outputs a line feed in video mode 0. | 
| parameter | usable only in drivers | 
| return values | --- | 
| register | --- | 
| function name | api_aread | 
| Call without macro | call api_aread | 
| function Description | reads a ByteWord from the array | 
| parameter | Y = Arraypointer | 
| return values | XL / X = content of the array cell | 
| register | R21 | 
| function name | api_awrite | 
| Call without macro | call api_awrite | 
| function Description | writes a byte / word into the array | 
| parameter | Y = Arraypointer, XL / X = value to be written | 
| return values | --- | 
| register | R21 | 
| function name | api_pageset | 
| Call without macro | call api_pageset | 
| function Description | sets the array page for external storage | 
| parameter | XL = new array page (after system startup 0) | 
| return values | --- | 
| register | --- | 
| function number | function | 
| 0 | Dummy function if the library is called from the main menu | 
| 1 | initialization | 
| 2 | Integer assignment variable = value | 
| 3 | Assignment via text string in the array | 
| 4 | returns integer value of the variable | 
| 5 | Text output of the variable | 
| 6 | Absolute value of a variable | 
| 7 | Inverse value (0 variable) | 
| 8 | Addition V3 = V1 + V2 | 
| 9 | Subtracking V3 = V1 - V2 | 
| 10 | Multiplication V3 = V1 * V2 | 
| 11 | Division V3 = V1 / V2 | 
| 12 | Constant assignment with predefined constants | 
| 13 | Pre-comma portion of a variable (INT) | 
| 14 | Fractional part of a variable (FRAC) | 
| 15 | Comparison of two variables | 
| 16 | Copy variable | 
| 17 | Variable / 2 | 
| 18 | Variable * 2 | 
| 19 | Start script in the array memory | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Number of pre-bytes bytes - 1 (0 ... 15) | 
| Parameter 2 | Number of decimal bytes | 
| Parameter 3 | --- | 
| return value | Number of initialized variables | 
| parameter | meaning | 
| Parameter 1 | variable number | 
| Parameter 2 | variable value | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | variable number | 
| Parameter 2 | Text start in the array | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | variable number | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | Integer value of the variable | 
| parameter | meaning | 
| Parameter 1 | variable number | 
| Parameter 2 | Bit 7 ... 4: minimum precom-byte -1 bit 3 ... 0: post-decimal byte | 
| Parameter 3 | (optional output channel) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | Variable number of variable 3 | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | Variable number of variable 3 | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | Variable number of variable 3 | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | Variable number of variable 3 | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | variable number | 
| Parameter 2 | Constant number (0 ... 7) | 
| Parameter 3 | --- | 
| return value | 0 | 
| constant number | value | 
| 0 | 0 | 
| 1 | 1 | 
| 2 | PI | 
| 3 | e (Euler number) | 
| 4 | ln (2) | 
| 5 | ln (10) | 
| 6 | SQRT (2) | 
| 7 | SQRT (3) | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | Comparison result (1,0,2) | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Variable number of variable 1 | 
| Parameter 2 | Variable number of variable 2 | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Start address in the array | 
| Parameter 2 | opt. Parameter 1 | 
| Parameter 3 | opt. Parameter 2 | 
| Parameter 4 | opt. Parameter 3 | 
| return value | Return value, depending on the exit command | 
| code | meaning | 
| 0 0 0 V | End script, variable value (integer) of variable v is returned | 
| 0 1 x M | End script, the value of Counter M is returned | 
| 0 2 nn | E is jumped to the script position nn | 
| 0 3 CV | Variable V is initialized with the constant C | 
| 0 4 x V | Variable V is initialized with the value of optional parameter 1 | 
| 0 5 x V | Variable V is initialized with the value of optional parameter 2 | 
| 0 6 x V | Variable V is initialized with the value of optional parameter 3 | 
| 1 0 WV | W = V | 
| 1 1 WV | W = ABS (V) | 
| 1 2 WV | W = -V | 
| 1 3 WV | W = INT (V) | 
| 1 4 WV | W = FRAC (V) | 
| 1 5 WV | W = V * 2 | 
| 1 6 WV | W = V / 2 | 
| 1 8 WV | skips the next statement if V is equal to W. | 
| 1 9 WV | skips the next statement if V is not equal to W. | 
| 1 AWV | skips the next statement if V is greater than W. | 
| 1 BWV | skips the next statement if V is less than W. | 
| 4 UWV | W = U + V | 
| 5 UWV | W = U - V | 
| 6 UWV | W = U * V | 
| 7 UWV | W = U / V | 
| 8 mnn | the counter M is set to nn | 
| 9 mnn | to the counter M nn is added | 
| AM nn | skips the next statement if the counter M is equal to nn | 
| BM nn | skips the next statement if the counter M is not nn | 
| CM xn | Counter M is initialized with parameter N. | 
| other codes | No function (NOP) | 

| PROGRAM :Fractal 2 | 

| function number | function | 
| 0 | Start of the demonstration program (currently not used) | 
| 1 | PA.1 to HIGH, voltage measurement to PA.0 and PA.1 | 
| 2 | PA.2 to HIGH, voltage measurement to PA.0 and PA.2 | 
| 3 | PA.3 to HIGH, voltage measurement to PA.0 and PA.3 | 
| 4 | PA.3 from LOW to HIGH, time measurement to U (PA.0)> Uref (resolution 300ns) | 
| 5 | PA.3 from LOW to HIGH, time measurement to U (PA.0)> Uref (resolution 500ns) | 
| 6 | PA.2 from LOW to HIGH, time measurement to U (PA.0)> Uref (resolution 300ns) | 
| 7 | PA.2 from LOW to HIGH, time measurement to U (PA.0)> Uref (resolution 64us) | 
| 8 | PA.1 from LOW to HIGH, time measurement to U (PA.0) <Uref (resolution 300ns) | 
| 9 | PA.1 from LOW to HIGH, time measurement to U (PA.0) <Uref (resolution 500ns) | 
| 10 | PA.2 from LOW to HIGH, time measurement to U (PA.0) <Uref (resolution 500ns) | 
| 11 | PA.3 from LOW to HIGH, time measurement to U (PA.0) <Uref (resolution 300ns) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 32 x measured value of PA.0, measured value of PA.1 in AR (1024) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 16 x measured value (in 300 nanosecond steps) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 2 x measured value (in 500 nanosecond steps) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 2 x measured value (in 500 nanosecond steps) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 2 x measured value (in 64 microsecond steps) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 16 x measured value (in 300 nanosecond steps) | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 2 x measured value (in 500 nanosecond steps) | 

| Type of measurement | measuring range | 
| resistance | 10Ω ... 1MΩ | 
| diode | 0 ... 4.8V | 
| capacity | 100pF ... 1000μF | 
| inductance | 10 uH ... 100mH | 
| address | row | measuring range | 
| 1026 | 9 | Resistors 6,5KΩ <R <1MΩ | 
| 1027 | 9 | Resistors 200Ω <R <6,5KΩ | 
| 1028 | 9 | Resistors 10Ω <R <200Ω | 
| 1029 | 10 | Diode voltage 0V <U <4.8V | 
| 1030,1031 (final value, offset) | 11 | Capacitors 0.1nF <C <72nF | 
| 1032,1033 (final value, offset) | 11 | Capacitors 72nF <C <740nF | 
| 1034,1035 (final value, offset) | 12 | Capacitors 740nF <C <22μF | 
| 1036,1037 (final value, offset) | 12 | Capacitors 22μF <C <1000μF | 
| 1038 | 13 | Inductors 50μH <L <6.7mH | 
| 1038 | 13 | Inductors 6,7mH <L <830mH | 
| PROGRAM:Mess4 | 
| command | function | 
| _SETSEC n | sets the seconds value to parameter n, while the limits are monitored. | 
| _SETMIN n | sets the minute value to the parameter n, while the limits are monitored. | 
| _SETHOUR n | sets the hour value to the parameter n, while the limits are monitored. | 
| _SETDAY n | sets the day value to the parameter n, while the limits are monitored. | 
| _SETMONTH n | sets the monthly value to the parameter n, while the limits are monitored. | 
| _SETYEAR n | sets the year value to the parameter n (0..99) | 
| _GETSEC V | reads the second value into variable V | 
| _GETMIN V | reads the minute value into variable V | 
| _GETHOUR V | reads the hour value into variable V | 
| _GETDAY V | reads the day value into variable V | 
| _GETMONTH V | reads the month value into variable V | 
| _GETYEAR V | reads the year value into variable V | 
| start address | end address | bytes | function | 
| 0 | 1079 | 1080 | 24 lines characters | 
| 1080 | 1319 | 240 | used internally | 
| 1320 | 2599 | 1280 | character set | 
| 2600 | 2759 | 160 | unused | 

| start address | end address | bytes | function | 
| 0 | 1199 | 1200 | 24 lines characters | 
| 1200 | 2759 | 1560 | unused | 

| start address | end address | bytes | function | 
| 0 | 1439 | 1440 | 24 lines characters | 
| 1440 | 2759 | 1320 | unused | 

| start address | end address | bytes | function | 
| 0 | 39 | 40 | system | 
| 40 | 1063 | 1024 | tilemap | 
| 1064 | 2599 | 1568 | 49 tiled definitions | 
| 2632 | 2691 | 60 | 2 lines characters | 
| 2692 | 2751 | 60 | 2 lines of attributes | 
| 2752 | 2759 | 8th | not used | 


| address | size | function | 
| 0 | byte | Y-coordinate (top left) of the visible section | 
| 1 | byte | X-coordinate (top left) of the visible section | 
| 4 | Word | Start address of the sprite area in memory is initialized by function 24 | 
| 6 | byte | Number of initialized sprites is initialized by function 24 | 
| offset | meaning | 
| 0 | New Y coordinate | 
| 1 | New X coordinate | 
| 2 | Old Y coordinate | 
| 3 | Old X coordinate | 
| 4 | Sprite Tile | 
| 5 | Start of the 4 backup tiles | 
| 6 | Transparency Color | 
| 7 | visible (0/1) | 
| 8 | Sprite active (0/1) | 
| 9 | Kollisionsflag | 
| 10 | horizontal step size | 
| 11 | vertical increment | 
| 12 | Tile index 1 for restore | 
| 13 | Tile index 2 for restore | 
| 14 | Tile index 3 for restore | 
| 15 | Tile index 4 for restore | 
| function number | function | 
| 9 | Fill tile map with constant tile index | 
| 10 | Tile map with a tile bitmap set | 
| 11 | Fill Tile Map area with constant tile index | 
| 12 | Set a tile index in the tile map | 
| 13 | Query a tile index in the tile map | 
| 14 | Fill tile with paint | 
| 15 | Draw a predefined pattern in tile | 
| 16 | Draw an array-defined pattern in tile | 
| 17 | Draw patterns from character set in tile | 
| 18 | Mirror tile horizontally | 
| 19 | Mirror tiles vertically | 
| 20 | Tile 90 degrees clockwise | 
| 21 | Turn the tile 90 degrees counterclockwise | 
| 22 | Copy Tile | 
| 23 | Join together tiles | 
| 24 | Rotate 2 tiles | 
| 25 | Initialize sprites | 
| 26 | Define sprite | 
| 27 | Position sprite | 
| 28 | Enable sprite | 
| 29 | Disable sprite | 
| 30 | Draw a single sprite | 
| 31 | Delete a drawn sprite | 
| 32 | Draw all sprites sequentially | 
| 33 | Delete all sprites sequentially | 
| 34 | Recalculate all sprites coordinates | 
| 35 | Move all sprites | 
| 36 | --- | 
| 37 | --- | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Bitmap position in the array (0 ... 640) | 
| Parameter 2 | Tile number (0 ... 48) | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | starting position | 
| Parameter 2 | end position | 
| Parameter 3 | Tile number (0 ... 48) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Y-coordinate (0 ... 31) | 
| Parameter 2 | X-coordinate (0 ... 31) | 
| Parameter 3 | Tile number (0 ... 48) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Y-coordinate (0 ... 31) | 
| Parameter 2 | Y-coordinate (0 ... 31) | 
| Parameter 3 | --- | 
| return value | Tile Index | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | Color (0 ... 15) | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | Sample number (0 ... 31) | 
| Parameter 3 | Character color (0 ... 15) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | Array start cell (0 ... 760) | 
| Parameter 3 | Character color (0 ... 15) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | Characters (0 ... 255) | 
| Parameter 3 | Character color (0 ... 15) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile number (0 ... 48) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Source Tile (0 ... 48) | 
| Parameter 2 | Target Tile (0 ... 48) | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Source and destination tiles (0 ... 48) | 
| Parameter 2 | Character Tile (0 ... 48) | 
| Parameter 3 | Transparency color (0 ... 15) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Tile 1 (0 ... 48) | 
| Parameter 2 | Tile 2 (0 ... 48) | 
| Parameter 3 | Shift direction (0 ... 3) | 
| return value | 0 | 
| Parameter 3 | direction | 
| 0 | Shift / rotation upwards | 
| 1 | Shift / rotation to the right | 
| 2 | Shift / rotation down | 
| 3 | Shift / rotation to the left | 
| parameter | meaning | 
| Parameter 1 | Array position (0 ... 511) | 
| Parameter 2 | Number of sprites (1 ... 8) | 
| Parameter 3 | --- | 
| return value | Maximum sprite number | 
| parameter | meaning | 
| Parameter 1 | Sprite number (0 ... 7) | 
| Parameter 2 | Tile number (0 ... 48) | 
| Parameter 3 | Transparency color (0 ... 15) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Sprite number (0 ... 7) | 
| Parameter 2 | Y position (0 ... 255) | 
| Parameter 3 | X position (0 ... 255) | 
| Parameter 4 | Y movement (0 ... 255) | 
| Parameter 5 | X movement (0 ... 255) | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Sprite number (0 ... 7) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Sprite number (0 ... 7) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Array address (0 ... 752) | 
| Parameter 2 | Y position | 
| Parameter 3 | X position | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Array address (0 ... 752) | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| start address | end address | bytes | function | 
| 0 | 59 | 60 | 2 lines characters | 
| 60 | 119 | 60 | 2 lines of attributes | 
| 120 | 224 | 105 | 105 line pointers | 
| 225 | 2744 | 2520 | 105 line definitions | 
| 2745 | 2759 | 15 | unused | 




| function number | function | 
| 16 | deletes the vector area | 
| 17 | Fill line pointer constantly | 
| 18 | Fill row pointer in ascending order | 
| 19 | Fill the line pointer in descending order | 
| 20 | Fill row pointer with array values | 
| 21 | Copy line pointer ranges | 
| 22 | Fill lines with constant array values | 
| 23 | Fill rows with consecutive array values | 
| 24 | --- | 
| 25 | --- | 
| 26 | --- | 
| 27 | --- | 
| parameter | meaning | 
| Parameter 1 | --- | 
| Parameter 2 | --- | 
| Parameter 3 | --- | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | start row | 
| Parameter 2 | number of lines | 
| Parameter 3 | value | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | start row | 
| Parameter 2 | number of lines | 
| Parameter 3 | start value | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | start row | 
| Parameter 2 | number of lines | 
| Parameter 3 | start value | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Start-row pointer | 
| Parameter 2 | number of lines | 
| Parameter 3 | Array start position | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | Start line source area | 
| Parameter 2 | Start line Target | 
| Parameter 3 | number of lines | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | start row | 
| Parameter 2 | number of lines | 
| Parameter 3 | Array start position | 
| return value | 0 | 
| parameter | meaning | 
| Parameter 1 | start row | 
| Parameter 2 | number of lines | 
| Parameter 3 | Array start position | 
| return value | 0 | 

| driver | driver code | display | Display works | Display does not work | 
| lcd116.bin | 0xA0 | 1 x 16 characters | Powertip PC1601A | , | 
| lcd216.bin | 0xA1 | 2 x 16 characters | , | , | 
| lcd220.bin | 0xA2 | 2 x 20 characters | Powertip PC2002-M | , | 

| button | Bit in scancode | keycode | 
| left | 0 | 0xE2 | 
| right | 1 | 0xE3 | 
| up | 2 | 0xE4 | 
| down | 3 | 0xE5 | 
| enter | 4 | 0xEA | 
| esc | 5 | 0xED | 
| F5 | 6 | 0xF5 | 
| start address | end address | bytes | function | 
| 0 | 1079 | 1080 | 24 lines characters | 
| 1080 | 1319 | 240 | used internally | 
| 1320 | 2599 | 1280 | character set | 
| 2600 | 2759 | 160 | unused | 



| I / O address | access | function | 
| 0x800 | R / W | Data signal D0 | 
| 0x801 | R / W | Data signal D1 | 
| 0x802 | R / W | Data signal D2 | 
| 0x803 | R / W | Data signal D3 | 
| 0x808 | R / W | Data signal STROBE | 
| 0x809 | R / W | Data signal BUSY | 
| 0x810 | W | Data direction D0 (0 = IN, 1 = OUT) | 
| 0x811 | W | Data direction D1 (0 = IN, 1 = OUT) | 
| 0x812 | W | Data direction D2 (0 = IN, 1 = OUT) | 
| 0x813 | W | Data direction D3 (0 = IN, 1 = OUT) | 
| 0x818 | R / W | Data direction STROBE | 
| 0x819 | R / W | Data direction BUSY | 
| 0x900 | R / W | Pulse width at D4 (0 ... 255) | 
| 0x901 | R / W | Pulse width at D5 (0 ... 255) | 
| 0x902 | R / W | Pulse width at D6 (0 ... 255) | 
| 0x903 | R / W | Pulse width at D7 (0 ... 255) | 

| I / O address | access | function | 
| 0x808 | R / W | Data signal STROBE | 
| 0x809 | R / W | Data signal BUSY | 
| 0x818 | R / W | Data direction STROBE | 
| 0x819 | R / W | Data direction BUSY | 
| 0x900 | R / W | Pulse width at D0 (0 ... 255) | 
| 0x901 | R / W | Pulse width at D1 (0 ... 255) | 
| 0x902 | R / W | Pulse width at D2 (0 ... 255) | 
| 0x903 | R / W | Pulse width at D3 (0 ... 255) | 
| 0x904 | R / W | Pulse width at D4 (0 ... 255) | 
| 0x905 | R / W | Pulse width at D5 (0 ... 255) | 
| 0x906 | R / W | Pulse width at D6 (0 ... 255) | 
| 0x907 | R / W | Pulse width at D7 (0 ... 255) | 

| I / O address | access | function | 
| 0x800 | R / W | Data signal D0 | 
| 0x801 | R / W | Data signal D1 | 
| 0x802 | R / W | Data signal D2 | 
| 0x803 | R / W | Data signal D3 | 
| 0x808 | R / W | Data signal STROBE | 
| 0x809 | R / W | Data signal BUSY | 
| 0x810 | W | Data direction D0 (0 = IN, 1 = OUT) | 
| 0x811 | W | Data direction D1 (0 = IN, 1 = OUT) | 
| 0x812 | W | Data direction D2 (0 = IN, 1 = OUT) | 
| 0x813 | W | Data direction D3 (0 = IN, 1 = OUT) | 
| 0x818 | R / W | Data direction STROBE | 
| 0x819 | R / W | Data direction BUSY | 
| 0x900 | R / W | Pulse width at D4 (0 ... 559) | 
| 0x901 | R / W | Pulse width at D5 (0 ... 559) | 
| 0x902 | R / W | Pulse width at D6 (0 ... 255) | 
| 0x903 | R / W | Pulse width at D7 (0 ... 255) | 
| Press space to start! | 
| ---------------------------- | 
| ---------------------------- | 
| ---------------------------- | 
| ---------------------------- | 
| ---------------------------- | 
| ---------------------------- | 
| ---------------------------- | 

|  | Leave program | 
|  | Change selected setting | 
|  | |
|  | |
|  | Clone system | 
| Host signal | Host PIN | Target signal | Target PIN | 
| GND | 4,6,8,10 | GND | 4,6,8,10 | 
| VCC | 2 | VCC | 2 | 
| MOSI | 1 | MOSI | 1 | 
| MISO | 9 | MISO | 9 | 
| SCK | 7 | SCK | 7 | 
| SS | 3 | RESET | 5 | 


|  | Leave program | 
|  | Chip8 program received via X-modem | 
|  | Save Chip8 program | 
|  | Load Chip8 program | 
|  | Start Chip8 program | 

|  | |
|  | Decrease delay, program execution becomes faster | 
|  | Increase delay, program execution slows down | 
|  | |
|  | |