Refresh 10

This commit is contained in:
n64 committed 2020-06-02 12:44:34 -04:00
1 parent e58669b4b3
commit d43d9b7f20
444 files changed
+30163 -7628

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+175 -492
View File
@@ -15,16 +15,14 @@
.endif
glabel __osExceptionPreamble
lui $k0, %hi(__osException) # $k0, 0x8032
addiu $k0, %lo(__osException) # addiu $k0, $k0, 0x66d0
lui $k0, %hi(__osException)
addiu $k0, %lo(__osException)
jr $k0
nop
glabel __osException
.ifndef VERSION_EU
lui $k0, %hi(gInterruptedThread) # $k0, 0x8036
addiu $k0, %lo(gInterruptedThread) # addiu $k0, $k0, 0x5f40
lui $k0, %hi(gInterruptedThread)
addiu $k0, %lo(gInterruptedThread)
sd $at, 0x20($k0)
mfc0 $k1, $12
sw $k1, 0x118($k0)
@@ -36,7 +34,7 @@ glabel __osException
sd $t2, 0x68($k0)
sw $zero, 0x18($k0)
mfc0 $t0, $13
.ifndef VERSION_EU
andi $t1, $t0, 0x7c
li $t2, 0
bne $t1, $t2, .L80326750
@@ -46,7 +44,7 @@ glabel __osException
beqz $t2, .L80326734
nop
li $t1, 1
lui $at, %hi(D_80334934) # $at, 0x8033
lui $at, %hi(D_80334934)
b .L80326794
sw $t1, %lo(D_80334934)($at)
.L80326734:
@@ -54,17 +52,19 @@ glabel __osException
beqz $t2, .L80326750
nop
li $t1, 1
lui $at, %hi(D_80334938) # $at, 0x8033
lui $at, %hi(D_80334938)
b .L80326794
sw $t1, %lo(D_80334938)($at)
.L80326750:
lui $at, %hi(D_80334934) # $at, 0x8033
lui $at, %hi(D_80334934)
sw $zero, %lo(D_80334934)($at)
lui $at, %hi(D_80334938) # $at, 0x8033
lui $at, %hi(D_80334938)
.endif
move $t0, $k0
.ifndef VERSION_EU
sw $zero, %lo(D_80334938)($at)
lui $k0, %hi(D_80334890 + 0x10) # $k0, 0x8033
.endif
lui $k0, %hi(D_80334890 + 0x10)
lw $k0, %lo(D_80334890 + 0x10)($k0)
ld $t1, 0x20($t0)
sd $t1, 0x20($k0)
@@ -76,10 +76,17 @@ glabel __osException
sd $t1, 0x60($k0)
ld $t1, 0x68($t0)
sd $t1, 0x68($k0)
.ifdef VERSION_EU
lw $k1, 0x118($k0)
.else
.L80326794:
.endif
mflo $t0
sd $t0, 0x108($k0)
mfhi $t0
.ifdef VERSION_EU
andi $t1, $k1, 0xff00
.endif
sd $v0, 0x28($k0)
sd $v1, 0x30($k0)
sd $a0, 0x38($k0)
@@ -105,30 +112,28 @@ glabel __osException
sd $sp, 0xf0($k0)
sd $fp, 0xf8($k0)
sd $ra, 0x100($k0)
.ifndef VERSION_EU
sd $t0, 0x110($k0)
.else
beqz $t1, .L802F3A18
sd $t0, 0x110($k0)
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
.ifdef VERSION_EU
beqz $t1, .L802F3A18
sd $t0, 0x110($k0)
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lw $t0, ($t0)
li $at, -1
xor $t0, $t0, $at
lui $at, (0xFFFF00FF >> 16) # lui $at, 0xffff
lui $at, (0xFFFF00FF >> 16)
andi $t0, $t0, 0xff00
ori $at, (0xFFFF00FF & 0xFFFF) # ori $at, $at, 0xff
ori $at, (0xFFFF00FF & 0xFFFF)
or $t1, $t1, $t0
and $k1, $k1, $at
or $k1, $k1, $t1
sw $k1, 0x118($k0)
.L802F3A18:
lui $t1, %hi(MI_INTR_MASK_REG) # $t1, 0xa430
lui $t1, %hi(MI_INTR_MASK_REG)
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
beqz $t1, .L802F3A50
nop
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
nop
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lw $t0, ($t0)
lw $t4, 0x128($k0)
li $at, -1
@@ -139,9 +144,9 @@ glabel __osException
or $t1, $t1, $t0
.L802F3A50:
sw $t1, 0x128($k0)
.else
sd $t0, 0x110($k0)
.endif
mfc0 $t0, $14
sw $t0, 0x11c($k0)
lw $t0, 0x18($k0)
@@ -169,45 +174,49 @@ glabel __osException
.L80326868:
mfc0 $t0, $13
sw $t0, 0x120($k0)
lui $t1, %hi(MI_INTR_MASK_REG) # $t1, 0xa430
.ifndef VERSION_EU
lui $t1, %hi(MI_INTR_MASK_REG)
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
sw $t1, 0x128($k0)
.endif
li $t1, 2
sh $t1, 0x10($k0)
lui $t1, %hi(D_80334934) # $t1, 0x8033
.ifndef VERSION_EU
lui $t1, %hi(D_80334934)
lw $t1, %lo(D_80334934)($t1)
beqz $t1, .L803268B4
nop
lui $t2, %hi(D_C0000008) # $t2, 0xc000
lui $t2, %hi(D_C0000008)
sw $zero, %lo(D_C0000008)($t2)
lui $a0, %hi(D_C0000000)
addiu $t2, %lo(D_C0000008) # addiu $t2, $t2, 8
addiu $t2, %lo(D_C0000008)
jal kdebugserver
lw $a0, %lo(D_C0000000)($a0)
b .L80326E08
nop
.L803268B4:
lui $t1, %hi(D_80334938) # $t1, 0x8033
lui $t1, %hi(D_80334938)
lw $t1, %lo(D_80334938)($t1)
beqz $t1, .L80326900
nop
lui $t2, %hi(D_C000000C) # $t2, 0xc000
lui $t2, %hi(D_C000000C)
sw $zero, %lo(D_C000000C)($t2)
lui $t1, %hi(D_80334A40) # $t1, 0x8033
lui $t1, %hi(D_80334A40)
lw $t1, %lo(D_80334A40)($t1)
addiu $t2, %lo(D_C000000C) # addiu $t2, $t2, 0xc
addiu $t2, %lo(D_C000000C)
beqz $t1, .L803268E8
nop
jal send_mesg
li $a0, 120
.L803268E8:
lui $t1, %hi(D_80334A44) # $t1, 0x8033
lui $t1, %hi(D_80334A44)
lw $t1, %lo(D_80334A44)($t1)
lui $at, %hi(D_80334A44) # $at, 0x8033
lui $at, %hi(D_80334A44)
addi $t1, $t1, 1
b .L80326E08
sw $t1, %lo(D_80334A44)($at)
.L80326900:
.endif
andi $t1, $t0, 0x7c
li $t2, 36
beq $t1, $t2, .L80326B84
@@ -235,41 +244,85 @@ glabel __osException
lw $t2, %lo(jtbl_80338630)($at)
jr $t2
nop
.ifdef VERSION_EU
glabel L802F3B28
li $at, -8193
b .L8032692C
and $s0, $s0, $at
glabel L802F3B34
li $at, -16385
b .L8032692C
and $s0, $s0, $at
.endif
glabel L80326964
mfc0 $t1, $11
mtc0 $t1, $11
jal send_mesg
li $a0, 24
lui $at, (0xFFFF7FFF >> 16) # lui $at, 0xffff
ori $at, (0xFFFF7FFF & 0xFFFF) # ori $at, $at, 0x7fff
lui $at, (0xFFFF7FFF >> 16)
ori $at, (0xFFFF7FFF & 0xFFFF)
b .L8032692C
and $s0, $s0, $at
glabel L80326984
.ifdef VERSION_EU
li $at, -2049
and $s0, $s0, $at
.endif
li $t2, 4
lui $at, %hi(D_80334920)
addu $at, $at, $t2
lw $t2, %lo(D_80334920)($at)
.ifdef VERSION_EU
lui $sp, %hi(D_80365E40)
addiu $sp, %lo(D_80365E40)
li $a0, 16
beqz $t2, .L803269A4
addiu $sp, $sp, 0xff0
.else
beqz $t2, .L803269A4
nop
.endif
jalr $t2
nop
.ifdef VERSION_EU
beqz $v0, .L803269A4
nop
b .L80326B9C
nop
.endif
.L803269A4:
jal send_mesg
.ifdef VERSION_EU
nop
b .L8032692C
nop
.else
li $a0, 16
li $at, -2049
b .L8032692C
and $s0, $s0, $at
.endif
glabel L803269B8
lui $s1, %hi(MI_INTR_REG) # $s1, 0xa430
.ifdef VERSION_EU
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lw $t0, ($t0)
.endif
lui $s1, %hi(MI_INTR_REG)
lw $s1, %lo(MI_INTR_REG)($s1)
.ifdef VERSION_EU
srl $t0, $t0, 0x10
and $s1, $s1, $t0
.else
andi $s1, $s1, 0x3f
.endif
andi $t1, $s1, 1
beqz $t1, .L80326A18
nop
lui $t4, %hi(SP_STATUS_REG) # $t4, 0xa404
lui $t4, %hi(SP_STATUS_REG)
lw $t4, %lo(SP_STATUS_REG)($t4)
li $t1, 8
lui $at, %hi(SP_STATUS_REG) # $at, 0xa404
lui $at, %hi(SP_STATUS_REG)
andi $t4, $t4, 0x300
andi $s1, $s1, 0x3e
beqz $t4, .L80326A08
@@ -288,7 +341,7 @@ glabel L803269B8
.L80326A18:
andi $t1, $s1, 8
beqz $t1, .L80326A3C
lui $at, %hi(VI_CURRENT_REG) # $at, 0xa440
lui $at, %hi(VI_CURRENT_REG)
andi $s1, $s1, 0x37
sw $zero, %lo(VI_CURRENT_REG)($at)
jal send_mesg
@@ -300,7 +353,7 @@ glabel L803269B8
beqz $t1, .L80326A68
nop
li $t1, 1
lui $at, %hi(AI_STATUS_REG) # $at, 0xa450
lui $at, %hi(AI_STATUS_REG)
andi $s1, $s1, 0x3b
sw $t1, %lo(AI_STATUS_REG)($at)
jal send_mesg
@@ -310,7 +363,7 @@ glabel L803269B8
.L80326A68:
andi $t1, $s1, 2
beqz $t1, .L80326A8C
lui $at, %hi(SI_STATUS_REG) # $at, 0xa480
lui $at, %hi(SI_STATUS_REG)
andi $s1, $s1, 0x3d
sw $zero, %lo(SI_STATUS_REG)($at)
jal send_mesg
@@ -322,7 +375,7 @@ glabel L803269B8
beqz $t1, .L80326AB8
nop
li $t1, 2
lui $at, %hi(PI_STATUS_REG) # $at, 0xa460
lui $at, %hi(PI_STATUS_REG)
andi $s1, $s1, 0x2f
sw $t1, %lo(PI_STATUS_REG)($at)
jal send_mesg
@@ -346,10 +399,10 @@ glabel L803269B8
glabel L80326AE8
lw $k1, 0x118($k0)
li $at, -4097
lui $t1, %hi(D_80334808) # $t1, 0x8033
lui $t1, %hi(D_80334808)
and $k1, $k1, $at
sw $k1, 0x118($k0)
addiu $t1, %lo(D_80334808) # addiu $t1, $t1, 0x4808
addiu $t1, %lo(D_80334808)
lw $t2, ($t1)
beqz $t2, .L80326B14
li $at, -4097
@@ -360,7 +413,7 @@ glabel L80326AE8
sw $t2, ($t1)
jal send_mesg
li $a0, 112
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8033
lui $t2, %hi(D_80334890 + 0x8)
lw $t2, %lo(D_80334890 + 0x8)($t2)
li $at, -4097
and $s0, $s0, $at
@@ -393,25 +446,26 @@ glabel L80326B64
li $a0, 80
b .L80326B9C
nop
.L80326B9C:
glabel L80326B9C
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8033
lui $t2, %hi(D_80334890 + 0x8)
lw $t2, %lo(D_80334890 + 0x8)($t2)
lw $t1, 4($k0)
lw $t3, 4($t2)
slt $at, $t1, $t3
beqz $at, .L80326BD0
nop
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8033
lui $a0, %hi(D_80334890 + 0x8)
move $a1, $k0
jal __osEnqueueThread
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x4898
addiu $a0, %lo(D_80334890 + 0x8)
j __osDispatchThread
nop
.L80326BD0:
lui $t1, %hi(D_80334890 + 0x8) # $t1, 0x8033
addiu $t1, %lo(D_80334890 + 0x8) # addiu $t1, $t1, 0x4898
lui $t1, %hi(D_80334890 + 0x8)
addiu $t1, %lo(D_80334890 + 0x8)
lw $t2, ($t1)
sw $t2, ($k0)
j __osDispatchThread
@@ -419,7 +473,7 @@ glabel L80326B9C
.L80326BE8:
glabel L80326BE8
lui $at, %hi(D_80334890 + 0x14) # $at, 0x8033
lui $at, %hi(D_80334890 + 0x14)
sw $k0, %lo(D_80334890 + 0x14)($at)
li $t1, 1
sh $t1, 0x10($k0)
@@ -431,369 +485,10 @@ glabel L80326BE8
li $a0, 96
j __osDispatchThread
nop
.else
lui $k0, %hi(gInterruptedThread) # $k0, 0x8033
addiu $k0, %lo(gInterruptedThread) # addiu $k0, $k0, 0x6ce0
sd $at, 0x20($k0)
mfc0 $k1, $12
sw $k1, 0x118($k0)
li $at, -4
and $k1, $k1, $at
mtc0 $k1, $12
sd $t0, 0x58($k0)
sd $t1, 0x60($k0)
sd $t2, 0x68($k0)
sw $zero, 0x18($k0)
mfc0 $t0, $13
move $t0, $k0
lui $k0, %hi(D_80334890 + 0x10) # $k0, 0x8030
lw $k0, %lo(D_80334890 + 0x10)($k0)
ld $t1, 0x20($t0)
sd $t1, 0x20($k0)
ld $t1, 0x118($t0)
sd $t1, 0x118($k0)
ld $t1, 0x58($t0)
sd $t1, 0x58($k0)
ld $t1, 0x60($t0)
sd $t1, 0x60($k0)
ld $t1, 0x68($t0)
sd $t1, 0x68($k0)
lw $k1, 0x118($k0)
mflo $t0
sd $t0, 0x108($k0)
mfhi $t0
andi $t1, $k1, 0xff00
sd $v0, 0x28($k0)
sd $v1, 0x30($k0)
sd $a0, 0x38($k0)
sd $a1, 0x40($k0)
sd $a2, 0x48($k0)
sd $a3, 0x50($k0)
sd $t3, 0x70($k0)
sd $t4, 0x78($k0)
sd $t5, 0x80($k0)
sd $t6, 0x88($k0)
sd $t7, 0x90($k0)
sd $s0, 0x98($k0)
sd $s1, 0xa0($k0)
sd $s2, 0xa8($k0)
sd $s3, 0xb0($k0)
sd $s4, 0xb8($k0)
sd $s5, 0xc0($k0)
sd $s6, 0xc8($k0)
sd $s7, 0xd0($k0)
sd $t8, 0xd8($k0)
sd $t9, 0xe0($k0)
sd $gp, 0xe8($k0)
sd $sp, 0xf0($k0)
sd $fp, 0xf8($k0)
sd $ra, 0x100($k0)
beqz $t1, .L802F3A18
sd $t0, 0x110($k0)
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
lw $t0, ($t0)
li $at, -1
xor $t0, $t0, $at
lui $at, (0xFFFF00FF >> 16) # lui $at, 0xffff
andi $t0, $t0, 0xff00
ori $at, (0xFFFF00FF & 0xFFFF) # ori $at, $at, 0xff
or $t1, $t1, $t0
and $k1, $k1, $at
or $k1, $k1, $t1
sw $k1, 0x118($k0)
.L802F3A18:
lui $t1, %hi(MI_INTR_MASK_REG) # $t1, 0xa430
lw $t1, %lo(MI_INTR_MASK_REG)($t1)
beqz $t1, .L802F3A50
nop
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
lw $t0, ($t0)
lw $t4, 0x128($k0)
li $at, -1
srl $t0, $t0, 0x10
xor $t0, $t0, $at
andi $t0, $t0, 0x3f
and $t0, $t0, $t4
or $t1, $t1, $t0
.L802F3A50:
sw $t1, 0x128($k0)
mfc0 $t0, $14
sw $t0, 0x11c($k0)
lw $t0, 0x18($k0)
beqz $t0, .L802F3AB4
nop
cfc1 $t0, $31
nop
sw $t0, 0x12c($k0)
sdc1 $f0, 0x130($k0)
sdc1 $f2, 0x138($k0)
sdc1 $f4, 0x140($k0)
sdc1 $f6, 0x148($k0)
sdc1 $f8, 0x150($k0)
sdc1 $f10, 0x158($k0)
sdc1 $f12, 0x160($k0)
sdc1 $f14, 0x168($k0)
sdc1 $f16, 0x170($k0)
sdc1 $f18, 0x178($k0)
sdc1 $f20, 0x180($k0)
sdc1 $f22, 0x188($k0)
sdc1 $f24, 0x190($k0)
sdc1 $f26, 0x198($k0)
sdc1 $f28, 0x1a0($k0)
sdc1 $f30, 0x1a8($k0)
.L802F3AB4:
mfc0 $t0, $13
sw $t0, 0x120($k0)
li $t1, 2
sh $t1, 0x10($k0)
andi $t1, $t0, 0x7c
li $t2, 36
beq $t1, $t2, .L802F3D90
nop
li $t2, 44
beq $t1, $t2, .L80326CCC
nop
li $t2, 0
bne $t1, $t2, .L80326BE8
nop
and $s0, $k1, $t0
.L802F3AF0:
andi $t1, $s0, 0xff00
srl $t2, $t1, 0xc
bnez $t2, .L802F3B08
nop
srl $t2, $t1, 8
addi $t2, $t2, 0x10
.L802F3B08:
lui $at, %hi(D_80338610)
addu $at, $at, $t2
lbu $t2, %lo(D_80338610)($at)
lui $at, %hi(jtbl_80338630)
addu $at, $at, $t2
lw $t2, %lo(jtbl_80338630)($at)
jr $t2
nop
li $at, -8193
b .L802F3AF0
and $s0, $s0, $at
li $at, -16385
b .L802F3AF0
and $s0, $s0, $at
glabel L80326964 #probably not right...
mfc0 $t1, $11
mtc0 $t1, $11
jal send_mesg
li $a0, 24
lui $at, (0xFFFF7FFF >> 16) # lui $at, 0xffff
ori $at, (0xFFFF7FFF & 0xFFFF) # ori $at, $at, 0x7fff
b .L802F3AF0
and $s0, $s0, $at
glabel L80326984 #possibly wrong
li $at, -2049
and $s0, $s0, $at
li $t2, 4
lui $at, %hi(D_80334920)
addu $at, $at, $t2
lw $t2, %lo(D_80334920)($at)
lui $sp, %hi(D_80365E40) # $sp, 0x8033 #.bss stack for D_802F4380
addiu $sp, %lo(D_80365E40) # addiu $sp, $sp, 0x5c20
li $a0, 16
beqz $t2, .L802F3BA4
addiu $sp, $sp, 0xff0
jalr $t2
nop
beqz $v0, .L802F3BA4
nop
b .L802F3DA8
nop
.L802F3BA4:
jal send_mesg
nop
b .L802F3AF0
nop
glabel L803269B8
lui $t0, %hi(D_8030208C) # $t0, 0x8030
addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
lw $t0, ($t0)
lui $s1, %hi(MI_INTR_REG) # $s1, 0xa430
lw $s1, %lo(MI_INTR_REG)($s1)
srl $t0, $t0, 0x10
and $s1, $s1, $t0
andi $t1, $s1, 1
beqz $t1, .L802F3C24
nop
lui $t4, %hi(SP_STATUS_REG) # $t4, 0xa404
lw $t4, %lo(SP_STATUS_REG)($t4)
li $t1, 8
lui $at, %hi(SP_STATUS_REG) # $at, 0xa404
andi $t4, $t4, 0x300
andi $s1, $s1, 0x3e
beqz $t4, .L802F3C14
sw $t1, %lo(SP_STATUS_REG)($at)
jal send_mesg
li $a0, 32
beqz $s1, .L802F3CE8
nop
b .L802F3C24
nop
.L802F3C14:
jal send_mesg
li $a0, 88
beqz $s1, .L802F3CE8
nop
.L802F3C24:
andi $t1, $s1, 8
beqz $t1, .L802F3C48
lui $at, %hi(VI_CURRENT_REG) # $at, 0xa440
andi $s1, $s1, 0x37
sw $zero, %lo(VI_CURRENT_REG)($at)
jal send_mesg
li $a0, 56
beqz $s1, .L802F3CE8
nop
.L802F3C48:
andi $t1, $s1, 4
beqz $t1, .L802F3C74
nop
li $t1, 1
lui $at, %hi(AI_STATUS_REG) # $at, 0xa450
andi $s1, $s1, 0x3b
sw $t1, %lo(AI_STATUS_REG)($at)
jal send_mesg
li $a0, 48
beqz $s1, .L802F3CE8
nop
.L802F3C74:
andi $t1, $s1, 2
beqz $t1, .L802F3C98
lui $at, %hi(SI_STATUS_REG) # $at, 0xa480
andi $s1, $s1, 0x3d
sw $zero, %lo(SI_STATUS_REG)($at)
jal send_mesg
li $a0, 40
beqz $s1, .L802F3CE8
nop
.L802F3C98:
andi $t1, $s1, 0x10
beqz $t1, .L802F3CC4
nop
li $t1, 2
lui $at, %hi(PI_STATUS_REG) # $at, 0xa460
andi $s1, $s1, 0x2f
sw $t1, %lo(PI_STATUS_REG)($at)
jal send_mesg
li $a0, 64
beqz $s1, .L802F3CE8
nop
.L802F3CC4:
andi $t1, $s1, 0x20
beqz $t1, .L802F3CE8
nop
li $t1, 2048
lui $at, 0xa430
andi $s1, $s1, 0x1f
sw $t1, ($at)
jal send_mesg
li $a0, 72
.L802F3CE8:
li $at, -1025
b .L802F3AF0
and $s0, $s0, $at
glabel L80326AE8
lw $k1, 0x118($k0)
li $at, -4097
lui $t1, %hi(D_80334808) # $t1, 0x8030
and $k1, $k1, $at
sw $k1, 0x118($k0)
addiu $t1, %lo(D_80334808) # addiu $t1, $t1, 0x2088
lw $t2, ($t1)
beqz $t2, .L802F3D20
li $at, -4097
b .L802F3DA8
and $s0, $s0, $at
.L802F3D20:
li $t2, 1
sw $t2, ($t1)
jal send_mesg
li $a0, 112
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8030
lw $t2, %lo(D_80334890 + 0x8)($t2)
li $at, -4097
and $s0, $s0, $at
lw $k1, 0x118($t2)
and $k1, $k1, $at
b .L802F3DA8
sw $k1, 0x118($t2)
glabel L80326B44
li $at, -513
and $t0, $t0, $at
mtc0 $t0, $13
jal send_mesg
li $a0, 8
li $at, -513
b .L802F3AF0
and $s0, $s0, $at
glabel L80326B64
li $at, -257
and $t0, $t0, $at
mtc0 $t0, $13
jal send_mesg
li $a0, 0
li $at, -257
b .L802F3AF0
and $s0, $s0, $at
.L802F3D90:
li $t1, 1
sh $t1, 0x12($k0)
jal send_mesg
li $a0, 80
b .L802F3DA8
nop
.L802F3DA8:
glabel L80326B9C
lui $t2, %hi(D_80334890 + 0x8) # $t2, 0x8030
lw $t2, %lo(D_80334890 + 0x8)($t2)
lw $t1, 4($k0)
lw $t3, 4($t2)
slt $at, $t1, $t3
beqz $at, .L80326BD0
nop
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8030
move $a1, $k0
jal __osEnqueueThread
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x2ef8
j __osDispatchThread
nop
.L80326BD0:
lui $t1, %hi(D_80334890 + 0x8) # $t1, 0x8030
addiu $t1, %lo(D_80334890 + 0x8) # addiu $t1, $t1, 0x2ef8
lw $t2, ($t1)
sw $t2, ($k0)
j __osDispatchThread
sw $k0, ($t1)
.L80326BE8:
glabel L80326BE8
lui $at, %hi(D_80334890 + 0x14) # $at, 0x8030
sw $k0, %lo(D_80334890 + 0x14)($at)
li $t1, 1
sh $t1, 0x10($k0)
li $t1, 2
sh $t1, 0x12($k0)
mfc0 $t2, $8
sw $t2, 0x124($k0)
jal send_mesg
li $a0, 96
j __osDispatchThread
nop
.endif
glabel send_mesg
lui $t2, %hi(D_80363830) # $t2, 0x8036
addiu $t2, %lo(D_80363830) # addiu $t2, $t2, 0x3830
lui $t2, %hi(D_80363830)
addiu $t2, %lo(D_80363830)
addu $t2, $t2, $a0
lw $t1, ($t2)
move $s2, $ra
@@ -833,10 +528,10 @@ glabel send_mesg
jal __osPopThread
move $a0, $t1
move $t2, $v0
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8033
lui $a0, %hi(D_80334890 + 0x8)
move $a1, $t2
jal __osEnqueueThread
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x4898
addiu $a0, %lo(D_80334890 + 0x8)
.L80326CC4:
jr $s2
nop
@@ -857,7 +552,7 @@ glabel send_mesg
glabel __osEnqueueAndYield
lui $a1, %hi(D_80334890 + 0x10) # $a1, 0x8033
lui $a1, %hi(D_80334890 + 0x10)
lw $a1, %lo(D_80334890 + 0x10)($a1)
mfc0 $t0, $12
lw $k1, 0x18($a1)
@@ -875,11 +570,7 @@ glabel __osEnqueueAndYield
sd $sp, 0xf0($a1)
sd $fp, 0xf8($a1)
sd $ra, 0x100($a1)
.ifdef VERSION_EU
beqz $k1, .L802F3F7C
.else
beqz $k1, .L80326D70
.endif
sw $ra, 0x11c($a1)
cfc1 $k1, $31
sdc1 $f20, 0x180($a1)
@@ -890,47 +581,42 @@ glabel __osEnqueueAndYield
sdc1 $f30, 0x1a8($a1)
sw $k1, 0x12c($a1)
.ifdef VERSION_EU
.L802F3F7C:
/* 0B377C 802F3F7C 8CBB0118 */ lw $k1, 0x118($a1)
/* 0B3780 802F3F80 3369FF00 */ andi $t1, $k1, 0xff00
/* 0B3784 802F3F84 1120000D */ beqz $t1, .L802F3FBC
/* 0B3788 802F3F88 00000000 */ nop
/* 0B378C 802F3F8C 3C088030 */ lui $t0, %hi(D_8030208C) # $t0, 0x8030
/* 0B3790 802F3F90 2508208C */ addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
/* 0B3794 802F3F94 8D080000 */ lw $t0, ($t0)
/* 0B3798 802F3F98 2401FFFF */ li $at, -1
/* 0B379C 802F3F9C 01014026 */ xor $t0, $t0, $at
/* 0B37A0 802F3FA0 3C01FFFF */ lui $at, (0xFFFF00FF >> 16) # lui $at, 0xffff
/* 0B37A4 802F3FA4 3108FF00 */ andi $t0, $t0, 0xff00
/* 0B37A8 802F3FA8 342100FF */ ori $at, (0xFFFF00FF & 0xFFFF) # ori $at, $at, 0xff
/* 0B37AC 802F3FAC 01284825 */ or $t1, $t1, $t0
/* 0B37B0 802F3FB0 0361D824 */ and $k1, $k1, $at
/* 0B37B4 802F3FB4 0369D825 */ or $k1, $k1, $t1
/* 0B37B8 802F3FB8 ACBB0118 */ sw $k1, 0x118($a1)
.L802F3FBC:
/* 0B37BC 802F3FBC 3C1BA430 */ lui $k1, %hi(MI_INTR_MASK_REG) # $k1, 0xa430
/* 0B37C0 802F3FC0 8F7B000C */ lw $k1, %lo(MI_INTR_MASK_REG)($k1)
/* 0B37C4 802F3FC4 1360000B */ beqz $k1, .L802F3FF4
/* 0B37C8 802F3FC8 00000000 */ nop
/* 0B37CC 802F3FCC 3C1A8030 */ lui $k0, %hi(D_8030208C) # $k0, 0x8030
/* 0B37D0 802F3FD0 275A208C */ addiu $k0, %lo(D_8030208C) # addiu $k0, $k0, 0x208c
/* 0B37D4 802F3FD4 8F5A0000 */ lw $k0, ($k0)
/* 0B37D8 802F3FD8 8CA80128 */ lw $t0, 0x128($a1)
/* 0B37DC 802F3FDC 2401FFFF */ li $at, -1
/* 0B37E0 802F3FE0 001AD402 */ srl $k0, $k0, 0x10
/* 0B37E4 802F3FE4 0341D026 */ xor $k0, $k0, $at
/* 0B37E8 802F3FE8 335A003F */ andi $k0, $k0, 0x3f
/* 0B37EC 802F3FEC 0348D024 */ and $k0, $k0, $t0
/* 0B37F0 802F3FF0 037AD825 */ or $k1, $k1, $k0
.L802F3FF4:
.endif
.L80326D70:
.ifndef VERSION_EU
lui $k1, %hi(MI_INTR_MASK_REG) # $k1, 0xa430
.ifdef VERSION_EU
lw $k1, 0x118($a1)
andi $t1, $k1, 0xff00
beqz $t1, .L802F3FBC
nop
lui $t0, %hi(D_8030208C)
addiu $t0, %lo(D_8030208C)
lw $t0, ($t0)
li $at, -1
xor $t0, $t0, $at
lui $at, (0xFFFF00FF >> 16)
andi $t0, $t0, 0xff00
ori $at, (0xFFFF00FF & 0xFFFF)
or $t1, $t1, $t0
and $k1, $k1, $at
or $k1, $k1, $t1
sw $k1, 0x118($a1)
.L802F3FBC:
.endif
lui $k1, %hi(MI_INTR_MASK_REG)
lw $k1, %lo(MI_INTR_MASK_REG)($k1)
.ifdef VERSION_EU
beqz $k1, .L802F3FF4
nop
lui $k0, %hi(D_8030208C)
addiu $k0, %lo(D_8030208C)
lw $k0, ($k0)
lw $t0, 0x128($a1)
li $at, -1
srl $k0, $k0, 0x10
xor $k0, $k0, $at
andi $k0, $k0, 0x3f
and $k0, $k0, $t0
or $k1, $k1, $k0
.L802F3FF4:
.endif
beqz $a0, .L80326D88
sw $k1, 0x128($a1)
@@ -940,7 +626,6 @@ glabel __osEnqueueAndYield
j __osDispatchThread
nop
#enqueue and pop look like compiled functions? but there's no easy way to extract them
glabel __osEnqueueThread
lw $t8, ($a0)
@@ -971,29 +656,27 @@ glabel __osPopThread
sw $t9, ($a0)
glabel __osDispatchThread
lui $a0, %hi(D_80334890 + 0x8) # $a0, 0x8033
lui $a0, %hi(D_80334890 + 0x8)
jal __osPopThread
addiu $a0, %lo(D_80334890 + 0x8) # addiu $a0, $a0, 0x4898
lui $at, %hi(D_80334890 + 0x10) # $at, 0x8033
addiu $a0, %lo(D_80334890 + 0x8)
lui $at, %hi(D_80334890 + 0x10)
sw $v0, %lo(D_80334890 + 0x10)($at)
li $t0, 4
sh $t0, 0x10($v0)
move $k0, $v0
.ifdef VERSION_EU
/* 0B3884 802F4084 3C088030 */ lui $t0, %hi(D_8030208C) # $t0, 0x8030
/* 0B3888 802F4088 8F5B0118 */ lw $k1, 0x118($k0)
/* 0B388C 802F408C 2508208C */ addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
/* 0B3890 802F4090 8D080000 */ lw $t0, ($t0)
/* 0B3894 802F4094 3C01FFFF */ lui $at, (0xFFFF00FF >> 16) # lui $at, 0xffff
/* 0B3898 802F4098 3369FF00 */ andi $t1, $k1, 0xff00
/* 0B389C 802F409C 342100FF */ ori $at, (0xFFFF00FF & 0xFFFF) # ori $at, $at, 0xff
/* 0B38A0 802F40A0 3108FF00 */ andi $t0, $t0, 0xff00
/* 0B38A4 802F40A4 01284824 */ and $t1, $t1, $t0
/* 0B38A8 802F40A8 0361D824 */ and $k1, $k1, $at
/* 0B38AC 802F40AC 0369D825 */ or $k1, $k1, $t1
/* 0B38B0 802F40B0 409B6000 */ mtc0 $k1, $12
lui $t0, %hi(D_8030208C)
lw $k1, 0x118($k0)
addiu $t0, %lo(D_8030208C)
lw $t0, ($t0)
lui $at, (0xFFFF00FF >> 16)
andi $t1, $k1, 0xff00
ori $at, (0xFFFF00FF & 0xFFFF)
andi $t0, $t0, 0xff00
and $t1, $t1, $t0
and $k1, $k1, $at
or $k1, $k1, $t1
mtc0 $k1, $12
.endif
.L80326E08:
ld $k1, 0x108($k0)
@@ -1059,19 +742,19 @@ glabel __osDispatchThread
.L80326EF0:
lw $k1, 0x128($k0)
.ifdef VERSION_EU
/* 0B3998 802F4198 3C1A8030 */ lui $k0, %hi(D_8030208C) # $k0, 0x8030
/* 0B399C 802F419C 275A208C */ addiu $k0, %lo(D_8030208C) # addiu $k0, $k0, 0x208c
/* 0B39A0 802F41A0 8F5A0000 */ lw $k0, ($k0)
/* 0B39A4 802F41A4 001AD402 */ srl $k0, $k0, 0x10
/* 0B39A8 802F41A8 037AD824 */ and $k1, $k1, $k0
lui $k0, %hi(D_8030208C)
addiu $k0, %lo(D_8030208C)
lw $k0, ($k0)
srl $k0, $k0, 0x10
and $k1, $k1, $k0
.endif
sll $k1, $k1, 1
lui $k0, %hi(D_803386D0) # $k0, 0x8034
addiu $k0, %lo(D_803386D0) # addiu $k0, $k0, -0x7930
lui $k0, %hi(D_803386D0)
addiu $k0, %lo(D_803386D0)
addu $k1, $k1, $k0
lhu $k1, ($k1)
lui $k0, %hi(MI_INTR_MASK_REG) # $k0, 0xa430
addiu $k0, %lo(MI_INTR_MASK_REG) # addiu $k0, $k0, 0xc
lui $k0, %hi(MI_INTR_MASK_REG)
addiu $k0, %lo(MI_INTR_MASK_REG)
sw $k1, ($k0)
nop
nop
@@ -1111,8 +794,8 @@ glabel jtbl_80338630
.word L80326984
.word L80326AE8
.ifdef VERSION_EU
.word 0x802f3b28
.word 0x802f3b34
.word L802F3B28
.word L802F3B34
.else
.word L80326BE8
.word L80326BE8
+11
View File
@@ -0,0 +1,11 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64
.include "macros.inc"
.section .text, "ax"
glabel sqrtf
jr $ra
sqrt.s $f0, $f12
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

