×   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

9D89 'AND' operator

Submitted by Steve Fewell

Description:

[96BE] Convert the first value (current value) to an integer (if it's a Float).
If the first value is a string then issue a ype Mismatch error.
Push the first value to the stack.
[9DA9] Get the next value (expression handler level 3 [<, =, >). For the next value
we only need to search the operators with higher precedence, as these must be evaluated
before we have the correct second value that we need. If the value obtained is a float
then convert it to an integer (if it's a string then Type Mismatch error).

AND the Integer on the stack (first value) with the Integer in the IWA (second value)
storing the result in the IWA.
We now have the result we require.

Reclaim the stack space, set A = #&40 (as we are handling an Integer) and jump to
&9D84 to check for further AND operators which need to be processed. Note: We
only need to check for the AND operator, as all higher precedence operators have
already been processed.


Disassembly for the 'AND' Operator routine

9D89   032 190 150 20 BE 96 JSR &96BE Check for Integer & convert if Float
9D8C & 032 038 188 20 26 BC JSR &BC26 Push Integer to Stack
9D8F   032 169 157 20 A9 9D JSR &9DA9 Expression handler level 3 (<, =, >)
9D92   032 190 150 20 BE 96 JSR &96BE Check for Integer & convert if Float
9D95   160 003 A0 03 LDY#&03
9D97   177 004 B1 04 LDA (&04),Y
9D99 9* 057 042 000 39 2A 00 AND &002A,Y
9D9C * 153 042 000 99 2A 00 STA &002A,Y
9D9F   136 88 DEY
9DA0   016 245 10 F5 BPL -11 --> &9D97
9DA2   032 250 188 20 FA BC JSR &BCFA Move Stack Pointer up 4 bytes (reclaim space)
9DA5 @ 169 064 A9 40 LDA#&40
9DA7   128 219 80 DB BRA -37 --> &9D84 Expression Handler level 2 [AND]

 


 Back to 8BS
Or