Merge pull request #140 from mkst/code_39cb0_len_100

WIP - Matching code_39cb0_len_100.c
This commit is contained in:
Ethan Roseman 2020-12-29 17:18:23 -05:00 committed by GitHub
commit 693fda4460
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 40 deletions

View File

@ -80,7 +80,7 @@ CC=tools/$(OS)/cc1
### Compiler Options ###
CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment
CPPFLAGS := -Iinclude -Isrc -D _LANGUAGE_C -D _FINALROM -ffreestanding -DF3DEX_GBI_2 -D_MIPS_SZLONG=32 -Wundef -Wcomment
ASFLAGS := -EB -Iinclude -march=vr4300 -mtune=vr4300
OLDASFLAGS := -EB -Iinclude -G 0
CFLAGS := -O2 -quiet -G 0 -mcpu=vr4300 -mfix4300 -mips3 -mgp32 -mfp32 -Wimplicit -Wuninitialized -Wshadow

View File

@ -37,11 +37,11 @@ glabel boot_idle
/* 39D88 8005E988 8C42A630 */ lw $v0, %lo(D_8009A630)($v0)
.L8005E98C:
/* 39D8C 8005E98C 1040FFFF */ beqz $v0, .L8005E98C
/* 39D90 8005E990 00000000 */ nop
/* 39D90 8005E990 00000000 */ nop
/* 39D94 8005E994 0040F809 */ jalr $v0
/* 39D98 8005E998 00000000 */ nop
/* 39D98 8005E998 00000000 */ nop
/* 39D9C 8005E99C 08017A61 */ j .L8005E984
/* 39DA0 8005E9A0 00000000 */ nop
/* 39DA4 8005E9A4 00000000 */ nop
/* 39DA8 8005E9A8 00000000 */ nop
/* 39DAC 8005E9AC 00000000 */ nop
/* 39DA0 8005E9A0 00000000 */ nop
/* 39DA4 8005E9A4 00000000 */ nop
/* 39DA8 8005E9A8 00000000 */ nop
/* 39DAC 8005E9AC 00000000 */ nop

View File

@ -1,27 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel nuBoot
/* 39CB0 8005E8B0 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 39CB4 8005E8B4 AFBF001C */ sw $ra, 0x1c($sp)
/* 39CB8 8005E8B8 0C01A9C2 */ jal osInitialize
/* 39CBC 8005E8BC AFB00018 */ sw $s0, 0x18($sp)
/* 39CC0 8005E8C0 3C10800A */ lui $s0, %hi(D_800A4270)
/* 39CC4 8005E8C4 26104270 */ addiu $s0, $s0, %lo(D_800A4270)
/* 39CC8 8005E8C8 0200202D */ daddu $a0, $s0, $zero
/* 39CCC 8005E8CC 3C02800A */ lui $v0, %hi(nuScStack)
/* 39CD0 8005E8D0 244265D0 */ addiu $v0, $v0, %lo(nuScStack)
/* 39CD4 8005E8D4 AFA20010 */ sw $v0, 0x10($sp)
/* 39CD8 8005E8D8 2402000A */ addiu $v0, $zero, 0xa
/* 39CDC 8005E8DC 24050001 */ addiu $a1, $zero, 1
/* 39CE0 8005E8E0 3C068006 */ lui $a2, %hi(boot_idle)
/* 39CE4 8005E8E4 24C6E90C */ addiu $a2, $a2, %lo(boot_idle)
/* 39CE8 8005E8E8 0000382D */ daddu $a3, $zero, $zero
/* 39CEC 8005E8EC 0C019798 */ jal osCreateThread
/* 39CF0 8005E8F0 AFA20014 */ sw $v0, 0x14($sp)
/* 39CF4 8005E8F4 0C019808 */ jal osStartThread
/* 39CF8 8005E8F8 0200202D */ daddu $a0, $s0, $zero
/* 39CFC 8005E8FC 8FBF001C */ lw $ra, 0x1c($sp)
/* 39D00 8005E900 8FB00018 */ lw $s0, 0x18($sp)
/* 39D04 8005E904 03E00008 */ jr $ra
/* 39D08 8005E908 27BD0020 */ addiu $sp, $sp, 0x20

View File

