8F83 Prompt for command line and execute the entered command(s)
Submitted by Steve Fewell
Description:
If called from &8F83 then a full initialisation will be done before the command line prompt appears.
-
This will reset the following:
- * Program start address
- * Stack Pointer
- * Clear *EDIT mode
- * REPEAT/FOR/GOSUB parameters, return addresses, etc...
- * Page &7 user tables (&07F0-&07FF)
- * Variable pointer tables (destroys all variables that have been created)
If called from &8F86 then the initialisation will not be done as not required. Any defined variables (etc...) will remain
Reset the BASIC Text pointer A (&0B, &0C) to &0700 (the address of the command line buffer).
Call routine &B2A6 to reset the 'ON ERROR' pointer to BASICs default error handling routine.
Call OSWRCH with A = #&3E to output the '>' [prompt character] to the screen.
Call routine &BA74 to read the input line (using OSWORD 0) and store the input to the command line buffer (&0700-
&07EF). The parameters (line length, minimum and maximum acceptable characters, etc...) for this input as the same as
those used during the INPUT command (as both inputs are done by the same routine, (&BA70)).
[&8F97] Set the 6502 stack pointer to #&FF (to clear any FN/PROC subroutines that were in progress when the last
command (that was executed by the BASIC Intrepreter) had finished, or when the last program execution had ended).
Call routine &B2A6 (again) to reset the 'ON ERROR' pointer to BASICs default error handling routine.
Call routine &BAEB to tokenise the command line (&0700-&07EF) and to enter the line into the current BASIC
program if a line number was supplied at the start of the command line.
If the Command line contained a program line (which has now been inserted into the current program), then jump back
to &8F83 to do a full initialisation (as after a line in the Program has been inserted/changed or removed, any defined
variables need to be reset, because the TOP of the program has now been changed - corrupting the variable storage space).
Otherwise, if a direct command (not a program line) has been entered, then call &901E to execute the statement(s) on
the Command Line.
Disassembly for the Prompt for command line and execute the entered command(s) routine
8F83 |
|
032 172 187 |
20 AC BB |
JSR &BBAC Initialise Page 7 & reset Variable pointers, etc... |
8F86 |
|
160 007 |
A0 07 |
LDY#&07 |
8F88 |
|
132 012 |
84 0C |
STY &0C |
8F8A |
d |
100 011 |
64 0B |
STZ &0B |
8F8C |
|
032 166 178 |
20 A6 B2 |
JSR &B2A6 Reset 'ON ERROR' pointer to BASICs default error handling routine |
8F8F |
> |
169 062 |
A9 3E |
LDA#&3E |
8F91 |
|
032 238 255 |
20 EE FF |
JSR &FFEE OSWRCH |
8F94 |
t |
032 116 186 |
20 74 BA |
JSR &BA74 Prompt for & get the User's input line (storing it in buffer &0700-&07FF) |
8F97 |
|
162 255 |
A2 FF |
LDX#&FF |
8F99 |
|
154 |
9A |
TXS |
8F9A |
|
032 166 178 |
20 A6 B2 |
JSR &B2A6 Reset 'ON ERROR' pointer to BASICs default error handling routine |
8F9D |
|
032 235 186 |
20 EB BA |
JSR &BAEB Tokenise Command Line and Insert Line into Program (if line number given) |
8FA0 |
|
176 225 |
B0 E1 |
BCS -31 --> &8F83 Initialise & prompt for next command line |
8FA2 |
z |
128 122 |
80 7A |
BRA 122 --> &901E Execute the command line |
Or