8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


Page Last Altered:

9BCF Check & skip Program Line end

Submitted by Steve Fewell

Description:

Firstly, this routine calls routine &9BA6 to check for the end of statement character (':', '<cr>', 'ELSE') if end of
Statement was not found then issue 'Syntax error'.

If the Line terminator character was ':', then exit (as nothing more to do - as we are not at the line end yet).

Now, either '<cr>' or 'ELSE' have been found, so we have to skip to the next statement/program line.
If the BASIC Text pointer A MSB is 7 (i.e. PTR A points to an address between &0700 and &07FF) then jump to &8F86
to return to the command line input prompt (as we are not currently executing a program).

Otherwise, the next line number needs to be processed and skipped before we continue running the program.
Get the next byte after the line terminator.
If the byte is negative (i.e. &FF) then jump to &8F86 to prompt for the next conmmand line input - as we have
reached the end of the program that we were executing.

If the TRACE flag (&20) is not 0 then TRACE is currently on, so set the IWA to the 2-byte line number (located after the
line terminator character) & call routine &9C4B to display the line number on the screen between square braces (i.e.[xxx]).

[&9BF2] Add 3 to the BASIC Text pointer A address (&0B-&0C) to skip the Line Number and Line length, set the
BASIC Text Pointer A Offset (&0A) to 1 and exit.


Disassembly for the Check & skip Program Line end routine

9BCF   032 166 155 20 A6 9B JSR &9BA6 Check end of Statement
9BD2   178 011 B2 0B LDA (&0B)
9BD4 : 201 058 C9 3A CMP#&3A
9BD6   240 246 F0 F6 BEQ -10 --> &9BCE   [RTS]
9BD8   165 012 A5 0C LDA &0C
9BDA   201 007 C9 07 CMP#&07
9BDC $ 240 036 F0 24 BEQ 36 --> &9C02
9BDE   160 001 A0 01 LDY#&01
9BE0   177 011 B1 0B LDA (&0B),Y
9BE2 0 048 030 30 1E BMI 30 --> &9C02
9BE4   166 032 A6 20 LDX &20
9BE6   240 010 F0 0A BEQ 10 --> &9BF2
9BE8 + 133 043 85 2B STA &2B
9BEA   200 C8 INY
9BEB   177 011 B1 0B LDA (&0B),Y
9BED * 133 042 85 2A STA &2A
9BEF K 032 075 156 20 4B 9C JSR &9C4B Display current line number (IWA) on screen [if TRACE is on]
9BF2   169 003 A9 03 LDA#&03
9BF4   024 18 CLC
9BF5 e 101 011 65 0B ADC &0B
9BF7   133 011 85 0B STA &0B
9BF9   144 002 90 02 BCC 2 --> &9BFD
9BFB   230 012 E6 0C INC &0C
9BFD   160 001 A0 01 LDY#&01
9BFF   132 010 84 0A STY &0A
9C01 ` 096 60 RTS
9C02 L 076 134 143 4C 86 8F JMP &8F86 Read & execute command line input

 


 Back to 8BS
Or