aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/libc/memmove.s
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-04-06 10:11:07 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-04-06 10:11:07 +0800
commitf3e040230772f978540a71aea43dfde200992922 (patch)
treebd8ca31b72dd01e24980b073854e263589530f56 /libpsn00b/libc/memmove.s
downloadpsn00bsdk-f3e040230772f978540a71aea43dfde200992922.tar.gz
First commit
Diffstat (limited to 'libpsn00b/libc/memmove.s')
-rw-r--r--libpsn00b/libc/memmove.s29
1 files changed, 29 insertions, 0 deletions
diff --git a/libpsn00b/libc/memmove.s b/libpsn00b/libc/memmove.s
new file mode 100644
index 0000000..961e71f
--- /dev/null
+++ b/libpsn00b/libc/memmove.s
@@ -0,0 +1,29 @@
+.set noreorder
+
+.section .text
+
+# Arguments
+# a0 - destination address
+# a1 - source address
+# a2 - bytes to move
+.global memmove
+.type memmove, @function
+memmove:
+ move $v0, $a0
+ addu $a0, $a2
+ addu $a1, $a2
+ addiu $a0, -1
+ addiu $a1, -1
+.loop:
+ blez $a2, .exit
+ addi $a2, -1
+ lbu $v1, 0($a1)
+ addiu $a1, -1
+ sb $v1, 0($a0)
+ addiu $a0, -1
+ b .loop
+ nop
+.exit:
+ jr $ra
+ nop
+ \ No newline at end of file