aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/libc/memmove.s
blob: d32e2ca8ab69aea0916ada46fe81d2d86bef03e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
.Lloop:
	blez	$a2, .Lexit
	addi	$a2, -1
	lbu		$v1, 0($a1)
	addiu	$a1, -1
	sb		$v1, 0($a0)
	addiu	$a0, -1
	b		.Lloop
	nop
.Lexit:
	jr		$ra
	nop