1 Answers
Code 01:
AREA ASECEND, CODE
ENTRY
MOV R0, #5
OUT LDR R5,= 0X40000000
ADD R6, R5, #1
MOV R3, #4
IN LDRB R1, [R5]
LDRB R2, [R6]
CMP R1, R2
BCC LOP
MOV R4, R2
MOV R2, R1
MOV R1, R4
LOP STRB R1, [R5]
STRB R2, [R6]
ADD R5, R5, #1
ADD R6, R6, #1
SUBS R3, R3, #1
BNE IN
SUBS R0, R0, #1
BNE OUT
STOP B STOP
END
Code 02:
AREA A0, CODE
ENTRY
MOV R6, #5
MOV R0, #0
MOV R1, #6
MOV R5, #0XFFFFFFFF
LDR R7,= 0X40000000
LDR R8,= 0X40000018
LOOP1 SUB R0, R1, #1
MOV R2, R7
MOV R4, R5
LOOP
LDR R3, [R2,#4]!
CMP R4, R3
MOVCS R4, R3
MOVCS R10, R2
SUBS R0, R0, #1
BNE LOOP
SUBS R6, R6, #1
STR R4, [R8], #4
STR R5, [R10]
BNE LOOP1
STOP B STOP
END