×   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

ADF9 TOP

Submitted by Steve Fewell
This routine is called when the 'TO'-Token is encountered in the program.
However, 'TO' itself is not handled by this routine, instead the 'FOR' routine will check that the
'TO'-Token occurs at the requested position, etc...
The BASIC Keyword 'TOP' does not have it's own token, as it consists of the 'TO' token followed by the letter 'P'.

Firstly, this routine checks whether the character after the 'TO'-Token is a 'P' or not.
If the character is not a 'P' then a 'No such variable error' is generated as the 'TO' BASIC Keyword
is only valid within a 'FOR' statement.

Otherwise, the keyword we have is 'TOP'.
So, increment the BASIC Text Pointer B offset to point to the character after the 'P'.
Set A to &12 (The LSB of the TOP address).
Set Y to &13 (The MSB of the TOP address).
Call routine &AE1A to set the IWA to the value of Y * 256 + A.

Description:



Disassembly for the TOP routine

ADF9   200 C8 INY
ADFA   177 025 B1 19 LDA (&19),Y
ADFC P 201 080 C9 50 CMP#&50
ADFE   208 140 D0 8C BNE -116 --> &AD8C No such variable error
AE00   230 027 E6 1B INC &1B
AE02   165 018 A5 12 LDA &12
AE04   164 019 A4 13 LDY &13
AE06   128 018 80 12 BRA 18 --> &AE1A Set IWA to 16-bit value

 


 Back to 8BS
Or