Prev: 1C1F Up: Map Next: 1C4E
1C22: 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 1C22 LD (IY+$37),$00 Initialise FLAGX to +00.
1C26 JR NC,VAR_A_2 Jump forward if the variable has been used before.
1C28 SET 1,(IY+$37) Signal 'a new variable' (set bit 1 of FLAGX).
1C2C 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 1C2E RST $08 Call the error handling routine.
1C2F DEFB $01
Continue with the handling of existing variables.
VAR_A_2 1C30 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.)
1C33 BIT 6,(IY+$01) Jump forward if handling a numeric variable (bit 6 of FLAGS set).
1C37 JR NZ,VAR_A_3
1C39 XOR A Clear the A register.
1C3A CALL SYNTAX_Z The parameters of the string or string array variable are fetched unless syntax is being checked.
1C3D CALL NZ,STK_FETCH
1C40 LD HL,$5C71 This is FLAGX.
1C43 OR (HL) Bit 0 is set only when handling complete 'simple strings' thereby signalling 'old copy to be deleted'.
1C44 LD (HL),A
1C45 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 1C46 LD ($5C72),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.
1C4A LD ($5C4D),HL Set DEST as required and return.
1C4D RET
Prev: 1C1F Up: Map Next: 1C4E