8-Bit Software

The BBC and Master Computer Public Domain Library

Back to 8BS Or Back to Disassembly

Page Last Altered:

9D4C 'OR' operator

Submitted by Steve Fewell


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.
[9D7B] Get the next value (expression handler level 2 [AND]). 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 it is converted to an integer (if it's a string then Type Mismatch error).

OR 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
&9D3E to check for further OR/EOR operators which need to be processed.

Disassembly for the 'OR' Operator routine

9D4C { 032 123 157 20 7B 9D JSR &9D7B Convert to Int, push to Stack & Get next value
9D4F   032 190 150 20 BE 96 JSR &96BE Check for Integer & convert if Float
9D52   160 003 A0 03 LDY#&03
9D54   177 004 B1 04 LDA (&04),Y
9D56 * 025 042 000 19 2A 00 ORA &002A,Y
9D59 * 153 042 000 99 2A 00 STA &002A,Y
9D5C   136 88 DEY
9D5D   016 245 10 F5 BPL -11 --> &9D54
9D5F   032 250 188 20 FA BC JSR &BCFA Move Stack Pointer up 4 bytes (reclaim space)
9D62 @ 169 064 A9 40 LDA#&40
9D64   128 216 80 D8 BRA -40 --> &9D3E Expression Handler level 1 [OR, EOR]


 Back to 8BS