arm汇编小程序

来源:百度知道 编辑:UC知道 时间:2024/06/07 10:02:02
读懂下面一段程序,子程序dststr执行过程中寄存器R0、R1、R2中的内容如何变化?试分析并给出子程序执行后的结果。
AREA StrCopy, CODE, READONLY
ENTRY ; mark the first instruction to call
start
LDR r1, =srcstr ; pointer to first string
LDR r0, =dststr ; pointer to second string
BL strcopy ; call subroutine to do copy
stop
MOV r0, #0x18
LDR r1, =0x20026
SWI 0x123456
strcopy
LDRB r2, [r1],#1
STRB r2, [r0],#1
CMP r2, #0
BNE strcopy
MOV pc,lr ; Return
AREA Strings, DATA, READWRITE
srcstr DCB "First string - source",0
dststr DCB "Second string - destination",0
END

AREA StrCopy, CODE, READONLY
ENTRY ; mark the first instruction to call
start
LDR r1, =srcstr ; pointer to first string
LDR r0, =dststr ; pointer to second string
BL strcopy ;
call subroutine to do copy
stop
MOV r0,
#0x18
LDR r1,
=0x20026
SWI
0x123456
strcopy
LDRB r2, [r1],#1
STRB r2, [r0],#1
CMP r2, #0
BNE strcopy
MOV pc,lr ;
Return
AREA Strings, DATA, READWRITE
srcstr DCB First string - source,0
dststr DCB Second string - destination,0
END
试试,