8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


Page Last Altered:

BE97 PTR =

Submitted by Steve Fewell

Description:

Store #&01 on the 6502 stack.
Call routine &BA3E to copy BASIC Text pointer A address to BASIC text pointer B, Check that the next character is '#'
('Missing #' error if not), set Y to the number after the '#' (the file channel number).
Store Y to the 6502 stack.

Call routine &9B52 to check that the next character is '=' ('Syntax error' if not), retrieve the result of the
expression after the '=' character, and check for the end of statement ('Syntax error' if not).

Call routine &96BC to check the expression result type (location &27), issue 'Type mismatch' error if the result
is a String value (SWA), or convert the result to Integer if the result type is a Floating-Point value.

Retrieve Y from the 6502 stack.
Now the IWA contains the Integer Pointer (PTR) value to assign to the open file at the channel number stored in Y.
Set X to point to the first byte of the IWA (#&2A, i.e. the start of the 4-byte zero page control block containing
the new PTR value).
Retrieve A from the stack (this value specifies the OSARGS action that is required, in this case #&01 (Set file PTR
value)).

Call the Operating System OSARGS routine (&FFDA) which will perform the requested operation on the open file.
Now the Pointer of the Open file (with the channel number specified in Y) has been set to the Integer value in the IWA.
Jump to &9005 to start processing the next command line or program statement.


Disassembly for the PTR = routine

BE97   169 001 A9 01 LDA#&01
BE99 H 072 48 PHA
BE9A > 032 062 186 20 3E BA JSR &BA3E Copy PTR A to PTR B, check for '#', get file channel number & store it in Y
BE9D Z 090 5A PHY
BE9E R 032 082 155 20 52 9B JSR &9B52 Check for '=' & get result of expression; check end of statement
BEA1   032 188 150 20 BC 96 JSR &96BC Check result type (location &27) - if Float then convert to Integer
BEA4 z 122 7A PLY
BEA5 * 162 042 A2 2A LDX#&2A
BEA7 h 104 68 PLA
BEA8   032 218 255 20 DA FF JSR &FFDA   OSARGS
BEAB L 076 005 144 4C 05 90 JMP &9005 Process the next program statement

 


 Back to 8BS
Or