lab2: simplify string printout
This commit is contained in:
parent
86de75098a
commit
54ce3caccb
25
lab1_v2.S
25
lab1_v2.S
|
@ -2,26 +2,21 @@
|
|||
.cpu cortex-m4
|
||||
.thumb
|
||||
|
||||
.macro BKPT_WRITE addr_src
|
||||
mov r0, 0x4
|
||||
mov r1, \addr_src
|
||||
bkpt 0xAB
|
||||
.endm
|
||||
|
||||
.section .data
|
||||
test_string: .asciz "Hello"
|
||||
|
||||
.section .text
|
||||
|
||||
lab1_v2:
|
||||
sub sp, #6
|
||||
ldr r0, =test_string
|
||||
mov r1, #5
|
||||
push {lr}
|
||||
|
||||
copy_loop:
|
||||
ldrb r2, [r0, r1]
|
||||
strb r2, [sp, r1]
|
||||
subs r1, #1
|
||||
bpl copy_loop
|
||||
ldr r1, =test_string
|
||||
BKPT_WRITE r1
|
||||
|
||||
mov r1, sp
|
||||
mov r0, 0x04
|
||||
bkpt 0xAB
|
||||
|
||||
add sp, #6
|
||||
|
||||
mov pc, lr
|
||||
pop {pc}
|
||||
|
|
Loading…
Reference in New Issue