×   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



9042 NEW

Submitted by Steve Fewell

Description:

Call routine &9C6A to check that the BASIC statement is correct and ends correctly

[&9045] Call routine &BF3E to carry out the NEW command as follows:
* Set TOP (&12-&13) to PAGE (&18, LSB of PAGE is always zero)
* Set TRACE flag (&20) to 0 (meaning that TRACE is OFF)
* Store #&0D as the first byte of the program, i.e. the '<cr>' character
* Store #&FF as the second byte of the program (previously this byte contained the line number MSB value)
  These 2 characters specify a null program ('<cr>' specifies program start and #&FF specifies program end)
* Set TOP to point to the next byte after these two characters
After the NEW command has been carried out, continue to routine &9048 to prompt for the next command line and then
execute any entered commands.


Disassembly for the NEW routine

9042

j

032 106 156

20 6A 9C

JSR &9C6A Check end of Statement

9045

032 062 191

20 3E BF

JSR &BF3E Reset the program to an empty program

9048

 

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

&BF3E - reset the program to an empty program

BF3E

 

169 013

A9 0D

LDA#&0D

BF40

 

164 024

A4 18

LDY &18

BF42

 

132 019

84 13

STY &13

BF44

d

100 018

64 12

STZ &12

BF46

d

100 032

64 20

STZ &20

BF48

 

146 018

92 12

STA (&12)

BF4A

 

169 255

A9 FF

LDA#&FF

BF4C

 

160 001

A0 01

LDY#&01

BF4E

 

145 018

91 12

"STA (&12),Y"

BF50

 

200

C8

INY

BF51

 

132 018

84 12

STY &12

BF53

`

96

60

RTS

 


 Back to 8BS
Or