Skip to content

Instantly share code, notes, and snippets.

@karaketir16
Created May 18, 2023 16:24
Show Gist options
  • Save karaketir16/f9684591b0c893d58133f8bc5367f4cd to your computer and use it in GitHub Desktop.
Save karaketir16/f9684591b0c893d58133f8bc5367f4cd to your computer and use it in GitHub Desktop.
my copy function
.syntax unified
.section .text
.thumb_func
.global my_cpy
my_cpy:
push {r4, lr} @ push r4 and lr onto the stack
movs r4, #0
loop:
ldrb r3, [r1, r4] @ load byte from r1 + r4 into r3
strb r3, [r0, r4] @ store byte from r3 into r0 + r4
adds r4, r4, #1 @ increment r4
cmp r4, r2 @ compare r4 with 10
bne loop @ branch to loop if r2 is not zero
pop {r4, pc} @ pop r4 and pc from the stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment