ARM集成环境下的数据块拷贝
2024-11-18 来源:cnblogs
; 数据块拷贝
;
AREA cpData, DATA, READWRITE
align 4 ;四字节对齐
buf1 space 12345
align 4 ;四字节对齐
buf2 space 12345
AREA cpCode, CODE, READONLY
ENTRY
start
;初始化测试数据
ldr r0, =12345-1
ldr r1, =buf1
initloop
strb r0, [r1, r0]
subs r0, r0, #1
bne initloop
;数据拷贝
ldr r0, =12345 ;计数器
ldr r1, =buf1 ;源缓冲区
ldr r2, =buf2 ;目的缓冲区
blkcpyloop ;块拷贝
cmp r0, #32
bmi bytecpyloop ;不够一整块
ldmia r1!, {r3-r10} ;读32字节
stmia r2!, {r3-r10} ;写入目的缓冲区
sub r0, r0, #32
b blkcpyloop
bytecpyloop ;字节拷贝
cmp r0, #0
beq stop
ldrb r3, [r1], #1
strb r3, [r2], #1
sub r0, r0, #1
b bytecpyloop
stop
mov r0, #0x18
ldr r1, =0x20026
swi 0x123456
end
下一篇:Tiny6410--取模软件设置