diff --git a/include/global.h b/include/global.h index 0a85fec..448e98d 100644 --- a/include/global.h +++ b/include/global.h @@ -35,6 +35,8 @@ extern MallocRecord mallocRecord; extern UNK_TYPE D_800DA83C; extern UNK_TYPE D_8010DF40; +extern UNK_TYPE D_80108620; + typedef struct Y511F0UnkStruct { /* 0x0 */ uintptr_t unk0; /* 0x4 */ s16 unk4; diff --git a/src/main/O2/70100.c b/src/main/O2/70100.c index 0c8ffd1..9e2c39e 100644 --- a/src/main/O2/70100.c +++ b/src/main/O2/70100.c @@ -1,4 +1,23 @@ #include "global.h" +#define WAIT_ON_IOBUSY_ALT(stat) \ + do { \ + stat = IO_READ(PI_STATUS_REG); \ + } while (stat & (PI_STATUS_IO_BUSY | PI_STATUS_DMA_BUSY)) -#pragma GLOBAL_ASM("asm/us/nonmatchings/main/O2/70100/func_8006F500.s") +#define ADDRESS_1 (PI_DOM1_ADDR2 + 0x458) // 0x10000458 +#define ADDRESS_2 (PI_DOM1_ADDR2 + 0x45C) // 0x1000045C + +void func_8006F500(void) { + register u32 stat; + u16 addr1Val; + u16 addr2Val; + + WAIT_ON_IOBUSY_ALT(stat); + addr1Val = IO_READ(ADDRESS_1); + + WAIT_ON_IOBUSY_ALT(stat); + addr2Val = IO_READ(ADDRESS_2); + + D_80108620 = (addr1Val << 16) | addr2Val; +}