ROM Entry Points to L2 Routines
Page Index
Entry points to various Level II BASIC ROM routines which may be accessed by user programs.
Keyboard Routines:
| Label | Address | Routine Description |
|---|---|---|
| KBD1 | 002BH | INKEY$ call $KBCHAR: Scan keyboard for a character |
| KBD2 | 0358H | Save DE regs, then call 2B |
| $KBLINE | 0040H | Get a line from the keyboard |
| KBWT1 | 0049H | KBD input with wait $KBWAIT: Wait for a keyboard character |
| KBWT2 | 0384H | KBD input with wait, DE saved |
| LINP1 | 05D9H | Line input routine Enter with:
|
| LINP2 | 0361H | Line input routine 2 |
| INPUT | 1BB3H | Same as LINP2, but with "?" |
| LBUFF | 40A7H | Storage buffer address for LINP2 |
Display Routines:
| Label | Address | Routine Description |
|---|---|---|
| DSP1 | 0033H | Display byte at cursor pos $VDCHAR: Display a character on the screen |
| CLS | 01C9H | Clear screen |
| BLINK | 022CH | Blink "*" in right upper corner |
| DSP2 | 033AH | Saves DE and calls DSP1 |
| DSTR | 28A7H | Display string pointed to in HL |
| SETRES | 0150H | Entry to SET/RESET routines |
| CURSOR | 4020H | Cursor position |
Printer Routines:
| Label | Address | Routine Description |
|---|---|---|
| $PRCHAR | 003BH | Print a character on the printer |
Miscellaneous routines & addresses
| Label | Address | Routine Description |
|---|---|---|
| BASIC | 1A19H | Return point for BASIC |
| DOS | 402DH | Return point for DOS |
| DOSERR | 4030H | Return to DOS with error |
| CHLDE | 1C90H | Compare HL with DE |
| FETCH | 1D78H | Fetch next non-blank character following that in HL |
| DECBIN | 1E5AH | Decimal # => Binary |
| WLDR | 0284H | Writes leader on cassette tape |
| WBYTE | 0264H | Writes one byte to tape |
| COFF | 01F8H | Turns off cassette motor |
| RLDR | 0293H | Reads sync byte from cassette |
| RBYTE | 0235H | Reads one byte from tape |
Floating-point arithmetic routines
TYPE FLAG IS 40AFH; VALUES AS FOLLOWS:
2 - INTEGER
3 - STRING
4 - SINGLE PRECISION FLOATING POINT
8 - DOUBLE PRECISION FLOATING POINT
3 - STRING
4 - SINGLE PRECISION FLOATING POINT
8 - DOUBLE PRECISION FLOATING POINT
Floating Point Accumulators (FPACC) as Follows:
| Type | Address Range |
|---|---|
| INTEGER | 4121H - 4122H |
| STRING | 4121H - 4122H (Holds descriptor address) |
| SINGLE PRECISION | 4121H - 4124H (4124H is exponent) |
| DOUBLE PRECISION | 411DH - 4124H (4124H is exponent) |
Operand Locations as Follows:
| Data Type | Register / Address Location |
|---|---|
| Integer | Register pairs DE & HL |
| Single Precision | Register pairs DE & HL |
| Double Precision | 4127H - 412EH |
| Label | Address | Routine Description |
|---|---|---|
| TSTYP | 25D9H | Test type flag at 40AFH |
| DSTOR | 09B4H | Store single-precision value in DE:BC into FPACC |
| SLOAD | 09C2H | Load single-precision into DE:BC from address in HL |
| SCOPY | 09B1H | Copy single-precision from HL address to FPACC |
| SGET | 09BFH | Load FPACC into DE:BC |
| SSTAK | 09A4H | Push FPACC into stack (DE:BC) |
| ISTOR | 0A9AH | Store integer in FPACC and set type |
| ASTOR | 0E6CH | Store numeric string in FPACC |
| NEDIT | 0FBDH | Non-formatted numeric edit |
| FEDIT | 0FBEH | Formatted numeric edit |
| CSVEC | 2865H | Create string vector |
| FPACC | 4121H | Floating point accumulator |
| DFPACC | 411DH | Double-precision FPACC |
| DOPER | 4127H | Double-precision operand registers |
Arithmetic function routines
| Label | Address | Routine Description |
|---|---|---|
| IADD | 0BD2H | Integer add: DE + HL => FPACC |
| ISUB | 0BC7H | Integer subtract: DE - HL => FPACC |
| IMUL | 0BF2H | Integer multiply: DE * HL => FPACC |
| IDIV | 2490H | Integer divide: DE / HL => FPACC |
| SADD | 0716H | Single-precision add: OPER + FPACC => FPACC |
| SSUB | 0713H | Single-precision subtract: OPER - FPACC => FPACC |
| SMUL | 0847H | Single-precision multiply: OPER * FPACC |
| SDIV | 08A2H | Single-precision divide: OPER / FPACC |
| DADD | 0C77H | Double-precision add: OPER + FPACC |
| DSUB | 0C70H | Double-precision subtract: OPER - FPACC |
| DMUL | 0DA1H | Double-precision multiply: OPER * FPACC |
| DDIV | 0DE5H | Double-precision divide: OPER / FPACC |
| SGN | 098AH | FPACC = SGN(FPACC) |
| INT | 0B37H | FPACC = INT(FPACC) |
| ABS | 0977H | FPACC = ABS(FPACC) |
| SQRT | 13E7H | FPACC = SQRT(FPACC) |
| RNDM | 14C9H | FPACC = RND(FPACC) |
| LOG | 0809H | FPACC = LOG(FPACC) |
| EXP | 1439H | FPACC = EXP(FPACC) |
| COSN | 1541H | FPACC = COS(FPACC) |
| SINE | 1547H | FPACC = SIN(FPACC) |
| TAN | 15A8H | FPACC = TAN(FPACC) |
| ATAN | 15BDH | FPACC = ATAN(FPACC) |
| CINT | 0A7FH | FPACC = CINT(FPACC) |
| CSNG | 0AB1H | FPACC = CSNG(FPACC) |
| CDBL | 0ADBH | FPACC = CDBL(FPACC) |
| FIX | 0B26H | FPACC = FIX(FPACC) |
Other random locations
| Memory Address | Function / Description |
|---|---|
| 14305 / 37E1H | 0, for better disk saves |
| 16405 / 4015H | 1 = Keyboard on; 2 = Keyboard off |
| 16413 / 401DH | 1 = Display off; 7 = Display on |
| 16414 / 401EH | 141 = Display to printer; 88 = Restore display |
| 16415 / 401FH | 5, 4 = ??? |
| 16449 / 4041H | Clock register: Seconds |
| 16450 / 4042H | Clock register: Minutes |
| 16451 / 4043H | Clock register: Hours |
| 16452 / 4044H | Clock register: Year |
| 16453 / 4045H | Clock register: Day |
| 16454 / 4046H | Clock register: Month |
| 16553 / 404FH | 255 = Data read after cassette input |
| 14312 / 37E8H | 127 = Line printer not ready |
| 15339 / 3BFFH | Check if key held down |
| 16457 / 4049H | Top-of-memory (DOS main system); Disk BASIC holds value-1 in 40B1H. |
| 16544 / 40A0H-40A1H | Pointer to string storage area (e.g., CLEAR 50 sets this to 40B1H-40B2H minus 50). Always stored LSB/MSB. |