Translate the following algorithm into assembly language. Input X from keyboard using Trap #15. Show outputs for both cases where X < 10 and X>= 10.
INPUT X from keyboard IF X < 10X = X - 10 ELSE X = 2*X+1
OUTPUT X
Please let me know what am I doing wrong
ORG $1000
START:
-
Put program code here MOVE.B #4,D0 TRAP #15 MOVE.W X,D1
CMP.L #10,D1 BLE ELSE
IF SUB.L #10,D1 BRA ENDIF
ELSE
MULU #2,D1 ADD #1,D1
ENDIF
MOVE #3,D0
TRAP #15
SIMHALT ; halt simulator
-
Put variables and constants here X DC.W 7
END START
Aucun commentaire:
Enregistrer un commentaire