Spectrum ROM | Routines |
Prev: 10418 | Up: Map |
Used by the routine at LOOK_VARS.
This subroutine is called by LOOK_VARS when DEFADD-hi is non-zero, to make a search of the arguments area of a DEF FN statement, before searching in the variables area. If the variable is found in the DEF FN statement, then the parameters of a string variable are stacked and a signal is given that there is no need to call STK_VAR. But it is left to S_LETTER to stack the value of a numerical variable at 9946 in the usual way.
|
|||||||
STK_F_ARG | 10577 | LD HL,(23563) | Point to the first character in the arguments area and put it into A. | ||||
10580 | LD A,(HL) | ||||||
10581 | CP ")" | Is it a ')'? | |||||
10583 | JP Z,V_RUN_SYN | Jump to search the variables area. | |||||
SFA_LOOP | 10586 | LD A,(HL) | Get the next argument in the loop. | ||||
10587 | OR 96 | Set bits 5 and 6, assuming a simple numeric variable; copy it to B. | |||||
10589 | LD B,A | ||||||
10590 | INC HL | Point to the next code. | |||||
10591 | LD A,(HL) | Put it into the A register. | |||||
10592 | CP 14 | Is it the 'number marker' code 0E hex? | |||||
10594 | JR Z,SFA_CP_VR | Jump if so: numeric variable. | |||||
10596 | DEC HL | Ensure that HL points to the character, not to a space or control code. | |||||
10597 | CALL FN_SKPOVR | ||||||
10600 | INC HL | HL now points to the 'number marker'. | |||||
10601 | RES 5,B | Reset bit 5 of B: string variable. | |||||
SFA_CP_VR | 10603 | LD A,B | Get the variable name into A. | ||||
10604 | CP C | Is it the one we are looking for? | |||||
10605 | JR Z,SFA_MATCH | Jump if it matches. | |||||
10607 | INC HL | Now pass over the 5 bytes of the floating-point number or string parameters to get to the next argument. | |||||
10608 | INC HL | ||||||
10609 | INC HL | ||||||
10610 | INC HL | ||||||
10611 | INC HL | ||||||
10612 | CALL FN_SKPOVR | Pass on to the next character. | |||||
10615 | CP ")" | Is it a ')'? | |||||
10617 | JP Z,V_RUN_SYN | If so, jump to search the variables area. | |||||
10620 | CALL FN_SKPOVR | Point to the next argument. | |||||
10623 | JR SFA_LOOP | Jump back to consider it. | |||||
A match has been found. The parameters of a string variable are stacked, avoiding the need to call STK_VAR.
|
|||||||
SFA_MATCH | 10625 | BIT 5,C | Test for a numeric variable. | ||||
10627 | JR NZ,SFA_END | Jump if the variable is numeric; SCANNING will stack it. | |||||
10629 | INC HL | Point to the first of the 5 bytes to be stacked. | |||||
10630 | LD DE,(23653) | Point DE to STKEND. | |||||
10634 | CALL duplicate | Stack the 5 bytes. | |||||
10637 | EX DE,HL | Point HL to the new position of STKEND, and reset the system variable. | |||||
10638 | LD (23653),HL | ||||||
SFA_END | 10641 | POP DE | Discard the LOOK_VARS pointers (second and first character pointers). | ||||
10642 | POP DE | ||||||
10643 | XOR A | Return from the search with both the carry and zero flags reset - signalling that a call STK_VAR is not required. | |||||
10644 | INC A | ||||||
10645 | RET | Finished. |
Prev: 10418 | Up: Map |