1 Answers
Code 01:
AREA NEGATIVESUM, CODE
ENTRY
LDR R0,= 0X40000000
MOV R5, #05
MOV R6, #00
NEG LDR R2, [R0], #4
MOV R3, R2
MOVS R2, R2, LSL #1
ADDCS R6, R6, R3
SUBS R5, R5, #1
BNE NEG
STOP B STOP
END
Code 02:
AREA NEG_SUM, CODE
ENTRY
LDR R0,= 0X40000000
MOV R5, #5
MOV R3, #00
MOV R6, #0Xffffffff
NEG LDR R7, [R0], #4
MOV R8, R7
AND R11, R6, R7
MOVS R11, R11, LSL #1
ADDCS R9, R9, R8
SUBS R5, R5, #1
BNE NEG
STOP B STOP
END