
Submitted by Steve Fewell
Description:
Call &9D3B to obtain the result of the expression at BASIC Text pointer B. This value should be the String value to
search within for the search string value.
If the value of the expression is not a String then issue a 'Type mismatch' error, as a string to search value was not
found.
If the next non-space character at BASIC Text pointer B is not a comma ',', then issue 'Missing ,' error.
Otherwise, increment BASIC Text pointer B offset (to point to the character after the comma).
Push the SWA String value (the String to search within) to the BASIC Stack.
Call &9D3B to obtain the result of the expression after the comma. This value should be the String value to search
for. The INSTR function will search for this string occuring within the first String value specified (the value that is now
on the stack).
If the value of the expression is not a String then issue a 'Type mismatch' error, as a search string value was not found.
Set the IWA LSB byte value (&2A) to 1. This is the default search starting position within the String being searched.
Increment the BASIC Text pointer B offset (&1B) to skip the next non-space character, which should be either a comma
(if a search starting position is being specified) or a close bracket (to indicate the end of the INSTR statement).
| AC36 | ; | 032 059 157 | 20 3B 9D | JSR &9D3B Evaluate expression at BASIC Text pointer B |
| AC39 | 208 145 | D0 91 | BNE -111 --> &ABCC [JMP &9092 - Type mismatch error] | |
| AC3B | , | 224 044 | E0 2C | CPX#&2C |
| AC3D | 208 024 | D0 18 | BNE 24 --> &AC57 | |
| AC3F | 230 027 | E6 1B | INC &1B | |
| AC41 | Q | 032 081 188 | 20 51 BC | JSR &BC51 Push SWA to Stack |
| AC44 | ; | 032 059 157 | 20 3B 9D | JSR &9D3B Evaluate expression at BASIC Text pointer B |
| AC47 | 208 131 | D0 83 | BNE -125 --> &ABCC [JMP &9092 - Type mismatch error] | |
| AC49 | 169 001 | A9 01 | LDA#&01 | |
| AC4B | * | 133 042 | 85 2A | STA &2A |
| AC4D | 230 027 | E6 1B | INC &1B | |
| AC4F | ) | 224 041 | E0 29 | CPX#&29 |
| AC51 | 240 013 | F0 0D | BEQ 13 --> &AC60 | |
| AC53 | , | 224 044 | E0 2C | CPX#&2C |
| AC55 | 240 003 | F0 03 | BEQ 3 --> &AC5A | |
| AC57 | L | 076 246 142 | 4C F6 8E | JMP &8EF6 'Missing ,' error |
| AC5A | 032 164 150 | 20 A4 96 | JSR &96A4 Push SWA to stack, get Integer result of expression & check for closing ')' | |
| AC5D | 032 210 188 | 20 D2 BC | JSR &BCD2 Pop String (SWA) from the stack | |
| AC60 | * | 166 042 | A6 2A | LDX &2A |
| AC62 | 208 002 | D0 02 | BNE 2 --> &AC66 | |
| AC64 | 162 001 | A2 01 | LDX#&01 | |
| AC66 | * | 134 042 | 86 2A | STX &2A |
| AC68 | 138 | 8A | TXA | |
| AC69 | 202 | CA | DEX | |
| AC6A | - | 134 045 | 86 2D | STX &2D |
| AC6C | 024 | 18 | CLC | |
| AC6D | e | 101 004 | 65 04 | ADC &04 |
| AC6F | 7 | 133 055 | 85 37 | STA &37 |
| AC71 | 169 000 | A9 00 | LDA#&00 | |
| AC73 | e | 101 005 | 65 05 | ADC &05 |
| AC75 | 8 | 133 056 | 85 38 | STA &38 |
| AC77 | 178 004 | B2 04 | LDA (&04) | |
| AC79 | 8 | 056 | 38 | SEC |
| AC7A | - | 229 045 | E5 2D | SBC &2D |
| AC7C | ! | 144 033 | 90 21 | BCC 33 --> &AC9F |
| AC7E | 6 | 229 054 | E5 36 | SBC &36 |
| AC80 | 144 029 | 90 1D | BCC 29 --> &AC9F | |
| AC82 | i | 105 000 | 69 00 | ADC#&00 |
| AC84 | + | 133 043 | 85 2B | STA &2B |
| AC86 | 032 225 188 | 20 E1 BC | JSR &BCE1 Restore Stack Space used by String (without overwriting the SWA) | |
| AC89 | 160 000 | A0 00 | LDY#&00 | |
| AC8B | 6 | 166 054 | A6 36 | LDX &36 |
| AC8D | 240 011 | F0 0B | BEQ 11 --> &AC9A | |
| AC8F | 7 | 177 055 | B1 37 | LDA (&37),Y |
| AC91 | 217 000 006 | D9 00 06 | CMP &0600,Y | |
| AC94 | 208 016 | D0 10 | BNE 16 --> &ACA6 | |
| AC96 | 200 | C8 | INY | |
| AC97 | 202 | CA | DEX | |
| AC98 | 208 245 | D0 F5 | BNE -11 --> &AC8F | |
| AC9A | * | 165 042 | A5 2A | LDA &2A |
| AC9C | L | 076 024 174 | 4C 18 AE | JMP &AE18 Set IWA to the 8-bit value in A |
| AC9F | 032 225 188 | 20 E1 BC | JSR &BCE1 Restore Stack Space used by String (without overwriting the SWA) | |
| ACA2 | 169 000 | A9 00 | LDA#&00 | |
| ACA4 | 128 246 | 80 F6 | BRA -10 --> &AC9C | |
| ACA6 | * | 230 042 | E6 2A | INC &2A |
| ACA8 | + | 198 043 | C6 2B | DEC &2B |
| ACAA | 240 246 | F0 F6 | BEQ -10 --> &ACA2 | |
| ACAC | 7 | 230 055 | E6 37 | INC &37 |
| ACAE | 208 217 | D0 D9 | BNE -39 --> &AC89 | |
| ACB0 | 8 | 230 056 | E6 38 | INC &38 |
| ACB2 | 128 213 | 80 D5 | BRA -43 --> &AC89 |