ROM Addresses
The following Z80 registers and register pairs apply:
A,F,B,C,D,E,H,L,AF,BC,DE,HL,IX,IY.
Any of these preceeded by a “‘” refers to the alternate set.
Miscellaneous
- SA – Software accumulator
- SA1 – Alternate software accumulator
- RA – Register accumulator (E,D,C,B).
Hex
Dec.
Label
Type
Description
0000
0
DOSCLD
Jp
“In cassette systems, reset computer; in disk systems, cold boot of DOS. Could also be done via RST 00H.”
0008
8
SYNTAX
RST
Checks for syntax. HL points to byte to be checked and proper byte follows RST 08H instruction.
000B
11
WHERE
Call
“Vector used to resolve relocation address of calling routine. On exit, HL points to address following Call instruction.”
0013
19
GET
Call
This routine gets a byte from a logical device or a file that is open. When calling, DE =starting address of DCB of device. On exit, A= byte received from device, z set if device ready. Uses AF.
0018
24
CP16
Rst
Compare DE and HL as 16 bit unsigned intergers.
001B
27
PUT
Call
Outputs a byte to a logical device or FCB. Outputs a byte to a device. When calling, A = output byte, DE = starting address of DCB of device. On exit, z set if device ready. Uses AF. Don’t confuse with CTL at 0023.
0023
35
CTL
Call
Outputs a control byte to a logical device or FCB. DE = FCB and A = control byte.
0028
40
Rst
Pressing Break key RST’s here and then jumps to location 400CH. Also normal DOS function vector.
002B
43
KBDSCN
Call
Scan keyboard and return with accumulator containing result. DE is used.
0033
51
VDCHAR
Call
Displays a character at current cursor location.
003B
59
PRCHAR
Call
“Waits until printer is ready then prints charatcter. A = ASCII character. If BREAK is pressed, a return to caller is made.”
0040
64
KBLINE
Call
Call Input a line from the keyboard. B = max length of line. HL points at buffer. Buffer should be the length of B plus 1. To terminate, hit BREAK or ENTER. On exit, HL points at buffer and B = number of characters entered. Carry will be set if BREAK was pressed.
0049
73
KBWAIT
Call
“Scans the keyboard until a key is pressed. If BREAK is pressed, it is returned like other keys.”
0050
80
RSRCV
Call
“Recieve a character from RS-232. No entry conditions. On exit, memory location 16872 contains character recieved. DE is altered. This routine honors wait status.”
0055
85
RSTX
Call
“Transmit character to RS-232. On entry, Accumulator or memory location 16880 contains character. On exit, 16880 = 0 if no character sent. Wait status honored.”
005A
90
RSINIT
Call
Call Initialize RS-232 interface. On entry, memory location 16888 = send/recieve baud rate code, location 16890 = wait/don’t wait switch, location 16889 = RS-232 characteristics switch. On exit, DE is altered. For more detail, consult Model 3 reference manual.
0060
96
DELAY
Call
“Load BC with how many times to loop, then call.”
0069
105
INITIO
Call
“Initialize all I/O drivers to their ROM routines. No entry conditions. On exit, all registers changed.”
006C
108
ROUTE
Call
“On entry, location 4222H = two byte source device ASCII abbreviation and location 4220H = two byte destination ASCII abbreviation. On exit, DE is altered.”
0072
114
An alternative for entering Basic. See also 1A19H.
00B1
177
Type in SYSTEM (even from DISK BASIC) and reply to the “*?” prompt with /177. The computer will then ask you for memory size. Upon return, you’ll still be in DISK BASIC, but your program will be gone. Also, it doesn’t get along with any high memory routines present.
00FA
250
Call this routine from BASIC and your computer will brag about it having Level II or Model III BASIC.
0132
306
POINT
Basic’s POINT routine.
0135
309
SET
Basic’s SET routine.
0138
312
RESET
Basic’s RESET routine.
0150
336
GRAPH
Jp
This is the routine that is Basic’s SET, RESET, and POINT functions. Here’s how to use it. Load HL with return address and push. Load register A with one of the following: 00H = POINT, 01H = RESET, and 80H = SET. Push AF onto stack. Load A with X coordinate and push onto stack. Load A with Y coordianate and JP GRAPH.
018C
396
Call
“Checks for syntax of “”)”” via RST 08H.”
01C9
457
CLS
Call
Clear screen.
01D3
467
RANDOM
Call
Randomize.
01F8
504
CSOFF
Call
This routine turns off the cassette drive.
0212
530
DEFCAS
Call
A register contains a 0 or 1 which is the cassette number. This routine defines cassette number and turns on cassette. Model I only.
022C
556
Model I only (also may be used with Model III). Blinks right asterisk during tape load operations. NOTE: On Model III this location has jump to 0212H (zeroes A register and returns). Uses AF.
0235
565
CSIN
Call
Inputs data one byte at a time from cassette after you use CSHIN. A = the data byte.
0264
612
CSOUT
Call
Outputs data one byte at a time to cassette after you use CSHWR. A = the output byte.
0287
647
CSHWR
Call
Turns on the cassette and writes the header.
0296
662
CSHIN
Call
Finds the cassette header info at the beggining of cassette file.
02B2
690
SYSTEM
Basic’s SYSTEM routine.
0314
788
Reads two bytes (LSB/MSB) and transfers to HL registers (used when reading SYSTEM format tapes). Uses AF,HL.
032A
810
OUTCHR
Call
Output a byte to device determined by byte stored at (409CH) – FFH=Tape, 0=Video, l=Printer. When calling, A = output byte. Uses AF (may use other registers as well). Warning: This routine CALLS a Disk BASIC link at address 41ClH which may have to be “plugged” with a RETurn (C9H) instruction
033A
826
DISPA
Call
Displays character in A on screen at next print position. Uses AF.
0358
856
Calls keyboard scan routine.
035B
859
Call
Same as 002BH.
0361
865
KIBUFF
Call
Reads keyboard into buffer until a carriage return is entered. 40A7H contains the address of the buffer.
03C2
962
Line printer driver for Model I.
03E3
995
Keyboard driver for Model I. Model III = 3024H.
0458
1112
Video driver for Model I.
0473
1139
Video driver for Model III.
0506
1286
CURCON
“Start of cursor control table. Model I. 80 Microcomputing, Sept. 1980, p. 187.”
0540
1344
End of cursor control table.
058D
1421
Line printer driver for Model I.
05D9
1497
KLINE
Call
Same as KBLINE. See 0040.
06CC
1740
An alternative for entering Basic. See also 1A19H.
06D2
1746
Start of Model 1 interrupts relocated to RAM on boot up.
06E6
1766
End of Model 1 interrupts relocated to RAM on boot up.
06E7
1767
Start of Model 1 keyboard DCB.
06EE
1774
End of Model 1 keyboard DCB.
06EF
1775
Start of Model 1 Video DCB.
06F6
1782
End of Model 1 Video DCB.
06F7
1783
Start of Model 1 Printer DCB.
06FE
1790
End of Model 1 Printer DCB.
0713
1811
SUBSP
Call
Subtract SA from RA; result in SA.
0716
1814
ADDSP
Call
Add RA and SA; result in SA.
0778
1912
RSETSA
Call
“If SA contains a 00H, RND generates a number between 0 and 1. Use this call to place a 00H in SA.”
0809
2057
LOG
Call
Basic’s LOG function.
0847
2119
MLTSP
Call
Multiply RA and SA; result in SA.
08A2
2210
DIVSP
Call
Divide RA by SA; result in SA.
0977
2423
ABS
Call
Basic’s ABS function.
0982
2434
MVVAR
Call
Move number of bytes shown by typeflag from area pointed to by DE to area pointed to by HL.
098A
2442
SGN
Call
Basic’s SGN function.
09A4
2468
LDSTSA
Call
Load SA into stack.
09B1
2481
LDSAHL
Call
Load single precision number pointed to by HL into SA.
09B4
2484
LDSARA
Call
Load RA into SA.
09BF
2495
LDRASA
Call
Load SA into RA.
09C2
2498
LDRAHL
Call
Load single precision number pointed to by HL into RA.
09CB
2507
LDHLSA
Call
Load SA into area pointed to by HL.
09D2
2514
LDDEHL
Call
Load single precision number pointed to by HL into area pointed to by DE; needs FLAGSP.
09D3
2515
LDHLDE
Call
Load single precision number pointed to by DE into area pointed to by HL; needs FLAGSP.
09D6
2518
MOVEA
Call
“Move data; DE = source, HL = destination, A = how much to move.”
09D7
2519
MOVEB
Call
“Same as above, except B contains the count.”
09F7
2551
MVSAHL
Call
Move number pointed to by HL into SA; needs FLAGDP.
09FC
2556
MVALT
Call
Move SA into SA1.
0A0C
2572
CPSP
Call
Compare RA and SA1.
0A39
2617
CPINT
Call
Compare DE and HL.
0A78
2680
CPDP
Call
Compare SA and SA1.
0A7F
2687
GETPAR
Call
Load parameter in USR(x) into HL; this must be first instruction of USR call. Also used for CINT function.
0A9A
2714
BSCPAR
Jp
Return to Basic program with parameter.
0A9D
2717
FLAGIN
Call
Set typeflag of SA to interger.
0AB1
2737
CSASP
Call
Convert SA to single precision. Also Basic’s CSNG routine.
0ACC
2764
CHGIS
Call
Value in workspace/accumulator is changed from integer to single precision.
0ADB
2779
CSADP
Call
Convert SA to double precision. Also Basic’s CDBL routine.
0AEC
2796
FLAGDP
Call
Set typeflag for SA to double precision.
0AEF
2799
FLAGSP
Call
Set typeflag for SA to single presision.
0B26
2854
FIX
Call
Basic’s FIX function.
0B37
2871
INT
Call
Basic’s INT function.
0BC7
3015
SUBINT
Call
Subtract HL from DE; result in HL and SA if no overflow (flag = 2); result in SA only if overflow (flag = 4).
0BD2
3026
ADDINT
Call
Add DE and HL; result in HL and in SA if no overflow.
0BF2
3058
MLTINT
Call
“Multiply DE and HL; result in HL and SA if no overflow (flag=2), result in SA only if overflow (flag=4)”
0C70
3184
SUBDP
Call
Subtract SA1 from SA; result in SA.
0C77
3191
ADDDP
Call
Add SA and SA1; result in SA.
0DA1
3489
MLTDP
Call
Multiply SA and SA1; result in SA.
0DE5
3557
DIVDP
Call
Divided SA by SA1; result in SA.
0FAF
4015
Display integer number in HL in ASCII decimal. The ASCII number will also be in memory at 4131H – 4135H.
0FBD
4029
CSAASC
Call
Convert SA (set typeflag) to ASCII. Result (in dec) is placed in buffer starting at 4130H and terminated by a 00H byte and HL = 4130H.
13E7
5095
SQR
Call
Basic’s SQR function.
13F7
5111
POWER
Call
Raise RA to the power SA; result in SA.
1439
5177
EXP
Call
Basic’s EXP function.
14C9
5321
RND
Call
Basic’s RND function.
14CC
5321
RND
Call
BASIC’s RND function if there is a number in the parenthetical
1541
5441
COS
Call
Basic’s COSine function.
1547
5447
SIN
Call
Basic’s SIN function.
15A8
5544
TAN
Call
Basic’s TAN function.
15BD
5565
ATN
Call
Basic’s ATN function
1608
5640
“Beginning of jump table for Basic’s functions. For Basic’s jump statement table, see 1822H.”
164F
5711
End of jump table for Basic’s functions.
1650
5712
Beginning of table of names of Basic’s reserved words.
181F
6175
End of table of names of Basic’s reserved words.
1822
6178
“Beginning of jump table for Basic’s statements. For Basic’s jump funtion table, see 1608H.”
1899
6297
End of jump table for Basic’s statements.
18C9
6345
“Start of BASIC error messages. Ie: NF, OM, etc.”
18F6
6390
End of BASIC error messages.
196C
6508
Check for enough RAM for stack operation.
1997
6551
SN ERROR routine.
19A2
6562
ERROR routine.
1A19
6681
BASIC
Jp
“Return to Basic and display Basic READY prompt (if you have difficulty with 1A19, try 06CCH or 0072H instead)”
1AF8
6904
Writes line pointers beginning from start of Basic program.
1AFC
6908
Writes line pointers beginning with line pointed to by DE.
1B2C
6956
FNDLIN
“To use: Load DE with line number, call and this location. Upon exit, BC will contain location. 80 Micro, Feb. 1981, p. 148.”
1B49
6985
NEW
Basic’s NEW routine.
1B4D
6989
“Reset Basic pointers? 80 Microcomputing, Nov 81, p. 386.”
1B5D
6705
Basic initialization routines (RUN).
1BC0
7104
TOKEN
Basic’s tokenizing routine. Point register pair HL to the start of the string to be tokenized terminated by a 0 byte and call 1BC0H. Upon exit, HL will point to one byte below the tokenized string which will be terminated by a 0 byte.
1CA1
7329
FOR
Basic’s FOR routine.
1D1E
7454
RUNSTM
Jp
“HL points at “”:”” or 00H terminating a Basic statement or line; execution will proceed from next statement.”
1D91
7569
RESTORE
Basic’s RESTORE routine.
1D9B
7579
Scan for shift @ and BREAK.
1DA9
7593
STOP
Basic’s STOP routine.
1DAE
7598
END
Basic’s END routine.
1DE4
7652
CONT
Basic’s CONT routine.
1DF7
7671
TRON
Basic’s TRON routine.
1DF8
7672
TROFF
Basic’s TROFF routine.
1E00
7680
DEFSTR
Basic’s DEFSTR routine.
1E03
7683
DEFINT
Basic’s DEFINT routine.
1E06
7686
DEFSNG
Basic’s DEFSNG routine.
1E09
7689
DEFDBL
Basic’s DEFDBL routine.
1E46
LOAD POSITIVE INTEGER EXPRESSION IN DE Same as following routine (at 1E5AH) except that HL may also point to any valid BASIC variable or expression, which must evaluate to a number in range 0 to 32767 decimal (used to get argument of BASIC CLEAR command). Note that this routine assumes that BASIC is operational. Results may be unpredictable if this is not the case, particularly if a BASIC variable name (or something that could be interpreted as such) is part of the string.
1E4A
7754
FCERR
Call
“Prints “”FC Error””.”
1E5A
7770
VAL
Call
“Convert a string representing a decimal number and terminated by a 00H byte to a binary number. HL points at first character, DE contains result after call.”
1E5A
LOAD POSITIVE INTEGER CONSTANT IN DE Evaluate the string at the address pointed to by the HL register pair for a positive integer value (such as a BASIC line number), stopping at the first non-numeric character. The result is returned in the DE register pair. A value of zero is returned if no numeric value is found. Maximum allowable number is 65529 decimal. NOTE: If this routine is being used to obtain a BASIC line number, it may be CALLed at 1E4FH. In this case, a period (2EH) character at (BL) will cause the routine to return with the “current” BASIC line number (as stored at 40ECH-40EDH).
1E7A
7802
CLEAR
Basic’s CLEAR routine.
1EA3
7843
RUN
Basic’s RUN routine.
1EB1
7857
GOSUB
Basic’s GOSUB routine.
1EC2
7874
GOTO
Basic’s GOTO routine.
1EDE
7902
RETURN
Basic’s RETURN routine.
1F05
7941
DATA
Basic’s DATA routine.
1F07
7943
REM/ELSE
Basic’s REM and/or ELSE routine.
1F21
7969
EVALU
Call
Call Evaluate expression. Useful for doing complicated math functions in machine language. HL must point to a portion of memory that is in tokenized BASIC and terminated by a 00H byte or a “:” byte. Also known as Basic’s LET routine.
1F6C
8044
ON
Basic’s ON routine.
1FAF
8111
RESUME
Basic’s RESUME routine.
1FF4
8180
ERROR
Basic’s ERROR routine.
2008
8200
AUTO
Basic’s AUTO routine.
2039
8249
IF
Basic’s IF routine.
2067
8295
LPRINT
Basic’s LPRINT routine.
206F
8303
PRINT
Basic’s PRINT routine.
219A
8602
INPUT
Basic’s INPUT routine.
21E3
8675
MVSTR
Call
Move string into space; HL points at first byte of buffer and BC points at variable name.
21E3
ASSIGN STRING(S) TO BASIC VARIABLE(S) This routine is part of the BASIC INPUT command routine, and can be used to process input obtained from CALLing one of the keyboard input routines at 1BB3B, 0361H, etc. On entry, BC must point to the first character of a string that contains the variable name(s) (if more than one variable name is used the names must be separated by commas, and a zero byte or colon must be placed after the last variable name). HL must point to the byte just prior to the beginning of the input string ( this is where it is placed by the above-mentioned input routines – note that this byte is altered by this routine), and the string may contain input for more than one variable (items must be separated by commas). String must be terminated with zero byte. On exit, the numbers or strings in the input will be assigned to the variables listed in the string containing the variable names. Numeric or string variables may be used, but only valid characters for numeric input may be used with numeric variables ( depending on how certain flags are set, a “?REDO” message or an error will occur if this rule is violated. To force the “?REDO” message, make sure that memory location 40DEH contains zero, and that location 40A9H contains a non-zero value. To determine if the “?REDO” message has occured, prior to calling the routine load memory locations 40E6H-40E7H with zero. If the HL register pair contains zero on exit, then an error has occured and the “?REDO” message has been printed). NOTE: For proper operation, the input string should be in the BASIC input buffer (as it will be if one of the input routines mentioned above is used) when this routine is CALLed. See chapter one of this book for information on the INPUT routine located at 21C9H.
21EF
8687
READ
Basic’s READ routine.
22B6
8886
NEXT
Basic’s NEXT routine.
2337
9015
“Gets a general (string, integer, single, or double precision) parameter in the accumulator and sets the type flag (40AFH) accordingly.”
2337
EVALUATE EXPRESSION AT (HL) Evaluate BASIC string expression (may include constants, BASIC variables, BASIC functions, operators, etc.) and place result in ACCUM ( also set NTF). On entry, HL must point to first character of the string to be evaluated. On exit, HL will point to the string delimiter, which must be an acceptable BASIC expression terminator (such as a zero byte, a colon, a right parenthesis, etc.). NOTE: This routine may be entered at 2335H, in which case the HL register pair MUST point to a left parenthesis (which precedes the expression to be evaluated) or a BASIC syntax error will result. This routine assumes that BASIC is operational – result may be unpredictable if this is not the case.
2490
9360
DIVINT
Call
Call Divide DE by HL; result in SA in single precision format. 2540 9536 LDVAWS Call Loads value of variable into workspace/ accumulator. On entry, HL points to first character of variable name. On exit, HL points to first character following variable name.
252C
EVALUATE PARENTHESIZED EXPRESSION Evaluate any valid BASIC expression enclosed in parenthesis. Calls previous routine (at 2335H to check for right parenthesis). A BASIC syntax error will result if expression is not terminated with a right parenthesis.
2540
LOAD ACCUM WITH VALUE OF BASIC VARIABLE Get value of BASIC variable and put in ACCUM ( also put precision of variable in NTF). On entry, HL must point to first character of variable name. On exit, HL will point to first character following variable name.
25A1
9633
CPSTR
Call
“Compare two strings. HL and BC point at strings, D and E contain lengths.”
2608
9736
DIM
Basic’s DIM statement.
260D
9741
VARPTR
Call
“Get variable address in DE, HL points at variable name.”
260D
LOCATE OR CREATE A BASIC VARIABLE This routine will locate the storage area in memory for an existing BASIC variable, or will assign a storage area for the specified variable if one does not presently exist. On entry, the HL register pair must point to the first character of the variable name. On exit, HL will point to the next character following the variable name, and DE will contain the address of the variable storage area ( same as would be returned in BASIC VARPTR function). NOTE: If the variable name does not contain a type declaration character ( !, %, #,or $ as the final character of the variable name), the variable will be set to the precision as defined by the variable type declaration table at 4101H through 411AH. This table is organized so that location 4101H contains a the variable type flag for variables that begin with the letter “A”, 4102H contains the flag for variables that start with “B”, 4103H contains the flag for variables starting with 91 C”, and so on. The flag digits are defined in the same manner as the NTF (integer= 2, string= 3, single= 4, double= 8). All table locations are set to 4 ( single precision) on power-up and when the BASIC RUN or CLEAR commands are executed. The table values are altered through use of the BASIC DEF commands (such as DEFINT, DEFSNG, DEFDBL, or DEFSTR).
27D4
10196
FRE
Basic’s FRE routine.
27F5
10229
POS
Basic’s POS routine.
2836
10294
STR$
Basic’s STR$ routine.
28A7
10407
OUTSTR
Call
“Output string terminated by a 00H byte or 22H (“”) byte.; HL points at first character, OUTSEL (409CH) selects device. See OUTSEL for device numbers.”
2A03
10755
LEN
Basic’s LEN routine.
2A0F
10767
ASC
Basic’s ASC routine.
2A1F
10783
CHR$
Basic’s CHR$ routine.
2A2F
10799
STRING$
Basic’s STRING$ routine.
2A61
10849
LEFT$
Basic’s LEFT$ routine.
2A91
10897
RIGHT$
Basic’s RIGHT$ routine.
2A9A
10906
MID$
Basic’s MID$ routine.
2AC5
10949
VAL
Basic’s VAL routine.
2AEF
10991
INP
Basic’s INP routine.
2AFB
11003
OUT
Basic’s OUT routine.
2B02
11010
Gets a two byte integer in DE.
2B02
LOAD INTEGER EXPRESSION IN DE Same as routine at 1E46H (described above) except allows negative argument. Number must evaluate within range -32768 to 32767.
2B17
11031
“Evaluate expression? 80 Microcomputing, Nov 81, p. 386”
2B1C
11036
Gets a one byte integer in A.
2B29
11049
LLIST
Basic’s LLIST routine.
2B2E
11054
LIST
Basic’s LIST routine.
2B75
11125
OSTR
Call
“Output string to current device. On entry, HL points to first character in string which ends in a 00 byte.”
2B7E
11134
“Write line of Basic in buffer, change tokens to words.”
2BC6
11206
DELETE
Basic’s DELETE routine.
2BF5
11253
CSAVE
Basic’s CSAVE routine.
2C1F
11295
CLOAD
Basic’s CLOAD routine.
2C77
11383
“Initialize for Basic. 80 Micro, Sep. 1980, p. 72.”
2CAA
11434
PEEK
Basic’s PEEK routine.
2CB1
11441
POKE
Basic’s POKE routine.
2E60
11872
EDIT
Basic’s EDIT routine.
2E66
11878
EDITOR
“Load HL with line number to edit and use this routine. 80 Micro, Feb. 1981, p. 148.”
3024
12324
Video driver for Model III.
3033
12339
GETDAT
Call
“Get date in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS.”
3036
12342
GETTIM
Call
“Get time in ASCII format. Mod III TRSDOS, LDOS, & MULTIDOS.”
3042
12354
Model III only. Prompts the user to set the cassette baud rate (displays “Cass?”). If user enters “L” the 500 baud rate is selected. If user enters “H” or “ENTER” the 1500 baud rate is selected. Cassette baud rate switch at 4211H is set to zero for 500 baud rate, 0DH or 48H (“ENTER” or “H”) if 1500 baud selected.
37E0
14304
Port
“Model I interrupt address port. Bit 7 set for clock, bit 6 set for disk.”
37E1
14305
Port
Model I disk drive select.
37E4
14308
Port
Model I cassette 1 or 2 select (0 or 1).
37E8
14312
Port
Lineprinter address port.
37EC
14316
Port
Model I disk command/status.
37ED
14317
Port
Model I disk track select.
37EE
14318
Port
Model I disk sector select.
37EF
14319
Port
Model I disk data.
3800
14336
Ports
Beginning of model I & III keyboard address ports.
3840
14400
Ports
End of model I & III keyboard address ports.