Submitted by Steve Fewell
Description:
Call routine &9B1E to detokenise the Line Number at BASIC Text pointer A & Set the IWA to the Line Number value.
If a line number was not found at BASIC text pointer A location (carry flag was clear on return from &9B1E) then issue
'Syntax error', as the DELETE statement is not correctly formed.
Push the IWA value (the first line number) to the BASIC stack.
Call routine &8CE5 to check that the next non-space character is a comma ',', if it isn't then issue 'Syntax error'.
Call routine &9B1E to detokenise the Line Number at BASIC Text pointer A & Set the IWA to the Line Number value.
If a line number was not found at BASIC text pointer A location (carry flag was clear on return from &9B1E) then issue
'Syntax error', as the DELETE statement is not correctly formed.
The IWA now contains the program line number to delete up to.
Call routine &9BA6 to check that the statement is correctly terminated by a ':', '<cr>' or 'ELSE-token' character
('Syntax error' is issued if the statement terminator character was not found).
Store the Line number in the IWA (&2A-&2B) [the line number to delete up to] in locations &39-&3A.
Retrieve the Integer value from the BASIC stack - the IWA will now contain the first ('delete from') Line Number.
[&9337] Call routine &BA98 to remove the Line number specified in the IWA from the program - if the line number
specified is not present in the program then no action will be taken by routine &BA98.
Call routine &9BCA to check for an 'Escape key press' condition. If the Escape key is detected as being pressed
then the 'Escape' error will be issued and the deletion will be prematurely stopped.
Call routine &BEEF to increment the IWA value by 1.
If the Line number value specified by &39-&3A is greater then the value in the IWA then jump back to &9337 to
attempt to remove the Line number specified in the IWA from the program.
Otherwise, the deletion has been completed.
To exit, jump to &8F83 to initialise program variable space and prompt for the user to enter a command line.
Note: Calling &BA98 for every possible line number seems a slow method of deleting. I wonder why this method was chosen.
9314 | Li | 076 105 155 | 4C 69 9B | JMP &9B69 Syntax error |
9317 | 032 030 155 | 20 1E 9B | JSR &9B1E Detokenise the Line Number at PTR A & Set IWA to the Line Number value | |
931A | 144 248 | 90 F8 | BCC -8 --> &9314 | |
931C | & | 032 038 188 | 20 26 BC | JSR &BC26 Push IWA value to the BASIC Stack [pushi] |
931F | 032 229 140 | 20 E5 8C | JSR &8CE5 Compare next non-space [PTR A] character with ',' | |
9322 | 208 240 | D0 F0 | BNE -16 --> &9314 | |
9324 | 032 030 155 | 20 1E 9B | JSR &9B1E Detokenise the Line Number at PTR A & Set IWA to the Line Number value | |
9327 | 144 235 | 90 EB | BCC -21 --> &9314 | |
9329 | 032 166 155 | 20 A6 9B | JSR &9BA6 Check end of Statement | |
932C | * | 165 042 | A5 2A | LDA &2A |
932E | 9 | 133 057 | 85 39 | STA &39 |
9330 | + | 165 043 | A5 2B | LDA &2B |
9332 | : | 133 058 | 85 3A | STA &3A |
9334 | 032 230 188 | 20 E6 BC | JSR &BCE6 Retrieve IWA value from the BASIC Stack [popi] | |
9337 | 032 152 186 | 20 98 BA | JSR &BA98 Remove Line Number (specified in IWA) from Program | |
933A | 032 202 155 | 20 CA 9B | JSR &9BCA Check for 'Escape key pressed' condition (if so, issue 'Escape' error) | |
933D | 032 239 190 | 20 EF BE | JSR &BEEF Increment IWA value | |
9340 | 9 | 165 057 | A5 39 | LDA &39 |
9342 | * | 197 042 | C5 2A | CMP &2A |
9344 | : | 165 058 | A5 3A | LDA &3A |
9346 | + | 229 043 | E5 2B | SBC &2B |
9348 | 176 237 | B0 ED | BCS -19 --> &9337 | |
934A | L | 076 131 143 | 4C 83 8F | JMP &8F83 Initialise & prompt for next command line |