×   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

8F7D NEW

Submitted by Steve Fewell

Description:

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

Call routine &BEFE 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 &8F83 to prompt for the next command line and then
execute any entered commands.


Disassembly for the NEW routine

8F7D   032 166 155 20 A6 9B JSR &9BA6 Check end of Statement
8F80   032 254 190 20 FE BE JSR &BEFE reset the program to an empty program
8F83   ... Prompt for command line and execute the entered command(s) ...

&BEFE - reset the program to an empty program

BEFE   169 013 A9 0D LDA#&0D
BF00   164 024 A4 18 LDY &18
BF02   132 019 84 13 STY &13
BF04 d 100 018 64 12 STZ &12
BF06 d 100 032 64 20 STZ &20
BF08   146 018 92 12 STA (&12)
BF0A   169 255 A9 FF LDA#&FF
BF0C   160 001 A0 01 LDY#&01
BF0E   145 018 91 12 STA (&12),Y
BF10   200 C8 INY
BF11   132 018 84 12 STY &12
BF13 ` 096 60 RTS

 


 Back to 8BS
Or