Submitted by Steve Fewell
Description:
Call routine &BA3C to set BASIC Text Pointer B to BASIC Text Pointer A location and check that the next
character is a '#'-character. If not then generate 'Missing #' error message. Evaluate the expression after
the '#' [Type mismatch error if string value], and set Y to the number found after the '#' character (this is
the file channel number). Store the channel number to location &4C.
Call &9275 to set BASIC text pointer A offset to the BASIC text pointer B offset value (to update BASIC Text
pointer A to point to the next character on the program line after the channel number.
[&B84F] Get the next non-space character at Text pointer A location. If the next character is not a comma (','), then we
are not expecting any more data, so exit (Store Y back to &0A (Text Pointer B offset) and jump to &9002
[if the end of statement was not reached then &9002 will generate a 'Syntax Error']).
Push the channel number (&4C) to the stack.
Call &98AE to Evaluate the variable name at Text pointer A, and create the variable if it doesn't already exist.
If the zero flag is set on return from &98AE, then the text at Text pointer B was not a valid variable name, so
generate a Syntax error.
Otherwise, the variable name was valid.
Call &9275 to set BASIC text pointer A offset to the BASIC text pointer B offset value (to update BASIC Text
pointer A to point to the next character on the program line after the variable name. This is done because routine
&98AE copies Text Pointer A location to Text Pointer B location and works from Text Pointer B.
Pop the channel number from the stack abd set &4C back to the channel number.
Push the flag settings to the stack to preserve the Carry flag value after the &98AE call.
Push the IWA (variable settings) to the BASIC stack (routine &BC26).
Set Y to the channel number (&4C).
Call OSBGET (&FFD7) to get the next Variable Type byte from the data file.
Store the variable type in location &27.
Retrieve the processor flags from the Stack. If the carry flag is clear (meaning that the variable has a
numeric value - no '$' at the end) then jump to &B88A to set the Numeric variable.
B83C | L | 076 146 144 | 4C 92 90 | JMP &9092 Type Mismatch error |
B83F | Li | 076 105 155 | 4C 69 9B | JMP &9B69 Syntax error |
B842 | 132 010 | 84 0A | STY &0A | |
B844 | L | 076 002 144 | 4C 02 90 | JMP &9002 'Syntax error' if not end of statement; otherwise, execute next statement/program line |
B847 | < | 032 060 186 | 20 3C BA | JSR &BA3C PTR B=PTR A, Check for '#', Set Y to file channel number (PTR B) |
B84A | L | 132 076 | 84 4C | STY &4C Store file channel number |
B84C | u | 032 117 146 | 20 75 92 | JSR &9275 Set PTR A Offset to PTR B Offset |
B84F | 032 229 140 | 20 E5 8C | JSR &8CE5 Get next non-space char (PTR A) and compare with ',' | |
B852 | 208 238 | D0 EE | BNE -18 --> &B842 No comma, so exit as no more data expected | |
B854 | L | 165 076 | A5 4C | LDA &4C |
B856 | H | 072 | 48 | PHA Store channel number |
B857 | 032 174 152 | 20 AE 98 | JSR &98AE Evaluate variable name & create if new variable | |
B85A | 240 227 | F0 E3 | BEQ -29 --> &B83F [JMP &9B69 Syntax error] | |
B85C | u | 032 117 146 | 20 75 92 | JSR &9275 Set PTR A Offset to PTR B Offset |
B85F | h | 104 | 68 | PLA |
B860 | L | 133 076 | 85 4C | STA &4C |
B862 | 008 | 08 | PHP | |
B863 | & | 032 038 188 | 20 26 BC | JSR &BC26 Push IWA (variable details) to stack |
B866 | L | 164 076 | A4 4C | LDY &4C |
B868 | 032 215 255 | 20 D7 FF | JSR &FFD7 OSBGET [Read variable type from file] | |
B86B | ' | 133 039 | 85 27 | STA &27 |
B86D | ( | 040 | 28 | PLP |
B86E | 144 026 | 90 1A | BCC 26 --> &B88A Numeric variable (no '$') | |
B870 | ' | 165 039 | A5 27 | LDA &27 |
B872 | 208 200 | D0 C8 | BNE -56 --> &B83C [JMP &9092 Type mismatch error] | |
B874 | 032 215 255 | 20 D7 FF | JSR &FFD7 OSBGET [Read string length from file] | |
B877 | 6 | 133 054 | 85 36 | STA &36 |
B879 | 170 | AA | TAX | |
B87A | 240 009 | F0 09 | BEQ 9 --> &B885 | |
B87C | 032 215 255 | 20 D7 FF | JSR &FFD7 OSBGET [Read next String character from file] | |
B87F | 157 255 005 | 9D FF 05 | STA &05FF,X | |
B882 | 202 | CA | DEX | |
B883 | 208 247 | D0 F7 | BNE -9 --> &B87C | |
B885 | 032 171 144 | 20 AB 90 | JSR &90AB Set String variable | |
B888 | 128 197 | 80 C5 | BRA -59 --> &B84F | |
B88A | ' | 165 039 | A5 27 | LDA &27 |
B88C | 240 174 | F0 AE | BEQ -82 --> &B83C [JMP &9092 Type mismatch error] | |
B88E | 0 | 048 012 | 30 0C | BMI 12 --> &B89C |
B890 | 162 003 | A2 03 | LDX#&03 | |
B892 | 032 215 255 | 20 D7 FF | JSR &FFD7 OSBGET [Get next Integer byte from file] | |
B895 | * | 149 042 | 95 2A | STA &2A,X |
B897 | 202 | CA | DEX | |
B898 | 016 248 | 10 F8 | BPL -8 --> &B892 | |
B89A | 128 014 | 80 0E | BRA 14 --> &B8AA | |
B89C | 162 004 | A2 04 | LDX#&04 | |
B89E | 032 215 255 | 20 D7 FF | JSR &FFD7 OSBGET [Get next Float byte from file] | |
B8A1 | l | 157 108 004 | 9D 6C 04 | STA &046C,X |
B8A4 | 202 | CA | DEX | |
B8A5 | 016 247 | 10 F7 | BPL -9 --> &B89E | |
B8A7 | 9 | 032 057 165 | 20 39 A5 | JSR &A539 Load FWA from &046C |
B8AA | 032 006 189 | 20 06 BD | JSR &BD06 Retrieve Integer from stack to &37-&3A | |
B8AD | 8 | 032 056 179 | 20 38 B3 | JSR &B338 Set numeric variable |
B8B0 | 128 157 | 80 9D | BRA -99 --> &B84F |