Submitted by Steve Fewell
Description:
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 A (the file channel number, as &BA3E sets A to a copy of Y) to the 6502 stack.
Call routine &96AC to check for a comma ',' (issuing an error if not found), and get the Integer result of the
expression after the comma (issuing 'Type mismatch' error if a String value was found). The IWA now contains the ASCII
code of the character required to be output to the file.
Call &9B96 to check for the end of statement (at BASIC Text Pointer B). If the next character after the BPUT
parameter value is not ':', '<cr>' or 'ELSE-token' then issue 'Syntax error', as the statement was not terminated
correctly.
Retrieve Y (the channel number) from the 6502 stack.
Set A to the LSB value of the IWA (location &2A; i.e. the ASCII code of the character to output to the file).
Call the Operating system OSBPUT routine (&FFD4) to carry out the file operation.
Jump to &9005 to execute the next BASIC statement in the program/command line.
BEBD | > | 032 062 186 | 20 3E BA | JSR &BA3E Copy PTR A to PTR B, check for '#', get file channel number & store it in Y |
BEC0 | H | 072 | 48 | PHA |
BEC1 | 032 172 150 | 20 AC 96 | JSR &96AC Check for ',', get result of expression and convert result to Integer | |
BEC4 | 032 150 155 | 20 96 9B | JSR &9B96 Check for end of Statement (PTR B) | |
BEC7 | z | 122 | 7A | PLY |
BEC8 | * | 165 042 | A5 2A | LDA &2A |
BECA | 032 212 255 | 20 D4 FF | JSR &FFD4 OSBPUT (write a single byte to an open file) | |
BECD | 128 220 | 80 DC | BRA -36 --> &BEAB [JMP &9005 Execute next statement] |