memory map Addresses below 4000h are in ROM, read-only memory, and can be read but not written; attempts to POKE them from BASIC orm/c have no effect at all. 4000h and above are in RAM, random- access memory, and can be both written and read, though POKing some addresses can have disastrous or unpredictable effects. ----------------------------------------start up from here; ROM 0000 restarts 0095 token table and key tables 028E keyboard routines 03B5 loudspeaker routines 04C2 cassette handling 09F4 screen and printer handling 0F2C editor 11B7 initialisation 12A2 main execution loop 15AF channel input/output and miscellaneous 1A48 BASIC interpreter 24FB expression evaluation - the SCANNING loop 2D4F calculator routines, including: 32C5 constants and literals 335B calculator 386E 0592h/1426d empty bytes 3D00 character set ---------------------------------------------------start of RAM 4000 display first third 4800 middle 5000 last 5800 attributes 5B00 ZX printer buffer 5C00 system variables: 5C00-07 KSTATE 5C10-35 STRMS 5C3A ERR NR <- IY + 00 5C92-AF MEMBOT -------------------------------------------5CB6 microdrive maps The remainder of the memory is movable, depending on thespace required for each area from the microdrive maps upwards. When space is required, it is made upwards in areas up to the top of the calculator stack, downwards from SP and above. A collision between these two results in an "Out of memory" report, see 1F65 TEST ROOM. Start addresses will be found in thesystem variables shown. -----------------------------------------------------5C4F CHANS channel information 80-byte ------------------------------------------------------5C53 PROG program area ------------------------------------------------------5C4B VARS variables area 80-byte ----------------------------------------------------5C59 E LINE editing area newline (0D) 80-byte ----------------------------------------------------5C61 WORKSP INPUT area newline (0D) workspace ----------------------------------------------------5C63 STKBOT calculator stack; grows upwards ----------------------------------------------------5C65 STKEND spare memory -------------------------------------------------------------SP machine stack; grows downwards ----------------------------------------------------5C3D ERR SP GO SUB stack ----------------------------5CB2 RAM TOP (usually 7F57 or FF57) 3Eh byte --------------------------------5C7B UDG (usually 7F58 or FF58) user-defined graphics ----------------------------------------------------5CB4 P RAMT top of RAM; the top of RAM is 8FFF in the 16K Spectrum, FFFF inthe 48K and later versions operating in the 48K mode. mem-0, mem-1, &c see 335B CALCULATE, 340F get-mem, 5C92 MEMBOT, 342D st-mem ME NEW LP 08D2 (08B6 ME CONTRL) Jumps from: 08EB ME NEW L2 ME NEW L2 08EB (08B6 ME CONTRL) Jumps from: 08DF ME OLD L1 ME OLD LP 08D7 (08B6 ME CONTRL) Jumps from: 08DF ME OLD L1 ME OLD L1 08DF (08B6 ME CONTRL) Jumps from: 08D7 ME OLD LP ME OLD VP 08F9 (08B6 ME CONTRL) Jumps from: 0901 ME OLD V1 ME OLD V1 0901 (08B6 ME CONTRL) Jumps from: 091E ME OLD V4 ME OLD V2 0909 (08B6 ME CONTRL) Jumps from: 08F9 ME OLD VP ME OLD V3 0912 (08B6 ME CONTRL) Jumps from: auto ME OLD V4 091E (08B6 ME CONTRL) Jumps from: 0912 ME OLD V3 MERGE key (D5) see also commands, functions and operators, KEYBOARD SCANNING, 022C extended mode key table (b) The T key in E mode without shift produces the command MERGE. The "MERGE statement" must include a filename but, umlikeLOAD, cannot have modifiers such as CODE. The command is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A7A.1AE2 P MERGE causes a jump via 1CDB CLASS 0B to the executive routine for all the cassette handling commands, 0605 SAVE ETC. The routine distinguishes between SAVE, LOAD, VERIFY and MERGE by looking at T ADDR, which was used to step through the 1A7A table: its low byte reads one more than the low byte of the "P" label, E0, E1, E2 or E3 respectively, so E3 for MERGE. 04C2 SA BYTES start of cassette handling routines 0605 SAVE ETC make code 03 from T ADDR lo 0629 SA BLANK null names allowed for MERGE 0652 SA DATA not allowed MERGE ... DATA 06A0 SA SCR$ not allowed MERGE ... SCREEN$ 06C3 SA CODE not allowed MERGE ... CODE 075A SA ALL prepare to fetch header from tape 07AD LD CH PR jump forward for MERGE 0802 LD BLOCK called (not exit) by ME CONTRL 08B6 ME CONTRL main executive routine 08F0 ME VAR LP variables MERGEd 092C ME ENTER single line/variable MERGEd MERGE A LINE OR A VARIABLE SUBROUTINE see 092C ME ENTER MERGE CONTROL ROUTINE see 08B6 ME CONTRL message block, message printing, messages see also 0C0A PO MSG Messages for printing on the screen are in ROM at: 0095 token table 09A1 cassette messages 0CF8 "scroll?" 1391 report messages The "report messages" block includes the "comma space" used in printing report messages, and the Sinclair copyright message printed on start-up or NEW. All these are printed by PO MSG, though for tokens the entry point is 0C10 PO TOKENS. In the notes on 20D8 IN ITEM 2 and following,_"prompt _message" refers to the flashing cursor - sometimes in quotes - printed in execution of an INPUT command. 078A LD TYPE prints appropriate cassette message 0970 SA CONTRL prints "Start tape and press any key" 0C22 PO EACH loop to print each character 0C88 PO SCR 2 prints "scroll?" 1219 RAM SET prints copyright message 133C MAIN 5 prints report messages 20D8 IN ITEM 2 prepare prompt message for INPUT ... LINE 20FA IN PROMPT print prompt message MESSAGE PRINTING SUBROUTINE see 0C0A PO MSG ME VAR LP 08F0 (08B6 ME CONTRL) Exit from: 08B6 ME CONTRL through one of: 08D2 ME NEW LP 0923 ME VAR L2 ME VAR L1 0921 (08B6 ME CONTRL) Jumps from: 0909 ME OLD V2 0912 ME OLD V3 ME VAR L2 0923 (08B6 ME CONTRL) Jumps from: 08F9 ME OLD VP MIC output see ports minuend see addend misprints in "ROM Disassembled" These are really excessive, even allowing for the complexity of the text; though many are trivial, and most of them are in the notes, not in the listings, which for the most part are accurately printed. Even trivial misprints can be thoroughly confusing in a text of this kind. A few "misprints" may actually be mistakes by the authors. In this list, for brevity I use curly brackets {} to indicate what I believe to be a misprint, and square brackets []for the presumed correct reading. 0055 ERROR 3 {machine} : [machine stack] 02C6 K ST LOOP {set as free} : [set is free] 03F8 BEEP [the 12th root of 2, minus one] 05CA LD 8 BITS {carry flat set} : [carry flag set] 08B6 ME CONTRL {Now made} : [Now make] 0970 SA CONTRL {straighforward} : [straightforward] 0A87 PO CONT {CO TEMPS} : [CO TEMP 5] {+21 - +22} : [+21 - +02] 0B24 PO ANY {0B7F PO ALL} : [0B7F PR ALL] 0B52 PO T&UDG {+00 - +0F} : [+00 - +14] 0B65 PO CHAR {character area} : [character set] 0BD3 {PO ALL 6} : [PR ALL 6] 0BDB PO ATTR {D holds ATTR T and E holds MASK T} : [E holds ATTR T and D holds MASK T] {ATTR R} : [ATTR T] 0C3B PO SAVE {PRINT OUT} : [PRINT A 1] 0C44 PO STEP {intial} : [initial] 0C55 PO SCR {if considering INPUT ... AT} : [if handling lower screen] {via CL SET} : [via AUTO LIST] (see note on 1795 AUTO LIST) 0C88 PO SCR 2 {0601 CHAN OPEN} : [1601 CHAN OPEN] 0DD9 CL SET {a character areas} : [a character area] {first character bit} : [first character byte] 0E19 CL SCR 3 {CL SR 1} : [CL SCR 1] 111D ED COPY {SET HL} : [SET DE] 1167 ED FULL {New} : [Now] 117E ED C END {The old value of S POSNL} : [The new position values] 1190 SET HL {HL ... first ... DE ... 'last'} : [DE ... first ... HL ... 'last'] 1219 RAM SET (p.61 l.15) {pinter} : [printer] 12CF MAIN 3 {JR NZ,155D} : [JP NZ,155D] RST 0018[,GET CHAR] {1B8A PROG RUN} : [1B8A LINE RUN] 133C MAIN 5 {OUT NUM1} : [OUT NUM 1] (twice) {1961} LINE NO A : [1691] 1736 OPEN {+00 or +03} : [+00 to +03] 1795 AUTO LIST {SET 0,FLAGS} : [SET 0,TV FLAG] {RES 0,FLAGS} : [RES 0,TV FLAG] {editing area} : [lower screen] 17ED AUTO L 4 {1833 LIST ALL} : [1833 LIST ALL-2]; the call is to 1833h, but this isn't the address of LIST ALL, it is the previous line "LD E,01" which is called. 1814 LIST 2 {5.20} : [5,20] or [5;20] 1822 LIST 5 {FIND INT} : [FIND INT2] 1833 [there should be another label; perhaps LIST ALL online 1833 and LIST ALL 1 on line 1835, to which the auto jumps return] 1865 {OUT LINE} : [OUT LINE 1] 18B6 NUMBER {IND HL} : [INC HL] 19DD DIFFER {address} : [addresses] 1A15 E L 1 label omitted on line JP C,1C8A,REPORT C 1B29 STMT L 1 {18CA REPORT C} : [1C8A REPORT C] 1BEE CHECK END {statment} : [statement] {the addresses of SCAN LOOP & STMT RET} : [the subroutine return address and STMT RET] (see index entry on CHECK END) 1C11 CLASS 05 {AND} : [and] 1C30 VAR A 2 {STK VARS} : [STK VAR] (twice) 1C46 VAR A 3 {'destination} : ['destination'] 1CD6 CL 09 1 {CO TEMP} : [CO TEMP 2] 1D34 F L&S {FP CLAC} : [FP CALC] {after for} : [after the] 1E0A READ 1 {calue}: [value] 1EA1 RUN {1EAF CLEAR 1} : [1EAF CLEAR RUN] 1EDC {CLEAR 3} : [CLEAR 2] {(RAMTOP,HL} : [(RAMTOP),HL] 1EED GO SUB {GO TO 1} : [GO TO] 1F3D PAUSE 1 {Jump will all} : [Jump with all] 1F60 DEF FN {bass-by} : [pass-by] 201E PR AT TAB {PRINT OUT} : [PRINT A 1] 2024 PR ITEM 3 {a colour items} : [a colour item] 203C PR STRING {decease} : [decrease] 2061 PR POSN 2 {PR CR} : [PRINT CR] 206E PR POSN 4 {reset} : [set] 2070 STR ALTER {+FF} : [+0F] 2096 INPUT 1 {LD (DF SZ),+01} : [LD (TV FLAG),+01] 20FA IN PROMPT {SUNTAX} : [SYNTAX] 211C IN PR 2 {Test bit 6} : [Test bit 1] 2129 IN PR 3 {error stack} : [error stack pointer] 2174 {IN VARS 5} : [IN VAR 5] 219B {IN VARS 6} : [IN VAR 6] {STK ST $} : [STK STO $] 21E1 CO TEMP 1 {PRINT OUT} : [PRINT A 1] 21FC CO TEMP 4 {PRINT OUT} : [PRINT A 1] (Correct in the header of CO TEMP 5) 2244 {REPORT} : [REPORT K] 2246 CO TEMP 9 {'0 to 5'7'} : ['0 to 7'] 22AA PIXEL ADD {the bite} : [the bits] 22FD PL TST IN {completemented} : [complemented] 2320 CIRCLE {at 2470-24B6} : [at 247D-24B6] 233B C R GRE 1 (against 1st +38 end-calc) {SIN (PI/A)} : [Z*SIN (PI/A)] ( " 2nd +02 delete) {machine stack} : [calculator stack] 2382 DRAW (para 2 of heading) {cirlce} : [circle] (para 3 of heading) {Two subroutine,} : [Two subroutines,] 23C1 DR PRMS (halfway down p.121, after get-mem-0) {X,Y,Y*W*SIN F,X*W} : [X,Y,Y*W*SIN F,COS F] (after get-mem-2) {X,Y,Y*W*SIN F,X*W,COS F} : [X,Y,Y*W*SIN F,COS F,X*W] 2420 DRAW STEPS {subseqeunt} : [subsequent] 2439 ARC START (opposite 2nd FP CALC) {X0+X,Y0+Y,Xn+1,Xn'} : [X0+X,Y0+Y,Xn+1,Xn+1,Xn'] (next line) {X0+X,Y0+Y,Xn+1,Xn+1,Xn' - Xn' = Un'} : [X0+X,Y0+Y,Xn+1,Xn+1 - Xn' = Un'] 2497 DRAW SAVE (line after USE 252): label omitted 24CB DL LARGER {The H - L horizontal} : [Then H - L horizontal] 24D4 D L DIAG {resisters} : [registers] 2535 S SCRN$ S {'pointed to' to} : ['pointed to' by] {25AF} S SCRN LP : [254F] 26C9 S LETTER {STK VARS} : [STK VAR] 26DF S NEGATE {+D8} : [+DB] (twice) 2734 S LOOP (ii in header) {market} : [marker]