lab2: simplify string printout

This commit is contained in:
ІО-23 Шмуляр Олег 2025-02-08 22:12:20 +02:00
parent 86de75098a
commit 54ce3caccb
1 changed files with 10 additions and 15 deletions

View File

@ -2,26 +2,21 @@
.cpu cortex-m4 .cpu cortex-m4
.thumb .thumb
.macro BKPT_WRITE addr_src
mov r0, 0x4
mov r1, \addr_src
bkpt 0xAB
.endm
.section .data .section .data
test_string: .asciz "Hello" test_string: .asciz "Hello"
.section .text .section .text
lab1_v2: lab1_v2:
sub sp, #6 push {lr}
ldr r0, =test_string
mov r1, #5
copy_loop: ldr r1, =test_string
ldrb r2, [r0, r1] BKPT_WRITE r1
strb r2, [sp, r1]
subs r1, #1
bpl copy_loop
mov r1, sp pop {pc}
mov r0, 0x04
bkpt 0xAB
add sp, #6
mov pc, lr