aboutsummaryrefslogtreecommitdiff
path: root/libpsn00b/psxgte/squareroot.s
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-06-23 07:42:16 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2019-06-23 07:42:16 +0800
commit7be9178c0f9b0e698a305ecc5c0c41fcc596a4fc (patch)
treee98c627e1da5c764563774b89b0c06d7ac5ad0a4 /libpsn00b/psxgte/squareroot.s
parentae9e545c3ed33d39ce21ae13ceb8337fa34901b8 (diff)
downloadpsn00bsdk-7be9178c0f9b0e698a305ecc5c0c41fcc596a4fc.tar.gz
LibPSn00b officially v0.10b, added psxsio library, better DrawSync() and VSync(), better reference manual.
Diffstat (limited to 'libpsn00b/psxgte/squareroot.s')
-rw-r--r--libpsn00b/psxgte/squareroot.s30
1 files changed, 16 insertions, 14 deletions
diff --git a/libpsn00b/psxgte/squareroot.s b/libpsn00b/psxgte/squareroot.s
index 71f40a9..a262d94 100644
--- a/libpsn00b/psxgte/squareroot.s
+++ b/libpsn00b/psxgte/squareroot.s
@@ -5,6 +5,8 @@
.section .text
+# Implementation based from Sony libs
+
.global SquareRoot12
.type SquareRoot12, @function
SquareRoot12:
@@ -12,7 +14,7 @@ SquareRoot12:
nop
nop
mfc2 $v0, C2_LZCR
- beq $v0, 32, $bad_sqr12
+ beq $v0, 32, .Lbad_sqr12
nop
andi $t0, $v0, 0x1
addiu $v1, $0 , -2
@@ -21,15 +23,15 @@ SquareRoot12:
sub $t1, $t2
sra $t1, 1
addi $t3, $t2, -24
- bltz $t3, $value_less12
+ bltz $t3, .Lvalue_less12
nop
sllv $t4, $a0, $t3
- b $value_greater12
-$value_less12:
+ b .Lvalue_greater12
+.Lvalue_less12:
addiu $t3, $0 , 24
sub $t3, $t2
srav $t4, $a0, $t3
-$value_greater12:
+.Lvalue_greater12:
addi $t4, -64
sll $t4, 1
la $t5, sqrt_table
@@ -37,18 +39,18 @@ $value_greater12:
lh $t5, 0($t5)
nop
- bltz $t1, $1594c
+ bltz $t1, .L1594c
nop
jr $ra
sllv $v0, $t5, $t1
-$1594c:
+.L1594c:
sub $t1, $0 , $t1
jr $ra
srl $v0, $t5, $t1
-$bad_sqr12:
+.Lbad_sqr12:
jr $ra
move $v0, $0
@@ -60,7 +62,7 @@ SquareRoot0:
nop
nop
mfc2 $v0, C2_LZCR
- beq $v0, 32, $bad_sqr
+ beq $v0, 32, .Lbad_sqr
nop
andi $t0, $v0, 0x1
addiu $v1, $0 , -2
@@ -69,15 +71,15 @@ SquareRoot0:
sub $t1, $t2
sra $t1, 1
addi $t3, $t2, -24
- bltz $t3, $value_less
+ bltz $t3, .Lvalue_less
nop
sllv $t4, $a0, $t3
- b $value_greater
-$value_less:
+ b .Lvalue_greater
+.Lvalue_less:
addiu $t3, $0 , 24
sub $t3, $t2
srav $t4, $a0, $t3
-$value_greater:
+.Lvalue_greater:
addi $t4, -64
sll $t4, 1
la $t5, sqrt_table
@@ -87,7 +89,7 @@ $value_greater:
sllv $t5, $t5, $t1
jr $ra
srl $v0, $t5, 12
-$bad_sqr:
+.Lbad_sqr:
jr $ra
move $v0, $0