1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-14 19:10:25 +00:00

Use IDO for assembling handwritten asm files in src (#2390)

* as0

* Fix ASOPTFLAGS for src/libc, remove unnecessary noreorder region in kanread

* Suggested changes

* Use %half to load the boot bss size for matching

Co-authored-by: cadmic <cadmic24@gmail.com>

* Wrap all of __osProbeTLB in noreorder

---------

Co-authored-by: cadmic <cadmic24@gmail.com>
This commit is contained in:
Tharo 2024-12-28 20:18:45 +00:00 committed by GitHub
parent ba6a83533a
commit 7e082f0c4f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 2612 additions and 2653 deletions

View file

@ -1,40 +1,36 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noat
.set noreorder
.section .text
.balign 32
.text
.align 5
#define MTX_INTPART 0
#define MTX_FRACPART 0x20
LEAF(guMtxF2L)
li $at, 0x47800000 // 65536.0f
mtc1 $at, $f0
li $t9, 0xFFFF0000
addiu $t8, $a1, MTX_FRACPART
li.s fv0, 65536.0
li t9, 0xFFFF0000
addu t8, a1, MTX_FRACPART
1:
lwc1 $f4, ($a0)
lwc1 $f10, 4($a0)
addiu $a1, $a1, 4
mul.s $f6, $f4, $f0
addiu $a0, $a0, 8
mul.s $f16, $f10, $f0
trunc.w.s $f8, $f6
trunc.w.s $f18, $f16
mfc1 $t0, $f8
mfc1 $t1, $f18
and $t2, $t0, $t9
sll $t5, $t0, 0x10
srl $t3, $t1, 0x10
andi $t6, $t1, 0xFFFF
or $t4, $t2, $t3
or $t7, $t5, $t6
sw $t4, (MTX_INTPART-4)($a1)
bne $a1, $t8, 1b
sw $t7, (MTX_FRACPART-4)($a1)
jr $ra
nop
lwc1 ft0, 0(a0)
lwc1 ft3, 4(a0)
mul.s ft1, ft0, fv0
mul.s ft4, ft3, fv0
trunc.w.s ft2, ft1
trunc.w.s ft5, ft4
mfc1 t0, ft2
mfc1 t1, ft5
srl t3, t1, 0x10
and t6, t1, 0xFFFF
and t2, t0, t9
sll t5, t0, 0x10
or t4, t2, t3
or t7, t5, t6
sw t4, (MTX_INTPART)(a1)
sw t7, (MTX_FRACPART)(a1)
addu a0, a0, 8
addu a1, a1, 4
bne a1, t8, 1b
jr ra
END(guMtxF2L)

View file

@ -1,29 +1,27 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noreorder
.section .text
.balign 32
.text
.align 5
LEAF(guMtxIdent)
addi $t0, $zero, 1
sll $t1, $t0, 0x10
sw $t1, ($a0)
sw $zero, 4($a0)
sw $t0, 8($a0)
sw $zero, 0xc($a0)
sw $zero, 0x10($a0)
sw $t1, 0x14($a0)
sw $zero, 0x18($a0)
sw $t0, 0x1C($a0)
sw $zero, 0x20($a0)
sw $zero, 0x24($a0)
sw $zero, 0x28($a0)
sw $zero, 0x2c($a0)
sw $zero, 0x30($a0)
sw $zero, 0x34($a0)
sw $zero, 0x38($a0)
jr $ra
sw $zero, 0x3C($a0)
add t0, zero, 1
sll t1, t0, 0x10
sw t1, 0x00(a0)
sw zero, 0x04(a0)
sw t0, 0x08(a0)
sw zero, 0x0C(a0)
sw zero, 0x10(a0)
sw t1, 0x14(a0)
sw zero, 0x18(a0)
sw t0, 0x1C(a0)
sw zero, 0x20(a0)
sw zero, 0x24(a0)
sw zero, 0x28(a0)
sw zero, 0x2c(a0)
sw zero, 0x30(a0)
sw zero, 0x34(a0)
sw zero, 0x38(a0)
sw zero, 0x3C(a0)
jr ra
END(guMtxIdent)

View file

@ -1,28 +1,26 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noreorder
.section .text
.balign 32
.text
.align 5
LEAF(guMtxIdentF)
li $t0, 0x3F800000 // 1.0f
sw $t0, ($a0)
sw $zero, 4($a0)
sw $zero, 8($a0)
sw $zero, 0xC($a0)
sw $zero, 0x10($a0)
sw $t0, 0x14($a0)
sw $zero, 0x18($a0)
sw $zero, 0x1C($a0)
sw $zero, 0x20($a0)
sw $zero, 0x24($a0)
sw $t0, 0x28($a0)
sw $zero, 0x2C($a0)
sw $zero, 0x30($a0)
sw $zero, 0x34($a0)
sw $zero, 0x38($a0)
jr $ra
sw $t0, 0x3C($a0)
li.s t0, 1.0
sw t0, 0x00(a0)
sw zero, 0x04(a0)
sw zero, 0x08(a0)
sw zero, 0x0C(a0)
sw zero, 0x10(a0)
sw t0, 0x14(a0)
sw zero, 0x18(a0)
sw zero, 0x1C(a0)
sw zero, 0x20(a0)
sw zero, 0x24(a0)
sw t0, 0x28(a0)
sw zero, 0x2C(a0)
sw zero, 0x30(a0)
sw zero, 0x34(a0)
sw zero, 0x38(a0)
sw t0, 0x3C(a0)
jr ra
END(guMtxIdentF)

View file

@ -1,41 +1,43 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noat
.set noreorder
.section .text
.balign 32
.text
.align 5
#define MTX_INTPART 0
#define MTX_FRACPART 0x20
#define FIXTOF 0.0000152587890625 /* 1.0f / 65536.0f */
LEAF(guMtxL2F)
li $at, 0x37800000 // 1.0f / 65536.0f
mtc1 $at, $f0
li $t9, 0xFFFF0000
addiu $t8, $a1, MTX_FRACPART
li.s fv0, FIXTOF
li t9, 0xFFFF0000
addiu t8, a1, MTX_FRACPART
1:
lw $t0, MTX_INTPART($a1)
lw $t1, MTX_FRACPART($a1)
addiu $a1, $a1, 4
and $t2, $t0, $t9
srl $t3, $t1, 0x10
or $t4, $t2, $t3
mtc1 $t4, $f4
sll $t5, $t0, 0x10
andi $t6, $t1, 0xFFFF
or $t7, $t5, $t6
cvt.s.w $f6, $f4
mtc1 $t7, $f10
addiu $a0, $a0, 8
cvt.s.w $f16, $f10
mul.s $f8, $f6, $f0
nop
mul.s $f18, $f16, $f0
swc1 $f8, -8($a0)
bne $a1, $t8, 1b
swc1 $f18, -4($a0)
jr $ra
nop
lw t0, MTX_INTPART(a1)
lw t1, MTX_FRACPART(a1)
and t2, t0, t9
srl t3, t1, 0x10
or t4, t2, t3
sll t5, t0, 0x10
and t6, t1, 0xFFFF
or t7, t5, t6
mtc1 t4, ft0
cvt.s.w ft1, ft0
mul.s ft2, ft1, fv0
mtc1 t7, ft3
cvt.s.w ft4, ft3
mul.s ft5, ft4, fv0
swc1 ft2, 0(a0)
swc1 ft5, 4(a0)
addu a0, a0, 8
addu a1, a1, 4
bne a1, t8, 1b
jr ra
END(guMtxL2F)

View file

@ -1,31 +1,27 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noreorder
.section .text
.balign 32
.text
.align 5
LEAF(guNormalize)
lwc1 $f4, ($a0)
lwc1 $f6, ($a1)
lwc1 $f8, ($a2)
mul.s $f10, $f4, $f4
li $t0, 0x3F800000 // 1.0f
mul.s $f16, $f6, $f6
add.s $f18, $f10, $f16
mul.s $f16, $f8, $f8
add.s $f10, $f16, $f18
mtc1 $t0, $f18
sqrt.s $f16, $f10
div.s $f10, $f18, $f16
mul.s $f16, $f4, $f10
nop
mul.s $f18, $f6, $f10
nop
mul.s $f4, $f8, $f10
swc1 $f16, ($a0)
swc1 $f18, ($a1)
jr $ra
swc1 $f4, ($a2)
lwc1 ft0, (a0)
lwc1 ft1, (a1)
lwc1 ft2, (a2)
li.s t0, 1.0
mul.s ft3, ft0, ft0
mul.s ft4, ft1, ft1
add.s ft5, ft3, ft4
mul.s ft4, ft2, ft2
add.s ft3, ft4, ft5
mtc1 t0, ft5
sqrt.s ft4, ft3
div.s ft3, ft5, ft4
mul.s ft4, ft0, ft3
mul.s ft5, ft1, ft3
mul.s ft0, ft2, ft3
swc1 ft4, (a0)
swc1 ft5, (a1)
swc1 ft0, (a2)
jr ra
END(guNormalize)

View file

@ -1,52 +1,56 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noat
.set noreorder
.section .text
.balign 32
.text
.align 5
LEAF(guScale)
li $at, 0x47800000 // 65536.0f
mtc1 $at, $f4
mtc1 $a1, $f6
sw $zero, 4($a0)
sw $zero, 0xC($a0)
mul.s $f8, $f6, $f4
mtc1 $a2, $f6
sw $zero, 0x10($a0)
sw $zero, 0x18($a0)
sw $zero, 0x24($a0)
sw $zero, 0x2C($a0)
sw $zero, 0x30($a0)
trunc.w.s $f10, $f8
mul.s $f8, $f6, $f4
mtc1 $a3, $f6
sw $zero, 0x38($a0)
mfc1 $t1, $f10
sw $zero, 0x3C($a0)
srl $t2, $t1, 0x10
trunc.w.s $f10, $f8
mul.s $f8, $f6, $f4
sll $t0, $t2, 0x10
sll $t2, $t1, 0x10
mfc1 $t1, $f10
sw $t0, ($a0)
sw $t2, 0x20($a0)
srl $t0, $t1, 0x10
trunc.w.s $f10, $f8
andi $t2, $t1, 0xFFFF
sw $t2, 0x28($a0)
sw $t0, 8($a0)
mfc1 $t1, $f10
nop
srl $t2, $t1, 0x10
sll $t0, $t2, 0x10
sw $t0, 0x14($a0)
li $t0, 1
sll $t2, $t1, 0x10
sw $t2, 0x34($a0)
jr $ra
sw $t0, 0x1C($a0)
li.s ft0, 65536.0
mtc1 a1, ft1
mul.s ft2, ft1, ft0
trunc.w.s ft3, ft2
mfc1 t1, ft3
srl t2, t1, 0x10
sll t0, t2, 0x10
sw t0, 0x00(a0)
sll t2, t1, 0x10
sw t2, 0x20(a0)
mtc1 a2, ft1
mul.s ft2, ft1, ft0
trunc.w.s ft3, ft2
mfc1 t1, ft3
srl t0, t1, 0x10
sw t0, 0x08(a0)
andi t2, t1, 0xFFFF
sw t2, 0x28(a0)
mtc1 a3, ft1
mul.s ft2, ft1, ft0
trunc.w.s ft3, ft2
mfc1 t1, ft3
srl t2, t1, 0x10
sll t0, t2, 0x10
sw t0, 0x14(a0)
sll t2, t1, 0x10
sw t2, 0x34(a0)
li t0, 1
sw t0, 0x1C(a0)
sw zero, 0x04(a0)
sw zero, 0x0C(a0)
sw zero, 0x10(a0)
sw zero, 0x18(a0)
sw zero, 0x24(a0)
sw zero, 0x2C(a0)
sw zero, 0x30(a0)
sw zero, 0x38(a0)
sw zero, 0x3C(a0)
jr ra
END(guScale)

View file

@ -1,61 +1,68 @@
#include "ultra64/asm.h"
#include "ultra64/regdef.h"
.set noat
.set noreorder
.section .text
.balign 32
.text
.align 5
LEAF(guTranslate)
li $at, 0x47800000 // 65536.0f
mtc1 $at, $f4
mtc1 $a1, $f6
sw $zero, ($a0)
sw $zero, 0x14($a0)
mul.s $f8, $f6, $f4
mtc1 $a2, $f6
sw $zero, 8($a0)
sw $zero, 4($a0)
sw $zero, 0xC($a0)
sw $zero, 0x10($a0)
sw $zero, 0x20($a0)
trunc.w.s $f10, $f8
mul.s $f8, $f6, $f4
mtc1 $a3, $f6
sw $zero, 0x24($a0)
mfc1 $t1, $f10
sw $zero, 0x28($a0)
sw $zero, 0x2C($a0)
srl $t2, $t1, 0x10
trunc.w.s $f10, $f8
mul.s $f8, $f6, $f4
sll $t0, $t2, 0x10
sw $zero, 0x30($a0)
mfc1 $t3, $f10
sw $zero, 0x34($a0)
srl $t2, $t3, 0x10
trunc.w.s $f10, $f8
or $t0, $t0, $t2
sw $t0, 0x18($a0)
sll $t0, $t1, 0x10
sll $t2, $t3, 0x10
mfc1 $t1, $f10
srl $t2, $t2, 0x10
or $t0, $t0, $t2
sw $t0, 0x38($a0)
srl $t2, $t1, 0x10
sll $t0, $t2, 0x10
addiu $t0, $t0, 1
sw $t0, 0x1C($a0)
lui $t0, 1
ori $t0, $t0, 0
sw $t0, ($a0)
sw $t0, 0x14($a0)
lui $t0, (0x00000001 >> 16)
ori $t0, (0x00000001 & 0xFFFF)
sll $t2, $t1, 0x10
sw $t2, 0x3C($a0)
jr $ra
sw $t0, 8($a0)
li.s ft0, 65536.0
mtc1 a1, ft1
mul.s ft2, ft1, ft0
trunc.w.s ft3, ft2
mfc1 t1, ft3
mtc1 a2, ft1
mul.s ft2, ft1, ft0
trunc.w.s ft3, ft2
mfc1 t3, ft3
srl t2, t1, 0x10
sll t0, t2, 0x10
srl t2, t3, 0x10
or t0, t0, t2
sw t0, 0x18(a0)
sll t2, t3, 0x10
sll t0, t1, 0x10
srl t2, t2, 0x10
or t0, t0, t2
sw t0, 0x38(a0)
mtc1 a3, ft1
mul.s ft2, ft1, ft0
trunc.w.s ft3, ft2
mfc1 t1, ft3
srl t2, t1, 0x10
sll t0, t2, 0x10
addiu t0, t0, 1
sw t0, 0x1C(a0)
sll t2, t1, 0x10
sw t2, 0x3C(a0)
sw zero, 0x00(a0)
sw zero, 0x04(a0)
sw zero, 0x08(a0)
sw zero, 0x0C(a0)
sw zero, 0x10(a0)
sw zero, 0x14(a0)
sw zero, 0x20(a0)
sw zero, 0x24(a0)
sw zero, 0x28(a0)
sw zero, 0x2C(a0)
sw zero, 0x30(a0)
sw zero, 0x34(a0)
lui t0, (0x00010000 >> 16)
ori t0, (0x00010000 & 0xFFFF)
sw t0, (a0)
sw t0, 0x14(a0)
lui t0, (0x00000001 >> 16)
ori t0, (0x00000001 & 0xFFFF)
sw t0, 8(a0)
jr ra
END(guTranslate)