Submitted by Steve Fewell
Description:
Get the next non-space character from BASIC Text Pointer A. If the character is a '#' (hash), then jump to
the PRINT# routine (&9141); otherwise, decrement &0A (Text Pointer A offset).
[&91AB]: Start a new Output field (&14 is reset and so is &15)
Clear carry flag (as we are outputting numbers in decimal - not hexadecimal).
Store &0400 (the LSB byte of @%) [Print width] in location &14 [PRINT BYTES] (which specifies the number of
bytes in each output field).
[&91B1] Move the carry flag (specified output Hexadecimal (if set) or Decimal (if clear) for numeric values) to the
top bit of location &15 (PRINT FLAG).
Get the next non-space character from BASIC Text Pointer A (&0B,&0C plus offset &0A).
If the next character is ':', then we have an empty PRINT field/statement, so call &BA92 to Output a new line and
goto &9000 to process the next statement.
If the next character is '<cr>' (carriage return), then we have an empty PRINT field/statement, so call &BA92 to Output
a new line and goto &9000 to process the next statement.
If the next character is 'ELSE'-token, then we have an empty PRINT field/statement, so call &BA92 to Output a new line &
goto &9000 to process the next statement.
[&91DB]: If the next character is '~' [tilde], then jump back to &91B1 to set the top bit of &15 to 1
(print numeric values in hexadecimal notation) and check again for end of statement (newline if so).
918D | 032 223 140 | 20 DF 8C | JSR &8CDF Get next non-space char (PTR A) and compare with '#' | |
9190 | 240 175 | F0 AF | BEQ -81 --> &9141 PRINT# | |
9192 | 198 010 | C6 0A | DEC &0A | |
9194 | 128 021 | 80 15 | BRA 21 --> &91AB Start new output field | |
9196 | 173 000 004 | AD 00 04 | LDA &0400 | |
9199 | 240 016 | F0 10 | BEQ 16 --> &91AB Start new output field | |
919B | 165 030 | A5 1E | LDA &1E | |
919D | 240 012 | F0 0C | BEQ 12 --> &91AB Start new output field | |
919F | 237 000 004 | ED 00 04 | SBC &0400 | |
91A2 | 176 249 | B0 F9 | BCS -7 --> &919D | |
91A4 | 168 | A8 | TAY | |
91A5 | 032 146 189 | 20 92 BD | JSR &BD92 Print a space to the screen | |
91A8 | 200 | C8 | INY | |
91A9 | 208 250 | D0 FA | BNE -6 --> &91A5 | |
91AB | 024 | 18 | CLC | |
91AC | 173 000 004 | AD 00 04 | LDA &0400 | |
91AF | 133 020 | 85 14 | STA &14 | |
91B1 | f | 102 021 | 66 15 | ROR &15 |
91B3 | 032 224 142 | 20 E0 8E | JSR &8EE0 Get next non-space character (PTR A) | |
91B6 | : | 201 058 | C9 3A | CMP#&3A |
91B8 | 240 008 | F0 08 | BEQ 8 --> &91C2 | |
91BA | 201 013 | C9 0D | CMP#&0D | |
91BC | 240 004 | F0 04 | BEQ 4 --> &91C2 | |
91BE | 201 139 | C9 8B | CMP#&8B | |
91C0 | 208 025 | D0 19 | BNE 25 --> &91DB | |
91C2 | 032 146 186 | 20 92 BA | JSR &BA92 Output new line & Zero COUNT | |
91C5 | L | 076 000 144 | 4C 00 90 | JMP &9000 End of PRINT. Check end of Statement & continue to process next program statement |
91C8 | d | 100 020 | 64 14 | STZ &14 |
91CA | d | 100 021 | 64 15 | STZ &15 |
91CC | 032 224 142 | 20 E0 8E | JSR &8EE0 Get next non-space character (PTR A) | |
91CF | : | 201 058 | C9 3A | CMP#&3A |
91D1 | 240 242 | F0 F2 | BEQ -14 --> &91C5 | |
91D3 | 201 013 | C9 0D | CMP#&0D | |
91D5 | 240 238 | F0 EE | BEQ -18 --> &91C5 | |
91D7 | 201 139 | C9 8B | CMP#&8B | |
91D9 | 240 234 | F0 EA | BEQ -22 --> &91C5 | |
91DB | ~ | 201 126 | C9 7E | CMP#&7E |
91DD | 240 210 | F0 D2 | BEQ -46 --> &91B1 | |
91DF | , | 201 044 | C9 2C | CMP#&2C |
91E1 | 240 179 | F0 B3 | BEQ -77 --> &9196 Comma (pad field) | |
91E3 | ; | 201 059 | C9 3B | CMP#&3B |
91E5 | 240 225 | F0 E1 | BEQ -31 --> &91C8 Semicolon (check for end of PRINT statement) | |
91E7 | z | 032 122 146 | 20 7A 92 | JSR &927A Check for "'", 'TAB(' or 'SPC' |
91EA | 144 199 | 90 C7 | BCC -57 --> &91B3 | |
91EC | 165 020 | A5 14 | LDA &14 | |
91EE | H | 072 | 48 | PHA |
91EF | 165 021 | A5 15 | LDA &15 | |
91F1 | H | 072 | 48 | PHA |
91F2 | 198 027 | C6 1B | DEC &1B | |
91F4 | ; | 032 059 157 | 20 3B 9D | JSR &9D3B Get the result of the expression at PTR B |
91F7 | h | 104 | 68 | PLA |
91F8 | 133 021 | 85 15 | STA &15 | |
91FA | h | 104 | 68 | PLA |
91FB | 133 020 | 85 14 | STA &14 | |
91FD | 165 027 | A5 1B | LDA &1B | |
91FF | 133 010 | 85 0A | STA &0A | |
9201 | 152 | 98 | TYA | |
9202 | 240 019 | F0 13 | BEQ 19 --> &9217 Print output string | |
9204 | 032 024 161 | 20 18 A1 | JSR &A118 NUMASC (Convert Numeric value to ASCII String) | |
9207 | 165 020 | A5 14 | LDA &14 | |
9209 | 8 | 056 | 38 | SEC |
920A | 6 | 229 054 | E5 36 | SBC &36 |
920C | 144 009 | 90 09 | BCC 9 --> &9217 Print Output string | |
920E | 240 007 | F0 07 | BEQ 7 --> &9217 Print output String | |
9210 | 168 | A8 | TAY | |
9211 | 032 146 189 | 20 92 BD | JSR &BD92 Output a space character | |
9214 | 136 | 88 | DEY | |
9215 | 208 250 | D0 FA | BNE -6 --> &9211 | |
9217 | 6 | 165 054 | A5 36 | LDA &36 |
9219 | 240 152 | F0 98 | BEQ -104 --> &91B3 | |
921B | 160 000 | A0 00 | LDY#&00 | |
921D | 185 000 006 | B9 00 06 | LDA &0600,Y | |
9220 | 032 152 189 | 20 98 BD | JSR &BD98 Output character in A | |
9223 | 200 | C8 | INY | |
9224 | 6 | 196 054 | C4 36 | CPY &36 |
9226 | 208 245 | D0 F5 | BNE -11 --> &921D | |
9228 | 128 137 | 80 89 | BRA -119 --> &91B3 |
927A | 166 011 | A6 0B | LDX &0B | |
927C | 134 025 | 86 19 | STX &19 | |
927E | 166 012 | A6 0C | LDX &0C | |
9280 | 134 026 | 86 1A | STX &1A | |
9282 | 166 010 | A6 0A | LDX &0A | |
9284 | 134 027 | 86 1B | STX &1B | |
9286 | ' | 201 039 | C9 27 | CMP#&27 char = (') |
9288 | 240 221 | F0 DD | BEQ -35 --> &9267 (PRINT) quote (') | |
928A | 201 138 | C9 8A | CMP#&8A char = TAB( | |
928C | 240 179 | F0 B3 | BEQ -77 --> &9241 (PRINT) TAB( | |
928E | 201 137 | C9 89 | CMP#&89 char = SPC | |
9290 | 240 201 | F0 C9 | BEQ -55 --> &925B (PRINT) SPC | |
9292 | 8 | 056 | 38 | SEC |
9293 | ` | 096 | 60 | RTS |