| Routines

2951: THE 'STACK FUNCTION ARGUMENT' SUBROUTINE

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 26DA in the usual way.
STK_F_ARG | 2951 | LD HL,($5C0B) | Point to the first character in the arguments area (DEFADD) and put it into A.
| 2954 | LD A,(HL)
| 2955 | CP ")" | Is it a ')'?
| 2957 | JP Z,V_RUN_SYN | Jump to search the variables area.
SFA_LOOP | 295A | LD A,(HL) | Get the next argument in the loop.
| 295B | OR $60 | Set bits 5 and 6, assuming a simple numeric variable; copy it to B.
| 295D | LD B,A
| 295E | INC HL | Point to the next code.
| 295F | LD A,(HL) | Put it into the A register.
| 2960 | CP $0E | Is it the 'number marker' code, +0E?
| 2962 | JR Z,SFA_CP_VR | Jump if so: numeric variable.
| 2964 | DEC HL | Ensure that HL points to the character, not to a space or control code.
| 2965 | CALL FN_SKPOVR
| 2968 | INC HL | HL now points to the 'number marker'.
| 2969 | RES 5,B | Reset bit 5 of B: string variable.
SFA_CP_VR | 296B | LD A,B | Get the variable name into A.
| 296C | CP C | Is it the one we are looking for?
| 296D | JR Z,SFA_MATCH | Jump if it matches.
| 296F | INC HL | Now pass over the 5 bytes of the floating-point number or string parameters to get to the next argument.
| 2970 | INC HL
| 2971 | INC HL
| 2972 | INC HL
| 2973 | INC HL
| 2974 | CALL FN_SKPOVR | Pass on to the next character.
| 2977 | CP ")" | Is it a ')'?
| 2979 | JP Z,V_RUN_SYN | If so, jump to search the variables area.
| 297C | CALL FN_SKPOVR | Point to the next argument.
| 297F | 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 | 2981 | BIT 5,C | Test for a numeric variable.
| 2983 | JR NZ,SFA_END | Jump if the variable is numeric; SCANNING will stack it.
| 2985 | INC HL | Point to the first of the 5 bytes to be stacked.
| 2986 | LD DE,($5C65) | Point DE to STKEND.
| 298A | CALL duplicate | Stack the 5 bytes.
| 298D | EX DE,HL | Point HL to the new position of STKEND, and reset the system variable.
| 298E | LD ($5C65),HL
SFA_END | 2991 | POP DE | Discard the LOOK_VARS pointers (second and first character pointers).
| 2992 | POP DE
| 2993 | XOR A | Return from the search with both the carry and zero flags reset - signalling that a call STK_VAR is not required.
| 2994 | INC A
| 2995 | RET | Finished.