Matching code_39cb0_len_100.c

This commit is contained in:
Mark Street 2020-12-24 23:39:47 +00:00
parent 46e8583dac
commit 466a31fe4e
9 changed files with 46 additions and 81 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

@ -1,47 +0,0 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
glabel boot_idle
/* 39D0C 8005E90C 27BDFFE0 */ addiu $sp, $sp, -0x20
/* 39D10 8005E910 AFBF001C */ sw $ra, 0x1c($sp)
/* 39D14 8005E914 AFB00018 */ sw $s0, 0x18($sp)
/* 39D18 8005E918 3C01800A */ lui $at, %hi(D_8009A630)
/* 39D1C 8005E91C 0C017D14 */ jal nuPiInit
/* 39D20 8005E920 AC20A630 */ sw $zero, %lo(D_8009A630)($at)
/* 39D24 8005E924 24040002 */ addiu $a0, $zero, 2
/* 39D28 8005E928 0C017A6C */ jal nuScCreateScheduler
/* 39D2C 8005E92C 24050001 */ addiu $a1, $zero, 1
/* 39D30 8005E930 0C019B98 */ jal osViSetSpecialFeatures
/* 39D34 8005E934 2404005A */ addiu $a0, $zero, 0x5a
/* 39D38 8005E938 3C10800A */ lui $s0, %hi(D_800A4420)
/* 39D3C 8005E93C 26104420 */ addiu $s0, $s0, %lo(D_800A4420)
/* 39D40 8005E940 0200202D */ daddu $a0, $s0, $zero
/* 39D44 8005E944 24050003 */ addiu $a1, $zero, 3
/* 39D48 8005E948 3C02800C */ lui $v0, %hi(D_800B8590)
/* 39D4C 8005E94C 24428590 */ addiu $v0, $v0, %lo(D_800B8590)
/* 39D50 8005E950 AFA20010 */ sw $v0, 0x10($sp)
/* 39D54 8005E954 2402000A */ addiu $v0, $zero, 0xa
/* 39D58 8005E958 3C068002 */ lui $a2, %hi(boot_main)
/* 39D5C 8005E95C 24C65F70 */ addiu $a2, $a2, %lo(boot_main)
/* 39D60 8005E960 0000382D */ daddu $a3, $zero, $zero
/* 39D64 8005E964 0C019798 */ jal osCreateThread
/* 39D68 8005E968 AFA20014 */ sw $v0, 0x14($sp)
/* 39D6C 8005E96C 0C019808 */ jal osStartThread
/* 39D70 8005E970 0200202D */ daddu $a0, $s0, $zero
/* 39D74 8005E974 3C04800A */ lui $a0, %hi(D_800A4270)
/* 39D78 8005E978 24844270 */ addiu $a0, $a0, %lo(D_800A4270)
/* 39D7C 8005E97C 0C0197D4 */ jal osSetThreadPri
/* 39D80 8005E980 0000282D */ daddu $a1, $zero, $zero
.L8005E984:
/* 39D84 8005E984 3C02800A */ lui $v0, %hi(D_8009A630)
/* 39D88 8005E988 8C42A630 */ lw $v0, %lo(D_8009A630)($v0)
.L8005E98C:
/* 39D8C 8005E98C 1040FFFF */ beqz $v0, .L8005E98C
/* 39D90 8005E990 00000000 */ nop
/* 39D94 8005E994 0040F809 */ jalr $v0
/* 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

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,33 @@
#include "common.h"
#include "nu/nusys.h"
#include "functions.h"
#include "variables.h"
INCLUDE_ASM(s32, "os/code_39cb0_len_100", nuBoot);
INCLUDE_ASM(s32, "os/code_39cb0_len_100", boot_idle);
// TODO: create src/os/nusys/nuSched.h?
extern u64 nuScStack[NU_SC_STACK_SIZE / sizeof(u64)];
void (*D_8009A630)(void) = NULL;
void nuBoot(void) {
osInitialize(); // __osInitialize_common
osCreateThread(&D_800A4270, 1, (void*) &boot_idle, 0, &nuScStack, 10);
osStartThread(&D_800A4270);
}
void boot_idle(void) {
void (*temp_v0)(void);
D_8009A630 = NULL;
nuPiInit();
nuScCreateScheduler(2, 1);
osViSetSpecialFeatures(0x5A);
osCreateThread(&D_800A4420, 3, (void*) &boot_main, 0, &D_800B8590, 10);
osStartThread(&D_800A4420);
osSetThreadPri(&D_800A4270, OS_PRIORITY_IDLE);
do {
do { /* nothing */ } while ((temp_v0 = D_8009A630) == NULL);
temp_v0();
} while (1);
}

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;

View File

@ -570,7 +570,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;
@ -678,8 +677,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;
@ -785,7 +782,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;