I have a simple program, where I'm trying to understand how to compare two address registers, and branch if A1 is less than or equal to A2
As such:
ORG $8000
START: ; first instruction of program
CMP A2,A1
BLE LOOP ;if A1 is less then or equal to A2, BRANCH
LOOP:
* Put variables and constants here
END START ; last line of source
Is this the correct way of doing it? What if I used the macro CMPA
here instead, would it make a difference?
You have to use cmpa
to compare with an addressregister on 68K. You don't have a choice.
Also it's best to include the size suffix .L to make sure the full 32 bits are compared as opposed to a sign-extended version of the low 16 bits.
CMPA.L A2,A1
BLE.S LOOP