8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


Page Last Altered:

97B1 PLOT

Submitted by Steve Fewell

Description:

Get the Integer result of the expression after the PLOT keyword (at BASIC Text pointer A location).
If a string value was found then issue a 'Type mismatch' error.

Push the LSB of the Integer value (&2A) to the 6502 stack. This is the first PLOT paramater (i.e. the PLOT type).
Note: Only the 1-byte LSB value of the Integer is used - the rest of the Integer value (if supplied) is ignored.
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).

[&97BA] Push the second Integer PLOT parameter value (in the IWA bytes &2A-&2D) to the BASIC 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 third
PLOT parameter.

Call &9B96 to check for the end of statement (at BASIC Text Pointer B). If the next character after the third PLOT
parameter value is not ':', '<cr>' or 'ELSE-token' then issue 'Syntax error', as the statement was not terminated
correctly.

Send ASCII character #&19 to the OS Write character routine (to start a VDU 25 command).
Retrieve the first PLOT parameter from the 6502 Stack (this is the 1-byte Integer that specifies the PLOT type).
Send the first PLOT parameter (retrieved above) to the OS Write Character routine (the Operating System will take this
value as the first parameter to the VDU 25 command.

Retrieve the second PLOT parameter from the BASIC Stack to locations &37-&3A (this is a 4-byte Integer value).
Send byte 1 (LSB) of this second PLOT parameter (location &37) to the OS Write Character routine (the Operating System
will take this value as the second parameter to the VDU 25 command.
Send byte 2 of this second PLOT parameter (location &38) to the OS Write Character routine (the Operating System
will take this value as the third parameter to the VDU 25 command.
Note: Only the first 16-bits of the 4 byte Integer are used (bytes 3 and 4 are ignored).

Send byte 1 (LSB) of the third PLOT parameter (IWA byte &2A) to the OS Write Character routine (the Operating System
will take this value as the forth parameter to the VDU 25 command.
Send byte 2 of the third PLOT parameter (IWA byte &2B) to the OS Write Character routine (the Operating System
will take this value as the fifth parameter to the VDU 25 command.
Note: Only the first 16-bits of the 4 byte Integer are used (bytes 3 and 4 are ignored).

Lastly, jump to &9005 to start processing the next program statement.


Disassembly for the PLOT routine

97B1 o 032 111 146 20 6F 92 JSR &926F Evaluate Expression at BASIC Text pointer A convert result to integer
97B4 * 165 042 A5 2A LDA &2A
97B6 H 072 48 PHA
97B7   032 172 150 20 AC 96 JSR &96AC Check for ',', get result of expression and convert result to Integer
97BA & 032 038 188 20 26 BC JSR &BC26 Push Integer to Stack
97BD   032 172 150 20 AC 96 JSR &96AC Check for ',', get result of expression and convert result to Integer
97C0   032 150 155 20 96 9B JSR &9B96 Check for end of Statement (PTR B)
97C3   169 025 A9 19 LDA#&19
97C5   032 238 255 20 EE FF JSR &FFEE   OSWRCH
97C8 h 104 68 PLA
97C9   032 238 255 20 EE FF JSR &FFEE   OSWRCH
97CC   032 006 189 20 06 BD JSR &BD06 Retrieve Integer from stack to locations &37-&3A
97CF 7 165 055 A5 37 LDA &37
97D1   032 238 255 20 EE FF JSR &FFEE   OSWRCH
97D4 8 165 056 A5 38 LDA &38
97D6   032 238 255 20 EE FF JSR &FFEE   OSWRCH
97D9 @ 032 064 152 20 40 98 JSR &9840 Send character in ?&2A to the Output vector
97DC + 165 043 A5 2B LDA &2B
97DE   128 014 80 0E BRA 14 --> &97EE [JSR &FFEE : JMP &9005 Process next program statement]

 


 Back to 8BS
Or