×   Main Menu ALL The 8BS News Manuals (New menu) Links Worth a Look Tools Disc and Basic Webring Site Map 8BS Guestbook Old Guest Book Me The Barnsley Rovers   
8-Bit Software

The BBC and Master Computer Public Domain Library



9048 Prompt for command line and execute the entered command(s)

Submitted by Steve Fewell

Description:

If called from &9048 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 &904B 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 &B2E0 to reset the 'ON ERROR' pointer to BASIC's default error handling routine.

Call OSWRCH with A = #&3E to output the '>' [prompt character] to the screen.
Call routine &BAA4 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)).

[&905C] 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 &B2E0 (again) to reset the 'ON ERROR' pointer to BASIC's default error handling routine.

Call routine &BB1B 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 &9048 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

9048

 

032 220 187

20 DC BB

JSR &BBDC Initialise Page 7 & reset Variable pointers, etc...

904B

 

160 007

A0 07

LDY#&07

904D

 

132 012

84 0C

STY &0C

904F

d

100 011

64 0B

STZ &0B

9051

 

032 224 178

20 E0 B2

JSR &B2E0 Reset 'ON ERROR' pointer to BASIC's default error handling routine

9054

169 062

A9 3E

LDA#&3E

9056

 

032 238 255

20 EE FF

JSR &FFEE OSWRCH

9059

 

032 164 186

20 A4 BA

JSR &BAA4 Prompt for & get the User's input line (storing it in buffer &0700-&07FF)
905C

 

162 255

A2 FF

LDX#&FF

905E

 

154

9A

TXS

905F

 

032 224 178

20 E0 B2

JSR &B2E0 Reset 'ON ERROR' pointer to BASIC's default error handling routine

9062

 

032 027 187

20 1B BB

JSR &BB1B Tokenise Command Line and Insert Line into Program (if line number given)

9065

 

176 225

B0 E1

BCS -31 --> &9048 Initialise & prompt for next command line

9067

z

128 122

80 7A

BRA 122 --> &90E3 Execute the command line

 


 Back to 8BS
Or