You've already forked Microtransactions64
mirror of
https://github.com/Print-and-Panic/Microtransactions64.git
synced 2026-01-21 10:17:19 -08:00
refresh 6
This commit is contained in:
BIN
lib/PR/boot/F3D_boot_eu.bin
Normal file
BIN
lib/PR/boot/F3D_boot_eu.bin
Normal file
Binary file not shown.
BIN
lib/PR/f3d/new/F3D_data_EU.bin
Normal file
BIN
lib/PR/f3d/new/F3D_data_EU.bin
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
22
lib/asm/__os_eu_802ef550.s
Normal file
22
lib/asm/__os_eu_802ef550.s
Normal file
@@ -0,0 +1,22 @@
|
||||
.set noreorder # don't insert nops after branches
|
||||
.set gp=64
|
||||
.set noat
|
||||
|
||||
.include "macros.inc"
|
||||
|
||||
|
||||
.section .text, "ax"
|
||||
# cache related
|
||||
glabel __os_eu_802ef550
|
||||
lui $t0,0x8000
|
||||
li $t2,0x2000
|
||||
addu $t1,$t0,$t2
|
||||
addiu $t1,$t1,-0x10
|
||||
.L: cache 0x1,0($t0)
|
||||
sltu $at,$t0,$t1
|
||||
bnez $at,.L
|
||||
addiu $t0,$t0,0x10
|
||||
jr $ra
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
@@ -9,14 +9,38 @@
|
||||
.section .text, "ax"
|
||||
|
||||
glabel osSetIntMask
|
||||
.ifndef VERSION_EU
|
||||
mfc0 $t1, $12
|
||||
andi $v0, $t1, 0xff01
|
||||
.else
|
||||
mfc0 $t4, $12
|
||||
andi $v0, $t4, 0xff01
|
||||
lui $t0, %hi(D_8030208C) # $t0, 0x8030
|
||||
addiu $t0, %lo(D_8030208C) # addiu $t0, $t0, 0x208c
|
||||
lw $t3, ($t0)
|
||||
li $at, -1
|
||||
xor $t0, $t3, $at
|
||||
andi $t0, $t0, 0xff00
|
||||
or $v0, $v0, $t0
|
||||
.endif
|
||||
lui $t2, %hi(MI_INTR_MASK_REG) # $t2, 0xa430
|
||||
lw $t2, %lo(MI_INTR_MASK_REG)($t2)
|
||||
.ifdef VERSION_EU
|
||||
beqz $t2, .L80200074
|
||||
srl $t1, $t3, 0x10
|
||||
li $at, -1
|
||||
xor $t1, $t1, $at
|
||||
andi $t1, $t1, 0x3f
|
||||
or $t2, $t2, $t1
|
||||
.L80200074:
|
||||
.endif
|
||||
sll $t2, $t2, 0x10
|
||||
or $v0, $v0, $t2
|
||||
lui $at, 0x3f
|
||||
and $t0, $a0, $at
|
||||
.ifdef VERSION_EU
|
||||
and $t0, $t0, $t3
|
||||
.endif
|
||||
srl $t0, $t0, 0xf
|
||||
lui $t2, %hi(D_803386D0)
|
||||
addu $t2, $t2, $t0
|
||||
@@ -24,11 +48,21 @@ glabel osSetIntMask
|
||||
lui $at, %hi(MI_INTR_MASK_REG) # $at, 0xa430
|
||||
sw $t2, %lo(MI_INTR_MASK_REG)($at)
|
||||
andi $t0, $a0, 0xff01
|
||||
.ifdef VERSION_EU
|
||||
andi $t1, $t3, 0xff00
|
||||
and $t0, $t0, $t1
|
||||
.endif
|
||||
lui $at, (0xFFFF00FF >> 16) # lui $at, 0xffff
|
||||
ori $at, (0xFFFF00FF & 0xFFFF) # ori $at, $at, 0xff
|
||||
.ifndef VERSION_EU
|
||||
and $t1, $t1, $at
|
||||
or $t1, $t1, $t0
|
||||
mtc0 $t1, $12
|
||||
.else
|
||||
and $t4, $t4, $at
|
||||
or $t4, $t4, $t0
|
||||
mtc0 $t4, $12
|
||||
.endif
|
||||
nop
|
||||
nop
|
||||
jr $ra
|
||||
|
||||
18
lib/asm/parameters.s
Normal file
18
lib/asm/parameters.s
Normal file
@@ -0,0 +1,18 @@
|
||||
.macro gsymbol sym addr
|
||||
.global \sym
|
||||
.set \sym, \addr
|
||||
.ifndef VERSION_JP
|
||||
nop
|
||||
nop
|
||||
.endif
|
||||
.endm
|
||||
|
||||
.text
|
||||
gsymbol osTvType 0x80000300
|
||||
gsymbol osRomType 0x80000304
|
||||
gsymbol osRomBase 0x80000308
|
||||
gsymbol osResetType 0x8000030C
|
||||
gsymbol osCiCId 0x80000310
|
||||
gsymbol osVersion 0x80000314
|
||||
gsymbol osMemSize 0x80000318
|
||||
gsymbol osAppNmiBuffer 0x8000031C
|
||||
@@ -5,7 +5,12 @@
|
||||
|
||||
.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
|
||||
glabel rspF3DBootEnd
|
||||
|
||||
.balign 16
|
||||
@@ -131,7 +136,11 @@ glabel rspS2DEXEnd
|
||||
.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
|
||||
|
||||
147
lib/src/D_802F4380.c
Normal file
147
lib/src/D_802F4380.c
Normal file
@@ -0,0 +1,147 @@
|
||||
#include "libultra_internal.h"
|
||||
#include "hardware.h"
|
||||
#include "new_func.h"
|
||||
#include "macros.h"
|
||||
#ifdef VERSION_EU
|
||||
u32 D_802F4380() {
|
||||
u32 sp3c;
|
||||
u32 sp38;
|
||||
u32 sp34;
|
||||
__OSTranxInfo *sp30;
|
||||
__OSBlockInfo *sp2c;
|
||||
u32 sp28;
|
||||
UNUSED __OSBlockInfo *sp24;
|
||||
if (!EU_D_80302090) {
|
||||
return 0;
|
||||
}
|
||||
sp30 = &__osDiskHandle->transferInfo;
|
||||
sp2c = &sp30->block[sp30->blockNum];
|
||||
sp38 = HW_REG(PI_STATUS_REG, u32);
|
||||
if (sp38 & PI_STATUS_BUSY) {
|
||||
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_RESET_CONTROLLER | PI_STATUS_CLEAR_INTR;
|
||||
WAIT_ON_IOBUSY(sp38);
|
||||
sp3c = HW_REG(ASIC_STATUS, u32);
|
||||
if (sp3c & MECHANIC_INTERRUPT) {
|
||||
WAIT_ON_IOBUSY(sp38);
|
||||
HW_REG(ASIC_BM_CTL, u32) = sp30->bmCtlShadow | MECHANIC_INTERRUPT_RESET;
|
||||
}
|
||||
sp30->unk10 = 75;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
WAIT_ON_IOBUSY(sp38);
|
||||
sp3c = HW_REG(ASIC_STATUS, u32);
|
||||
if (sp3c & MECHANIC_INTERRUPT) {
|
||||
WAIT_ON_IOBUSY(sp38);
|
||||
HW_REG(ASIC_BM_CTL, u32) = sp30->bmCtlShadow | MECHANIC_INTERRUPT_RESET;
|
||||
sp30->unk10 = 0;
|
||||
return 0;
|
||||
}
|
||||
if (sp3c & BUFFER_MANAGER_ERROR) {
|
||||
sp30->unk10 = 3;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
if (sp30->cmdType == 1) {
|
||||
if ((sp3c & DATA_REQUEST) == 0) {
|
||||
if (sp30->sectorNum + 1 != sp30->transferMode * 85) {
|
||||
sp30->unk10 = 6;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
|
||||
D_8030208C |= 0x00100401;
|
||||
sp30->unk10 = 0;
|
||||
func_802F4B08();
|
||||
return 1;
|
||||
}
|
||||
sp2c->dramAddr = (void *) ((u32) sp2c->dramAddr + sp2c->sectorSize);
|
||||
sp30->sectorNum += 1;
|
||||
osEPiRawStartDma(__osDiskHandle, 1, 0x05000400, sp2c->dramAddr, sp2c->sectorSize);
|
||||
return 1;
|
||||
}
|
||||
if (sp30->cmdType == 0) {
|
||||
if (sp30->transferMode == 3) {
|
||||
if ((s32)(sp2c->C1ErrNum + 17) < sp30->sectorNum) {
|
||||
sp30->unk10 = 0;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
if ((sp3c & DATA_REQUEST) == 0) {
|
||||
sp30->unk10 = 17;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
sp2c->dramAddr = (void *) ((u32) sp2c->dramAddr + sp2c->sectorSize);
|
||||
}
|
||||
sp34 = HW_REG(ASIC_BM_STATUS, u32);
|
||||
if (((C1_SINGLE & sp34) && (C1_DOUBLE & sp34)) || (sp34 & MICRO_STATUS))
|
||||
{
|
||||
if (sp2c->C1ErrNum > 3) {
|
||||
if (sp30->transferMode != 3 || sp30->sectorNum > 0x52) {
|
||||
sp30->unk10 = 17;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
sp28 = sp2c->C1ErrNum;
|
||||
sp2c->C1ErrSector[sp28] = sp30->sectorNum + 1;
|
||||
}
|
||||
sp2c->C1ErrNum += 1;
|
||||
}
|
||||
if (sp3c & C2_TRANSFER) {
|
||||
if (sp30->sectorNum != 87) {
|
||||
sp30->unk10 = 6;
|
||||
func_802F4A20();
|
||||
}
|
||||
if (sp30->transferMode == 2 && sp30->blockNum == 0) {
|
||||
sp30->blockNum = 1;
|
||||
sp30->sectorNum = -1;
|
||||
sp30->block[1].dramAddr =
|
||||
(void *) ((u32) sp30->block[1].dramAddr - sp30->block[1].sectorSize);
|
||||
} else {
|
||||
HW_REG(PI_STATUS_REG, u32) = PI_STATUS_CLEAR_INTR;
|
||||
D_8030208C |= 0x00100401;
|
||||
}
|
||||
osEPiRawStartDma(__osDiskHandle, 0, 0x5000000, sp2c->C2Addr, sp2c->sectorSize * 4);
|
||||
sp30->unk10 = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (sp30->sectorNum == -1 && sp30->transferMode == 2 && sp30->blockNum == 1) {
|
||||
sp24 = &sp30->block[0];
|
||||
if (sp30->block[0].C1ErrNum == 0) {
|
||||
if (((u32 *) sp30->block[0].C2Addr)[0] | ((u32 *) sp30->block[0].C2Addr)[1]
|
||||
| ((u32 *) sp30->block[0].C2Addr)[2] | ((u32 *) sp30->block[0].C2Addr)[3]) {
|
||||
sp30->unk10 = 6;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
sp30->unk10 = 0;
|
||||
func_802F4B08();
|
||||
}
|
||||
sp30->sectorNum += 1;
|
||||
if (sp3c & DATA_REQUEST) {
|
||||
if (sp30->sectorNum > 0x54) {
|
||||
sp30->unk10 = 6;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
osEPiRawStartDma(__osDiskHandle, 0, 0x05000400, sp2c->dramAddr, sp2c->sectorSize);
|
||||
sp30->unk10 = 0;
|
||||
return 1;
|
||||
}
|
||||
if (sp30->sectorNum <= 0x54) {
|
||||
sp30->unk10 = 6;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
sp30->unk10 = 75;
|
||||
func_802F4A20();
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
12
lib/src/EU_D_802f4330.c
Normal file
12
lib/src/EU_D_802f4330.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include "libultra_internal.h"
|
||||
|
||||
// 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])() ;
|
||||
|
||||
void EU_D_802f4330(u32 a0, u32 a1(void)) {
|
||||
register u32 int_disabled = __osDisableInt();
|
||||
D_80334920[a0] = a1;
|
||||
__osRestoreInt(int_disabled);
|
||||
}
|
||||
@@ -99,9 +99,7 @@ void _Ldtob(printf_struct *args, u8 type) {
|
||||
if (exp > 0) {
|
||||
factor = 1;
|
||||
exp &= ~3;
|
||||
n = exp;
|
||||
|
||||
for (i = 0; n > 0; n >>= 1, i++) {
|
||||
for (n = exp, i = 0; n > 0; n >>= 1, i++) {
|
||||
if ((n & 1) != 0) {
|
||||
factor *= D_80338670[i];
|
||||
}
|
||||
|
||||
@@ -1,5 +1,88 @@
|
||||
#include "libultra_internal.h"
|
||||
|
||||
#include "macros.h"
|
||||
#if defined(VERSION_EU)
|
||||
#include "new_func.h"
|
||||
void __osDevMgrMain(void *args) {
|
||||
OSIoMesg *sp44;
|
||||
OSMesg sp40;
|
||||
OSMesg sp3c;
|
||||
s32 sp38;
|
||||
OSMgrArgs *sp34;
|
||||
UNUSED u32 sp30;
|
||||
u32 sp2c;
|
||||
__OSBlockInfo *sp28;
|
||||
__OSTranxInfo *sp24;
|
||||
sp30 = 0;
|
||||
sp2c = 0;
|
||||
sp44 = NULL;
|
||||
sp38 = 0;
|
||||
sp34 = (OSMgrArgs *) args;
|
||||
while (1) {
|
||||
osRecvMesg(sp34->unk08, (OSMesg) &sp44, OS_MESG_BLOCK);
|
||||
if (sp44->piHandle != NULL && sp44->piHandle->type == 2
|
||||
&& (sp44->piHandle->transferInfo.cmdType == 0
|
||||
|| sp44->piHandle->transferInfo.cmdType == 1)) {
|
||||
sp24 = &sp44->piHandle->transferInfo;
|
||||
sp28 = &sp24->block[sp24->blockNum];
|
||||
sp24->sectorNum = -1;
|
||||
if (sp24->transferMode != 3) {
|
||||
sp28->dramAddr = (void *) ((u32) sp28->dramAddr - sp28->sectorSize);
|
||||
}
|
||||
if (sp24->transferMode == 2 && sp44->piHandle->transferInfo.cmdType == 0)
|
||||
sp2c = 1;
|
||||
else
|
||||
sp2c = 0;
|
||||
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
|
||||
func_802F7140(0x00100401); // remove magic constant!
|
||||
func_802F71A0(sp44->piHandle, 0x05000510, (sp24->bmCtlShadow | 0x80000000));
|
||||
while (1) {
|
||||
osRecvMesg(sp34->unk0c, &sp40, OS_MESG_BLOCK);
|
||||
sp30 = osSendMesg(sp44->hdr.retQueue, sp44, OS_MESG_NOBLOCK);
|
||||
if (sp2c != 1 || sp44->piHandle->transferInfo.unk10 != 0)
|
||||
break;
|
||||
sp2c = 0;
|
||||
}
|
||||
osSendMesg(sp34->unk10, NULL, OS_MESG_NOBLOCK);
|
||||
if (sp44->piHandle->transferInfo.blockNum == 1)
|
||||
func_802F71F0();
|
||||
} else {
|
||||
switch (sp44->hdr.type) {
|
||||
case 11:
|
||||
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
|
||||
sp38 = sp34->dma_func(OS_READ, sp44->devAddr, sp44->dramAddr, sp44->size);
|
||||
break;
|
||||
case 12:
|
||||
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
|
||||
sp38 = sp34->dma_func(OS_WRITE, sp44->devAddr, sp44->dramAddr, sp44->size);
|
||||
break;
|
||||
case 15:
|
||||
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
|
||||
sp38 = sp34->edma_func(sp44->piHandle, OS_READ, sp44->devAddr, sp44->dramAddr,
|
||||
sp44->size);
|
||||
break;
|
||||
case 16:
|
||||
osRecvMesg(sp34->unk10, &sp3c, OS_MESG_BLOCK);
|
||||
sp38 = sp34->edma_func(sp44->piHandle, OS_WRITE, sp44->devAddr, sp44->dramAddr,
|
||||
sp44->size);
|
||||
break;
|
||||
case 10:
|
||||
osSendMesg(sp44->hdr.retQueue, sp44, OS_MESG_NOBLOCK);
|
||||
sp38 = -1;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
sp38 = -1;
|
||||
break;
|
||||
}
|
||||
if (sp38 == 0) {
|
||||
osRecvMesg(sp34->unk0c, &sp40, OS_MESG_BLOCK);
|
||||
sp30 = osSendMesg(sp44->hdr.retQueue, sp44, OS_MESG_NOBLOCK);
|
||||
osSendMesg(sp34->unk10, NULL, OS_MESG_NOBLOCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
void __osDevMgrMain(void *args) {
|
||||
OSIoMesg *sp34;
|
||||
OSMesg sp30;
|
||||
@@ -35,3 +118,4 @@ void __osDevMgrMain(void *args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
5
lib/src/__osGetCurrFaultedThread.c
Normal file
5
lib/src/__osGetCurrFaultedThread.c
Normal file
@@ -0,0 +1,5 @@
|
||||
#include "libultra_internal.h"
|
||||
extern OSThread* D_8033489C;
|
||||
OSThread *__osGetCurrFaultedThread() {
|
||||
return D_8033489C; // 80302efc
|
||||
}
|
||||
@@ -6,6 +6,7 @@ typedef struct {
|
||||
u8 unk01 : 2;
|
||||
u8 unk2[3];
|
||||
} unkStruct;
|
||||
|
||||
u32 D_80334A40 = 0;
|
||||
u32 D_80334A44 = 1;
|
||||
|
||||
|
||||
@@ -8,14 +8,23 @@ extern u32 osTvType;
|
||||
OSViContext D_803348B0[2] = { 0 };
|
||||
OSViContext *D_80334910 = &D_803348B0[0];
|
||||
OSViContext *D_80334914 = &D_803348B0[1];
|
||||
#ifdef VERSION_EU
|
||||
u32 D_8033491C = 0x02E6D354;
|
||||
u32 D_80334918 = TV_TYPE_PAL;
|
||||
#else
|
||||
u32 D_80334918 = TV_TYPE_NTSC;
|
||||
u32 D_8033491C = 0x02E6D354;
|
||||
#endif
|
||||
|
||||
extern OSViMode D_80334990;
|
||||
extern OSViMode D_803349E0;
|
||||
#ifdef VERSION_EU
|
||||
extern OSViMode D_80302FD0;
|
||||
#endif
|
||||
|
||||
void __osViInit(void) {
|
||||
//#ifdef VERSION_JP
|
||||
#ifndef VERSION_JP
|
||||
#ifdef VERSION_US
|
||||
D_80334918 = osTvType;
|
||||
#endif
|
||||
bzero(D_803348B0, sizeof(D_803348B0));
|
||||
@@ -23,6 +32,21 @@ void __osViInit(void) {
|
||||
D_80334914 = &D_803348B0[1];
|
||||
D_80334914->retraceCount = 1;
|
||||
D_80334910->retraceCount = 1;
|
||||
|
||||
#ifdef VERSION_EU
|
||||
|
||||
if (osTvType == TV_TYPE_PAL) {
|
||||
D_80334914->unk08 = &D_80334990;
|
||||
D_8033491C = 0x02F5B2D2;
|
||||
} else if (osTvType == TV_TYPE_MPAL) {
|
||||
D_80334914->unk08 = &D_803349E0;
|
||||
D_8033491C = 0x02E6025C;
|
||||
} else {
|
||||
D_80334914->unk08 = &D_80302FD0;
|
||||
D_8033491C = 0x02E6D354;
|
||||
}
|
||||
|
||||
#else
|
||||
#ifdef VERSION_JP
|
||||
if (D_80334918 != TV_TYPE_PAL)
|
||||
#else
|
||||
@@ -39,6 +63,7 @@ void __osViInit(void) {
|
||||
D_8033491C = 0x02E6025C;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
D_80334914->unk00 = 32;
|
||||
D_80334914->features = D_80334914->unk08->comRegs.ctrl;
|
||||
#ifndef VERSION_JP
|
||||
|
||||
171
lib/src/func_802F4A20.c
Normal file
171
lib/src/func_802F4A20.c
Normal file
@@ -0,0 +1,171 @@
|
||||
#include "new_func.h"
|
||||
|
||||
extern OSThread *D_80334898;
|
||||
void func_802F4A20() {
|
||||
__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(D_A4600010) # $t8, 0xa460
|
||||
// lw $t9, %lo(D_A4600010)($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(D_A4600010) # $t2, 0xa460
|
||||
// lw $t3, %lo(D_A4600010)($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(D_A4600010) # $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(D_A4600010)($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(D_A4600010) # $t4, 0xa460
|
||||
// lw $t5, %lo(D_A4600010)($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(D_A4600010) # $t2, 0xa460
|
||||
// sw $t1, %lo(D_A4600010)($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 {
|
||||
OSMesgQueue *queue;
|
||||
OSMesg msg;
|
||||
} OSEventMessageStruct_0;
|
||||
|
||||
extern OSEventMessageStruct_0 D_80363830[16]; // should be OS_NUM_EVENTS + 1 I think
|
||||
void func_802F4B08() {
|
||||
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
|
||||
}
|
||||
31
lib/src/func_802F7140.c
Normal file
31
lib/src/func_802F7140.c
Normal file
@@ -0,0 +1,31 @@
|
||||
#include "libultra_internal.h"
|
||||
extern u32 D_8030208C;
|
||||
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 */
|
||||
36
lib/src/func_802F71A0.c
Normal file
36
lib/src/func_802F71A0.c
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
#include "libultra_internal.h"
|
||||
#include "hardware.h"
|
||||
//possibly osEpiWriteIo
|
||||
s32 func_802F71A0(OSPiHandle *a0, u32 a1, u32 a2) {
|
||||
register u32 a3 = HW_REG(PI_STATUS_REG, u32);
|
||||
while (a3 & PI_STATUS_ERROR)
|
||||
a3 = HW_REG(PI_STATUS_REG, u32);
|
||||
HW_REG(a0->baseAddress | a1, u32) = a2;
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
/ 0B69A0 802F71A0 3C0EA460 / lui $t6, %hi(D_A4600010) # $t6, 0xa460
|
||||
/ 0B69A4 802F71A4 8DC70010 / lw $a3, %lo(D_A4600010)($t6)
|
||||
/ 0B69A8 802F71A8 27BDFFF8 / addiu $sp, $sp, -8
|
||||
/ 0B69AC 802F71AC 30EF0003 / andi $t7, $a3, 3
|
||||
|
||||
/ 0B69B0 802F71B0 11E00006 / beqz $t7, .L802F71CC
|
||||
/ 0B69B4 802F71B4 00000000 / nop
|
||||
.L802F71B8:
|
||||
/ 0B69B8 802F71B8 3C18A460 / lui $t8, %hi(D_A4600010) # $t8, 0xa460
|
||||
/ 0B69BC 802F71BC 8F070010 / lw $a3, %lo(D_A4600010)($t8)
|
||||
/ 0B69C0 802F71C0 30F90003 / andi $t9, $a3, 3
|
||||
/ 0B69C4 802F71C4 1720FFFC / bnez $t9, .L802F71B8
|
||||
/ 0B69C8 802F71C8 00000000 / nop
|
||||
.L802F71CC:
|
||||
/ 0B69CC 802F71CC 8C88000C / lw $t0, 0xc($a0)
|
||||
/ 0B69D0 802F71D0 3C01A000 / lui $at, 0xa000
|
||||
/ 0B69D4 802F71D4 27BD0008 / addiu $sp, $sp, 8
|
||||
/ 0B69D8 802F71D8 01054825 / or $t1, $t0, $a1
|
||||
/ 0B69DC 802F71DC 01215025 / or $t2, $t1, $at
|
||||
/ 0B69E0 802F71E0 AD460000 / sw $a2, ($t2)
|
||||
/ 0B69E4 802F71E4 03E00008 / jr $ra
|
||||
/ 0B69E8 802F71E8 00001025 / move $v0, $zero
|
||||
|
||||
/ 0B69EC 802F71EC 00000000 / nop */
|
||||
33
lib/src/func_802F71F0.c
Normal file
33
lib/src/func_802F71F0.c
Normal file
@@ -0,0 +1,33 @@
|
||||
#include "libultra_internal.h"
|
||||
|
||||
extern OSThread *D_803348A0;
|
||||
extern OSThread *D_80334898;
|
||||
void func_802F71F0() {
|
||||
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 */
|
||||
@@ -66,6 +66,9 @@
|
||||
#define PI_STATUS_IOBUSY 0x2
|
||||
#define PI_STATUS_ERROR 0x3
|
||||
|
||||
#define PI_STATUS_RESET_CONTROLLER 0x1
|
||||
#define PI_STATUS_CLEAR_INTR 0x2
|
||||
|
||||
#define SI_DRAM_ADDR_REG 0x04800000
|
||||
#define SI_PIF_ADDR_RD64B_REG 0x04800004
|
||||
#define SI_PIF_ADDR_WR64B_REG 0x04800010
|
||||
@@ -82,4 +85,43 @@
|
||||
#define MI_INTR_REG 0x04300008
|
||||
#define MI_INTR_MASK_REG 0x0430000C
|
||||
|
||||
//https://github.com/LuigiBlood/64dd/wiki/Registers
|
||||
#define ASIC_STATUS 0x05000508
|
||||
|
||||
#define DATA_REQUEST 0x40000000
|
||||
#define C2_TRANSFER 0x10000000
|
||||
#define BUFFER_MANAGER_ERROR 0x08000000
|
||||
#define BUFFER_MANAGER_INTERRUPT 0x04000000
|
||||
#define MECHANIC_INTERRUPT 0x02000000
|
||||
#define DISK_PRESENT 0x01000000
|
||||
#define BUSY_STATE 0x00800000
|
||||
#define RESET_STATE 0x00400000
|
||||
#define MOTOR_NOT_SPINNING 0x00100000
|
||||
#define HEAD_RETRACTED 0x00080000
|
||||
#define WRITE_PROTECT_ERROR 0x00040000
|
||||
#define MECHANIC_ERROR 0x00020000
|
||||
#define DISK_CHANGE 0x00010000
|
||||
|
||||
#define _64DD_PRESENT_MASK 0xFFFF
|
||||
|
||||
|
||||
//ro
|
||||
#define ASIC_BM_STATUS 0x05000510
|
||||
|
||||
#define MICRO_STATUS 0x02000000
|
||||
#define C1_DOUBLE 0x00400000
|
||||
#define C1_SINGLE 0x00200000
|
||||
|
||||
//wo
|
||||
#define ASIC_BM_CTL 0x05000510
|
||||
#define BUFFER_MANAGER_RESET 0x10000000
|
||||
#define MECHANIC_INTERRUPT_RESET 0x01000000
|
||||
/*- Start Buffer Manager (0x80000000)
|
||||
- Buffer Manager Mode (0x40000000)
|
||||
- BM Interrupt Mask (0x20000000)
|
||||
- Buffer Manager Reset (0x10000000)
|
||||
- Disable OR Check? (0x08000000)
|
||||
- Disable C1 Correction (0x04000000)
|
||||
- Block Transfer (0x02000000)
|
||||
- Mechanic Interrupt Reset (0x01000000)*/
|
||||
#endif
|
||||
|
||||
@@ -13,7 +13,7 @@ u32 D_80334A30 = 0;
|
||||
u32 D_80334A34 = 0;
|
||||
s32 D_80334A38 = 0;
|
||||
|
||||
u8 D_80365E40[0x100];
|
||||
extern u8 D_80365E40[0x1000];
|
||||
|
||||
OSThread gInterruptedThread;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user