×   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

9DB5 '=' and other relational operators

Submitted by Steve Fewell

Description:

Check which operator (<, = or >) we have. If we have the Less Than operator "<",
then jump to &9DCD to handle Less Than.
If we have the Greater Than operator ">", then jump to &9DF5 to handle Greater Than.
Otherwise, we have '=' Equal To. This is handled as below:

Update the flags with the current value type (in A).
Call &9CCA to Compare the current value with the second value and set the flags
according to which value is greater, or whether the values are equal.

If the zero flag is set then the values are equal, so set the IWA to TRUE; otherwise,
the values aren't equal so set the IWA to FALSE.
Exit with A = #&40 (as we are currently handling an Integer value).


Disassembly for the '=' and other relational operators routine

9DB5   240 022 F0 16 BEQ 22 --> &9DCD '<' Less Than Operator
9DB7 > 224 062 E0 3E CPX#&3E
9DB9 : 240 058 F0 3A BEQ 58 --> &9DF5 '>' Greater Than Operator
9DBB   170 AA TAX
9DBC   032 202 156 20 CA 9C JSR &9CCA Compare Values
9DBF   208 001 D0 01 BNE 1 --> &9DC2
9DC1   136 88 DEY
9DC2 * 132 042 84 2A STY &2A
9DC4 + 132 043 84 2B STY &2B
9DC6 , 132 044 84 2C STY &2C
9DC8 - 132 045 84 2D STY &2D
9DCA @ 169 064 A9 40 LDA#&40
9DCC ` 096 60 RTS

 


 Back to 8BS
Or