Prev: 07199 Up: Map Next: 07246
07202: THE 'VARIABLE IN ASSIGNMENT' SUBROUTINE
Used by the routine at CLASS_04.
The routine at CLASS_01 continues here.
This subroutine develops the appropriate values for the system variables DEST and STRLEN.
Input
C Bit 5: Set if the variable is numeric, reset if it's a string
C Bit 6: Set if the variable is simple, reset if it's an array
C Bit 7: Set if checking syntax, reset if executing
HL Address of the last letter of the variable's name (in the variables area, if it exists)
F Carry flag reset if the variable already exists
F Zero flag reset if the variable is simple (not an array) and does not exist
VAR_A_1 07202 LD (IY+55),0 Initialise FLAGX to 0.
07206 JR NC,VAR_A_2 Jump forward if the variable has been used before.
07208 SET 1,(IY+55) Signal 'a new variable' (set bit 1 of FLAGX).
07212 JR NZ,VAR_A_3 Give an error if trying to use an 'undimensioned array'.
This entry point is used by the routines at NEXT and S_LETTER.
Report 2 - Variable not found.
REPORT_2 07214 RST 8 Call the error handling routine.
07215 DEFB 1
Continue with the handling of existing variables.
VAR_A_2 07216 CALL Z,STK_VAR The parameters of simple string variables and all array variables are passed to the calculator stack. (STK_VAR will 'slice' a string if required.)
07219 BIT 6,(IY+1) Jump forward if handling a numeric variable (bit 6 of FLAGS set).
07223 JR NZ,VAR_A_3
07225 XOR A Clear the A register.
07226 CALL SYNTAX_Z The parameters of the string or string array variable are fetched unless syntax is being checked.
07229 CALL NZ,STK_FETCH
07232 LD HL,23665 This is FLAGX.
07235 OR (HL) Bit 0 is set only when handling complete 'simple strings' thereby signalling 'old copy to be deleted'.
07236 LD (HL),A
07237 EX DE,HL HL now points to the string or the element of the array.
The pathways now come together to set STRLEN and DEST as required. For all numeric variables and 'new' string and string array variables STRLEN-lo holds the 'letter' of the variable's name. But for 'old' string and string array variables whether 'sliced' or complete it holds the 'length' in 'assignment'.
VAR_A_3 07238 LD (23666),BC Set STRLEN as required.
DEST holds the address for the 'destination' of an 'old' variable but in effect the 'source' for a 'new' variable.
07242 LD (23629),HL Set DEST as required and return.
07245 RET
Prev: 07199 Up: Map Next: 07246