Turned on: 20D8 IN ITEM 2 Turned off: 1313 MAIN G 1C22 VAR A 1 20ED IN ITEM 3 2174 IN VAR 5 Read by: 0F38 ED LOOP 1076 ED SYMBOL 20FA IN PROMPT 2129 IN PR 3 2174 IN VAR 5 FLAGX bit 6: input result string/numeric status flag On "expect numeric result"; off "string result"; used bythe INPUT command. Cf FLAGS bit 6, which records the status of the last value on the calculator stack. Turned on: 211A IN PR 1 Turned off: 1313 MAIN G 1C22 VAR A 1 20FA IN PROMPT Read by: 21B9 IN ASSIGN/1C59 VAL FET 2 Rems: 1C56 VAL FET 1 bit 6 of FLAGS or FLAGX checked 1C59 VAL FET 2 bit 6 checked against FLAGS FLAGX bit 5: input/editing flag On "in input mode"; off "in editing mode". When the bit is set, keyboard input is sent to the work space, when it is zero to the editing area. Turned on: 20FA IN PROMPT Turned off: 1313 MAIN G (twice, apparently unnecessarily) 1C22 VAR A 1 2174 IN VAR 5 Read by: 0FA9 ED EDIT 0FF3 ED DOWN 1059 ED UP 1195 SET DE 1881 OUT LINE3 191C LN STORE 1937 OUT CHAR Rems: 1031 ED EDGE line start address depends on state of flag read in 1195 SET DE FLAGX bit 4: not used FLAGX bit 3: not used FLAGX bit 2: not used FLAGX bit 1: new variable flag On "new variable"; off "variable is in variables area" Turned on: 1C22 VAR A 1 Turned off: 1313 MAIN G 1C22 VAR A 1 Read by: 1DAB NEXT 2AFF LET FLAGX bit 0: simple string flag see strings On "complete simple string: old variable is to be deleted"; off "slice or array element; overwrite old value" Turned on: 1C30 VAR A 2 Turned off: 1313 MAIN G 1C22 VAR A 1 Read by: 2B72 L DELETE$ Rems: 2AFF LET set to delete old copy of variable FLASH key (DB) see also colours, KEYBOARD SCANNING, extendedmode key table (c) The V key in E mode with either shift produces the tokenFLASH. FLASH can be used either as a BASIC command or as a printcontrol item within a PRINT etc statement. In either case it causes any new printing on the screen to flash on and off, or tostop flashing, in that position on the screen. FLASH must be followed by a parameter, one for "FLASH on", zero for "off", eight for "no change". CLS after a FLASH 1 command makes the whole of the upperscreen flash; flashing in the lower screen can only be executed by the FLASH control code, see under BRIGHT control code, or by POKing 5C48 BORDCR. The flashing is executed by printing alternately TRUE VIDEO and INVERSE VIDEO; the mechanism which actually produces it is in the Spectrum hardware, not under ROM control. As a command, it is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A7A. 1AED P FLASH causes a jump to 1C96 CLASS 07 (PERMS),the executive routine for all the colour item commands INK to OVER. As a print control item, execution is from within the PRINT executive routine 1FCD PRINT; each new expression following the PRINT command is checked by a call to 1FFC PR ITEM1 from 1FE5 PRINT 3. If it is FLASH, this in turn calls 21F2 CO TEMP 3 from 2024 PR ITEM 3; here the token code DB is converted to the "embedded" control code 12h, which is then sent through the output routine followed by the parameter one or zero. The way this works when printing on screen can be seen at 09F4 PRINT OUT; indexing with 12h for FLASH into the control character table at 0A11 produces an indirect jump to 0A7A (0A1D + 5D) PO 1 OPER. See the index description of this subroutine for the rather tricky way in which it collects the parameter andsends execution to 0A87 PO CONT, which finally executes the FLASH command. The effect of execution in every case is to set the hi bit of 5C8F ATTR T, see under colours, and hence the hi bit of the byte in the attributes area. FLASH control code (12h) see BRIGHT control code FLOATING POINT CALCULATOR, FLOATING POINT NUMBERS A major section of ROM from 32C5, the tables of constants and calculation subroutine addresses to the end of thecharacter set at 3FFF. Contains the floating-point calculator and most of its subroutines - see CALCULATE. floating point forms in BASIC line see CALCULATE, number in BASIC line FLOATING POINT TO A SUBROUTINE see 2DD5 FP TO A FLOATING POINT TO BC SUBROUTINE see 2DA2 FP TO BC F LOOP 1D64 (1D03 FOR) Jumps from: auto F L&S 1D34 (1D03 FOR) Jumps from: 1D16 F REORDER FN key (A8) see also commands, functions and operators, KEYBOARD SCANNING, 0284 extended mode table (f) The 2 key in E mode with symbol shift produces the function FN. The_FN_statement must contain: - a single letter function name, which must be followed by "$" if the value of the function is a string; the name and type of the function must be matched by a DEF FN statement somewhere in the program. - a pair of brackets "()"; these may be empty, or they may contain any number of string or numeric arguments, separatedby commas. On execution, 24FB SCANNING indexes into the scanning function table at 2596 to find the executive routine 27BD S FN SBRN, through 2672 S FN, which locates the corresponding DEF FN statement and evaluates the function for the given arguments. 26C9 S LETTER vbles looked for in DEF FN as well as vbles area 27E9 SF FLAG 6 separates string result from numeric 2814 SF CP DEF check DEF FN for match with FN name 2831 SF VALUES arguments of FN evaluated 2852 SF ARG VL check for match of FN & DEF FN arguments 2885 SF R BR 2 check for end of arguments in FN 288D SF VALUE evaluates FN function 28AB FN SKPOVR used by FN in searching DEF FN statements 28E3 V TEST FN look for vble first in DEF FN statement FN SKPOVR subroutine 28AB Much like 0020 NEXT CHAR; finds the next "printable character". However in reading a DEF FN statement NEXT CHAR cannot be used, as it moves on 5C5D CH ADD, which is marking theplace in the FN statement. Input parameters: HL is a pointer to the last character read. Action: increment the pointer and read its code - if it is less than 21h jump back to FN SKPOVR; ie moveon again for a control code or space. Exit: RET. Output parameters: A and HL hold the code and address of the next "printable" code. Called from: 2814 SF CP DEF (twice) 2831 SF VALUES (twice) 2843 SF ARG LP 2852 SF ARG VL (twice) 295A SFA LOOP 296B SFA CP VR (twice) Jumps from: auto FOR key (EB) see also commands, functions and operators, KEYBOARD SCANNING The F key in K mode produces the command FOR. The_FOR _statement must have the form FOR f = x TO y STEP z; only the STEP and its parameter are optional. See "FOR ... NEXT loops". The command is read by 1B29 STMT L 1 referring through the syntax offset table 1A48 to the syntax parameter table 1A78.1A90 P FOR causes a jump via 1C6C CLASS 04: pick up the loop control variable back to 1A90 P FOR, check for the "=" 1C82 CLASS 06: evaluate the expression for VALUE back to 1A90 P FOR, check for the "TO" 1C82 CLASS 06 again: evaluate the expression for LIMIT 1C11 CLASS 05: because there may be a STEP into 1C16 JUMP C R which in turn jumps to the executive routine 1D03 FOR. FOR subroutine 1D03 Executes a FOR ... NEXT loop from BASIC. For the terminology, see FOR ... NEXT loops. Called only from the syntaxparameter table at 1A90 P FOR. Any or all of VALUE, LIMIT or STEP may be variables or functional expressions in the BASIC. VALUE and LIMIT have already been evaluated and their values put on the calculator stack by the 1C82 CLASS 06 calls in the "syntax parameter" routine 1A90 P FOR; STEP is evaluated by 1C82 EXPT 1NUM at the start of the FOR subroutine. In syntax checking, the subroutine just checks that there is a statement terminator either immediately or after a STEP parameter; the rest of the statement has already been checked by 1A90 P FOR, and from F REORDER onwards the subroutineis only executed in run time. Checking for "FOR without NEXT" would be pointless while the program is still being written. In run time, it calls 2AFF LET to find or create the loop control variable in the variables area. If a variable is found with the letter to be used, it may be a simple numeric variable, in which case its structure is changed: it must have aletter with all three hi bits set, followed by eighteen bytes, five each for the FP numbers VALUE, LIMIT and STEP, and three for the looping line and statement number. See variables These eighteen bytes are temporarily marked as the calculator memory; VALUE, LIMIT and STEP are put in its mem-0 tomem-2 locations, the line number of the FOR statement in the line number location and its statement number incremented by onein the statement number location. The line and statement numberswill be picked up by the corresponding NEXT command when it jumps back for another turn of the loop. Now a trial call to 1DDA NEXT LOOP checks that at least one pass will be required. If VALUE is already greater than LIMIT, none will be required; this can happen eg with "FOR f = st to 38", if the current value of "st" is 39 or more . If thereisn't going to be a pass, execution immediately jumps forward inBASIC to the statement after the corresponding NEXT. The BASIC is searched for the first NEXT statement using the same looping variable; the line and statement number to be jumped to, just after this NEXT statement, are put in 5C42 NEWPPC and 5C44 NSPPC. The search starts from the FOR statement - all NEXTs preceding it are ignored. If there is no such NEXT, this is a "FOR without NEXT" error. Input parameters: the BASIC pointer in 5C5D CH ADD is on the next BASIC character after the expression for LIMIT - A holds the code at the pointer - VALUE and LIMIT are on the calculator stack, LIMIT as last value. Action: if A doesn't hold CD STEP jump on to F USE 1 - (STEP is given in BASIC) move on the BASIC pointer to the expression following CD STEP - call 1C92 EXPT 1NUM to put the value of STEP from BASIC on the calculator stack - call 1BEE CHECK END; in syntax checking it reports "Nonsense in BASIC" if this isn't the end of the statement, and makes a double return to 1B76 STMT RET if it is - (run time) jump on to F REORDER. _1D10_F_USE_1 (no STEP given in BASIC): call CHECK END; this must be the end of the statement - (run time) use the calculator to put one on the stack for STEP. _1D16_F_REORDER (the calculator stack holds, from the top, STEP, LIMIT, VALUE): use the calculator to reorder them as VALUE, STEP, LIMIT - call 2AFF LET to find or create the loop control variable in the variables area and give it the value of VALUE from the top of the stack - put the variable pointer in 5C68 MEM; it is on the FP number for the variable's value. This makes the variable a temporary calculator memory, with VALUE in mem-0. There is no reference to the memory in the subroutine itself, but it is usedin the call to 1DDA NEXT LOOP in F L&S - read the variable letter and then set its hi bit; simple numeric variable letters start 011, looping variables 111 - move the variable pointer on by six bytes; if it was asimple variable, this now points just beyond it - rotate the hi bit of the variable letter, as it was read, into carry - if carry is set jump on to F L&S; the variable is already a looping variable - (it is a simple numeric variable) call 1655 MAKE ROOM with a counter of thirteen; to add space for two more FP numbersand the line and statement numbers - set the variable pointer on the first byte of the temporary mem-1. _1D34_F_L&S: delete LIMIT and STEP from the calculator stack; for the moment this only means the stack end pointer is moved down - copy the ten bytes of LIMIT and STEP from the new stack end to the temporary mem-1 and mem-2 of the looping variable - get the current line number from 5C45 PPC and put it in the line number locations after mem-2 - get the current statement number from 5C47 SUBPPC, increment it and put it in its location - call 1DDA NEXT LOOP, which makes a trial subtraction of VALUE from LIMIT to check whether a pass of the loop is required - if it returns with NC return; at least one pass will be required