Procrustean lengthening/shortening see 2B72 L DELETE$ (2AFF LET) PROG system variable 5C53 Bytes: 2 Holds the address of the_start_of_the_BASIC_program. Loaded on start-up with the address just above the channels area. Although it is one of the fourteen system pointers set by 1664 POINTERS, the only thing that can change it is expansion orcontraction of the Microdrive maps. ME ENT 1 -> ME ENT 3 and MAIN ADD 1 save and restore it when adding lines to the program,in case the line is at the start, when they would move PROG. Written by: 0958 ME ENT 3 1219 RAM SET 157D MAIN ADD1 166B PTR NEXT Read by: 073A SA TYPE 0 093E ME ENT 1 157D MAIN ADD1 196E LINE ADDR 2802 SF ARGMT 1 program area, program (BASIC), program block, program/ data block, program/data flag A BASIC program input from the keyboard or loaded from tape etc is put in memory as a string of token and character codes in the_program_area, starting at the_base_address stored in the sv 5C53 PROG, which is just above the Microdrive maps if any and the channel information, and ending just before the address in 5C4B VARS which marks the start of the variables area. This area expands or contracts with the program. When the program is saved on tape etc, it is the string of bytes in the program area and the variables area which is the_save/load_block to be recorded; the header recorded on tape holds the_parameters_of_the_save/load_block, signalling: - this is a program, and a line number if one is saved - the_start_address or_destination_address to which the program is to be loaded, ie the address in 5C53 PROG; as SAVing or LOADing proceeds, the destination address is stepped on through the program, and the notes sometimes speak of the_base _address being so stepped on, which is confusing and wrong - the_size_of_the_save/load_block, or_number_of_bytes _in_the_save/load_block, indicating the space that must be opened up to accept it on loading back, between the addresses insvs 5C53 PROG and 5C59 E LINE, the end of the variables area; the_length_counter is counted down during SAVing and LOADing andwhen it reaches zero the parity byte is saved or checked - the_program_length, ie not including the variables, indicating where 5C4B VARS must be set At several points the notes use the expression_data _block, as opposed to_header_block, to mean a block of bytes which is a program or an array of data or a CODE or SCREEN$ block. This is logical enough in context, but can be confusing. Introduction on saving, header describes saved block 04C2 SA BYTES saves the block 04D0 SA FLAG adjust length and base address to allow for flag 04F2 SA SYNC 2 1st byte saved indicates header or block 04FE SA LOOP check length counter for zero 0525 SA 8 BITS count down and move on base address 0556 LD BYTES load a block 058F LD SYNC check flag before loading block 05B3 LD FLAG adjust counter to allow for flag 05BD LD VERIFY verifies a block 05C2 LD NEXT step on destination address 05C4 LD DEC count down 05CA LD 8 BITS loop till counter zero 0621 SA SPACE put start address in header 064B SA NAME get start address 06C3 SA CODE zero length signifies unspecified 06E1 SA CODE 1 must specify start/length for CODE 06F0 SA CODE 2 zero length signifies unspecified 06F5 SA CODE 3 get length as specified 06F9 SA CODE 4 all parameters in header 073A SA TYPE 0 puts parameters in header string 075A SA ALL save pointer to start 07CB VR CONTRL on verification, check recorded bytes against those in memory 07F4 VR CONT 2 transfer destination pointer 0800 VR CONT 3 signals data not header 0802 LD BLOCK loads or verifies a block 0808 LD CONTRL loads program and variables or array 0819 LD CONT 1 checks space available for new block 082E LD DATA skipped when loading program 084C LD DATA 1 signals "data block" when loading array 0873 LD PROG loading program and variables 08AD LD PROG 1 signals "load" & "data" and loads 08B6 ME CONTRL loads block for merging 08D2 ME NEW LP loop through lines of new program 08D7 ME OLD LP inner loop through lines of old program 08DF ME OLD L1 place found for line of new program 08F0 ME VAR LP merge old and new variables 0970 SA CONTRL saving a block 0991 SA 1 SEC get length & start, signal "data" & save 155D MAIN ADD adding line to BASIC 1974 LINE AD 1 find place for new line number in program 19B8 NEXT ONE find start of next line in BASIC 1B17 LINE SCAN reads every code of BASIC program 1B9E LINE NEW scan program for address to jump to 1BB3 LINE END check for end of program 1BD1 NEXT LINE sets signals for reading program line 1D64 F LOOP looks through program area for NEXT 1D86 LOOK PROG looks for DATA, DEF FN, NEXT 1D8B LOOK P 1 loops through each line of program 26C9 S LETTER variables if DEF FN are in program area 27BD S FN SBRN to scan FNs, find DEF FN in program area 2802 SF ARGMT1 start search at PROG less one 2808 SF FND DF search program for DEF FN 28B2 LOOK VARS seeks variable named in program area 'Program: ' message see 09A1 cassette messages PROGRAM NAME 04AA see unused addresses PROG RUN misprint for LINE RUN at 12CF MAIN 3 prompts see message printing proper character code A mysterious expression used only in the note on 15EF OUT CODE; probably a misprint for [report] character code. PR POSN 1 subroutine 204E See 1FCD PRINT. Called from: 1FE5 PRINT 3 (twice) 20C1 IN ITEM 1 21B2 IN NEXT 2 PR POSN 2 2061 (1FCD PRINT) Exit from: 204E PR POSN 1 PR POSN 3 2067 (1FCD PRINT) Jumps from: 204E PR POSN 1 (3 times) PR POSN 4 206E (1FCD PRINT) Jumps from: 2067 PR POSN 3 PR ST END subroutine 2048 See 1FCD PRINT. Called from: 06C3 SA CODE Exit from: 2045 PR END Z PR STRING 203C (1FCD PRINT) Exit from: 2024 PR ITEM 3 auto P RUN 1AAB P SAVE 1ADF P STOP 1A8A see 1A7A syntax parameter table PTR DONE 1675 (1664 POINTERS) Exit from: 166B PTR NEXT PTR NEXT 166B (1664 POINTERS) Jumps from: 1675 PTR DONE pulses, pulsing signal see timing P VERIFY 1AE1 see 1A7A syntax parameter table ----- question mark see ? key (3F) after end of alphabet quotation mark, quotes see " (22) after end of alphabet 'quotes' flag, quote mode see 5C6A FLAGS2 bit 2 ----- radians see 3783 get-argt RAM CHECK 11DA (1187 NEW) There seems to be no use of this label anywhere in ROM. RAM DONE 11EF (1187 NEW) Jumps from: 11E2 RAM READ (twice) RAM FILL 11DC (1187 NEW) Jumps from: auto RAM READ 11E2 (1187 NEW) Jumps from: auto RAM SET 1219 (1187 NEW) Jumps from: 11EF RAM DONE RAMTOP system variable 5CB2 Bytes: 2 Loaded on start-up by 1219 RAM SET with the address of the highest byte below the user-defined graphics; this will be FF57h/65367d for the 48K Spectrum or 7F57h/32599 for the 16K machine. This address is loaded with a marker byte 3Eh/62d. RAMTOP isn't affected by a NEW command, and poking it from BASIC or m/c with a lower number will create a safe block of memory for m/c programs etc: this can also be done from BASICby the command CLEAR xx, using 1EDC CLEAR 2. CLEAR_always sets RAMTOP, but if no value is supplied the existing value is used. RAMTOP cannot be set higher than 5CB4 P RAMT, or lower than 50d bytes above the top of the calculator stack pointed to by 5C55 STKEND. This lower limit will vary with the size of the program and variables areas, etc. Written by: 1219 RAM SET 1EDC CLEAR 2 Read by: 11B7 NEW 1219 RAM SET 1EAF CLEAR RUN Rems: 11DA RAM CHECK memory rewrite (NEW) from RAMTOP down 1EAC CLEAR can move RAMTOP 1EB7 CLEAR 1 new RAMTOP checked 1EDA REPORT M if RAMTOP too high or low RANDOMIZE key (F9) see also commands, functions and operators, KEYBOARD SCANNING The T key in K mode produces the command RANDOMIZE, which requires a numeric parameter; zero is supplied if there isnone in the BASIC. It is interpreted by 1B29 STMT L 1 using the syntax offset table 1A48 and the syntax parameter table 1A7A; 1AB5 P RANDOM jumps through 1C0D CLASS 03, which collects the parameter or supplies zero, and 1C16 JUMP C R to the executive routine 1E4F RANDOMIZE. RANDOMIZE subroutine 1E4F Called only from 1AB5 P RANDOM in the syntax parameter table; the executive routine of the RANDOMIZE command, which loads 5C76 SEED with a given value S, or if none is given from BASIC with the two lo bytes from 5C78 FRAMES, which run from zero to 65535d every 20 minutes or so. This number is random, ieunpredictable, in practice if not in theory; see the comments under 25F8 S RND. Input parameters: none - S is on the calculator stack; if S wasn't specified inthe BASIC command, it is zero. Action: call 1E99 FIND INT2 to get S - if it isn't zero jump on to RAND 1 - (zero S) make S equal to the lo bytes of 5C78 FRAMES. _1E5A_RAND_1: load S into 5C76 SEED. Exit: RET, from 1E5A RAND 1. Output parameters: none, and the stack is cleared. random numbers see 25F8 S RND RAND 1 1E5A (1E4F RANDOMIZE) Exit from: 1E4F RANDOMIZE range of steps (line drawing) see 24B7 DRAW LINE RASP system variable 5C38 Bytes: 1 The_length of the low-pitched "groan" emitted by the Spectrum when it finds it impossible to perform an editing command, because either the screen or the memory is full; see 107F ED ERROR and 1167 ED FULL. The "pulses" of the rasp are always the same length, 6800 T-states or 7.8 thousandths of a second, 129 hz; RASP just controls the_number of pulses. It is set at 40h/64d on initialization, half a second, and not changedthereafter unless a new value is deliberately POKEd into it; anysuch change of value will be undisturbed by a NEW command. The immediately following system variable is the one- byte PIP, and both are written together in 11EF RAM DONE. Written by: 11EF RAM DONE (twice) Read by: 107F ED ERROR 1167 ED FULL 11B7 NEW READ key (E3) see also commands, functions and operators, KEYBOARD SCANNING, 022C extended mode table (b) The A key in E mode without shift produces the command READ. The "READ statement" must also include one or more variable names, separated by commas. The command is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A7A.1AC8 P READ causes a jump via 1C11 CLASS 05 and 1C16 JUMP C R tothe executive routine 1DED READ. READ subroutine 1DED Called only from 1AC8 P READ in the syntax parameter table 1A7A; the executive routine of the READ command. Assigns values to all the variables in the READ statement, from the nextDATA statements in the BASIC. Input parameters: none. Action: call 1C1F CLASS 01, which either finds the variable named in the READ statement or makes a new one - call 0018 GET CHAR to get the current BASIC pointer and store it temporarily in 5C5F X PTR; the usual store, 5C5D CHADD, is needed for the DATA search - put a data pointer on the current address in 5C57 DATADD; this is just after the last DATA item read, if any - if the code at that address is 2C comma, jump on to READ 1; the next DATA item is just past the comma