@ -5,6 +5,11 @@
#include "common_structs.h"
#include "enums.h"
void nuBoot(void);
void boot_idle(void);
void boot_main(void);
void osCleanupThread(void);
s32 heap_malloc(s32 size);

View File

@ -246,4 +246,9 @@ extern s16 gMusicTargetVolume;
extern MusicPlayer gMusicPlayers[4];
extern MusicPlayer D_8014F6F0;
// OS
extern OSThread D_800A4270; // idle thread, id 1
extern OSThread D_800A4420; // id 3
extern s32 D_800B8590;
#endif

View File

@ -1,5 +1,36 @@
#include "common.h"
#include "nu/nusys.h"
#include "functions.h"
#include "variables.h"
INCLUDE_ASM(s32, "os/code_39cb0_len_100", nuBoot);
// TODO: create src/os/nusys/nuSched.h?
extern u64 nuScStack[NU_SC_STACK_SIZE / sizeof(u64)];
INCLUDE_ASM(s32, "os/code_39cb0_len_100", boot_idle);
//void (*nuIdleFunc)(void) = NULL;
void nuBoot(void) {
osInitialize(); // __osInitialize_common
osCreateThread(&D_800A4270, NU_IDLE_THREAD_ID, boot_idle, NULL, &nuScStack, 10);
osStartThread(&D_800A4270);
}
#ifdef NON_MATCHING
void boot_idle(void) {
nuIdleFunc = NULL;
nuPiInit();
nuScCreateScheduler(OS_VI_NTSC_LAN1, 1);
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON);
osCreateThread(&D_800A4420, NU_MAIN_THREAD_ID, boot_main, NULL, &D_800B8590, NU_MAIN_THREAD_PRI);
osStartThread(&D_800A4420);
osSetThreadPri(&D_800A4270, NU_IDLE_THREAD_PRI);
while (1) {
if (nuIdleFunc != NULL) {
nuIdleFunc();
}
}
}
#else
INCLUDE_ASM(void, "os/code_39cb0_len_100", boot_idle, void);
#endif

View File

@ -61,3 +61,4 @@ func_802AA0D8 = 0x802AA0D8;
func_802AB330 = 0x802AB330;
func_802AB338 = 0x802AB338;
func_802B71E8 = 0x802B71E8;
__osInitialize_common = 0x8006A708;

View File

@ -43,6 +43,10 @@ D_800A0960 = 0x800A0960;
D_800A0963 = 0x800A0963;
D_800A0964 = 0x800A0964;
D_800A4270 = 0x800A4270;
D_800A4420 = 0x800A4420;
D_800B8590 = 0x800B8590;
D_800E92D8 = 0x800E92D8;
gPartnerAnimations = 0x800F8348;
@ -110,6 +114,7 @@ nuGfxZBuffer = 0x8009A5DC;
nuGfxDisplay = 0x8009A5F8;
gGameState = 0x8009A600;
D_8009A610 = 0x8009A610;
D_8009A630 = 0x8009A630;
nuGfxTaskSpool = 0x8009A618;
carthandle = 0x8009A638;

View File

@ -549,7 +549,6 @@ D_8009A61C = 0x8009A61C;
D_8009A620 = 0x8009A620;
D_8009A628 = 0x8009A628;
D_8009A62C = 0x8009A62C;
D_8009A630 = 0x8009A630;
D_8009A634 = 0x8009A634;
D_8009A63C = 0x8009A63C;
D_8009A640 = 0x8009A640;
@ -657,8 +656,6 @@ D_800A425C = 0x800A425C;
D_800A4260 = 0x800A4260;
D_800A4264 = 0x800A4264;
D_800A4268 = 0x800A4268;
D_800A4270 = 0x800A4270;
D_800A4420 = 0x800A4420;
D_800AC6B0 = 0x800AC6B0;
D_800AE6D0 = 0x800AE6D0;
D_800AE6D4 = 0x800AE6D4;
@ -764,7 +761,6 @@ D_800B451E = 0x800B451E;
D_800B451F = 0x800B451F;
D_800B4520 = 0x800B4520;
D_800B6590 = 0x800B6590;
D_800B8590 = 0x800B8590;
D_800B91A0 = 0x800B91A0;
D_800B91D0 = 0x800B91D0;
D_800D91D0 = 0x800D91D0;