×   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

B71D GOTO

Submitted by Steve Fewell

Description:

Call routine &B82A to get the Line Number after the GOTO keyword, Issue 'No such line' error if the Line doesn't exist
and set &3D-&3E to the start address of the specified Program Line.
Call routine &9BA6 to check that the statement terminates correctly with a ':', '<cr>' or 'ELSE-token' character,
issuing 'Syntax error' if it doesn't.

If the TRACE flag (location &20) is not zero, then call routine &9C4B to check that TRACE is on, and that the
Line Number (locationed in the IWA) is in the specified TRACE range, if it is then the Line number will be displayed on
the screen.

Set BASIC Text Pointer A to the start of the specified program line, by:
* [&B72A] Set #&0A (the BASIC Text Pointer A Offset) to 4 (a pointer to the first character of the
    Program Line (skipping the preceding Line number (3 bytes) and Next Line offset (1 byte) values).
* Set &0B (the BASIC Text Pointer A LSB) to the Line Number Start Address LSB value at location &3D
* Set &0C (the BASIC Text Pointer A MSB) to the Line Number Start Address MSB value at location &3E
Jump to &900B to start executing the code at the GOTO Line (the new BASIC Text Pointer A location).


Disassembly for the GOTO routine

B71D * 032 042 184 20 2A B8 JSR &B82A Get Line Number & find Program Address of the Line Number
B720   032 166 155 20 A6 9B JSR &9BA6 Check end of Statement
B723   165 032 A5 20 LDA &20
B725   240 003 F0 03 BEQ 3 --> &B72A
B727 K 032 075 156 20 4B 9C JSR &9C4B Display current line number (IWA) on screen [if TRACE is on]
B72A   160 004 A0 04 LDY#&04
B72C   132 010 84 0A STY &0A
B72E = 164 061 A4 3D LDY &3D
B730 > 165 062 A5 3E LDA &3E
B732   132 011 84 0B STY &0B
B734   133 012 85 0C STA &0C
B736 L 076 011 144 4C 0B 90 JMP &900B Process next BASIC program statement

 


 Back to 8BS
Or