Submitted by Steve Fewell
Description:
Load the character pointed to by (&37-&38) + 1 (offset). (&37-&38) point to the start of the subroutine
call statement (either PROC or FN), and this character will either be the BASIC Keyword token for 'FN' or
'PROC'.
If the BASIC Keyword is the 'PROC' token then Set A to #&F6 (as &04F6-&04F7 contain the address of the
Procedure lookup table, and jump to routine &9859 to create an entry in this table for the subroutine name pointed to
by &37-&38.
Otherwise, the BASIC Keyword must be the 'FN' token, so Set A to #&F8 (as &04F8-&04F9 contain the address of
the Function lookup table, and jump to routine &9859 to create an entry in this table for the subroutine name pointed
to by &37-&38.
Note: Routine &9859 will increment Y before reading the first character of the subroutine (this will skip the BASIC
Keyword token). Note, unlike a variable name, the first character of a subroutine name is not skipped, as there is not
a separate lookup table for each letter that a function or procedure name can begin with - just 2 lookup tables, one for
Functions and the other for Procedures.
On exit from the &9859 routine, a parameter block will have been created for the subroutine name (this will have the
same format as a variable's parameter block).
9845 | 160 001 | A0 01 | LDY#&01 | |
9847 | 7 | 177 055 | B1 37 | LDA (&37),Y |
9849 | 170 | AA | TAX | |
984A | 169 246 | A9 F6 | LDA#&F6 | |
984C | 224 242 | E0 F2 | CPX#&F2 | |
984E | 240 009 | F0 09 | BEQ 9 --> &9859 Add variable name to Variable Pointer Table (page &4 offset pointed to by A) | |
9850 | 169 248 | A9 F8 | LDA#&F8 | |
9852 | 128 005 | 80 05 | BRA 5 --> &9859 Add variable name to Variable Pointer Table (page &4 offset pointed to by A) |