Given the Java code fragment below write the equivalent in M
Given the Java code fragment below, write the equivalent in Motorola M68000 assembly language code. Write only the code fragment, not a complete program. Write your pseudocode on this page, and write your assembly language code on the following page. Your MUST use the following register assignments:
Solution
CMP #10,D3
BGE ELSE ;IF D3 GREATER OR EQUAL THAN 10, JUMP TO ELSE:
CMP #20,D4
BLE ELSE ;IF D4 LOWER OR EQUAL THAN 20, JUMP TO ELSE:
CMP #0,D5
BNE ELSE ;IF D5 NOT EQUAL THAN 0, JUMP TO ELSE:
ADD.L #1,D2 ;ALL THE CONDITIONS ARE GOOD, SO INCREMENT D2
BRA END ;JUMP TO THE END
ELSE:
SUBI.L #1,D2 ;ONE OR MORE CONDITIONS ARE BAD, SO DECREMENT D2
END:
