092C ME ENTER reclaims old vble 093E ME ENT 1 prepare to add new vble 0955 ME ENT 2 makes room for new 0958 ME ENT 3 moves new vble from work space 1C1F CLASS 01 used by vble handling commands 1C22 VAR A 1 checks for new vble 1C2E REPORT 2 "Variable not found" 1C30 VAR A 2 deals with old vbles 1C4C VAR A 3 sets STRLEN/DEST for all types of vble 1C4E CLASS 02 assigns value to vble 1C56 VAL FET 1 gets value to be assigned 1C59 VAL FET 2 checks for mismatch of string/numeric 1C6C CLASS 04 looks in vbles area for loop control vble 1D16 F REORDER sets up or uses loop control vble 1D34 F L&S puts LIMIT, STEP, loop line no in vble 1D64 F LOOP looks for matching NEXT vble 1DAB NEXT checks VALUE + STEP against LIMIT and adjusts loop control vble 1EAC CLEAR also clears vbles area 1EB7 CLEAR 1 reduce vbles area to 1 byte 2089 INPUT gives value to vble from keyboard 20D8 IN ITEM 2 finds destination for INPUT...LINE value 20ED IN ITEM 3 finds destination for ordinary value 2161 IN VAR 4 resets svs in preparation for assignment 2174 IN VAR 5 makes assignment 219B IN VAR 6 makes assignment for INPUT ... LINE 21B9 IN ASSIGN assigns value to vble 26C9 S LETTER gets vble value on to calculator stack 28B2 LOOK VARS to find vble in vbles area 28D4 V CHAR to find long names 28EF V RUN/SYN prepare to search 28FD V RUN searching in run-time 2900 V EACH check each 1st letter 2912 V MATCHES check each letter of long name 2913 V SPACES skip spaces 2929 V GET PTR no match 292A V NEXT next vble 2932 V 80 BYTE end reached, match not found 293E V FOUND 1 match was found 2943 V PASS skip over long name 2948 V END summarizes outcome of vble search 2AFF LET assigns value to vble 2B0B L EACH CH reads long name 2B0C L NO SP ignores spaces & colour codes 2B1F L TEST CH reads string vble names 2B29 L SPACES makes room for new vble in vbles area 2B3E L CHAR copies chars of long name 2B4F L SINGLE puts vble letter in vbles area 2B59 L NUMERIC add number to vbles area 2B66 L EXISTS old vbles: check for string/numeric 2B72 L DELETE$ make space for new string vble in work space 2BA3 L IN W/S ready to copy new string to vbles area 2BA6 L ENTER copy number or string to vbles area 2BAF L ADD$ add complete simple string to vbles area 2BC0 L NEW$ prepare to add new simple string 2BC6 L STRING make room and copy string from work space 2BEA L FIRST insertg new vble letter 2C02 DIM puts zero/blank array in vbles area 2C15 D RUN reclaim old array after DIM command 2C1F D LETTER get parameters of new array 2C2E D NO LOOP makes room in vbles area for new array 3405 LOC MEM operates on loop control vble as memory variables (DEF FN) A DEF FN statement usually contains_dummy_variables, eg x, y, z$ in DEF FN q(x,y,z$)=x*PI+y**CODE z$ The variables x, y and z$ may or may not duplicate others in the variables area, they aren't looked for there: whenthe FN expressions are evaluated their values are sought for within the DEF FN statement, and only if they aren't found thereis any search made in the variables area. In the notes on 1F6A DEF FN 1 and following, however, "the variable of the function" means something quite different, which would be better called "the letter [or name] of the function: "q" in the example above. 1F6A DEF FN 1 name checked for string/numeric status 1F7D DEF FN 2 name must be followed by "$" or "(" 1FA6 DEF FN 6 function name must match in status the expression as evaluated VARS system variable 5C4B Bytes: 2. Holds the address of the start of the variables area, see variables above. One of the fourteen system pointers checked and reset by1664 POINTERS each time space is made or reclaimed in RAM. Written by: 0873 LD PROG 1219 RAM SET 166B PTR NEXT Read by: 073A SA TYPE 0 08F0 ME VAR LP 166B PTR NEXT 1EB7 CLEAR 1 28FD V RUN Rem: 1664 POINTERS the first of the system pointers V CHAR 28D4 (28B2 LOOK VARS) Jumps from: auto V EACH 2900 (28B2 LOOK VARS) Jumps from: 292A V NEXT V END 294B (28B2 LOOK VARS) Exit from 28B2 LOOK VARS through one of: 2934 V SYNTAX 2943 V PASS VERIFY key (D6) see also commands, functions and operators, KEYBOARD SCANNING, 0246 extended mode key table (c) The R key in E mode with either shift produces the command VERIFY. The "VERIFY statement", exactly as for LOAD, must include a filename and may also include 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.1AE1 P VERIFY 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 5C74 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, E2 in the case of VERIFY. 04C2 SA BYTES outline of SAVE, LOAD, VERIFY 0556 LD BYTES flag is NC for verifying 058F LD SYNC header bytes verified 05A9 LD LOOP jump forward to verify 05BD LD VERIFY tests tape byte against memory byte 05E3 LD EDGE 2 important part of verifying operation 0605 SAVE ETC flag 02 signals verifying 0629 SA BLANK null name allowed in verifying 0652 SA DATA can't verify "new array" 075A SA ALL checks header from tape against work space 07AD LD CH PR same routine for VERIFY, LOAD CODE/SCREEN$ 07CB VR CONTRL check length of data block 07F4 VR CONT 2 set flag to signal verification 0802 LD BLOCK handles verification error VERIFY CONTROL ROUTINE see 07CB VR CONTRL (in 0605 SAVE ETC) V FOUND 1 293E (28B2 LOOK VARS) Jumps from: 2913 V SPACES V FOUND 2 293F (28B2 LOOK VARS) Jumps from: 2900 V EACH (twice) Rems: 2943 V PASS duplicates skip of long names V GET PTR 2929 (28B2 LOOK VARS) Jumps from: 2913 V SPACES V MATCHES 2912 (28B2 LOOK VARS) Jumps from: 2913 V SPACES V NEXT 292A (28B2 LOOK VARS) Jumps from: 2900 V EACH V PASS 2943 (28B2 LOOK VARS) Jumps from: 2934 V SYNTAX auto VR CONTRL 07CB (0605 SAVE ETC) Jumps from: 07AD LD CH PR VR CONT 1 07E9 (0605 SAVE ETC) Jumps from: 07CB VR CONTRL (twice) VR CONT 2 07F4 (0605 SAVE ETC) Jumps from: 07E9 VR CONT 1 VR CONT 3 0800 (0605 SAVE ETC) Jumps from: 07F4 VR CONT 2 V RPORT C 360C (35DE val) Jumps from: 35DE val V RUN 28FD (28B2 LOOK VARS) Jumps from: 28EF V RUN/SYN V RUN/SYN 28EF (28B2 LOOK VARS) Jumps from: 28B2 LOOK VARS 28D4 V CHAR 28E3 V TEST FN 2951 STK F ARG 296B SFA CP/VR V SPACES 2913 (28B2 LOOK VARS) Jumps from: auto V STR VAR 28DE (28B2 LOOK VARS) Jumps from: 28B2 LOOK VARS V SYNTAX 2934 (28B2 LOOK VARS) Jumps from: 28EF R RUN/SYN V TEST FN 28E3 (28B2 LOOK VARS) Jumps from: 28B2 LOOK VARS V 80 BYTE 2932 (28B2 LOOK VARS) Jumps from: 2900 V EACH ----- waiting period see time period WAIT KEY subroutine 15D4 Much simpler than it looks. Apart from setting a flag ifrequired, merely makes repeated calls to the general-purpose input routine 15E6 INPUT AD till it finds the carry flag set. INPUT AD jumps into whatever subroutine is addressed on the input side of the current channel: in normal working, this is always 10A8 KEY INPUT, the input routine of channel K, the only one which has an operating input routine. KEY INPUT will return with carry only if a new key has been pressed, so the ROMexecution remains stuck in WAIT KEY until this happens. The Spectrum in fact spends at least 99% of its working life circling endlessly round the loop in 15DE WAIT KEY 1! Input parameters: none. Action: if TV FLAG bit 5 is set jump on to WAIT KEY 1; the flag signals "clear lower screen after the next keystroke" - (don't clear) set TV FLAG bit 3 to signal "copy edit/ input line to lower screen"; it is always copied on first entry to WAIT KEY except just after one of the "Press any key" prompts, see under TV FLAG bit 3, when there is nothing to copy _15DE_WAIT_KEY_1: call the channel input routine via 15E6INPUT AD - if it returns with carry, return; a meaningful new keyhas been pressed, or an acceptable input from some other channel - (it returned with no carry) if it also returned with zero, loop back to WAIT KEY 1; no-key or no input - (it returned with no carry and with NZ) report "End offile"; impossible for keyboard inputs, but assumed possible for inputs handled by other channels set up by peripherals. Exit: RET, from WAIT KEY1. Output parameters: none of its own, see 10A8 KEY INPUT for output from the keyboard. Called from: 0970 SA CONTRL 0C88 PO SCR 2 0F38 ED LOOP (twice) 0F6C ED CONTRL 101E ED IGNORE (twice) WAIT KEY1 15DE (15D4 WAIT KEY) Exit from: 15D4 WAIT KEY auto work areas As 16B0 SET MIN affects the editing area, the work spaceand the calculator stack, this is presumably what the notes meanat the two references below. 12A9 MAIN 1 gives them minimum configurations 1313 MAIN G clears them WORKSP system variable 5C61 Bytes: 2. Holds the address of the first byte of the work space, see below. One of the fourteen system pointers reset by 1664 POINTERS each time space is made or reclaimed in RAM. Written by: 1219 RAM SET 166B PTR NEXT 169E RESERVE 16B0 SET MIN Read by: 0030 BC SPACES 1190 SET HL 1195 SET DE 155D MAIN ADD 157D MAIN ADD 1 166B PTR NEXT 16BF SET WORK 1B8A LINE RUN 2148 IN VAR 2 219B IN VAR 6 21B9 IN ASSIGN Rems: 1031 ED EDGE start address for INPUT is WORKSP work space The work space is an area of RAM defined by a bottom address held in 5C61 WORKSP, up to the bottom of the calculator stack held in 5C63 STKBOT, used for various purposes; really it is where things are put that aren't meant to be preserved very long and have no other special place to go. Nothing can be kept there very long: the work space is cleared - each time ENTER is hit in the editing routines, by the call to 1650 SET MIN from 12A9 MAIN 1