+6 -22
View File
@@ -5,22 +5,14 @@
.balign 16
glabel rspF3DBootStart
.ifndef VERSION_EU
.incbin "lib/PR/boot/F3D_boot.bin"
.else
.incbin "lib/PR/boot/F3D_boot_eu.bin"
.half 0
.endif
.incbin "rsp/rspboot.bin"
.balign 16
glabel rspF3DBootEnd
.balign 16
.ifndef F3DEX_GBI_SHARED
glabel rspF3DStart /* Use regular Fast3D bins (default) */
.ifndef F3D_OLD
.incbin "lib/PR/f3d/new/F3D.bin" /* OS 2.0H (J2 and IQ) */
.else
.incbin "lib/PR/f3d/old/F3D.bin" /* OS 2.0D (US and JP) */
.endif
.incbin "rsp/fast3d.bin"
glabel rspF3DEnd
.else /* Use one of the Fast3DEX series grucodes. */
@@ -39,7 +31,7 @@ glabel rspF3DEnd
.balign 16
glabel rspAspMainStart
.incbin "lib/PR/audio/aspMain.bin"
.incbin "rsp/audio.bin"
glabel rspAspMainEnd
/*
@@ -135,15 +127,7 @@ glabel rspS2DEXEnd
.balign 16
.ifndef F3DEX_GBI_SHARED /* Use regular Fast3D data (default) */
glabel rspF3DDataStart
.ifndef F3D_OLD /* OS 2.0H (J2 and IQ) */
.ifdef VERSION_EU
.incbin "lib/PR/f3d/new/F3D_data_EU.bin"
.else
.incbin "lib/PR/f3d/new/F3D_data.bin"
.endif
.else /* OS 2.0D (US and JP) */
.incbin "lib/PR/f3d/old/F3D_data.bin"
.endif
.incbin "rsp/fast3d_data.bin"
glabel rspF3DDataEnd
.else /* Using one of the Fast3DEX series grucodes */
@@ -162,7 +146,7 @@ glabel rspF3DDataEnd
.balign 16
glabel rspAspMainDataStart
.incbin "lib/PR/audio/aspMain_data.bin"
.incbin "rsp/audio_data.bin"
glabel rspAspMainDataEnd
/* LESS COMMON MICROCODES */
+1 -1
View File
@@ -3,7 +3,7 @@
// an array of pointers to functions taking no arguments and returning u32...
// this is only referenced in the exception handler and here. this function is called with a0=1 and
// then the same memory address is loaded. it's definitely an array access though..
extern u32 (*D_80334920[8])() ;
extern u32 (*D_80334920[8])(void) ;
void EU_D_802f4330(u32 a0, u32 a1(void)) {
register u32 int_disabled = __osDisableInt();
+3 -3
View File
@@ -6,13 +6,13 @@ OSMesg osPiMesgBuff[PIAccessQueueSize];
OSMesgQueue gOsPiMessageQueue;
u32 gOsPiAccessQueueCreated = 0;
void __osPiCreateAccessQueue() {
void __osPiCreateAccessQueue(void) {
gOsPiAccessQueueCreated = 1;
osCreateMesgQueue(&gOsPiMessageQueue, &osPiMesgBuff[0], PIAccessQueueSize - 1);
osSendMesg(&gOsPiMessageQueue, NULL, OS_MESG_NOBLOCK);
}
void __osPiGetAccess() {
void __osPiGetAccess(void) {
OSMesg sp1c;
if (!gOsPiAccessQueueCreated) {
__osPiCreateAccessQueue();
@@ -20,6 +20,6 @@ void __osPiGetAccess() {
osRecvMesg(&gOsPiMessageQueue, &sp1c, OS_MESG_BLOCK);
}
void __osPiRelAccess() {
void __osPiRelAccess(void) {
osSendMesg(&gOsPiMessageQueue, NULL, OS_MESG_NOBLOCK);
}
+1 -1
View File
@@ -57,7 +57,7 @@ static void _bnkfPatchBank(ALInstrument *inst, ALBankFile *f, u8 *table) {
// Force adding another jr $ra. Has to be called or it doesn't get put in the
// right place.
static void unused() {
static void unused(void) {
}
void alBnkfNew(ALBankFile *f, u8 *table) {
+3 -134
View File
@@ -1,82 +1,16 @@
#include "new_func.h"
void func_802F4A20() {
void func_802F4A20(void) {
__OSTranxInfo *sp1c;
volatile u32 sp18;
// lui $t6, %hi(__osDiskHandle) # $t6, 0x8033
// lw $t6, %lo(__osDiskHandle)($t6)
// addiu $sp, $sp, -0x20
// sw $ra, 0x14($sp)
// addiu $t7, $t6, 0x14
// sw $t7, 0x1c($sp)
sp1c = &__osDiskHandle->transferInfo;
// lui $t8, %hi(PI_STATUS_REG) # $t8, 0xa460
// lw $t9, %lo(PI_STATUS_REG)($t8)
// sw $t9, 0x18($sp)
// sp18 = HW_REG(PI_STATUS_REG, u32);
// while(sp18 & 0x2) sp18 = HW_REG(PI_STATUS_REG, u32);
WAIT_ON_IOBUSY(sp18);
// lw $t0, 0x18($sp)
// andi $t1, $t0, 2
// beqz $t1, .L802F4A70
// nop
// L802F4A54:
// lui $t2, %hi(PI_STATUS_REG) # $t2, 0xa460
// lw $t3, %lo(PI_STATUS_REG)($t2)
// sw $t3, 0x18($sp)
// lw $t4, 0x18($sp)
// andi $t5, $t4, 2
// bnez $t5, .L802F4A54
// nop
// L802F4A70:
// lw $t6, 0x1c($sp)
// lui $at, 0x1000
// lui $t9, %hi(D_A5000510) # $t9, 0xa500
// lw $t7, 0x14($t6)
// lui $t0, %hi(PI_STATUS_REG) # $t0, 0xa460
// or $t8, $t7, $at
// sw $t8, %lo(D_A5000510)($t9)
HW_REG(ASIC_BM_CTL, u32) = BUFFER_MANAGER_RESET | sp1c->bmCtlShadow; //should be unk10??
// lw $t1, %lo(PI_STATUS_REG)($t0)
// sw $t1, 0x18($sp)
// lw $t2, 0x18($sp)
// andi $t3, $t2, 2
// beqz $t3, .L802F4AC0
// nop
WAIT_ON_IOBUSY(sp18);
// L802F4AA4:
// lui $t4, %hi(PI_STATUS_REG) # $t4, 0xa460
// lw $t5, %lo(PI_STATUS_REG)($t4)
// sw $t5, 0x18($sp)
// lw $t6, 0x18($sp)
// andi $t7, $t6, 2
// bnez $t7, .L802F4AA4
// nop
// L802F4AC0:
// lw $t8, 0x1c($sp)
// lui $t0, %hi(D_A5000510) # $t0, 0xa500
// lw $t9, 0x14($t8)
// jal func_802F4B08
// sw $t9, %lo(D_A5000510)($t0)
HW_REG(ASIC_BM_CTL, u32) = sp1c->bmCtlShadow;
func_802F4B08();
// li $t1, 2
// lui $t2, %hi(PI_STATUS_REG) # $t2, 0xa460
// sw $t1, %lo(PI_STATUS_REG)($t2)
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
// lui $t3, %hi(D_8030208C) # $t3, 0x8030
// lw $t3, %lo(D_8030208C)($t3)
// lui $at, (0x00100401 >> 16) # lui $at, 0x10
// lw $ra, 0x14($sp)
// ori $at, (0x00100401 & 0xFFFF) # ori $at, $at, 0x401
// or $t4, $t3, $at
// lui $at, %hi(D_8030208C) # $at, 0x8030
// sw $t4, %lo(D_8030208C)($at)
D_8030208C |= 0x00100401; //TODO: fix magic numbers
// jr $ra
// addiu $sp, $sp, 0x20
}
typedef struct OSEventMessageStruct_0_s {
@@ -85,86 +19,21 @@ typedef struct OSEventMessageStruct_0_s {
} OSEventMessageStruct_0;
extern OSEventMessageStruct_0 D_80363830[16]; // should be OS_NUM_EVENTS + 1 I think
void func_802F4B08() {
void func_802F4B08(void) {
OSEventMessageStruct_0 *sp2c;
OSMesgQueue *sp28;
u32 sp24;
register OSThread *s0;
// addiu $sp, $sp, -0x30
// lui $t6, %hi(D_80363830) # $t6, 0x8033
// addiu $t6, %lo(D_80363830) # addiu $t6, $t6, 0x36d0
// addiu $t7, $t6, 0x40
// sw $ra, 0x1c($sp)
// sw $s0, 0x18($sp)
// sw $t7, 0x2c($sp)
sp2c = &D_80363830[OS_EVENT_PI];
// lw $t8, 0x40($t6)
// beqz $t8, .L802F4BE0
// sw $t8, 0x28($sp)
sp28 = sp2c->queue;
// lw $t9, 8($t8)
// lw $t0, 0x10($t8)
// slt $at, $t9, $t0
// beqz $at, .L802F4BE0
// nop
if (!sp28 || sp28->validCount >= sp28->msgCount)
return;
// lw $t1, 0x28($sp)
// lw $t6, 0x2c($sp)
// lw $t2, 0xc($t1)
// lw $t3, 8($t1)
// lw $t5, 0x10($t1)
// addu $t4, $t2, $t3
// div $zero, $t4, $t5
// mfhi $t7
// sw $t7, 0x24($sp)
sp24 = (sp28->first + sp28->validCount) % sp28->msgCount;
// lw $t0, 0x14($t1)
// lw $t8, 4($t6)
// sll $t9, $t7, 2
// addu $t2, $t0, $t9
// sw $t8, ($t2)
sp28->msg[sp24] = sp2c->msg;
// lw $t3, 0x28($sp)
// bnez $t5, .L802F4B8C
// nop
// break 7
// L802F4B8C:
// li $at, -1
// bne $t5, $at, .L802F4BA4
// lui $at, 0x8000
// bne $t4, $at, .L802F4BA4
// nop
// break 6
// L802F4BA4:
// lw $t4, 8($t3)
// addiu $t5, $t4, 1
// sw $t5, 8($t3)
sp28->validCount += 1;
// lw $t6, 0x28($sp)
// lw $t7, ($t6)
// lw $t1, ($t7)
// beqz $t1, .L802F4BE0
// nop
// jal __osPopThread
// move $a0, $t6
if (sp28->mtqueue->next != NULL) {
s0 = __osPopThread(&sp28->mtqueue);
// move $s0, $v0
// lui $a0, %hi(D_80334898) # $a0, 0x8030
// addiu $a0, %lo(D_80334898) # addiu $a0, $a0, 0x2ef8
// jal __osEnqueueThread
// move $a1, $s0
__osEnqueueThread(&D_80334898, s0);
}
// L802F4BE0:
// lw $ra, 0x1c($sp)
// lw $s0, 0x18($sp)
// addiu $sp, $sp, 0x30
// jr $ra
// nop
// nop
// nop
// nop
}
+2 -24
View File
@@ -1,31 +1,9 @@
#include "libultra_internal.h"
extern u32 D_8030208C;
#include "new_func.h"
void func_802F7140(u32 a0) {
register u32 s0;
s0 = __osDisableInt();
D_8030208C &= ~(-0x402 & a0);
__osRestoreInt(s0);
}
/*
/ 0B6940 802F7140 27BDFFD8 / addiu $sp, $sp, -0x28
/ 0B6944 802F7144 AFBF001C / sw $ra, 0x1c($sp)
/ 0B6948 802F7148 AFA40028 / sw $a0, 0x28($sp)
/ 0B694C 802F714C 0C0BD400 / jal __osDisableInt
/ 0B6950 802F7150 AFB00018 / sw $s0, 0x18($sp)
/ 0B6954 802F7154 8FAF0028 / lw $t7, 0x28($sp)
/ 0B6958 802F7158 3C0E8030 / lui $t6, %hi(D_8030208C) # $t6, 0x8030
/ 0B695C 802F715C 8DCE208C / lw $t6, %lo(D_8030208C)($t6)
/ 0B6960 802F7160 2401FBFE / li $at, -1026
/ 0B6964 802F7164 01E1C024 / and $t8, $t7, $at
/ 0B6968 802F7168 0300C827 / not $t9, $t8
/ 0B696C 802F716C 00408025 / move $s0, $v0
/ 0B6970 802F7170 3C018030 / lui $at, %hi(D_8030208C) # $at, 0x8030
/ 0B6974 802F7174 01D94024 / and $t0, $t6, $t9
/ 0B6978 802F7178 AC28208C / sw $t0, %lo(D_8030208C)($at)
/ 0B697C 802F717C 0C0BD408 / jal __osRestoreInt
/ 0B6980 802F7180 02002025 / move $a0, $s0
/ 0B6984 802F7184 8FBF001C / lw $ra, 0x1c($sp)
/ 0B6988 802F7188 8FB00018 / lw $s0, 0x18($sp)
/ 0B698C 802F718C 27BD0028 / addiu $sp, $sp, 0x28
/ 0B6990 802F7190 03E00008 / jr $ra
/ 0B6994 802F7194 00000000 / nop */
+1 -24
View File
@@ -1,31 +1,8 @@
#include "libultra_internal.h"
void func_802F71F0() {
void func_802F71F0(void) {
register u32 s0 = __osDisableInt();
D_803348A0->state = OS_STATE_RUNNABLE;
__osEnqueueAndYield(&D_80334898);
__osRestoreInt(s0);
}
/*
/ 0B69F0 802F71F0 27BDFFD8 / addiu $sp, $sp, -0x28
/ 0B69F4 802F71F4 AFBF001C / sw $ra, 0x1c($sp)
/ 0B69F8 802F71F8 0C0BD400 / jal __osDisableInt
/ 0B69FC 802F71FC AFB00018 / sw $s0, 0x18($sp)
/ 0B6A00 802F7200 3C0F8030 / lui $t7, %hi(D_803348A0) # $t7, 0x8030
/ 0B6A04 802F7204 8DEF2F00 / lw $t7, %lo(D_803348A0)($t7)
/ 0B6A08 802F7208 240E0002 / li $t6, 2
/ 0B6A0C 802F720C 3C048030 / lui $a0, %hi(D_80334898) # $a0, 0x8030
/ 0B6A10 802F7210 00408025 / move $s0, $v0
/ 0B6A14 802F7214 24842EF8 / addiu $a0, %lo(D_80334898) # addiu $a0, $a0, 0x2ef8
/ 0B6A18 802F7218 0C0BCFC3 / jal __osEnqueueAndYield
/ 0B6A1C 802F721C A5EE0010 / sh $t6, 0x10($t7)
/ 0B6A20 802F7220 0C0BD408 / jal __osRestoreInt
/ 0B6A24 802F7224 02002025 / move $a0, $s0
/ 0B6A28 802F7228 8FBF001C / lw $ra, 0x1c($sp)
/ 0B6A2C 802F722C 8FB00018 / lw $s0, 0x18($sp)
/ 0B6A30 802F7230 27BD0028 / addiu $sp, $sp, 0x28
/ 0B6A34 802F7234 03E00008 / jr $ra
/ 0B6A38 802F7238 00000000 / nop
/ 0B6A3C 802F723C 00000000 / nop */
+13
View File
@@ -1,5 +1,9 @@
#include "libultra_internal.h"
#ifdef GBI_FLOATS
#include <string.h>
#endif
#ifndef GBI_FLOATS
void guMtxF2L(float mf[4][4], Mtx *m) {
int r, c;
s32 tmp1;
@@ -35,6 +39,11 @@ void guMtxL2F(float mf[4][4], Mtx *m) {
}
}
}
#else
void guMtxF2L(float mf[4][4], Mtx *m) {
memcpy(m, mf, sizeof(Mtx));
}
#endif
void guMtxIdentF(float mf[4][4]) {
int r, c;
@@ -49,7 +58,11 @@ void guMtxIdentF(float mf[4][4]) {
}
}
void guMtxIdent(Mtx *m) {
#ifndef GBI_FLOATS
float mf[4][4];
guMtxIdentF(mf);
guMtxF2L(mf, m);
#else
guMtxIdentF(m->m);
#endif
}
+4 -2
View File
@@ -68,14 +68,16 @@ void send(u8 *buff, s32 len) {
send_packet(&buff[end], rem);
}
}
void process_command_memory() {
void process_command_memory(void) {
u32 sp1c;
u32 sp18;
sp1c = string_to_u32(&D_80365E40[1]);
sp18 = string_to_u32(&D_80365E40[5]);
send((u8 *) (uintptr_t) sp1c, sp18);
}
void process_command_register() {
void process_command_register(void) {
send((u8 *) &gInterruptedThread.context, sizeof(__OSThreadContext));
}
+17 -17
View File
@@ -60,40 +60,40 @@ typedef struct {
#endif
} OSMgrArgs;
s32 __osDisableInt();
s32 __osDisableInt(void);
void __osRestoreInt(s32);
void __osEnqueueAndYield(OSThread **);
void __osDequeueThread(OSThread **, OSThread *);
void __osEnqueueThread(OSThread **, OSThread *);
OSThread *__osPopThread(OSThread **);
s32 __osSiRawStartDma(s32, void *);
void __osSiCreateAccessQueue();
void __osSiGetAccess();
void __osSiRelAccess();
void __osSiCreateAccessQueue(void);
void __osSiGetAccess(void);
void __osSiRelAccess(void);
u32 __osProbeTLB(void *);
void __osPiCreateAccessQueue();
void __osPiGetAccess();
void __osPiCreateAccessQueue(void);
void __osPiGetAccess(void);
void __osSetSR(u32);
u32 __osGetSR();
u32 __osGetSR(void);
void __osSetFpcCsr(u32);
s32 __osSiRawReadIo(void *, u32 *);
s32 __osSiRawWriteIo(void *, u32);
s32 osPiRawReadIo(u32 a0, u32 *a1);
void __osSpSetStatus(u32);
u32 __osSpGetStatus();
u32 __osSpGetStatus(void);
s32 __osSpSetPc(void *);
s32 __osSpDeviceBusy();
s32 __osSiDeviceBusy();
s32 __osSpDeviceBusy(void);
s32 __osSiDeviceBusy(void);
s32 __osSpRawStartDma(u32 dir, void *sp_ptr, void *dram_ptr, size_t size);
void __osViInit();
OSViContext *__osViGetCurrentContext();
OSViContext *__osViGetCurrentContext2();
void __osViSwapContext();
void __osViInit(void);
OSViContext *__osViGetCurrentContext(void);
OSViContext *__osViGetCurrentContext2(void);
void __osViSwapContext(void);
void __osSetTimerIntr(u64);
u64 __osInsertTimer(OSTimer *);
void __osSetCompare(u32);
s32 __osAiDeviceBusy();
void __osDispatchThread();
u32 __osGetCause();
s32 __osAiDeviceBusy(void);
void __osDispatchThread(void);
u32 __osGetCause(void);
s32 __osAtomicDec(u32 *);
#endif
+5 -3
View File
@@ -1,5 +1,6 @@
#ifndef NEW_FUNC_H
#define NEW_FUNC_H
#include "libultra_internal.h"
#include "hardware.h"
@@ -14,9 +15,10 @@ extern OSPiHandle *__osDiskHandle; //possibly __osPiTable
extern volatile u32 D_8030208C;
s32 osEPiRawStartDma(OSPiHandle *arg0, s32 dir, u32 cart_addr, void *dram_addr, u32 size);
void func_802F4B08();
void func_802F4A20();
void func_802F4B08(void);
void func_802F4A20(void);
void func_802F7140(u32);
void func_802F71A0(OSPiHandle*, u32, u32); //osEPi something
void func_802F71F0();
void func_802F71F0(void);
#endif
+48 -48
View File
@@ -4,96 +4,96 @@
void __osPackRequestData(u8);
void __osContGetInitData(u8 *, OSContStatus *);
u32 D_80334810 = 0; // probably initialized
u32 _osContInitialized = 0; // probably initialized
extern u64 osClockRate;
// these probably belong in EEPROMlongread or something
u8 D_80365D20;
u8 _osCont_numControllers;
OSTimer D_80365D28; // some kind of buffer, or maybe an as yet unknown struct
u8 _osLastSentSiCmd;
u8 _osContNumControllers;
OSTimer D_80365D28;
OSMesgQueue _osContMesgQueue;
OSMesg _osContMesgBuff[4];
s32 osContInit(OSMesgQueue *mq, u8 *a1, OSContStatus *status) {
s32 osContInit(OSMesgQueue *mq, u8 *bitpattern, OSContStatus *status) {
OSMesg mesg;
u32 sp78 = 0;
u32 ret = 0;
OSTime currentTime;
OSTimer sp50;
OSMesgQueue sp38;
OSTimer timer;
OSMesgQueue timerMesgQueue;
if (D_80334810) {
if (_osContInitialized) {
return 0;
}
D_80334810 = 1;
_osContInitialized = 1;
currentTime = osGetTime();
if (500000 * osClockRate / 1000000 > currentTime) {
osCreateMesgQueue(&sp38, &mesg, 1);
osSetTimer(&sp50, 500000 * osClockRate / 1000000 - currentTime, 0, &sp38, &mesg);
osRecvMesg(&sp38, &mesg, OS_MESG_BLOCK);
osCreateMesgQueue(&timerMesgQueue, &mesg, 1);
osSetTimer(&timer, 500000 * osClockRate / 1000000 - currentTime, 0, &timerMesgQueue, &mesg);
osRecvMesg(&timerMesgQueue, &mesg, OS_MESG_BLOCK);
}
_osCont_numControllers = 4; // TODO: figure out what it means
_osContNumControllers = 4; // TODO: figure out what it means
#ifdef VERSION_EU
__osPackRequestData(0);
#else
__osPackRequestData(255);
#endif
sp78 = __osSiRawStartDma(1, D_80365CE0);
ret = __osSiRawStartDma(OS_WRITE, _osContCmdBuf);
osRecvMesg(mq, &mesg, OS_MESG_BLOCK);
sp78 = __osSiRawStartDma(0, D_80365CE0);
ret = __osSiRawStartDma(OS_READ, _osContCmdBuf);
osRecvMesg(mq, &mesg, OS_MESG_BLOCK);
__osContGetInitData(a1, status);
__osContGetInitData(bitpattern, status);
#ifdef VERSION_EU
D_80365D20 = 0;
_osLastSentSiCmd = 0;
#else
D_80365D20 = 255;
_osLastSentSiCmd = 255;
#endif
__osSiCreateAccessQueue();
osCreateMesgQueue(&_osContMesgQueue, _osContMesgBuff, 1);
return sp78;
return ret;
}
void __osContGetInitData(u8 *a0, OSContStatus *status) {
OSContPackedRequest *sp14;
OSContPackedRequest spc;
void __osContGetInitData(u8 *bitpattern, OSContStatus *status) {
OSContPackedRequest *cmdBufPtr;
OSContPackedRequest response;
s32 i;
u8 sp7;
sp7 = 0;
sp14 = &(D_80365CE0[0].request);
for (i = 0; i < _osCont_numControllers; i++, sp14++, status++) {
spc = *(OSContPackedRequest *) sp14;
status->errno = (spc.unk02 & 0xc0) >> 4;
if (status->errno == 0) {
status->type = spc.unk05 << 8 | spc.unk04;
status->status = spc.unk06;
cmdBufPtr = &(_osContCmdBuf[0].request);
for (i = 0; i < _osContNumControllers; i++, cmdBufPtr++, status++) {
response = *(OSContPackedRequest *) cmdBufPtr;
status->errnum = (response.rxLen & 0xc0) >> 4;
if (status->errnum == 0) {
status->type = response.data2 << 8 | response.data1;
status->status = response.data3;
sp7 |= 1 << i;
}
}
*a0 = sp7;
*bitpattern = sp7;
}
void __osPackRequestData(u8 a0) {
OSContPackedRequest *spc;
OSContPackedRequest sp4;
void __osPackRequestData(u8 command) {
OSContPackedRequest *cmdBufPtr;
OSContPackedRequest request;
s32 i;
// some kind of weird zeroing code
for (i = 0; i < 0x10; i++) {
*((u32 *) &D_80365CE0 + i) = 0;
*((u32 *) &_osContCmdBuf + i) = 0;
}
D_80365D1C = 1;
spc = &D_80365CE0[0].request;
sp4.unk00 = 255;
sp4.unk01 = 1;
sp4.unk02 = 3;
sp4.unk03 = a0;
sp4.unk04 = 255;
sp4.unk05 = 255;
sp4.unk06 = 255;
sp4.unk07 = 255;
_osContPifCtrl = 1;
cmdBufPtr = &_osContCmdBuf[0].request;
request.padOrEnd = 255;
request.txLen = 1;
request.rxLen = 3;
request.command = command;
request.data1 = 255;
request.data2 = 255;
request.data3 = 255;
request.data4 = 255;
for (i = 0; i < _osCont_numControllers; i++) {
*spc++ = sp4;
for (i = 0; i < _osContNumControllers; i++) {
*cmdBufPtr++ = request;
}
spc->unk00 = 254;
cmdBufPtr->padOrEnd = 254;
}
+16 -16
View File
@@ -3,10 +3,10 @@
#include <types.h>
typedef struct
{
u8 unk00; //unknown, set to 255 a lot
u8 unk01;
u8 unk02; //probably status
u8 unk03; //maybe errno
u8 padOrEnd;
u8 txLen;
u8 rxLen; //includes errno
u8 command;
u16 button;
s8 rawStickX;
s8 rawStickY;
@@ -14,14 +14,14 @@ typedef struct
typedef struct
{
u8 unk00; //unknown, set to 255 a lot
u8 unk01;
u8 unk02; //probably status
u8 unk03; //maybe errno
u8 unk04;
u8 unk05;
u8 unk06;
u8 unk07;
u8 padOrEnd;
u8 txLen;
u8 rxLen;
u8 command;
u8 data1;
u8 data2;
u8 data3;
u8 data4;
} OSContPackedRequest;
typedef union {
@@ -32,14 +32,14 @@ typedef union {
#ifdef AVOID_UB
// Fix the OSContPackedStruct array
extern OSContPackedStruct D_80365CE0[8];
extern OSContPackedStruct _osContCmdBuf[8];
// And fix the last element
#define D_80365D1C D_80365CE0[7].as_raw[1]
#define _osContPifCtrl _osContCmdBuf[7].as_raw[1]
#else
// Original OSContPackedStruct definitions
extern OSContPackedStruct D_80365CE0[7];
extern u32 D_80365D1C;
extern OSContPackedStruct _osContCmdBuf[7];
extern u32 _osContPifCtrl;
#endif
#endif
+36 -36
View File
@@ -3,71 +3,71 @@
#include <macros.h>
#ifndef AVOID_UB
OSContPackedStruct D_80365CE0[7];
ALIGNED8 OSContPackedStruct _osContCmdBuf[7];
UNUSED static u32 unused; // padding between these two variables
u32 D_80365D1C;
u32 _osContPifCtrl;
#else
// Reordered gcc vars above will disturb the aliasing done to access all 8 members of this array, hence AVOID_UB.
OSContPackedStruct D_80365CE0[8];
ALIGNED8 OSContPackedStruct _osContCmdBuf[8];
#endif
extern u8 D_80365D20;
extern u8 _osCont_numControllers;
extern u8 _osLastSentSiCmd;
extern u8 _osContNumControllers;
void __osPackReadData(void);
s32 osContStartReadData(OSMesgQueue *mesg) {
s32 ret = 0;
s32 i;
__osSiGetAccess();
if (D_80365D20 != 1) {
if (_osLastSentSiCmd != 1) {
__osPackReadData();
ret = __osSiRawStartDma(1, D_80365CE0);
ret = __osSiRawStartDma(OS_WRITE, _osContCmdBuf);
osRecvMesg(mesg, NULL, OS_MESG_BLOCK);
}
for (i = 0; i < 0x10; i++) {
*((u32 *) &D_80365CE0 + i) = 255;
*((u32 *) &_osContCmdBuf + i) = 255;
}
D_80365D1C = 0;
ret = __osSiRawStartDma(0, &D_80365CE0);
D_80365D20 = 1;
_osContPifCtrl = 0;
ret = __osSiRawStartDma(OS_READ, _osContCmdBuf);
_osLastSentSiCmd = 1;
__osSiRelAccess();
return ret;
}
void osContGetReadData(OSContPad *pad) {
OSContPackedRead *spc;
OSContPackedRead sp4;
OSContPackedRead *cmdBufPtr;
OSContPackedRead response;
s32 i;
spc = &D_80365CE0[0].read;
for (i = 0; i < _osCont_numControllers; i++, spc++, pad++) {
sp4 = *spc;
pad->errno = (sp4.unk02 & 0xc0) >> 4;
if (pad->errno == 0) {
pad->button = sp4.button;
pad->stick_x = sp4.rawStickX;
pad->stick_y = sp4.rawStickY;
cmdBufPtr = &_osContCmdBuf[0].read;
for (i = 0; i < _osContNumControllers; i++, cmdBufPtr++, pad++) {
response = *cmdBufPtr;
pad->errnum = (response.rxLen & 0xc0) >> 4;
if (pad->errnum == 0) {
pad->button = response.button;
pad->stick_x = response.rawStickX;
pad->stick_y = response.rawStickY;
}
};
}
void __osPackReadData() {
OSContPackedRead *spc;
OSContPackedRead sp4;
OSContPackedRead *cmdBufPtr;
OSContPackedRead request;
s32 i;
spc = &D_80365CE0[0].read;
cmdBufPtr = &_osContCmdBuf[0].read;
for (i = 0; i < 0x10; i++) {
*((u32 *) &D_80365CE0 + i) = 0;
*((u32 *) &_osContCmdBuf + i) = 0;
}
D_80365D1C = 1;
sp4.unk00 = 255;
sp4.unk01 = 1;
sp4.unk02 = 4;
sp4.unk03 = 1;
sp4.button = 65535;
sp4.rawStickX = -1;
sp4.rawStickY = -1;
for (i = 0; i < _osCont_numControllers; i++) {
*spc++ = sp4;
_osContPifCtrl = 1;
request.padOrEnd = 255;
request.txLen = 1;
request.rxLen = 4;
request.command = 1;
request.button = 65535;
request.rawStickX = -1;
request.rawStickY = -1;
for (i = 0; i < _osContNumControllers; i++) {
*cmdBufPtr++ = request;
}
spc->unk00 = 254;
cmdBufPtr->padOrEnd = 254;
}
+1 -1
View File
@@ -2,7 +2,7 @@
extern u64 osClockRate;
extern u8 D_80365D20;
extern u8 _osCont_numControllers;
extern u8 _osContNumControllers;
extern OSTimer D_80365D28; // not sure what this is yet
extern OSMesgQueue _osContMesgQueue;
extern OSMesg _osContMesgBuff[4];
+1 -1
View File
@@ -2,7 +2,7 @@
extern u64 osClockRate;
extern u8 D_80365D20;
extern u8 _osCont_numControllers;
extern u8 _osContNumControllers;
extern OSTimer D_80365D28;
extern OSMesgQueue _osContMesgQueue;
extern OSMesg _osContMesgBuff[4];
+2 -2
View File
@@ -1,6 +1,6 @@
#include "libultra_internal.h"
extern u8 D_80365D20;
extern u8 _osLastSentSiCmd;
typedef struct {
u16 unk00;
@@ -58,7 +58,7 @@ s32 osEepromRead(OSMesgQueue *mq, u8 address, u8 *buffer) {
}
D_80365E3C = 0;
sp34 = __osSiRawStartDma(OS_READ, D_80365E00);
D_80365D20 = 4;
_osLastSentSiCmd = 4;
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
for (sp30 = 0; sp30 < 4; sp30++) {
sp2c++;
+5 -5
View File
@@ -2,14 +2,14 @@
#include "osContInternal.h"
#ifndef AVOID_UB
u32 D_80365E00[15];
ALIGNED8 u32 D_80365E00[15];
u32 D_80365E3C;
#else
// Certain code accesses the 16th element (D_80365E3C) in this array, making a seperate
// definition UB when gcc rearranges those.
u32 D_80365E00[16];
ALIGNED8 u32 D_80365E00[16];
#endif
extern u8 D_80365D20;
extern u8 _osLastSentSiCmd;
typedef struct {
u16 unk00;
@@ -73,7 +73,7 @@ s32 osEepromWrite(OSMesgQueue *mq, u8 address, u8 *buffer) {
D_80365E3C = 0;
sp34 = __osSiRawStartDma(OS_READ, D_80365E00);
D_80365D20 = 5;
_osLastSentSiCmd = 5;
osRecvMesg(mq, NULL, OS_MESG_BLOCK);
for (sp30 = 0; sp30 < 4; sp30++) {
@@ -142,7 +142,7 @@ s32 __osEepStatus(OSMesgQueue *a0, unkStruct *a1) {
sp2c = __osSiRawStartDma(OS_WRITE, D_80365E00);
osRecvMesg(a0, NULL, OS_MESG_BLOCK);
D_80365D20 = 5;
_osLastSentSiCmd = 5;
sp2c = __osSiRawStartDma(OS_READ, D_80365E00);
osRecvMesg(a0, NULL, OS_MESG_BLOCK);
+3 -1
View File
@@ -1,5 +1,6 @@
#include "libultra_internal.h"
#include "hardware.h"
// this file must include some globally referenced data because it is not called anywhere
// data, comes shortly before _Ldtob I think, before crash_screen
@@ -7,8 +8,9 @@ extern OSPiHandle *D_80302DFC;
// bss
OSPiHandle LeoDiskHandle;
OSPiHandle *__osDiskHandle;
// some kind of piHandle init function, maybe osDriveRomInit or osCartRomInit
OSPiHandle *osLeoDiskInit() {
OSPiHandle *osLeoDiskInit(void) {
s32 sp1c;
LeoDiskHandle.type = 2;
LeoDiskHandle.baseAddress = (0xa0000000 | 0x05000000);
+3 -2
View File
@@ -8,7 +8,8 @@ OSTime _osCurrentTime;
u32 D_80365DA8;
u32 __osViIntrCount;
u32 D_80365DB0;
void __osTimerServicesInit() {
void __osTimerServicesInit(void) {
_osCurrentTime = 0;
D_80365DA8 = 0;
__osViIntrCount = 0;
@@ -20,7 +21,7 @@ void __osTimerServicesInit() {
D_80334830->msg = NULL;
}
void __osTimerInterrupt() {
void __osTimerInterrupt(void) {
OSTimer *sp24;
u32 sp20;
u32 sp1c;
-10
View File
@@ -1,10 +0,0 @@
#include <math.h>
#ifndef __GNUC__
#pragma intrinsic(sqrtf)
#define __builtin_sqrtf sqrtf
#endif
float sqrtf(float f) {
return __builtin_sqrtf(f);
}