Learning Challenge - 6502 Assembly: Day 8-9

Playing with Py65Mon

Day 8 saw me playing with more branching opcodes, including BCS (branch if greater than or equal) and BCC (branch if less than). Both of the branching instructions happen after a CMP (Compare) opcode. The results of the CMP opcode are stored in the carry flag. BCC stands for Branch Carry Clear, and branches when the carry flag is not set. BCS stands for Branch Carry Set and branches when the carry flag is set. So how does CMP and BCC / BCS work? CMP sets the flag if the number compared is equal or greater than the amount compared against (CMP uses the accumulator, but there's also CPX and CPY which compare against the X and Y registers).

Seems if you want to compare just "greater than" then you'll need to do two operations (BEQ to remove equal, and BCS to check the number is greater).

I did this under Py65Mon because I wanted to play around with it a bit.

Day 9 didn't see any progress.


links

social