From 157cd7f9abfebdfecb4b8c125a2c52c95be5fbea Mon Sep 17 00:00:00 2001 From: Kelebek1 Date: Sat, 10 Aug 2024 06:27:33 +0100 Subject: [PATCH] a --- Makefile | 6 +- diff.py | 0 diff_settings.py | 4 +- lib/ultralib/base/I_P/libultra_rom.txt | 1 + linker_scripts/us/symbol_addrs.txt | 711 +++++++++++++------------ src/code_49190.s | 430 +++++++++++++++ yamls/us/rom.yaml | 12 +- 7 files changed, 802 insertions(+), 362 deletions(-) mode change 100644 => 100755 diff.py create mode 100644 src/code_49190.s diff --git a/Makefile b/Makefile index 8f5b215..ffb202c 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ NON_MATCHING ?= 0 # if WERROR is 1, pass -Werror to CC_CHECK, so warnings would be treated as errors WERROR ?= 0 # Keep .mdebug section in build -KEEP_MDEBUG ?= 0 +KEEP_MDEBUG ?= 1 # Check code syntax with host compiler RUN_CC_CHECK ?= 1 CC_CHECK_COMP ?= gcc @@ -164,7 +164,7 @@ C_DEFINES := -DLANGUAGE_C -D_LANGUAGE_C LIBULTRA_DEFINES := -DBUILD_VERSION=VERSION_$(ULTRALIB_VERSION) ENDIAN := -EB -OPTFLAGS := -O2 -g3 +OPTFLAGS := -O2 MIPS_VERSION := -mips2 ICONV_FLAGS := --from-code=UTF-8 --to-code=EUC-JP @@ -235,8 +235,10 @@ build/src/boot/libu64/%.o: OPTFLAGS := -O2 build/src/boot/fault.o: CFLAGS += -trapuv build/src/boot/fault_drawer.o: CFLAGS += -trapuv +build/src/C030.o: OPTFLAGS += -Wo,-loopunroll,0 # cc & asm-processor +build/src/libleo/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC_OLD) -- $(AS) $(ASFLAGS) -- build/src/%.o: CC := $(ASM_PROC) $(ASM_PROC_FLAGS) $(CC) -- $(AS) $(ASFLAGS) -- diff --git a/diff.py b/diff.py old mode 100644 new mode 100755 diff --git a/diff_settings.py b/diff_settings.py index 7b9d48b..708327a 100644 --- a/diff_settings.py +++ b/diff_settings.py @@ -2,6 +2,6 @@ def apply(config, args): config['baseimg'] = 'baserom.z64' - config['myimg'] = 'build/pokestadium.z64' - config['mapfile'] = 'build/pokestadium.map' + config['myimg'] = 'build/pokestadium-us.z64' + config['mapfile'] = 'build/pokestadium-us.map' config['source_directories'] = ['.'] diff --git a/lib/ultralib/base/I_P/libultra_rom.txt b/lib/ultralib/base/I_P/libultra_rom.txt index c879d12..87f664e 100644 --- a/lib/ultralib/base/I_P/libultra_rom.txt +++ b/lib/ultralib/base/I_P/libultra_rom.txt @@ -366,5 +366,6 @@ xlitob.o xldtob.o xprintf.o sprintf.o +gbpakgetstatus.o syncprintf.o sched.o diff --git a/linker_scripts/us/symbol_addrs.txt b/linker_scripts/us/symbol_addrs.txt index 7e02311..44ec110 100644 --- a/linker_scripts/us/symbol_addrs.txt +++ b/linker_scripts/us/symbol_addrs.txt @@ -12,87 +12,365 @@ LeoSetRTC = 0x80054800; LeoSpdlMotor = 0x80053650; LeoTestUnitReady = 0x80056590; leoVerifyRTC = 0x800548C0; -_Litob = 0x80064CA0; -_Printf = 0x8005D850; -_Putfld = 0x8005D1E0; -__leoSetReset = 0x80051414; -__leoResetCalled = 0x80079510; -__ll_div = 0x8005751C; -__ll_lshift = 0x800574B4; -__ll_mod = 0x80057608; -__ll_mul = 0x80057578; -__ll_rem = 0x800574E0; -__ll_rshift = 0x800576A4; -__osAiDeviceBusy = 0x80065C50; -__osCheckId = 0x8005CA40; -__osCheckPackId = 0x8005C730; -__osContAddressCrc = 0x80063C90; -__osContDataCrc = 0x80063D60; -__osContGetInitData = 0x800589D0; -__osContRamRead = 0x80063A60; -__osContRamWrite = 0x80063810; -__osDequeueThread = 0x80056CB0; -__osDevMgrMain = 0x8005B820; -__osDisableInt = 0x80062A90; -__osDispatchThread = 0x80057E44; // ! -__osEepStatus = 0x8005BFA4; -__osEnqueueAndYield = 0x80057CEC; // ! -__osGbpakSelectBank = 0x80065AD0; -__osGetId = 0x8005C894; -__osIdCheckSum = 0x8005C2E4; -__osLeoInterrupt = 0x80055DF0; -__osLeoAbnormalResume = 0x80056350; -__osLeoResume = 0x80056404; -__osPackEepReadData = 0x80065E44; -__osPackEepWriteData = 0x8005BEF8; -__osPackReadData = 0x80058F20; -__osPackRequestData = 0x80058AA0; -__osPfsGetOneChannelData = 0x800598C4; -__osPfsGetStatus = 0x80059730; -__osPfsRWInode = 0x8005CB14; -__osPfsRequestOneChannel = 0x80059800; -__osPfsSelectBank = 0x80063670; -__osPiCreateAccessQueue = 0x800567F0; -__osPiGetAccess = 0x80056840; -__osPiRelAccess = 0x80056884; -__osPopThread = 0x80057E34; // ! -__osRepairPackId = 0x8005C3E0; -__osResetGlobalIntMask = 0x80062870; -__osRestoreInt = 0x80062B00; -__osRunningThread = 0x80079630; -__osSetCause = 0x800568B0; -__osSetGlobalIntMask = 0x80062220; -__osSiDeviceBusy = 0x8005E570; -__osSiRawReadIo = 0x8005AA50; -__osSiRawStartDma = 0x8005A8E0; -__osSiRawWriteIo = 0x80064F40; -__osSpDeviceBusy = 0x8005E540; -__osSpGetStatus = 0x80064FA0; -__osSpRawStartDma = 0x8005A850; -__osSpSetPc = 0x80065F10; -__osSpSetStatus = 0x80064F90; -__osSumCalc = 0x8005C270; -__osViSwapContext = 0x80062C60; -__ull_div = 0x80057478; -__ull_divremi = 0x800575A8; -__ull_rem = 0x8005743C; -__ull_rshift = 0x80057410; -__locReadTimer = 0x80055864; -__locSetTimer = 0x800559D4; -guLookAtReflect = 0x8005AECC; -guLookAtReflectF = 0x8005AAC0; -guMtxF2L = 0x8005AF50; -guMtxIdent = 0x8005B0D8; -guMtxIdentF = 0x8005B050; -guMtxL2F = 0x8005B108; -guNormalize = 0x80062420; -guOrtho = 0x80062A24; -guOrthoF = 0x800628D0; -guScale = 0x80056D44; -guScaleF = 0x80056CF0; -guTranslate = 0x8005E5E8; -guTranslateF = 0x8005E5A0; -ldiv = 0x80064C10; + + + +_Litob = 0x80064CA0; // defined:true +_Printf = 0x8005D850; // defined:true +_Putfld = 0x8005D1E0; // defined:true +__leoSetReset = 0x80051414; // defined:true +__leoResetCalled = 0x80079510; // defined:true +__ll_div = 0x8005751C; // defined:true +__ll_lshift = 0x800574B4; // defined:true +__ll_mod = 0x80057608; // defined:true +__ll_mul = 0x80057578; // defined:true +__ll_rem = 0x800574E0; // defined:true +__ll_rshift = 0x800576A4; // defined:true +__osAiDeviceBusy = 0x80065C50; // defined:true +__osCheckId = 0x8005CA40; // defined:true +__osCheckPackId = 0x8005C730; // defined:true +__osContAddressCrc = 0x80063C90; // defined:true +__osContDataCrc = 0x80063D60; // defined:true +__osContGetInitData = 0x800589D0; // defined:true +__osContRamRead = 0x80063A60; // defined:true +__osContRamWrite = 0x80063810; // defined:true +__osDequeueThread = 0x80056CB0; // defined:true +__osDevMgrMain = 0x8005B820; // defined:true +__osDisableInt = 0x80062A90; // defined:true +__osDispatchThread = 0x80057E44; // defined:true +__osEepStatus = 0x8005BFA4; // defined:true +__osEnqueueAndYield = 0x80057CEC; // defined:true +__osGbpakSelectBank = 0x80065AD0; // defined:true +__osGetId = 0x8005C894; // defined:true +__osIdCheckSum = 0x8005C2E4; // defined:true +__osLeoInterrupt = 0x80055DF0; // defined:true +__osLeoAbnormalResume = 0x80056350; // defined:true +__osLeoResume = 0x80056404; // defined:true +__osPackEepReadData = 0x80065E44; // defined:true +__osPackEepWriteData = 0x8005BEF8; // defined:true +__osPackReadData = 0x80058F20; // defined:true +__osPackRequestData = 0x80058AA0; // defined:true +__osPfsGetOneChannelData = 0x800598C4; // defined:true +__osPfsGetStatus = 0x80059730; // defined:true +__osPfsRWInode = 0x8005CB14; // defined:true +__osPfsRequestOneChannel = 0x80059800; // defined:true +__osPfsSelectBank = 0x80063670; // defined:true +__osPiCreateAccessQueue = 0x800567F0; // defined:true +__osPiGetAccess = 0x80056840; // defined:true +__osPiRelAccess = 0x80056884; // defined:true +__osPopThread = 0x80057E34; // defined:true +__osRepairPackId = 0x8005C3E0; // defined:true +__osResetGlobalIntMask = 0x80062870; // defined:true +__osRestoreInt = 0x80062B00; // defined:true +__osRunningThread = 0x80079630; // defined:true +__osSetCause = 0x800568B0; // defined:true +__osSetGlobalIntMask = 0x80062220; // defined:true +__osSiDeviceBusy = 0x8005E570; // defined:true +__osSiRawReadIo = 0x8005AA50; // defined:true +__osSiRawStartDma = 0x8005A8E0; // defined:true +__osSiRawWriteIo = 0x80064F40; // defined:true +__osSpDeviceBusy = 0x8005E540; // defined:true +__osSpGetStatus = 0x80064FA0; // defined:true +__osSpRawStartDma = 0x8005A850; // defined:true +__osSpSetPc = 0x80065F10; // defined:true +__osSpSetStatus = 0x80064F90; // defined:true +__osSumCalc = 0x8005C270; // defined:true +__osViSwapContext = 0x80062C60; // defined:true +__ull_div = 0x80057478; // defined:true +__ull_divremi = 0x800575A8; // defined:true +__ull_rem = 0x8005743C; // defined:true +__ull_rshift = 0x80057410; // defined:true +__locReadTimer = 0x80055864; // defined:true +__locSetTimer = 0x800559D4; // defined:true +guLookAtReflect = 0x8005AECC; // defined:true +guLookAtReflectF = 0x8005AAC0; // defined:true +guMtxF2L = 0x8005AF50; // defined:true +guMtxIdent = 0x8005B0D8; // defined:true +guMtxIdentF = 0x8005B050; // defined:true +guMtxL2F = 0x8005B108; // defined:true +guNormalize = 0x80062420; // defined:true +guOrtho = 0x80062A24; // defined:true +guOrthoF = 0x800628D0; // defined:true +guScale = 0x80056D44; // defined:true +guScaleF = 0x80056CF0; // defined:true +guTranslate = 0x8005E5E8; // defined:true +guTranslateF = 0x8005E5A0; // defined:true +ldiv = 0x80064C10; // defined:true +lldiv = 0x80064B10; // defined:true + +memcpy = 0x8005E250; // defined:true +__osRcpImTable = 0x8007E210; // defined:true +osAiGetLength = 0x80063700; // defined:true +osAiSetFrequency = 0x80062270; // defined:true +osAiSetNextBuffer = 0x80065BA0; // defined:true +osContGetReadData = 0x80058E94; // defined:true +osContInit = 0x80058860; // defined:true +osContStartReadData = 0x80058E10; // defined:true +osCreateThread = 0x80058CC0; // defined:true +osCreateViManager = 0x80064FC0; // defined:true +osDestroyThread = 0x80057300; // defined:true +osDpGetCounters = 0x800623C0; // defined:true +osDpSetStatus = 0x800624D0; // defined:true +osDriveRomInit = 0x80052860; // defined:true +osEPiRawReadIo = 0x8005E890; // defined:true +osEPiRawStartDma = 0x8005EA40; // defined:true +osEPiRawWriteIo = 0x80063E10; // defined:true +osEepromLongRead = 0x80059000; // defined:true +osEepromProbe = 0x8005BD10; // defined:true +osEepromRead = 0x80065C80; // defined:true +osEepromWrite = 0x8005BD80; // defined:true +osGbpakCheckConnector = 0x800582C0; // defined:true +osGbpakGetStatus = 0x8005DEA0; // defined:true +osGbpakInit = 0x80059500; // defined:true +osGbpakPower = 0x80058750; // defined:true +osGbpakReadId = 0x80063350; // defined:true +osGbpakReadWrite = 0x80065910; // defined:true +osGetThreadPri = 0x8005E870; // defined:true +osGetTime = 0x8005F150; // defined:true +osJamMesg = 0x8005E640; // defined:true +osLeoDiskInit = 0x80052A70; // defined:true +osPiGetCmdQueue = 0x80062F60; // defined:true +osPiRawStartDma = 0x8005BC30; // defined:true +osRecvMesg = 0x80056AD0; // defined:true +osSendMesg = 0x800568C0; // defined:true +osSetEventMesg = 0x8005CDF0; // defined:true +osSetIntMask = 0x80056C10; // defined:true +osSetThreadPri = 0x8005E790; // defined:true +osSetTimer = 0x80063F70; // defined:true +osSpTaskYield = 0x8005AAA0; // defined:true +osSpTaskYielded = 0x8005EC20; // defined:true +osStartThread = 0x80065370; // defined:true +osStopThread = 0x80056A10; // defined:true +osSyncPrintf = 0x8005E210; // defined:true +osViBlack = 0x8005A9E0; // defined:true +osViGetCurrentFramebuffer = 0x80065ED0; // defined:true +osViSetEvent = 0x800632E0; // defined:true +osViSetMode = 0x8005B1C0; // defined:true +osViSetSpecialFeatures = 0x80063150; // defined:true +osViSetXScale = 0x800654C0; // defined:true +osViSetYScale = 0x800655F0; // defined:true +osViSwapBuffer = 0x8005E9F0; // defined:true +osVirtualToPhysical = 0x80059090; // defined:true +osYieldThread = 0x800637C0; // defined:true +proutSprintf = 0x8005E020; // defined:true +rmonPrintf = 0x8005E22C; // defined:true +sprintf = 0x8005E044; // defined:true +strchr = 0x8005E2A4; // defined:true +strlen = 0x8005E27C; // defined:true +viMgrMain = 0x80065140; // defined:true +leoRd_capacity = 0x80054CC0; // defined:true +leoWrite = 0x80055A80; // defined:true +leoSeek = 0x800566D0; // defined:true +__osSetCount = 0x80058FF0; // defined:true +__osSetSR = 0x80059110; // defined:true +osWritebackDCache = 0x80059120; // defined:true +osInitialize = 0x800591A0; // defined:true +__osGetSR = 0x800594F0; // defined:true +alFxPull = 0x80059960; // defined:true +alFxParam = 0x80059CA0; // defined:true +alFxParamHdl = 0x80059CB8; // defined:true +_loadOutputBuffer = 0x80059F14; // defined:true +_loadBuffer = 0x8005A134; // defined:true +_saveBuffer = 0x8005A2CC; // defined:true +_filterBuffer = 0x8005A460; // defined:true +_doModFunc = 0x8005A510; // defined:true +__osSiCreateAccessQueue = 0x80058BA0; // defined:true +__osSiGetAccess = 0x80058BF0; // defined:true +__osSiRelAccess = 0x80058C34; // defined:true +osGetMemSize = 0x8005C150; // defined:true +sqrtf = 0x8005CEB0; // defined:true +guMtxXFMF = 0x8005CEE0; // defined:true +guMtxCatF = 0x8005CF80; // defined:true +guMtxXFML = 0x8005D0F0; // defined:true +guMtxCatL = 0x8005D150; // defined:true +guRandom = 0x8005D1B0; // defined:true +osUnmapTLBAll = 0x8005E0A0; // defined:true +alHeapInit = 0x8005E1D0; // defined:true +osInvalDCache = 0x8005E2F0; // defined:true +osCreateMesgQueue = 0x8005E3A0; // defined:true +osInvalICache = 0x8005E3D0; // defined:true +bcmp = 0x8005EE40; // defined:true +__osTimerServicesInit = 0x8005F1E0; // defined:true +__osTimerInterrupt = 0x8005F26C; // defined:true +__osSetTimerIntr = 0x8005F3E4; // defined:true +__osInsertTimer = 0x8005F458; // defined:true +_init_lpfilter = 0x8005FC60; // defined:true +alFxNew = 0x8005FD00; // defined:true +alEnvmixerNew = 0x8006013C; // defined:true +alLoadNew = 0x800601E4; // defined:true +alResampleNew = 0x8006028C; // defined:true +alAuxBusNew = 0x80060318; // defined:true +alMainBusNew = 0x8006036C; // defined:true +alSaveNew = 0x800603C0; // defined:true +alMainBusParam = 0x80060410; // defined:true +alMainBusPull = 0x80060440; // defined:true +alAuxBusParam = 0x80060560; // defined:true +alAuxBusPull = 0x80060590; // defined:true +alEnvmixerPull = 0x80060670; // defined:true +alResampleParam = 0x800612F0; // defined:true +alResamplePull = 0x800613DC; // defined:true +alFilterNew = 0x80062140; // defined:true +alSavePull = 0x80062160; // defined:true +alSaveParam = 0x800621EC; // defined:true +__osActiveQueue = 0x8007962C; // defined:true +__osGetActiveQueue = 0x80062410; // defined:true +__osSetCompare = 0x800624B0; // defined:true +osAiGetStatus = 0x800624C0; // defined:true +alCopy = 0x800624E0; // defined:true +_bcopy = 0x80062560; // defined:true +__osViInit = 0x80062B20; // defined:true +__cosf = 0x80062F90; // defined:true +osEPiReadIo = 0x80063100; // defined:true +osSetTime = 0x800632B0; // defined:true +osCartRomInit = 0x80063510; // defined:true +__osSetFpcCsr = 0x800636F0; // defined:true +osEPiWriteIo = 0x80063710; // defined:true +osMapTLBRdb = 0x80063760; // defined:true +__osViCurr = 0x8007ACF0; // defined:true +__osViGetCurrentContext = 0x800652D0; // defined:true +osWritebackDCacheAll = 0x800652E0; // defined:true +alHeapDBAlloc = 0x80065310; // defined:true +__d_to_ll = 0x80065650; // defined:true +__f_to_ll = 0x8006566C; // defined:true +__d_to_ull = 0x80065688; // defined:true +__f_to_ull = 0x80065728; // defined:true +__ll_to_d = 0x800657C4; // defined:true +__ll_to_f = 0x800657DC; // defined:true +__ull_to_d = 0x800657F4; // defined:true +__ull_to_f = 0x80065828; // defined:true +alSynAllocFX = 0x80065860; // defined:true +alSynDelete = 0x80065900; // defined:true +__osSetHWIntrRoutine = 0x80065F50; // defined:true +entry_point = 0x80000400; // defined:true +alSynNew = 0x8005F5E0; // defined:true +alAudioFrame = 0x8005F8E0; // defined:true +__allocParam = 0x8005FAB0; // defined:true +__freeParam = 0x8005FAE0; // defined:true +_collectPVoices = 0x8005FAF8; // defined:true +_freePVoice = 0x8005FB58; // defined:true +_timeToSamples = 0x8005FBDC; // defined:true +alUnlink = 0x80056F50; // defined:true +alLink = 0x80056F80; // defined:true +alClose = 0x80056FA4; // defined:true +alInit = 0x80056FDC; // defined:true +_VirtualToPhysicalTask = 0x80057010; // defined:true +osSpTaskLoad = 0x8005712C; // defined:true +osSpTaskStartGo = 0x800572BC; // defined:true +tmp_task = 0x80102100; // defined:true +__osPiAccessQueue = 0x801020E8; // defined:true +__osPiAccessQueueEnabled = 0x80079610; // defined:true +piAccessBuf = 0x801020E0; // defined:true +__sinf = 0x80056D90; // defined:true +__libm_qnan_f = 0x8007E5D0; // defined:true +bzero = 0x80057FD0; // defined:true +__osGbpakTimer = 0x80102200; // defined:true +__osGbpakTimerQ = 0x80102220; // defined:true +__osGbpakTimerMsg = 0x80102238; // defined:true +__osContPifRam = 0x80102140; // defined:true +__osMaxControllers = 0x80102181; // defined:true +__osContLastCmd = 0x80102180; // defined:true +__osEepromTimerQ = 0x801021A8; // defined:true +__osEepromTimerMsg = 0x801021C0; // defined:true +__osContInitialized = 0x80079680; // defined:true +__osSiAccessQueue = 0x801021D8; // defined:true +__osSiAccessQueueEnabled = 0x80079690; // defined:true +siAccessBuf = 0x801021D0; // defined:true +__osCleanupThread = 0x80057FC0; // defined:true +__osProbeTLB = 0x8005B5E0; // defined:true +__osFinalRom = 0x801021F0; // defined:true +__osExceptionPreamble = 0x800576D0; // defined:true +__osCartRomInit = 0x80059448; // defined:true +osResetType = 0x8000030C; // defined:true +osAppNMIBuffer = 0x8000031C; // defined:true +osTvType = 0x80000300; // defined:true +__osGetCause = 0x80063E00; // defined:true +CartRomHandle = 0x80102430; // defined:true +LeoDiskHandle = 0x801024A8; // defined:true +__LeoDiskHandle = 0x801007C0; // defined:true +__osGlobalIntMask = 0x800796B0; // defined:true +__osShutdown = 0x800796AC; // defined:true +osViClock = 0x800796A8; // defined:true +__osPfsInodeCacheBank = 0x8007A934; // defined:true +__osPfsPifRam = 0x801023F0; // defined:true +alGlobals = 0x80079640; // defined:true +guPerspectiveF = 0x8005A5C0; // defined:true +guPerspective = 0x8005A7F0; // defined:true +alSeqFileNew = 0x80058278; // defined:true +__osDiskHandle = 0x80100834; // defined:true +__osPiTable = 0x8007A87C; // defined:true +osViRepeatLine = 0x8005B230; // defined:true +osPfsIsPlug = 0x8005B2A0; // defined:true +__osPfsRequestData = 0x8005B440; // defined:true +__osPfsGetInitData = 0x8005B510; // defined:true +osCreatePiManager = 0x8005B6A0; // defined:true +osEPiStartDma = 0x8005E0F0; // defined:true +__osEepromTimer = 0x80102188; // defined:true +osEepromLongWrite = 0x8005E450; // defined:true +guRotateRPYF = 0x8005ECA0; // defined:true +guRotateRPY = 0x8005EDEC; // defined:true +guRotateF = 0x8005EF60; // defined:true +guRotate = 0x8005F0F4; // defined:true +_Ldtob = 0x800645C0; // defined:true +alAdpcmPull = 0x80061C9C; // defined:true +alLoadParam = 0x800615F0; // defined:true +osEPiLinkHandle = 0x8005A990; // defined:true +__osViNext = 0x8007ACF4; // defined:true +piEventQueue = 0x801036D0; // defined:true +piEventBuf = 0x801036E8; // defined:true +piThread = 0x80102520; // defined:true +__osPiDevMgr = 0x8007A860; // defined:true +piThreadStack = 0x801026D0; // defined:true +osRomBase = 0x80000308; // defined:true +__osEepPifRam = 0x80104B70; // defined:true +osGetCount = 0x8005BD00; // defined:true +__osPfsInodeCacheChannel = 0x8007A930; // defined:true +__osPfsInodeCache = 0x801036F0; // defined:true +__osPreNMI = 0x8007A940; // defined:true +__osEventStateTab = 0x801037F0; // defined:true +osAfterPreNMI = 0x8005CEC0; // defined:true +__osThreadTail = 0x80079620; // defined:true +__osRunQueue = 0x80079628; // defined:true +__osEnqueueThread = 0x80057DEC; // defined:true +__osCurrentHandle = 0x8007A880; // defined:true +osViModeNtscLpn1 = 0x8007A890; // defined:true +osViModeMpalLpn1 = 0x8007A8E0; // defined:true +__osTimerList = 0x8007A9B0; // defined:true +__osBaseTimer = 0x80103890; // defined:true +__osCurrentTime = 0x801038B0; // defined:true +__osCurrentTime+4 = 0x801038B4; // defined:true +__osBaseCounter = 0x801038B8; // defined:true +__osViIntrCount = 0x801038BC; // defined:true +__osTimerCounter = 0x801038C0; // defined:true +_timeToSamplesNoRound = 0x8005FB90; // defined:true +alEnvmixerParam = 0x80060B78; // defined:true +_pullSubFrame = 0x80060C58; // defined:true +_frexpf = 0x80060F40; // defined:true +_ldexpf = 0x8006102C; // defined:true +_getRate = 0x80061054; // defined:true +_getVol = 0x80061238; // defined:true +osViModePalLan1 = 0x8007AD00; // defined:true +osViModeMpalLan1 = 0x8007ADA0; // defined:true +osViModeNtscLan1 = 0x8007AD50; // defined:true +g_OsGbNintendoData = 0x8007ADF0; // defined:true +g_OsGbCartVersions = 0x8007AE20; // defined:true +__CartRomHandle = 0x801038D0; // defined:true +__DriveRomHandle = 0x80100740; // defined:true +__osPfsLastChannel = 0x8007AE50; // defined:true +__osViDevMgr = 0x8007AE90; // defined:true +__leoQueuesCreated = 0x80079514; // defined:true +__leoActive = 0x800795B0; // defined:true +__leoVersion = 0x801010D0; // defined:true +__additional_scanline = 0x8007AEAC; // defined:true +viThread = 0x80103950; // defined:true +viThreadStack = 0x80103B00; // defined:true +viEventQueue = 0x80104B00; // defined:true +viEventBuf = 0x80104B18; // defined:true +viRetraceMsg = 0x80104B30; // defined:true +viCounterMsg = 0x80104B48; // defined:true +__osHwIntTable = 0x80079650; // defined:true + + + LEOcur_command = 0x801006C8; LEOPiInfo = 0x80100710; LEOPiDmaParam = 0x80100718; @@ -207,278 +485,7 @@ LeoBootGame = 0x8000B8B0; // defined:true __LeoBootGame2 = 0x8000B9EC; __LeoBootGame3 = 0x8000BD10; leomain = 0x80051EC0; -lldiv = 0x80064B10; Main = 0x80000530; -memcpy = 0x8005E250; -__osRcpImTable = 0x8007E210; -osAiGetLength = 0x80063700; -osAiSetFrequency = 0x80062270; -osAiSetNextBuffer = 0x80065BA0; -osContGetReadData = 0x80058E94; -osContInit = 0x80058860; -osContStartReadData = 0x80058E10; -osCreateThread = 0x80058CC0; -osCreateViManager = 0x80064FC0; -osDestroyThread = 0x80057300; -osDpGetCounters = 0x800623C0; -osDpSetStatus = 0x800624D0; -osDriveRomInit = 0x80052860; -osEPiRawReadIo = 0x8005E890; -osEPiRawStartDma = 0x8005EA40; -osEPiRawWriteIo = 0x80063E10; -osEepromLongRead = 0x80059000; -osEepromProbe = 0x8005BD10; -osEepromRead = 0x80065C80; -osEepromWrite = 0x8005BD80; -osGbpakCheckConnector = 0x800582C0; -osGbpakGetStatus = 0x8005DEA0; -osGbpakInit = 0x80059500; -osGbpakPower = 0x80058750; -osGbpakReadId = 0x80063350; -osGbpakReadWrite = 0x80065910; -osGetThreadPri = 0x8005E870; -osGetTime = 0x8005F150; -osJamMesg = 0x8005E640; -osLeoDiskInit = 0x80052A70; -osPiGetCmdQueue = 0x80062F60; -osPiRawStartDma = 0x8005BC30; -osRecvMesg = 0x80056AD0; -osSendMesg = 0x800568C0; -osSetEventMesg = 0x8005CDF0; -osSetIntMask = 0x80056C10; -osSetThreadPri = 0x8005E790; -osSetTimer = 0x80063F70; -osSpTaskYield = 0x8005AAA0; -osSpTaskYielded = 0x8005EC20; -osStartThread = 0x80065370; -osStopThread = 0x80056A10; -osSyncPrintf = 0x8005E210; -osViBlack = 0x8005A9E0; -osViGetCurrentFramebuffer = 0x80065ED0; -osViSetEvent = 0x800632E0; -osViSetMode = 0x8005B1C0; -osViSetSpecialFeatures = 0x80063150; -osViSetXScale = 0x800654C0; -osViSetYScale = 0x800655F0; -osViSwapBuffer = 0x8005E9F0; -osVirtualToPhysical = 0x80059090; -osYieldThread = 0x800637C0; -proutSprintf = 0x8005E020; -rmonPrintf = 0x8005E22C; -sprintf = 0x8005E044; -strchr = 0x8005E2A4; -strlen = 0x8005E27C; -viMgrMain = 0x80065140; -leoRd_capacity = 0x80054CC0; -leoWrite = 0x80055A80; -leoSeek = 0x800566D0; -__osSetCount = 0x80058FF0; -__osSetSR = 0x80059110; -osWritebackDCache = 0x80059120; -osInitialize = 0x800591A0; -__osGetSR = 0x800594F0; -alFxPull = 0x80059960; -alFxParam = 0x80059CA0; -alFxParamHdl = 0x80059CB8; -_loadOutputBuffer = 0x80059F14; -_loadBuffer = 0x8005A134; -_saveBuffer = 0x8005A2CC; -_filterBuffer = 0x8005A460; -_doModFunc = 0x8005A510; -__osSiCreateAccessQueue = 0x80058BA0; -__osSiGetAccess = 0x80058BF0; -__osSiRelAccess = 0x80058C34; -osGetMemSize = 0x8005C150; -sqrtf = 0x8005CEB0; -guMtxXFMF = 0x8005CEE0; -guMtxCatF = 0x8005CF80; -guMtxXFML = 0x8005D0F0; -guMtxCatL = 0x8005D150; -guRandom = 0x8005D1B0; -osUnmapTLBAll = 0x8005E0A0; -alHeapInit = 0x8005E1D0; -osInvalDCache = 0x8005E2F0; -osCreateMesgQueue = 0x8005E3A0; -osInvalICache = 0x8005E3D0; -bcmp = 0x8005EE40; -__osTimerServicesInit = 0x8005F1E0; -__osTimerInterrupt = 0x8005F26C; -__osSetTimerIntr = 0x8005F3E4; -__osInsertTimer = 0x8005F458; -_init_lpfilter = 0x8005FC60; -alFxNew = 0x8005FD00; -alEnvmixerNew = 0x8006013C; -alLoadNew = 0x800601E4; -alResampleNew = 0x8006028C; -alAuxBusNew = 0x80060318; -alMainBusNew = 0x8006036C; -alSaveNew = 0x800603C0; -alMainBusParam = 0x80060410; -alMainBusPull = 0x80060440; -alAuxBusParam = 0x80060560; -alAuxBusPull = 0x80060590; -alEnvmixerPull = 0x80060670; -alResampleParam = 0x800612F0; -alResamplePull = 0x800613DC; -alFilterNew = 0x80062140; -alSavePull = 0x80062160; -alSaveParam = 0x800621EC; -__osActiveQueue = 0x8007962C; -__osGetActiveQueue = 0x80062410; -__osSetCompare = 0x800624B0; -osAiGetStatus = 0x800624C0; -alCopy = 0x800624E0; -_bcopy = 0x80062560; -__osViInit = 0x80062B20; -__cosf = 0x80062F90; -osEPiReadIo = 0x80063100; -osSetTime = 0x800632B0; -osCartRomInit = 0x80063510; -__osSetFpcCsr = 0x800636F0; -osEPiWriteIo = 0x80063710; -osMapTLBRdb = 0x80063760; -__osViCurr = 0x8007ACF0; -__osViGetCurrentContext = 0x800652D0; -osWritebackDCacheAll = 0x800652E0; -alHeapDBAlloc = 0x80065310; -__d_to_ll = 0x80065650; -__f_to_ll = 0x8006566C; -__d_to_ull = 0x80065688; -__f_to_ull = 0x80065728; -__ll_to_d = 0x800657C4; -__ll_to_f = 0x800657DC; -__ull_to_d = 0x800657F4; -__ull_to_f = 0x80065828; -alSynAllocFX = 0x80065860; -alSynDelete = 0x80065900; -__osSetHWIntrRoutine = 0x80065F50; -entry_point = 0x80000400; -alSynNew = 0x8005F5E0; -alAudioFrame = 0x8005F8E0; -__allocParam = 0x8005FAB0; -__freeParam = 0x8005FAE0; -_collectPVoices = 0x8005FAF8; -_freePVoice = 0x8005FB58; -_timeToSamples = 0x8005FBDC; -alUnlink = 0x80056F50; -alLink = 0x80056F80; -alClose = 0x80056FA4; -alInit = 0x80056FDC; -_VirtualToPhysicalTask = 0x80057010; -osSpTaskLoad = 0x8005712C; -osSpTaskStartGo = 0x800572BC; -tmp_task = 0x80102100; -__osPiAccessQueue = 0x801020E8; -__osPiAccessQueueEnabled = 0x80079610; -piAccessBuf = 0x801020E0; -__sinf = 0x80056D90; -__libm_qnan_f = 0x8007E5D0; -bzero = 0x80057FD0; -__osGbpakTimer = 0x80102200; -__osGbpakTimerQ = 0x80102220; -__osGbpakTimerMsg = 0x80102238; -__osContPifRam = 0x80102140; -__osMaxControllers = 0x80102181; -__osContLastCmd = 0x80102180; -__osEepromTimerQ = 0x801021A8; -__osEepromTimerMsg = 0x801021C0; -__osContInitialized = 0x80079680; -__osSiAccessQueue = 0x801021D8; -__osSiAccessQueueEnabled = 0x80079690; -siAccessBuf = 0x801021D0; -__osCleanupThread = 0x80057FC0; -__osProbeTLB = 0x8005B5E0; -__osFinalRom = 0x801021F0; -__osExceptionPreamble = 0x800576D0; -__osCartRomInit = 0x80059448; -osResetType = 0x8000030C; -osAppNMIBuffer = 0x8000031C; -osTvType = 0x80000300; -__osGetCause = 0x80063E00; -CartRomHandle = 0x80102430; -LeoDiskHandle = 0x801024A8; -__LeoDiskHandle = 0x801007C0; -__osGlobalIntMask = 0x800796B0; -__osShutdown = 0x800796AC; -osViClock = 0x800796A8; -__osPfsInodeCacheBank = 0x8007A934; -__osPfsPifRam = 0x801023F0; -alGlobals = 0x80079640; -guPerspectiveF = 0x8005A5C0; -guPerspective = 0x8005A7F0; -alSeqFileNew = 0x80058278; -__osDiskHandle = 0x80100834; -__osPiTable = 0x8007A87C; -osViRepeatLine = 0x8005B230; -osPfsIsPlug = 0x8005B2A0; -__osPfsRequestData = 0x8005B440; -__osPfsGetInitData = 0x8005B510; -osCreatePiManager = 0x8005B6A0; -osEPiStartDma = 0x8005E0F0; -__osEepromTimer = 0x80102188; -osEepromLongWrite = 0x8005E450; -guRotateRPYF = 0x8005ECA0; -guRotateRPY = 0x8005EDEC; -guRotateF = 0x8005EF60; -guRotate = 0x8005F0F4; -_Ldtob = 0x800645C0; -alAdpcmPull = 0x80061C9C; -alLoadParam = 0x800615F0; -osEPiLinkHandle = 0x8005A990; -__osViNext = 0x8007ACF4; -piEventQueue = 0x801036D0; -piEventBuf = 0x801036E8; -piThread = 0x80102520; -__osPiDevMgr = 0x8007A860; -piThreadStack = 0x801026D0; -osRomBase = 0x80000308; -__osEepPifRam = 0x80104B70; -osGetCount = 0x8005BD00; -__osPfsInodeCacheChannel = 0x8007A930; -__osPfsInodeCache = 0x801036F0; -__osPreNMI = 0x8007A940; -__osEventStateTab = 0x801037F0; -osAfterPreNMI = 0x8005CEC0; -__osThreadTail = 0x80079620; -__osRunQueue = 0x80079628; -__osEnqueueThread = 0x80057DEC; -__osCurrentHandle = 0x8007A880; -osViModeNtscLpn1 = 0x8007A890; -osViModeMpalLpn1 = 0x8007A8E0; -__osTimerList = 0x8007A9B0; -__osBaseTimer = 0x80103890; -__osCurrentTime = 0x801038B0; -__osCurrentTime+4 = 0x801038B4; -__osBaseCounter = 0x801038B8; -__osViIntrCount = 0x801038BC; -__osTimerCounter = 0x801038C0; -_timeToSamplesNoRound = 0x8005FB90; -alEnvmixerParam = 0x80060B78; -_pullSubFrame = 0x80060C58; -_frexpf = 0x80060F40; -_ldexpf = 0x8006102C; -_getRate = 0x80061054; -_getVol = 0x80061238; -osViModePalLan1 = 0x8007AD00; -osViModeMpalLan1 = 0x8007ADA0; -osViModeNtscLan1 = 0x8007AD50; -g_OsGbNintendoData = 0x8007ADF0; -g_OsGbCartVersions = 0x8007AE20; -__CartRomHandle = 0x801038D0; -__DriveRomHandle = 0x80100740; -__osPfsLastChannel = 0x8007AE50; -__osViDevMgr = 0x8007AE90; -__leoQueuesCreated = 0x80079514; -__leoActive = 0x800795B0; -__leoVersion = 0x801010D0; -__additional_scanline = 0x8007AEAC; -viThread = 0x80103950; -viThreadStack = 0x80103B00; -viEventQueue = 0x80104B00; -viEventBuf = 0x80104B18; -viRetraceMsg = 0x80104B30; -viCounterMsg = 0x80104B48; -__osHwIntTable = 0x80079650; set_watch_lohi = 0x8000B7D0; trigger_fault = 0x8000B7E0; crash_screen_sleep = 0x800082C0; diff --git a/src/code_49190.s b/src/code_49190.s new file mode 100644 index 0000000..21d5671 --- /dev/null +++ b/src/code_49190.s @@ -0,0 +1,430 @@ +.include "macro.inc" + +/* assembler directives */ +.set noat /* allow manual use of $at */ +.set noreorder /* don't insert nops after branches */ +.set gp=64 /* allow use of 64-bit general purpose registers */ + +.section .text, "ax" + +/* Generated by spimdisasm 1.28.0 */ + +/* Handwritten function */ +glabel func_80048590 +/* 049190 80048590 2481FFF9 */ addiu $at, $a0, -0x7 +/* 049194 80048594 1C20000D */ bgtz $at, .L800485CC +/* 049198 80048598 00000000 */ nop +/* 04919C 8004859C 03E00821 */ addu $at, $ra, $zero +/* 0491A0 800485A0 04100036 */ bltzal $zero, .L8004867C +/* 0491A4 800485A4 00000000 */ nop +/* 0491A8 800485A8 27EF00D4 */ addiu $t7, $ra, 0xD4 +/* 0491AC 800485AC 0020F821 */ addu $ra, $at, $zero +/* 0491B0 800485B0 01E47821 */ addu $t7, $t7, $a0 +/* 0491B4 800485B4 81E10000 */ lb $at, 0x0($t7) +/* 0491B8 800485B8 00000000 */ nop +/* 0491BC 800485BC 00014103 */ sra $t0, $at, 4 +/* 0491C0 800485C0 30290007 */ andi $t1, $at, 0x7 +/* 0491C4 800485C4 10000004 */ b .L800485D8 +/* 0491C8 800485C8 00000000 */ nop +.L800485CC: +/* 0491CC 800485CC 2488FFF8 */ addiu $t0, $a0, -0x8 +/* 0491D0 800485D0 000840C3 */ sra $t0, $t0, 3 +/* 0491D4 800485D4 30890007 */ andi $t1, $a0, 0x7 +.L800485D8: +/* 0491D8 800485D8 000962C0 */ sll $t4, $t1, 11 +/* 0491DC 800485DC 258C47FF */ addiu $t4, $t4, 0x47FF +/* 0491E0 800485E0 340A0006 */ ori $t2, $zero, 0x6 +/* 0491E4 800485E4 01485023 */ subu $t2, $t2, $t0 +/* 0491E8 800485E8 340B0001 */ ori $t3, $zero, 0x1 +/* 0491EC 800485EC 2541FFFF */ addiu $at, $t2, -0x1 +/* 0491F0 800485F0 002B5804 */ sllv $t3, $t3, $at +/* 0491F4 800485F4 340E000D */ ori $t6, $zero, 0xD +/* 0491F8 800485F8 00C0C021 */ addu $t8, $a2, $zero +.L800485FC: +/* 0491FC 800485FC 870D0000 */ lh $t5, 0x0($t8) +/* 049200 80048600 00000000 */ nop +/* 049204 80048604 000D6B40 */ sll $t5, $t5, 13 +/* 049208 80048608 25AD9000 */ addiu $t5, $t5, -0x7000 +/* 04920C 8004860C 01AC0018 */ mult $t5, $t4 +/* 049210 80048610 00006812 */ mflo $t5 +/* 049214 80048614 25AD4000 */ addiu $t5, $t5, 0x4000 +/* 049218 80048618 000D6BC3 */ sra $t5, $t5, 15 +/* 04921C 8004861C 01AB6821 */ addu $t5, $t5, $t3 +/* 049220 80048620 014D6807 */ srav $t5, $t5, $t2 +/* 049224 80048624 A70D0000 */ sh $t5, 0x0($t8) +/* 049228 80048628 25CEFFFF */ addiu $t6, $t6, -0x1 +/* 04922C 8004862C 1DC0FFF3 */ bgtz $t6, .L800485FC +/* 049230 80048630 27180002 */ addiu $t8, $t8, 0x2 +/* 049234 80048634 00E0C821 */ addu $t9, $a3, $zero +/* 049238 80048638 340E0028 */ ori $t6, $zero, 0x28 +.L8004863C: +/* 04923C 8004863C A7200000 */ sh $zero, 0x0($t9) +/* 049240 80048640 25CEFFFF */ addiu $t6, $t6, -0x1 +/* 049244 80048644 1DC0FFFD */ bgtz $t6, .L8004863C +/* 049248 80048648 27390002 */ addiu $t9, $t9, 0x2 +/* 04924C 8004864C 00E5C821 */ addu $t9, $a3, $a1 +/* 049250 80048650 0325C821 */ addu $t9, $t9, $a1 +/* 049254 80048654 00C0C021 */ addu $t8, $a2, $zero +/* 049258 80048658 340E000D */ ori $t6, $zero, 0xD +.L8004865C: +/* 04925C 8004865C 87010000 */ lh $at, 0x0($t8) +/* 049260 80048660 27180002 */ addiu $t8, $t8, 0x2 +/* 049264 80048664 A7210000 */ sh $at, 0x0($t9) +/* 049268 80048668 25CEFFFF */ addiu $t6, $t6, -0x1 +/* 04926C 8004866C 1DC0FFFB */ bgtz $t6, .L8004865C +/* 049270 80048670 27390006 */ addiu $t9, $t9, 0x6 +/* 049274 80048674 03E00008 */ jr $ra +/* 049278 80048678 00000000 */ nop + +# these feel like deliberately invalid instructions. +# they decode to a branch from a delay slot, which +# cant possibly be valid. +.L8004867C: +/* 04927C 8004867C C7D7E3E7 */ .4byte 0xC7D7E3E7 +/* 049280 80048680 F1F3F5F7 */ .4byte 0xF1F3F5F7 + +glabel func_80048684 +/* 049284 80048684 848B0166 */ lh $t3, 0x166($a0) +/* 049288 80048688 24A1FFD8 */ addiu $at, $a1, -0x28 +/* 04928C 8004868C 04200005 */ bltz $at, .L800486A4 +/* 049290 80048690 00000000 */ nop +/* 049294 80048694 2421FFB0 */ addiu $at, $at, -0x50 +/* 049298 80048698 1C200002 */ bgtz $at, .L800486A4 +/* 04929C 8004869C 00000000 */ nop +/* 0492A0 800486A0 00A05821 */ addu $t3, $a1, $zero +.L800486A4: +/* 0492A4 800486A4 A48B0166 */ sh $t3, 0x166($a0) +/* 0492A8 800486A8 03E00821 */ addu $at, $ra, $zero +/* 0492AC 800486AC 04100022 */ bltzal $zero, .L80048738 +/* 0492B0 800486B0 00000000 */ nop +/* 0492B4 800486B4 27E80084 */ addiu $t0, $ra, 0x84 +/* 0492B8 800486B8 0020F821 */ addu $ra, $at, $zero +/* 0492BC 800486BC 01064021 */ addu $t0, $t0, $a2 +/* 0492C0 800486C0 01064021 */ addu $t0, $t0, $a2 +/* 0492C4 800486C4 95080000 */ lhu $t0, 0x0($t0) +/* 0492C8 800486C8 340A0077 */ ori $t2, $zero, 0x77 +/* 0492CC 800486CC 248D0000 */ addiu $t5, $a0, 0x0 +.L800486D0: +/* 0492D0 800486D0 95AC0050 */ lhu $t4, 0x50($t5) +/* 0492D4 800486D4 254AFFFF */ addiu $t2, $t2, -0x1 +/* 0492D8 800486D8 A5AC0000 */ sh $t4, 0x0($t5) +/* 0492DC 800486DC 0541FFFC */ bgez $t2, .L800486D0 +/* 0492E0 800486E0 25AD0002 */ addiu $t5, $t5, 0x2 +/* 0492E4 800486E4 340A0027 */ ori $t2, $zero, 0x27 +/* 0492E8 800486E8 248E0000 */ addiu $t6, $a0, 0x0 +/* 0492EC 800486EC 248D0000 */ addiu $t5, $a0, 0x0 +/* 0492F0 800486F0 01AB6823 */ subu $t5, $t5, $t3 +/* 0492F4 800486F4 01AB6823 */ subu $t5, $t5, $t3 +/* 0492F8 800486F8 00E07821 */ addu $t7, $a3, $zero +.L800486FC: +/* 0492FC 800486FC 85A900F0 */ lh $t1, 0xF0($t5) +/* 049300 80048700 25AD0002 */ addiu $t5, $t5, 0x2 +/* 049304 80048704 01280018 */ mult $t1, $t0 +/* 049308 80048708 00004812 */ mflo $t1 +/* 04930C 8004870C 25294000 */ addiu $t1, $t1, 0x4000 +/* 049310 80048710 00094BC3 */ sra $t1, $t1, 15 +/* 049314 80048714 85E10000 */ lh $at, 0x0($t7) +/* 049318 80048718 25EF0002 */ addiu $t7, $t7, 0x2 +/* 04931C 8004871C 01214821 */ addu $t1, $t1, $at +/* 049320 80048720 A5C900F0 */ sh $t1, 0xF0($t6) +/* 049324 80048724 25CE0002 */ addiu $t6, $t6, 0x2 +/* 049328 80048728 1D40FFF4 */ bgtz $t2, .L800486FC +/* 04932C 8004872C 254AFFFF */ addiu $t2, $t2, -0x1 +/* 049330 80048730 03E00008 */ jr $ra +/* 049334 80048734 00000000 */ nop +.L80048738: # these feel like deliberately invalid instructions. + # they decode to a branch from a delay slot, which + # cant possibly be valid. +/* 049338 80048738 0CCD2CCD */ .4byte 0x0CCD2CCD +/* 04933C 8004873C 53337FFF */ .4byte 0x53337FFF +.L80048740: +/* 049340 80048740 852A0000 */ lh $t2, 0x0($t1) +/* 049344 80048744 25290002 */ addiu $t1, $t1, 0x2 +/* 049348 80048748 00196C00 */ sll $t5, $t9, 16 +/* 04934C 8004874C 000D6C03 */ sra $t5, $t5, 16 +/* 049350 80048750 02ED0018 */ mult $s7, $t5 +/* 049354 80048754 00000812 */ mflo $at +/* 049358 80048758 24214000 */ addiu $at, $at, 0x4000 +/* 04935C 8004875C 00010BC3 */ sra $at, $at, 15 +/* 049360 80048760 01415023 */ subu $t2, $t2, $at +/* 049364 80048764 00196C03 */ sra $t5, $t9, 16 +/* 049368 80048768 02CD0018 */ mult $s6, $t5 +/* 04936C 8004876C 00000812 */ mflo $at +/* 049370 80048770 24214000 */ addiu $at, $at, 0x4000 +/* 049374 80048774 00010BC3 */ sra $at, $at, 15 +/* 049378 80048778 01415023 */ subu $t2, $t2, $at +/* 04937C 8004877C 01AA0018 */ mult $t5, $t2 +/* 049380 80048780 00000812 */ mflo $at +/* 049384 80048784 24214000 */ addiu $at, $at, 0x4000 +/* 049388 80048788 00010BC3 */ sra $at, $at, 15 +/* 04938C 8004878C 0036B821 */ addu $s7, $at, $s6 +/* 049390 80048790 00186C00 */ sll $t5, $t8, 16 +/* 049394 80048794 000D6C03 */ sra $t5, $t5, 16 +/* 049398 80048798 02AD0018 */ mult $s5, $t5 +/* 04939C 8004879C 00000812 */ mflo $at +/* 0493A0 800487A0 24214000 */ addiu $at, $at, 0x4000 +/* 0493A4 800487A4 00010BC3 */ sra $at, $at, 15 +/* 0493A8 800487A8 01415023 */ subu $t2, $t2, $at +/* 0493AC 800487AC 01AA0018 */ mult $t5, $t2 +/* 0493B0 800487B0 00000812 */ mflo $at +/* 0493B4 800487B4 24214000 */ addiu $at, $at, 0x4000 +/* 0493B8 800487B8 00010BC3 */ sra $at, $at, 15 +/* 0493BC 800487BC 0035B021 */ addu $s6, $at, $s5 +/* 0493C0 800487C0 00186C03 */ sra $t5, $t8, 16 +/* 0493C4 800487C4 028D0018 */ mult $s4, $t5 +/* 0493C8 800487C8 00000812 */ mflo $at +/* 0493CC 800487CC 24214000 */ addiu $at, $at, 0x4000 +/* 0493D0 800487D0 00010BC3 */ sra $at, $at, 15 +/* 0493D4 800487D4 01415023 */ subu $t2, $t2, $at +/* 0493D8 800487D8 01AA0018 */ mult $t5, $t2 +/* 0493DC 800487DC 00000812 */ mflo $at +/* 0493E0 800487E0 24214000 */ addiu $at, $at, 0x4000 +/* 0493E4 800487E4 00010BC3 */ sra $at, $at, 15 +/* 0493E8 800487E8 0034A821 */ addu $s5, $at, $s4 +/* 0493EC 800487EC 000F6C00 */ sll $t5, $t7, 16 +/* 0493F0 800487F0 000D6C03 */ sra $t5, $t5, 16 +/* 0493F4 800487F4 026D0018 */ mult $s3, $t5 +/* 0493F8 800487F8 00000812 */ mflo $at +/* 0493FC 800487FC 24214000 */ addiu $at, $at, 0x4000 +/* 049400 80048800 00010BC3 */ sra $at, $at, 15 +/* 049404 80048804 01415023 */ subu $t2, $t2, $at +/* 049408 80048808 01AA0018 */ mult $t5, $t2 +/* 04940C 8004880C 00000812 */ mflo $at +/* 049410 80048810 24214000 */ addiu $at, $at, 0x4000 +/* 049414 80048814 00010BC3 */ sra $at, $at, 15 +/* 049418 80048818 0033A021 */ addu $s4, $at, $s3 +/* 04941C 8004881C 000F6C03 */ sra $t5, $t7, 16 +/* 049420 80048820 024D0018 */ mult $s2, $t5 +/* 049424 80048824 00000812 */ mflo $at +/* 049428 80048828 24214000 */ addiu $at, $at, 0x4000 +/* 04942C 8004882C 00010BC3 */ sra $at, $at, 15 +/* 049430 80048830 01415023 */ subu $t2, $t2, $at +/* 049434 80048834 01AA0018 */ mult $t5, $t2 +/* 049438 80048838 00000812 */ mflo $at +/* 04943C 8004883C 24214000 */ addiu $at, $at, 0x4000 +/* 049440 80048840 00010BC3 */ sra $at, $at, 15 +/* 049444 80048844 00329821 */ addu $s3, $at, $s2 +/* 049448 80048848 000E6C00 */ sll $t5, $t6, 16 +/* 04944C 8004884C 000D6C03 */ sra $t5, $t5, 16 +/* 049450 80048850 022D0018 */ mult $s1, $t5 +/* 049454 80048854 00000812 */ mflo $at +/* 049458 80048858 24214000 */ addiu $at, $at, 0x4000 +/* 04945C 8004885C 00010BC3 */ sra $at, $at, 15 +/* 049460 80048860 01415023 */ subu $t2, $t2, $at +/* 049464 80048864 01AA0018 */ mult $t5, $t2 +/* 049468 80048868 00000812 */ mflo $at +/* 04946C 8004886C 24214000 */ addiu $at, $at, 0x4000 +/* 049470 80048870 00010BC3 */ sra $at, $at, 15 +/* 049474 80048874 00319021 */ addu $s2, $at, $s1 +/* 049478 80048878 000E6C03 */ sra $t5, $t6, 16 +/* 04947C 8004887C 020D0018 */ mult $s0, $t5 +/* 049480 80048880 00000812 */ mflo $at +/* 049484 80048884 24214000 */ addiu $at, $at, 0x4000 +/* 049488 80048888 00010BC3 */ sra $at, $at, 15 +/* 04948C 8004888C 01415023 */ subu $t2, $t2, $at +/* 049490 80048890 01AA0018 */ mult $t5, $t2 +/* 049494 80048894 00000812 */ mflo $at +/* 049498 80048898 24214000 */ addiu $at, $at, 0x4000 +/* 04949C 8004889C 00010BC3 */ sra $at, $at, 15 +/* 0494A0 800488A0 00308821 */ addu $s1, $at, $s0 +/* 0494A4 800488A4 01408021 */ addu $s0, $t2, $zero +/* 0494A8 800488A8 34016E14 */ ori $at, $zero, 0x6E14 +/* 0494AC 800488AC 00270018 */ mult $at, $a3 +/* 0494B0 800488B0 00000812 */ mflo $at +/* 0494B4 800488B4 24214000 */ addiu $at, $at, 0x4000 +/* 0494B8 800488B8 00010BC3 */ sra $at, $at, 15 +/* 0494BC 800488BC 01415021 */ addu $t2, $t2, $at +/* 0494C0 800488C0 01403821 */ addu $a3, $t2, $zero +/* 0494C4 800488C4 000A5040 */ sll $t2, $t2, 1 +/* 0494C8 800488C8 000A0BC3 */ sra $at, $t2, 15 +/* 0494CC 800488CC 24210001 */ addiu $at, $at, 0x1 +/* 0494D0 800488D0 00010843 */ sra $at, $at, 1 +/* 0494D4 800488D4 10200004 */ beqz $at, .L800488E8 +/* 0494D8 800488D8 00000000 */ nop +/* 0494DC 800488DC 04200002 */ bltz $at, .L800488E8 +/* 0494E0 800488E0 240A8000 */ addiu $t2, $zero, -0x8000 +/* 0494E4 800488E4 240A7FFF */ addiu $t2, $zero, 0x7FFF +.L800488E8: +/* 0494E8 800488E8 314AFFF8 */ andi $t2, $t2, 0xFFF8 +/* 0494EC 800488EC A50A0000 */ sh $t2, 0x0($t0) +/* 0494F0 800488F0 25080002 */ addiu $t0, $t0, 0x2 +/* 0494F4 800488F4 1D60FF92 */ bgtz $t3, .L80048740 +/* 0494F8 800488F8 256BFFFF */ addiu $t3, $t3, -0x1 +/* 0494FC 800488FC 03E00008 */ jr $ra +/* 049500 80048900 00000000 */ nop + +/* Handwritten function */ +glabel func_80048904 +/* 049504 80048904 27BDFFBC */ addiu $sp, $sp, -0x44 +/* 049508 80048908 AFBF0000 */ sw $ra, 0x0($sp) +/* 04950C 8004890C AFA40004 */ sw $a0, 0x4($sp) +/* 049510 80048910 AFA50008 */ sw $a1, 0x8($sp) +/* 049514 80048914 AFA6000C */ sw $a2, 0xC($sp) +/* 049518 80048918 AFA70010 */ sw $a3, 0x10($sp) +/* 04951C 8004891C AFB00014 */ sw $s0, 0x14($sp) +/* 049520 80048920 AFB10018 */ sw $s1, 0x18($sp) +/* 049524 80048924 AFB2001C */ sw $s2, 0x1C($sp) +/* 049528 80048928 AFB30020 */ sw $s3, 0x20($sp) +/* 04952C 8004892C AFB40024 */ sw $s4, 0x24($sp) +/* 049530 80048930 AFB50028 */ sw $s5, 0x28($sp) +/* 049534 80048934 AFB6002C */ sw $s6, 0x2C($sp) +/* 049538 80048938 AFB70030 */ sw $s7, 0x30($sp) +/* 04953C 8004893C 24810140 */ addiu $at, $a0, 0x140 +/* 049540 80048940 8C300000 */ lw $s0, 0x0($at) +/* 049544 80048944 8C310004 */ lw $s1, 0x4($at) +/* 049548 80048948 8C320008 */ lw $s2, 0x8($at) +/* 04954C 8004894C 8C33000C */ lw $s3, 0xC($at) +/* 049550 80048950 8C340010 */ lw $s4, 0x10($at) +/* 049554 80048954 8C350014 */ lw $s5, 0x14($at) +/* 049558 80048958 8C360018 */ lw $s6, 0x18($at) +/* 04955C 8004895C 8C37001C */ lw $s7, 0x1C($at) +/* 049560 80048960 84870164 */ lh $a3, 0x164($a0) +/* 049564 80048964 04100065 */ bltzal $zero, .L80048AFC +/* 049568 80048968 00000000 */ nop +/* 04956C 8004896C 27EB0190 */ addiu $t3, $ra, 0x190 +/* 049570 80048970 04110039 */ bal .L80048A58 /* handwritten instruction */ +/* 049574 80048974 00000000 */ nop +/* 049578 80048978 24A90000 */ addiu $t1, $a1, 0x0 +/* 04957C 8004897C 24C80000 */ addiu $t0, $a2, 0x0 +/* 049580 80048980 0411FF6F */ bal .L80048740 /* handwritten instruction */ +/* 049584 80048984 340B000C */ ori $t3, $zero, 0xC +/* 049588 80048988 04100062 */ bltzal $zero, .L80048B14 +/* 04958C 8004898C 00000000 */ nop +/* 049590 80048990 27EB0184 */ addiu $t3, $ra, 0x184 +/* 049594 80048994 04110030 */ bal .L80048A58 /* handwritten instruction */ +/* 049598 80048998 00000000 */ nop +/* 04959C 8004899C 24A9001A */ addiu $t1, $a1, 0x1A +/* 0495A0 800489A0 24C8001A */ addiu $t0, $a2, 0x1A +/* 0495A4 800489A4 0411FF66 */ bal .L80048740 /* handwritten instruction */ +/* 0495A8 800489A8 340B000D */ ori $t3, $zero, 0xD +/* 0495AC 800489AC 0410005D */ bltzal $zero, .L80048B24 +/* 0495B0 800489B0 00000000 */ nop +/* 0495B4 800489B4 27EB0170 */ addiu $t3, $ra, 0x170 +/* 0495B8 800489B8 04110027 */ bal .L80048A58 /* handwritten instruction */ +/* 0495BC 800489BC 00000000 */ nop +/* 0495C0 800489C0 24A90036 */ addiu $t1, $a1, 0x36 +/* 0495C4 800489C4 24C80036 */ addiu $t0, $a2, 0x36 +/* 0495C8 800489C8 0411FF5D */ bal .L80048740 /* handwritten instruction */ +/* 0495CC 800489CC 340B000C */ ori $t3, $zero, 0xC +/* 0495D0 800489D0 0410005A */ bltzal $zero, .L80048B3C +/* 0495D4 800489D4 00000000 */ nop +/* 0495D8 800489D8 27EB0164 */ addiu $t3, $ra, 0x164 +/* 0495DC 800489DC 0411001E */ bal .L80048A58 /* handwritten instruction */ +/* 0495E0 800489E0 00000000 */ nop +/* 0495E4 800489E4 24A90050 */ addiu $t1, $a1, 0x50 +/* 0495E8 800489E8 24C80050 */ addiu $t0, $a2, 0x50 +/* 0495EC 800489EC 0411FF54 */ bal .L80048740 /* handwritten instruction */ +/* 0495F0 800489F0 340B0077 */ ori $t3, $zero, 0x77 +/* 0495F4 800489F4 24810140 */ addiu $at, $a0, 0x140 +/* 0495F8 800489F8 AC300000 */ sw $s0, 0x0($at) +/* 0495FC 800489FC AC310004 */ sw $s1, 0x4($at) +/* 049600 80048A00 AC320008 */ sw $s2, 0x8($at) +/* 049604 80048A04 AC33000C */ sw $s3, 0xC($at) +/* 049608 80048A08 AC340010 */ sw $s4, 0x10($at) +/* 04960C 80048A0C AC350014 */ sw $s5, 0x14($at) +/* 049610 80048A10 AC360018 */ sw $s6, 0x18($at) +/* 049614 80048A14 AC37001C */ sw $s7, 0x1C($at) +/* 049618 80048A18 A4870164 */ sh $a3, 0x164($a0) +/* 04961C 80048A1C 8FBF0000 */ lw $ra, 0x0($sp) +/* 049620 80048A20 8FA40004 */ lw $a0, 0x4($sp) +/* 049624 80048A24 8FA50008 */ lw $a1, 0x8($sp) +/* 049628 80048A28 8FA6000C */ lw $a2, 0xC($sp) +/* 04962C 80048A2C 8FA70010 */ lw $a3, 0x10($sp) +/* 049630 80048A30 8FB00014 */ lw $s0, 0x14($sp) +/* 049634 80048A34 8FB10018 */ lw $s1, 0x18($sp) +/* 049638 80048A38 8FB2001C */ lw $s2, 0x1C($sp) +/* 04963C 80048A3C 8FB30020 */ lw $s3, 0x20($sp) +/* 049640 80048A40 8FB40024 */ lw $s4, 0x24($sp) +/* 049644 80048A44 8FB50028 */ lw $s5, 0x28($sp) +/* 049648 80048A48 8FB6002C */ lw $s6, 0x2C($sp) +/* 04964C 80048A4C 8FB70030 */ lw $s7, 0x30($sp) +/* 049650 80048A50 03E00008 */ jr $ra +/* 049654 80048A54 27BD0044 */ addiu $sp, $sp, 0x44 +.L80048A58: +/* 049658 80048A58 84810188 */ lh $at, 0x188($a0) +/* 04965C 80048A5C 24880168 */ addiu $t0, $a0, 0x168 +/* 049660 80048A60 10200003 */ beqz $at, .L80048A70 +/* 049664 80048A64 25090010 */ addiu $t1, $t0, 0x10 +/* 049668 80048A68 01204021 */ addu $t0, $t1, $zero +/* 04966C 80048A6C 24890168 */ addiu $t1, $a0, 0x168 +.L80048A70: +/* 049670 80048A70 03E06821 */ addu $t5, $ra, $zero +/* 049674 80048A74 850A0000 */ lh $t2, 0x0($t0) +/* 049678 80048A78 0160F809 */ jalr $t3 +/* 04967C 80048A7C 852C0000 */ lh $t4, 0x0($t1) +/* 049680 80048A80 000A7400 */ sll $t6, $t2, 16 +/* 049684 80048A84 850A0002 */ lh $t2, 0x2($t0) +/* 049688 80048A88 0160F809 */ jalr $t3 +/* 04968C 80048A8C 852C0002 */ lh $t4, 0x2($t1) +/* 049690 80048A90 01CA7025 */ or $t6, $t6, $t2 +/* 049694 80048A94 850A0004 */ lh $t2, 0x4($t0) +/* 049698 80048A98 0160F809 */ jalr $t3 +/* 04969C 80048A9C 852C0004 */ lh $t4, 0x4($t1) +/* 0496A0 80048AA0 000A7C00 */ sll $t7, $t2, 16 +/* 0496A4 80048AA4 850A0006 */ lh $t2, 0x6($t0) +/* 0496A8 80048AA8 0160F809 */ jalr $t3 +/* 0496AC 80048AAC 852C0006 */ lh $t4, 0x6($t1) +/* 0496B0 80048AB0 01EA7825 */ or $t7, $t7, $t2 +/* 0496B4 80048AB4 850A0008 */ lh $t2, 0x8($t0) +/* 0496B8 80048AB8 0160F809 */ jalr $t3 +/* 0496BC 80048ABC 852C0008 */ lh $t4, 0x8($t1) +/* 0496C0 80048AC0 000AC400 */ sll $t8, $t2, 16 +/* 0496C4 80048AC4 850A000A */ lh $t2, 0xA($t0) +/* 0496C8 80048AC8 0160F809 */ jalr $t3 +/* 0496CC 80048ACC 852C000A */ lh $t4, 0xA($t1) +/* 0496D0 80048AD0 030AC025 */ or $t8, $t8, $t2 +/* 0496D4 80048AD4 850A000C */ lh $t2, 0xC($t0) +/* 0496D8 80048AD8 0160F809 */ jalr $t3 +/* 0496DC 80048ADC 852C000C */ lh $t4, 0xC($t1) +/* 0496E0 80048AE0 000ACC00 */ sll $t9, $t2, 16 +/* 0496E4 80048AE4 850A000E */ lh $t2, 0xE($t0) +/* 0496E8 80048AE8 0160F809 */ jalr $t3 +/* 0496EC 80048AEC 852C000E */ lh $t4, 0xE($t1) +/* 0496F0 80048AF0 01A0F821 */ addu $ra, $t5, $zero +/* 0496F4 80048AF4 03E00008 */ jr $ra +/* 0496F8 80048AF8 032AC825 */ or $t9, $t9, $t2 +.L80048AFC: +/* 0496FC 80048AFC 000A5083 */ sra $t2, $t2, 2 +/* 049700 80048B00 000C6043 */ sra $t4, $t4, 1 +/* 049704 80048B04 014C5021 */ addu $t2, $t2, $t4 +/* 049708 80048B08 000C6043 */ sra $t4, $t4, 1 +/* 04970C 80048B0C 1000000B */ b .L80048B3C +/* 049710 80048B10 014C5021 */ addu $t2, $t2, $t4 +.L80048B14: +/* 049714 80048B14 000A5043 */ sra $t2, $t2, 1 +/* 049718 80048B18 000C6043 */ sra $t4, $t4, 1 +/* 04971C 80048B1C 10000007 */ b .L80048B3C +/* 049720 80048B20 014C5021 */ addu $t2, $t2, $t4 +.L80048B24: +/* 049724 80048B24 000A5043 */ sra $t2, $t2, 1 +/* 049728 80048B28 000C6083 */ sra $t4, $t4, 2 +/* 04972C 80048B2C 018A6021 */ addu $t4, $t4, $t2 +/* 049730 80048B30 000A5043 */ sra $t2, $t2, 1 +/* 049734 80048B34 10000001 */ b .L80048B3C +/* 049738 80048B38 014C5021 */ addu $t2, $t2, $t4 +.L80048B3C: +/* 04973C 80048B3C 05410003 */ bgez $t2, .L80048B4C +/* 049740 80048B40 00006021 */ addu $t4, $zero, $zero +/* 049744 80048B44 000A5023 */ negu $t2, $t2 +/* 049748 80048B48 340C0001 */ ori $t4, $zero, 0x1 +.L80048B4C: +/* 04974C 80048B4C 2541D4CD */ addiu $at, $t2, -0x2B33 +/* 049750 80048B50 04200006 */ bltz $at, .L80048B6C +/* 049754 80048B54 000A0840 */ sll $at, $t2, 1 +/* 049758 80048B58 2541B19A */ addiu $at, $t2, -0x4E66 +/* 04975C 80048B5C 04200003 */ bltz $at, .L80048B6C +/* 049760 80048B60 25412B33 */ addiu $at, $t2, 0x2B33 +/* 049764 80048B64 000A0883 */ sra $at, $t2, 2 +/* 049768 80048B68 24216600 */ addiu $at, $at, 0x6600 +.L80048B6C: +/* 04976C 80048B6C 242A8001 */ addiu $t2, $at, -0x7FFF +/* 049770 80048B70 19400002 */ blez $t2, .L80048B7C +/* 049774 80048B74 00205021 */ addu $t2, $at, $zero +/* 049778 80048B78 340A7FFF */ ori $t2, $zero, 0x7FFF +.L80048B7C: +/* 04977C 80048B7C 15800002 */ bnez $t4, .L80048B88 +/* 049780 80048B80 000A5023 */ negu $t2, $t2 +/* 049784 80048B84 000A5023 */ negu $t2, $t2 +.L80048B88: +/* 049788 80048B88 03E00008 */ jr $ra +/* 04978C 80048B8C 314AFFFF */ andi $t2, $t2, 0xFFFF diff --git a/yamls/us/rom.yaml b/yamls/us/rom.yaml index 09fc509..1ee024a 100644 --- a/yamls/us/rom.yaml +++ b/yamls/us/rom.yaml @@ -19,10 +19,10 @@ subsegments: - [0x1000, hasm, entry] # bootloader - [0x1060, c, main] # rsp graphics - - [0x11B0, bin, noppad_11B0] # There's an extra nop align here, but cant reproduce it with just splat functionality alone. need a . += 0x10 in the linker script at this spot. + - [0x11B0, pad] # There's an extra nop align here, but cant reproduce it with just splat functionality alone. need a . += 0x10 in the linker script at this spot. - [0x11C0, c, rsp] # rsp audio - [0x1A80, c, dma] # DMA transfer - - [0x1F70, bin, noppad_1F70] # Extra nop align like earlier. Weird + - [0x1F70, pad] # Extra nop align like earlier. Weird - [0x1F80, c, dp_intro] # dp intro code - [0x28E0, c, memmap] - [0x2EC0, c, memory_main] # handles the main global pool @@ -92,7 +92,7 @@ - [0x485C0, c] # moves code - [0x48C60, c] # move effects code - [0x490A0, c] # audio functions to 0x50C00 - - [0x49190, bin] + - [0x49190, hasm, code_49190] - [0x49790, c] - [0x49BA0, c] - [0x49DC0, c] @@ -123,7 +123,7 @@ - [0x51BC0, c, libleo/readwrite] - [0x51C50, c, libleo/leofunc] - [0x520C0, c, libleo/leoint] - - [0x52AB0, bin, noppad_52AB0] # again with the weird nop padding. + - [0x52AB0, pad] # again with the weird nop padding. - [0x52AC0, c, libleo/leocmdex] - [0x53150, c, libleo/leoread] - [0x53310, c, libleo/lbatobyte] @@ -207,7 +207,7 @@ - [0x5C410, pad] - [0x5C420, lib, libultra, devmgr] - [0x5C830, lib, libultra, pirawdma] - - [0x5C900, lib, libultra, osGetCount] + - [0x5C900, lib, libultra, getcount] - [0x5C910, lib, libultra, conteepprobe] - [0x5C980, lib, libultra, conteepwrite] - [0x5CD50, lib, libultra, getmemsize] @@ -240,7 +240,7 @@ - [0x5F5F0, lib, libultra, viswapbuf] - [0x5F640, lib, libultra, epirawdma] - [0x5F820, lib, libultra, sptaskyielded] - - [0x5F8A0, lib, libultra, rotateRPY] + - [0x5F8A0, lib, libultra, rotaterpy] - [0x5FA40, lib, libultra, bcmp] - [0x5FB60, lib, libultra, rotate] - [0x5FD50, lib, libultra, gettime]