First page Back Continue Last page Overview Graphics
Complex Branch Instructions
- BHI (Branch if HIgher) branches if the carry flag and zero flag are zero, i.e. if Z+C=0.
- BLO (Branch if LOwer) branches if C=1.
- This instruction is the same as BCS.
- BLS (Branch if Lower or Same) branches if C+Z=1.
Normally these branch instructions follow a compare instruction. The instruction operation treats the numbers as though they are unsigned. In the case of the BHI and BLS instructions two condition flag bits are logically OR’ed to determine the action.
The BHI instruction branches if the value in the accumulator is larger than the operand. Under these conditions there would be no carry (accumulator value is higher or equal) and since the zero flag must also be zero the two values cannot be equal. Therefore the value in the accumulator must be higher.
The BLS instruction branches if the value in the accumulator is lower than or the same as the operand. If it is lower the carry flag is set and if the same the zero flag is set.