1 Answers
Code:
AREA A0, CODE
ENTRY
MOV R1, #15
MOV R2, #3
CMP R2, #0
BEQ DEN
MOV R0, #0
MOV R3, #1
START CMP R2, R1
MOVLS R2, R2, LSL #1
MOVLS R3, R3, LSL #1
BLS START
LOOP CMP R1, R2
SUBCS R1, R1, R2
ADDCS R0, R0, R3
MOVS R3, R3, LSR #1
MOVCC R2, R2, LSR #1
BCC LOOP
DEN
SUBS R4, R1, R2
STOP B STOP
END