8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly


Page Last Altered:

AC0E POINT(

Submitted by Steve Fewell

Description:

Call routine &96AF to get the Integer value of the expression after the POINT( keyword (issue Type mismatch error if
the result is a String value)
Push the Integer to the BASIC Stack. This is the first parameter to the POINT routine - i.e. the X screen position.

Read the comma ',' character, and issue 'Missing ,' error if the next non-space character wasn't a comma.
Call routine &96A7 to obtain the Integer value of the expression after the comma and check for a closing parenthesis ')'.
Issue a 'Syntax error' if the closing bracket wasn't found.
Push this Integer's LSB (&2A) to the 6502 Stack, and the 16-bit Integer's MSB (&2B) to the X index register.
These 2 bytes are the second parameter to the POINT routine - i.e. the Y screen position.

Retrieve the first Integer from the BASIC stack.
Store the Second Integer MSB (from X) to location &2D and store the second Integer LSB (retrieved from 6502 Stack)
to location &2C.

Set Y to 0 and X to #&2A -> as &002A is the start of the 5-byte OSWORD parameter block, which contains the
following:
* Byte &2A -> The X screen position LSB
* Byte &2B -> The X screen position MSB
* Byte &2C -> The Y screen position LSB
* Byte &2D -> The Y screen position MSB
* Byte &2E -> Reserved for return value

Call the OSWORD &09 command to execute the POINT instruction.
If the return value (byte &2E) is negative then exit with the IWA = -1 (TRUE); otherwise, exit with the IWA = byte &2E
(which should be 0, so the IWA will be set to FALSE).


Disassembly for the POINT( routine

AC0E   032 175 150 20 AF 96 JSR &96AF Get Integer result of expression
AC11 & 032 038 188 20 26 BC JSR &BC26 Push IWA value to the BASIC Stack [pushi]
AC14   032 241 142 20 F1 8E JSR &8EF1 Check for ',' and issue error if not found
AC17   032 167 150 20 A7 96 JSR &96A7 Extract Integer result of expression & check for ')'
AC1A * 165 042 A5 2A LDA &2A
AC1C H 072 48 PHA
AC1D + 166 043 A6 2B LDX &2B
AC1F   032 230 188 20 E6 BC JSR &BCE6 Retrieve IWA value from Stack [popi]
AC22 - 134 045 86 2D STX &2D
AC24 h 104 68 PLA
AC25 , 133 044 85 2C STA &2C
AC27   160 000 A0 00 LDY#&00
AC29 * 162 042 A2 2A LDX#&2A
AC2B   169 009 A9 09 LDA#&09
AC2D   032 241 255 20 F1 FF JSR &FFF1   OSWORD
AC30 . 165 046 A5 2E LDA &2E
AC32 0 048 167 30 A7 BMI -89 --> &ABDB Set IWA to TRUE (-1)
AC34   128 214 80 D6 BRA -42 --> &AC0C [Jump to &AE18 Set IWA to 8-bit value]

 


 Back to 8BS
Or