From d2279294209edd9ec92e601ccb86388ff9283dbb Mon Sep 17 00:00:00 2001 From: Seth Barberee Date: Sat, 19 Sep 2020 23:28:48 -0500 Subject: [PATCH] more datadumping and some decomp work --- asm/code_800D090.s | 552 -------------------------------------------- asm/code_80118A4.s | 545 +++++++++++++++++++++++++++++++++++++++++++ data/data.s | 129 +++++++++-- data/data_80B9BB8.s | 44 ++-- ld_script.txt | 2 + src/code_80118A4.c | 13 ++ 6 files changed, 698 insertions(+), 587 deletions(-) create mode 100644 asm/code_80118A4.s create mode 100644 src/code_80118A4.c diff --git a/asm/code_800D090.s b/asm/code_800D090.s index 4f43b66f..b3c63f33 100644 --- a/asm/code_800D090.s +++ b/asm/code_800D090.s @@ -9494,556 +9494,4 @@ _0801189C: .4byte gUnknown_202DE22 _080118A0: .4byte gUnknown_202DE24 thumb_func_end sub_8011860 - thumb_func_start sub_80118A4 -sub_80118A4: - push {lr} - bl sub_8011924 - ldr r0, _080118BC - bl sub_801199C - ldr r0, _080118C0 - bl sub_801199C - pop {r0} - bx r0 - .align 2, 0 -_080118BC: .4byte 0x000003e6 -_080118C0: .4byte 0x000003e5 - thumb_func_end sub_80118A4 - - thumb_func_start sub_80118C4 -sub_80118C4: - push {r4,lr} - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - adds r0, r4, 0 - bl sub_800BFD0 - ldr r0, _080118E8 - adds r1, r4, 0 - bl sub_800C3F8 - ldr r0, _080118EC - adds r1, r4, 0 - bl sub_800C3F8 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080118E8: .4byte 0x000003e6 -_080118EC: .4byte 0x000003e5 - thumb_func_end sub_80118C4 - - thumb_func_start sub_80118F0 -sub_80118F0: - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl sub_800BDFC - pop {r0} - bx r0 - thumb_func_end sub_80118F0 - - thumb_func_start sub_8011900 -sub_8011900: - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - bl sub_800BE8C - pop {r0} - bx r0 - thumb_func_end sub_8011900 - - thumb_func_start sub_8011914 -sub_8011914: - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl sub_800BF48 - pop {r0} - bx r0 - thumb_func_end sub_8011914 - - thumb_func_start sub_8011924 -sub_8011924: - push {lr} - bl sub_800BF80 - pop {r0} - bx r0 - thumb_func_end sub_8011924 - - thumb_func_start sub_8011930 -sub_8011930: - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl sub_800BFD0 - pop {r0} - bx r0 - thumb_func_end sub_8011930 - - thumb_func_start sub_8011940 -sub_8011940: - push {r4,lr} - lsls r0, 16 - lsrs r4, r0, 16 - bl sub_800C068 - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, _08011960 - cmp r4, r0 - bne _08011964 - eors r1, r4 - negs r0, r1 - orrs r0, r1 - lsrs r0, 31 - b _0801196C - .align 2, 0 -_08011960: .4byte 0x000003e7 -_08011964: - movs r0, 0 - cmp r1, r4 - bne _0801196C - movs r0, 0x1 -_0801196C: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8011940 - - thumb_func_start sub_8011974 -sub_8011974: - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - bl sub_800C074 - pop {r0} - bx r0 - thumb_func_end sub_8011974 - - thumb_func_start sub_8011988 -sub_8011988: - push {lr} - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x80 - lsls r1, 1 - bl sub_800C074 - pop {r0} - bx r0 - thumb_func_end sub_8011988 - - thumb_func_start sub_801199C -sub_801199C: - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl sub_800C298 - pop {r0} - bx r0 - thumb_func_end sub_801199C - - thumb_func_start sub_80119AC -sub_80119AC: - push {lr} - lsls r0, 16 - lsrs r0, 16 - lsls r1, 16 - lsrs r1, 16 - bl sub_800C3F8 - pop {r0} - bx r0 - thumb_func_end sub_80119AC - - thumb_func_start sub_80119C0 -sub_80119C0: - push {lr} - lsls r0, 16 - lsrs r0, 16 - bl sub_800C5D0 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80119C0 - - thumb_func_start sub_80119D4 -sub_80119D4: - push {r4,lr} - adds r2, r0, 0 - ldr r4, _080119FC - movs r1, 0 - ldrsh r0, [r4, r1] - cmp r0, 0 - bgt _080119F6 - ldr r1, _08011A00 - lsls r0, r2, 1 - adds r0, r1 - ldrh r0, [r0] - movs r1, 0x80 - lsls r1, 1 - bl sub_800C074 - movs r0, 0x4 - strh r0, [r4] -_080119F6: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_080119FC: .4byte gUnknown_202DE20 -_08011A00: .4byte gUnknown_80D4144 - thumb_func_end sub_80119D4 - - thumb_func_start sub_8011A04 -sub_8011A04: - push {lr} - ldr r1, _08011A24 - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0 - bgt _08011A1E - movs r0, 0x3 - strh r0, [r1] - ldr r0, _08011A28 - movs r1, 0x80 - lsls r1, 1 - bl sub_800C074 -_08011A1E: - pop {r0} - bx r0 - .align 2, 0 -_08011A24: .4byte gUnknown_202DE22 -_08011A28: .4byte 0x00000131 - thumb_func_end sub_8011A04 - - thumb_func_start sub_8011A2C -sub_8011A2C: - ldr r1, _08011A34 - str r0, [r1] - bx lr - .align 2, 0 -_08011A34: .4byte gUnknown_202DE1C - thumb_func_end sub_8011A2C - - thumb_func_start NDS_DebugInit -NDS_DebugInit: - push {lr} - bl nullsub_26 - bl nullsub_27 - bl nullsub_29 - bl nullsub_30 - bl nullsub_31 - bl nullsub_32 - bl nullsub_28 - ldr r1, _08011A60 - movs r0, 0x1 - str r0, [r1] - pop {r0} - bx r0 - .align 2, 0 -_08011A60: .4byte gUnknown_203B14C - thumb_func_end NDS_DebugInit - - thumb_func_start nullsub_25 -nullsub_25: - bx lr - thumb_func_end nullsub_25 - - thumb_func_start nullsub_26 -nullsub_26: - bx lr - thumb_func_end nullsub_26 - - thumb_func_start PrintFuncFileLineOrNotEntry -PrintFuncFileLineOrNotEntry: - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r0, r1, 0 - cmp r0, 0 - beq _08011A90 - ldr r1, _08011A8C - ldr r2, [r0, 0x8] - ldr r3, [r0] - ldr r0, [r0, 0x4] - str r0, [sp] - adds r0, r4, 0 - bl sprintf - b _08011A98 - .align 2, 0 -_08011A8C: .4byte gUnknown_80D418C -_08011A90: - ldr r1, _08011AA0 - adds r0, r4, 0 - bl sprintf -_08011A98: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_08011AA0: .4byte gUnknown_80D41B0 - thumb_func_end PrintFuncFileLineOrNotEntry - - thumb_func_start PrintFuncFileLine -PrintFuncFileLine: - push {r4,r5,lr} - sub sp, 0x8 - ldr r5, _08011AC4 - ldr r3, [r1, 0x8] - ldr r4, [r1] - str r4, [sp] - ldr r1, [r1, 0x4] - str r1, [sp, 0x4] - adds r1, r5, 0 - bl sprintf - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .align 2, 0 -_08011AC4: .4byte gUnknown_80D41C4 - thumb_func_end PrintFuncFileLine - - thumb_func_start PrintMessageWithFuncFileLine -PrintMessageWithFuncFileLine: - push {r2,r3} - push {r4,r5,lr} - sub sp, 0x4 - adds r4, r0, 0 - adds r5, r1, 0 - ldr r1, [sp, 0x10] - add r2, sp, 0x14 - bl vsprintf - adds r0, r4, 0 - bl strlen - adds r4, r0 - ldr r1, _08011AFC - ldr r2, [r5, 0x8] - ldr r3, [r5] - ldr r0, [r5, 0x4] - str r0, [sp] - adds r0, r4, 0 - bl sprintf - add sp, 0x4 - pop {r4,r5} - pop {r3} - add sp, 0x8 - bx r3 - .align 2, 0 -_08011AFC: .4byte gUnknown_80D41EC - thumb_func_end PrintMessageWithFuncFileLine - - thumb_func_start nullsub_199 -nullsub_199: - bx lr - thumb_func_end nullsub_199 - - thumb_func_start nullsub_27 -nullsub_27: - bx lr - thumb_func_end nullsub_27 - - thumb_func_start sub_8011B08 -sub_8011B08: - ldr r1, _08011B10 - movs r0, 0x1 - strb r0, [r1] - bx lr - .align 2, 0 -_08011B10: .4byte gUnknown_203B150 - thumb_func_end sub_8011B08 - - thumb_func_start sub_8011B14 -sub_8011B14: - ldr r1, _08011B1C - movs r0, 0 - strb r0, [r1] - bx lr - .align 2, 0 -_08011B1C: .4byte gUnknown_203B150 - thumb_func_end sub_8011B14 - - thumb_func_start sub_8011B20 -sub_8011B20: - push {lr} - ldr r1, _08011B38 - movs r2, 0 - ldrb r0, [r1] - cmp r0, 0 - bne _08011B2E - movs r2, 0x1 -_08011B2E: - strb r2, [r1] - ldrb r0, [r1] - pop {r1} - bx r1 - .align 2, 0 -_08011B38: .4byte gUnknown_203B150 - thumb_func_end sub_8011B20 - - thumb_func_start sub_8011B3C -sub_8011B3C: - ldr r0, _08011B44 - ldrb r0, [r0] - bx lr - .align 2, 0 -_08011B44: .4byte gUnknown_203B150 - thumb_func_end sub_8011B3C - - thumb_func_start nullsub_137 -nullsub_137: - bx lr - thumb_func_end nullsub_137 - - thumb_func_start FatalErrorPrintFuncFileLine -FatalErrorPrintFuncFileLine: - push {lr} - sub sp, 0x100 - adds r2, r0, 0 - cmp r2, 0 - beq _08011B5E - mov r0, sp - bl PrintFuncFileLine - b _08011B66 -_08011B5E: - ldr r2, _08011B6C - mov r0, sp - bl PrintFuncFileLine -_08011B66: - add sp, 0x100 - pop {r0} - bx r0 - .align 2, 0 -_08011B6C: .4byte gUnknown_80D421C - thumb_func_end FatalErrorPrintFuncFileLine - - thumb_func_start FatalErrorFormatMessage -FatalErrorFormatMessage: - push {r0-r3} - push {lr} - sub sp, 0x100 - ldr r1, [sp, 0x104] - add r2, sp, 0x108 - mov r0, sp - bl vsprintf - add sp, 0x100 - pop {r3} - add sp, 0x10 - bx r3 - thumb_func_end FatalErrorFormatMessage - - thumb_func_start sub_8011B88 -sub_8011B88: - push {r0-r3} - push {lr} - sub sp, 0x100 - ldr r1, [sp, 0x104] - add r2, sp, 0x108 - mov r0, sp - bl vsprintf - add sp, 0x100 - pop {r3} - add sp, 0x10 - bx r3 - thumb_func_end sub_8011B88 - - thumb_func_start nullsub_28 -nullsub_28: - bx lr - thumb_func_end nullsub_28 - - thumb_func_start sub_8011BA4 -sub_8011BA4: - movs r0, 0 - bx lr - thumb_func_end sub_8011BA4 - - thumb_func_start sub_8011BA8 -sub_8011BA8: - movs r0, 0 - bx lr - thumb_func_end sub_8011BA8 - - thumb_func_start sub_8011BAC -sub_8011BAC: - ldr r0, _08011BB0 - bx lr - .align 2, 0 -_08011BB0: .4byte gUnknown_80D4288 - thumb_func_end sub_8011BAC - - thumb_func_start sub_8011BB4 -sub_8011BB4: - push {lr} - bl Hang - pop {r0} - bx r0 - thumb_func_end sub_8011BB4 - - thumb_func_start Log -Log: - push {r1-r3} - add sp, 0xC - bx lr - thumb_func_end Log - - thumb_func_start sub_8011BC8 -sub_8011BC8: - push {r2,r3} - add sp, 0x8 - bx lr - thumb_func_end sub_8011BC8 - - thumb_func_start nullsub_29 -nullsub_29: - bx lr - thumb_func_end nullsub_29 - - thumb_func_start nullsub_30 -nullsub_30: - bx lr - thumb_func_end nullsub_30 - - thumb_func_start nullsub_31 -nullsub_31: - bx lr - thumb_func_end nullsub_31 - - thumb_func_start nullsub_32 -nullsub_32: - bx lr - thumb_func_end nullsub_32 - - thumb_func_start FatalErrorHang -FatalErrorHang: - push {lr} - bl Hang - pop {r0} - bx r0 - thumb_func_end FatalErrorHang - - thumb_func_start FatalError -FatalError: - push {r1-r3} - push {r4,lr} - sub sp, 0x100 - adds r1, r0, 0 - ldr r4, [sp, 0x108] - ldr r0, _08011C14 - bl FatalErrorPrintFuncFileLine - add r2, sp, 0x10C - mov r0, sp - adds r1, r4, 0 - bl vsprintf - ldr r0, _08011C18 - mov r1, sp - bl FatalErrorFormatMessage - bl FatalErrorHang - .align 2, 0 -_08011C14: .4byte gUnknown_80D42C0 -_08011C18: .4byte gUnknown_80D42D4 - thumb_func_end FatalError - .align 2, 0 @ Don't pad with nop. diff --git a/asm/code_80118A4.s b/asm/code_80118A4.s new file mode 100644 index 00000000..139f972f --- /dev/null +++ b/asm/code_80118A4.s @@ -0,0 +1,545 @@ + .include "constants/gba_constants.inc" + .include "asm/macros.inc" + + .syntax unified + + .text + + thumb_func_start sub_80118C4 +sub_80118C4: + push {r4,lr} + adds r4, r0, 0 + lsls r4, 16 + lsrs r4, 16 + adds r0, r4, 0 + bl sub_800BFD0 + ldr r0, _080118E8 + adds r1, r4, 0 + bl sub_800C3F8 + ldr r0, _080118EC + adds r1, r4, 0 + bl sub_800C3F8 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 +_080118E8: .4byte 0x000003e6 +_080118EC: .4byte 0x000003e5 + thumb_func_end sub_80118C4 + + thumb_func_start sub_80118F0 +sub_80118F0: + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl sub_800BDFC + pop {r0} + bx r0 + thumb_func_end sub_80118F0 + + thumb_func_start sub_8011900 +sub_8011900: + push {lr} + lsls r0, 16 + lsrs r0, 16 + lsls r1, 16 + lsrs r1, 16 + bl sub_800BE8C + pop {r0} + bx r0 + thumb_func_end sub_8011900 + + thumb_func_start sub_8011914 +sub_8011914: + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl sub_800BF48 + pop {r0} + bx r0 + thumb_func_end sub_8011914 + + thumb_func_start sub_8011924 +sub_8011924: + push {lr} + bl sub_800BF80 + pop {r0} + bx r0 + thumb_func_end sub_8011924 + + thumb_func_start sub_8011930 +sub_8011930: + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl sub_800BFD0 + pop {r0} + bx r0 + thumb_func_end sub_8011930 + + thumb_func_start sub_8011940 +sub_8011940: + push {r4,lr} + lsls r0, 16 + lsrs r4, r0, 16 + bl sub_800C068 + lsls r0, 16 + lsrs r1, r0, 16 + ldr r0, _08011960 + cmp r4, r0 + bne _08011964 + eors r1, r4 + negs r0, r1 + orrs r0, r1 + lsrs r0, 31 + b _0801196C + .align 2, 0 +_08011960: .4byte 0x000003e7 +_08011964: + movs r0, 0 + cmp r1, r4 + bne _0801196C + movs r0, 0x1 +_0801196C: + pop {r4} + pop {r1} + bx r1 + thumb_func_end sub_8011940 + + thumb_func_start sub_8011974 +sub_8011974: + push {lr} + lsls r0, 16 + lsrs r0, 16 + lsls r1, 16 + lsrs r1, 16 + bl sub_800C074 + pop {r0} + bx r0 + thumb_func_end sub_8011974 + + thumb_func_start sub_8011988 +sub_8011988: + push {lr} + lsls r0, 16 + lsrs r0, 16 + movs r1, 0x80 + lsls r1, 1 + bl sub_800C074 + pop {r0} + bx r0 + thumb_func_end sub_8011988 + + thumb_func_start sub_801199C +sub_801199C: + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl sub_800C298 + pop {r0} + bx r0 + thumb_func_end sub_801199C + + thumb_func_start sub_80119AC +sub_80119AC: + push {lr} + lsls r0, 16 + lsrs r0, 16 + lsls r1, 16 + lsrs r1, 16 + bl sub_800C3F8 + pop {r0} + bx r0 + thumb_func_end sub_80119AC + + thumb_func_start sub_80119C0 +sub_80119C0: + push {lr} + lsls r0, 16 + lsrs r0, 16 + bl sub_800C5D0 + lsls r0, 24 + lsrs r0, 24 + pop {r1} + bx r1 + thumb_func_end sub_80119C0 + + thumb_func_start sub_80119D4 +sub_80119D4: + push {r4,lr} + adds r2, r0, 0 + ldr r4, _080119FC + movs r1, 0 + ldrsh r0, [r4, r1] + cmp r0, 0 + bgt _080119F6 + ldr r1, _08011A00 + lsls r0, r2, 1 + adds r0, r1 + ldrh r0, [r0] + movs r1, 0x80 + lsls r1, 1 + bl sub_800C074 + movs r0, 0x4 + strh r0, [r4] +_080119F6: + pop {r4} + pop {r0} + bx r0 + .align 2, 0 +_080119FC: .4byte gUnknown_202DE20 +_08011A00: .4byte gUnknown_80D4144 + thumb_func_end sub_80119D4 + + thumb_func_start sub_8011A04 +sub_8011A04: + push {lr} + ldr r1, _08011A24 + movs r2, 0 + ldrsh r0, [r1, r2] + cmp r0, 0 + bgt _08011A1E + movs r0, 0x3 + strh r0, [r1] + ldr r0, _08011A28 + movs r1, 0x80 + lsls r1, 1 + bl sub_800C074 +_08011A1E: + pop {r0} + bx r0 + .align 2, 0 +_08011A24: .4byte gUnknown_202DE22 +_08011A28: .4byte 0x00000131 + thumb_func_end sub_8011A04 + + thumb_func_start sub_8011A2C +sub_8011A2C: + ldr r1, _08011A34 + str r0, [r1] + bx lr + .align 2, 0 +_08011A34: .4byte gUnknown_202DE1C + thumb_func_end sub_8011A2C + + thumb_func_start NDS_DebugInit +NDS_DebugInit: + push {lr} + bl nullsub_26 + bl nullsub_27 + bl nullsub_29 + bl nullsub_30 + bl nullsub_31 + bl nullsub_32 + bl nullsub_28 + ldr r1, _08011A60 + movs r0, 0x1 + str r0, [r1] + pop {r0} + bx r0 + .align 2, 0 +_08011A60: .4byte gUnknown_203B14C + thumb_func_end NDS_DebugInit + + thumb_func_start nullsub_25 +nullsub_25: + bx lr + thumb_func_end nullsub_25 + + thumb_func_start nullsub_26 +nullsub_26: + bx lr + thumb_func_end nullsub_26 + + thumb_func_start PrintFuncFileLineOrNotEntry +PrintFuncFileLineOrNotEntry: + push {r4,lr} + sub sp, 0x4 + adds r4, r0, 0 + adds r0, r1, 0 + cmp r0, 0 + beq _08011A90 + ldr r1, _08011A8C + ldr r2, [r0, 0x8] + ldr r3, [r0] + ldr r0, [r0, 0x4] + str r0, [sp] + adds r0, r4, 0 + bl sprintf + b _08011A98 + .align 2, 0 +_08011A8C: .4byte gUnknown_80D418C +_08011A90: + ldr r1, _08011AA0 + adds r0, r4, 0 + bl sprintf +_08011A98: + add sp, 0x4 + pop {r4} + pop {r0} + bx r0 + .align 2, 0 +_08011AA0: .4byte gUnknown_80D41B0 + thumb_func_end PrintFuncFileLineOrNotEntry + + thumb_func_start PrintFuncFileLine +PrintFuncFileLine: + push {r4,r5,lr} + sub sp, 0x8 + ldr r5, _08011AC4 + ldr r3, [r1, 0x8] + ldr r4, [r1] + str r4, [sp] + ldr r1, [r1, 0x4] + str r1, [sp, 0x4] + adds r1, r5, 0 + bl sprintf + add sp, 0x8 + pop {r4,r5} + pop {r0} + bx r0 + .align 2, 0 +_08011AC4: .4byte gUnknown_80D41C4 + thumb_func_end PrintFuncFileLine + + thumb_func_start PrintMessageWithFuncFileLine +PrintMessageWithFuncFileLine: + push {r2,r3} + push {r4,r5,lr} + sub sp, 0x4 + adds r4, r0, 0 + adds r5, r1, 0 + ldr r1, [sp, 0x10] + add r2, sp, 0x14 + bl vsprintf + adds r0, r4, 0 + bl strlen + adds r4, r0 + ldr r1, _08011AFC + ldr r2, [r5, 0x8] + ldr r3, [r5] + ldr r0, [r5, 0x4] + str r0, [sp] + adds r0, r4, 0 + bl sprintf + add sp, 0x4 + pop {r4,r5} + pop {r3} + add sp, 0x8 + bx r3 + .align 2, 0 +_08011AFC: .4byte gUnknown_80D41EC + thumb_func_end PrintMessageWithFuncFileLine + + thumb_func_start nullsub_199 +nullsub_199: + bx lr + thumb_func_end nullsub_199 + + thumb_func_start nullsub_27 +nullsub_27: + bx lr + thumb_func_end nullsub_27 + + thumb_func_start sub_8011B08 +sub_8011B08: + ldr r1, _08011B10 + movs r0, 0x1 + strb r0, [r1] + bx lr + .align 2, 0 +_08011B10: .4byte gUnknown_203B150 + thumb_func_end sub_8011B08 + + thumb_func_start sub_8011B14 +sub_8011B14: + ldr r1, _08011B1C + movs r0, 0 + strb r0, [r1] + bx lr + .align 2, 0 +_08011B1C: .4byte gUnknown_203B150 + thumb_func_end sub_8011B14 + + thumb_func_start sub_8011B20 +sub_8011B20: + push {lr} + ldr r1, _08011B38 + movs r2, 0 + ldrb r0, [r1] + cmp r0, 0 + bne _08011B2E + movs r2, 0x1 +_08011B2E: + strb r2, [r1] + ldrb r0, [r1] + pop {r1} + bx r1 + .align 2, 0 +_08011B38: .4byte gUnknown_203B150 + thumb_func_end sub_8011B20 + + thumb_func_start sub_8011B3C +sub_8011B3C: + ldr r0, _08011B44 + ldrb r0, [r0] + bx lr + .align 2, 0 +_08011B44: .4byte gUnknown_203B150 + thumb_func_end sub_8011B3C + + thumb_func_start nullsub_137 +nullsub_137: + bx lr + thumb_func_end nullsub_137 + + thumb_func_start FatalErrorPrintFuncFileLine +FatalErrorPrintFuncFileLine: + push {lr} + sub sp, 0x100 + adds r2, r0, 0 + cmp r2, 0 + beq _08011B5E + mov r0, sp + bl PrintFuncFileLine + b _08011B66 +_08011B5E: + ldr r2, _08011B6C + mov r0, sp + bl PrintFuncFileLine +_08011B66: + add sp, 0x100 + pop {r0} + bx r0 + .align 2, 0 +_08011B6C: .4byte gUnknown_80D421C + thumb_func_end FatalErrorPrintFuncFileLine + + thumb_func_start FatalErrorFormatMessage +FatalErrorFormatMessage: + push {r0-r3} + push {lr} + sub sp, 0x100 + ldr r1, [sp, 0x104] + add r2, sp, 0x108 + mov r0, sp + bl vsprintf + add sp, 0x100 + pop {r3} + add sp, 0x10 + bx r3 + thumb_func_end FatalErrorFormatMessage + + thumb_func_start sub_8011B88 +sub_8011B88: + push {r0-r3} + push {lr} + sub sp, 0x100 + ldr r1, [sp, 0x104] + add r2, sp, 0x108 + mov r0, sp + bl vsprintf + add sp, 0x100 + pop {r3} + add sp, 0x10 + bx r3 + thumb_func_end sub_8011B88 + + thumb_func_start nullsub_28 +nullsub_28: + bx lr + thumb_func_end nullsub_28 + + thumb_func_start sub_8011BA4 +sub_8011BA4: + movs r0, 0 + bx lr + thumb_func_end sub_8011BA4 + + thumb_func_start sub_8011BA8 +sub_8011BA8: + movs r0, 0 + bx lr + thumb_func_end sub_8011BA8 + + thumb_func_start sub_8011BAC +sub_8011BAC: + ldr r0, _08011BB0 + bx lr + .align 2, 0 +_08011BB0: .4byte gUnknown_80D4288 + thumb_func_end sub_8011BAC + + thumb_func_start sub_8011BB4 +sub_8011BB4: + push {lr} + bl Hang + pop {r0} + bx r0 + thumb_func_end sub_8011BB4 + + thumb_func_start Log +Log: + push {r1-r3} + add sp, 0xC + bx lr + thumb_func_end Log + + thumb_func_start sub_8011BC8 +sub_8011BC8: + push {r2,r3} + add sp, 0x8 + bx lr + thumb_func_end sub_8011BC8 + + thumb_func_start nullsub_29 +nullsub_29: + bx lr + thumb_func_end nullsub_29 + + thumb_func_start nullsub_30 +nullsub_30: + bx lr + thumb_func_end nullsub_30 + + thumb_func_start nullsub_31 +nullsub_31: + bx lr + thumb_func_end nullsub_31 + + thumb_func_start nullsub_32 +nullsub_32: + bx lr + thumb_func_end nullsub_32 + + thumb_func_start FatalErrorHang +FatalErrorHang: + push {lr} + bl Hang + pop {r0} + bx r0 + thumb_func_end FatalErrorHang + + thumb_func_start FatalError +FatalError: + push {r1-r3} + push {r4,lr} + sub sp, 0x100 + adds r1, r0, 0 + ldr r4, [sp, 0x108] + ldr r0, _08011C14 + bl FatalErrorPrintFuncFileLine + add r2, sp, 0x10C + mov r0, sp + adds r1, r4, 0 + bl vsprintf + ldr r0, _08011C18 + mov r1, sp + bl FatalErrorFormatMessage + bl FatalErrorHang + .align 2, 0 +_08011C14: .4byte gUnknown_80D42C0 +_08011C18: .4byte gUnknown_80D42D4 + thumb_func_end FatalError + + .align 2,0 @ Don't pad with nop diff --git a/data/data.s b/data/data.s index fe5a0621..33bd937b 100644 --- a/data/data.s +++ b/data/data.s @@ -20,7 +20,9 @@ gUnknown_80B69F8: @ 80B69F8 .global gUnknown_80B6A28 gUnknown_80B6A28: @ 80B6A28 - .incbin "baserom.gba", 0xB6A28, 0xC + .byte 0x04, 0x6A, 0x0B, 0x08 @ Pointer to titlen0p + .byte 0x10, 0x6A, 0x0B, 0x08 @ Pointer to titlen1p + .byte 0x1C, 0x6A, 0x0B, 0x08 @ Pointer to titlen2p .include "data/text/save.inc" @@ -35,11 +37,48 @@ gUnknown_80B7144: @ 80B7144 .global gUnknown_80B714C gUnknown_80B714C: @ 80B714C - .incbin "baserom.gba", 0xB714C, 0x54 + .byte 0x9C, 0x71, 0x0B, 0x08 + .byte 0x9C, 0x71, 0x0B, 0x08 + .byte 0x94, 0x71, 0x0B, 0x08 + .byte 0x90, 0x71, 0x0B, 0x08 + .byte 0x8C, 0x71, 0x0B, 0x08 + .byte 0x88, 0x71, 0x0B, 0x08 + .byte 0x80, 0x71, 0x0B, 0x08 + .byte 0x7C, 0x71, 0x0B, 0x08 + .byte 0x78, 0x71, 0x0B, 0x08 + .byte 0x74, 0x71, 0x0B, 0x08 + .asciz "END" + .asciz "9" + .align 2,0 + .asciz "3" + .align 2,0 + .asciz "2-2 8" + .align 2,0 + .asciz "6" + .align 2,0 + .asciz "5" + .align 2,0 + .asciz "4" + .align 2,0 + .asciz "1-2 7" + .align 2,0 + .asciz "2-1" + .align 2,0 .global gUnknown_80B71A0 gUnknown_80B71A0: @ 80B71A0 - .incbin "baserom.gba", 0xB71A0, 0x44 + .byte 0xD8, 0x71, 0x0B, 0x08 @ Pointer to CISTART + .byte 0xC8, 0x71, 0x0B, 0x08 @ Pointer to CECONTINUE + .byte 0xBC, 0x71, 0x0B, 0x08 @ Pointer to CNLAST + .byte 0xB0, 0x71, 0x0B, 0x08 @ Pointer to CWEND + .asciz "#CWEND#R" + .align 2,0 + .asciz "#CNLAST#R" + .align 2,0 + .asciz "#CECONTINUE#R" + .align 2,0 + .asciz "#CISTART#R" + .align 2,0 .global gUnknown_80B71E4 gUnknown_80B71E4: @ 80B71E4 @@ -59,7 +98,9 @@ gUnknown_80B7324: @ 80B7324 .global gUnknown_80B7350 gUnknown_80B7350: @ 80B7350 - .incbin "baserom.gba", 0xB7350, 0xC + .byte 0xF4, 0x72, 0x0B, 0x08 @ Pointer to ../main/event_flag.c + .byte 0x7C, 0x05, 0x00, 0x00 + .byte 0x44, 0x73, 0x0B, 0x08 @ Pointer to _FlagJudge .global gUnknown_80B735C gUnknown_80B735C: @ 80B735C @@ -67,11 +108,13 @@ gUnknown_80B735C: @ 80B735C .global gUnknown_80B7378 gUnknown_80B7378: @ 80B7378 - .incbin "baserom.gba", 0xB7378, 0x10 + .asciz "error number" + .align 2,0 .global gUnknown_80B7388 gUnknown_80B7388: @ 80B7388 - .incbin "baserom.gba", 0xB7388, 0xC + .asciz "1-1" + .asciz "pksdir0" .global gUnknown_80B7394 gUnknown_80B7394: @ 80B7394 @@ -95,7 +138,9 @@ gUnknown_80B7EFC: @ 80B7EFC .global gUnknown_80B7F14 gUnknown_80B7F14: @ 80B7F14 - .incbin "baserom.gba", 0xB7F14, 0xC + .byte 0x8C, 0x7E, 0x0B, 0x08 + .byte 0x2C, 0x03, 0x00, 0x00 + .byte 0x08, 0x7F, 0x0B, 0x08 .global gUnknown_80B7F20 gUnknown_80B7F20: @ 80B7F20 @@ -103,11 +148,22 @@ gUnknown_80B7F20: @ 80B7F20 .global gUnknown_80B7F88 gUnknown_80B7F88: @ 80B7F88 - .incbin "baserom.gba", 0xB7F88, 0xC + .byte 0x8C, 0x7E, 0x0B, 0x08 @ Pointer to ../system/memory_locate.c + .byte 0x55, 0x04, 0x00, 0x00 + .byte 0x6C, 0x7F, 0x0B, 0x08 @ Pointer to MemoryLocate_LocalCreate .global gUnknown_80B7F94 gUnknown_80B7F94: @ 80B7F94 - .incbin "baserom.gba", 0xB7F94, 0x74 + .asciz "Memroy LocalCreate buffer %08x size can\'t locate" @ Spelling error is intentional + .align 2,0 + .asciz "pksdir0" + .asciz "pksdir0" + .asciz "pksdir0" + .asciz "pksdir0" + .asciz "pksdir0" + .asciz "pksdir0" + .asciz "pksdir0" + .asciz "pksdir0" .global gUnknown_80B8008 gUnknown_80B8008: @ 80B8008 @@ -143,7 +199,10 @@ gUnknown_80B85DC: @ 80B85DC .global gUnknown_80B86A4 gUnknown_80B86A4: @ 80B86A4 - .incbin "baserom.gba", 0xB86A4, 0x10 + .byte 0x5C, 0x86, 0x0B, 0x08 + .byte 0xA1, 0x81, 0x07, 0x00 + .byte 0x0A, 0x00, 0x00, 0x00 + .byte 0x08, 0x00, 0x00, 0x00 .global gUnknown_80B86B4 gUnknown_80B86B4: @ 80B86B4 @@ -151,27 +210,49 @@ gUnknown_80B86B4: @ 80B86B4 .global gUnknown_80B87B4 gUnknown_80B87B4: @ 80B87B4 - .incbin "baserom.gba", 0xB87B4, 0x8 + .asciz "kanji_a" + .align 2,0 .global gUnknown_80B87BC gUnknown_80B87BC: @ 80B87BC - .incbin "baserom.gba", 0xB87BC, 0x8 + .asciz "kanji_b" + .align 2,0 .global gUnknown_80B87C4 gUnknown_80B87C4: @ 80B87C4 - .incbin "baserom.gba", 0xB87C4, 0x20 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 .global gUnknown_80B87E4 gUnknown_80B87E4: @ 80B87E4 - .incbin "baserom.gba", 0xB87E4, 0x20 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 + .byte 0x88, 0x88, 0x88, 0x88 .global gUnknown_80B8804 gUnknown_80B8804: @ 80B8804 - .incbin "baserom.gba", 0xB8804, 0x10 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 .global gUnknown_80B8814 gUnknown_80B8814: @ 80B8814 - .incbin "baserom.gba", 0xB8814, 0x10 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 .global gUnknown_80B8824 gUnknown_80B8824: @ 80B8824 @@ -187,22 +268,28 @@ gUnknown_80B8868: @ 80B8868 .global gUnknown_80B88B0 gUnknown_80B88B0: @ 80B88B0 - .incbin "baserom.gba", 0xB88B0, 0x8 + .asciz "font" + .align 2,0 .global gUnknown_80B88B8 gUnknown_80B88B8: @ 80B88B8 - .incbin "baserom.gba", 0xB88B8, 0x8 + .asciz "fontsp" + .align 2,0 .global gUnknown_80B88C0 gUnknown_80B88C0: @ 80B88C0 - .incbin "baserom.gba", 0xB88C0, 0xC + .asciz "fontsppa" + .align 2,0 .global gUnknown_80B88CC gUnknown_80B88CC: @ 80B88CC - .incbin "baserom.gba", 0xB88CC, 0x18 + .asciz "fontpal" + .align 2,0 + .asciz "pksdir0" + .asciz "pksdir0" .global gUnknown_80B88E4 -gUnknown_80B88E4: @ 80B88E4 +gUnknown_80B88E4: @ 80B88E4 @ (uppercase font table??) .incbin "baserom.gba", 0xB88E4, 0x200 .global gUnknown_80B8AE4 diff --git a/data/data_80B9BB8.s b/data/data_80B9BB8.s index df4e021d..1b523e32 100644 --- a/data/data_80B9BB8.s +++ b/data/data_80B9BB8.s @@ -10270,59 +10270,75 @@ gUnknown_810DE0C: @ 810DE0C .global gUnknown_810DE20 gUnknown_810DE20: @ 810DE20 - .incbin "baserom.gba", 0x10DE20, 0x4 + .byte 0x10, 0xDE, 0x10, 0x08 .global gUnknown_810DE24 gUnknown_810DE24: @ 810DE24 - .incbin "baserom.gba", 0x10DE24, 0x4 + .byte 0x00, 0xDE, 0x10, 0x08 .global gUnknown_810DE28 gUnknown_810DE28: @ 810DE28 - .incbin "baserom.gba", 0x10DE28, 0x10 + .byte 0x10, 0xDE, 0x10, 0x08 + .asciz "#>118.$v03" + .align 2,0 .global gUnknown_810DE38 gUnknown_810DE38: @ 810DE38 - .incbin "baserom.gba", 0x10DE38, 0x14 + .byte 0x2C, 0xDE, 0x10, 0x08 + .asciz "#>118.#c2$v03#r" + .align 2,0 .global gUnknown_810DE4C gUnknown_810DE4C: @ 810DE4C - .incbin "baserom.gba", 0x10DE4C, 0x4 + .byte 0x3C, 0xDE, 0x10, 0x08 .global gUnknown_810DE50 gUnknown_810DE50: @ 810DE50 - .incbin "baserom.gba", 0x10DE50, 0x4 + .byte 0x2C, 0xDE, 0x10, 0x08 .global gUnknown_810DE54 gUnknown_810DE54: @ 810DE54 - .incbin "baserom.gba", 0x10DE54, 0x4 + .byte 0x3C, 0xDE, 0x10, 0x08 .global gUnknown_810DE58 gUnknown_810DE58: @ 810DE58 - .incbin "baserom.gba", 0x10DE58, 0x14 + .byte 0x1C, 0xAE, 0x10, 0x08 + .asciz "Item:#>46.$i0 " + .align 2,0 .global gUnknown_810DE6C gUnknown_810DE6C: @ 810DE6C - .incbin "baserom.gba", 0x10DE6C, 0x14 + .byte 0x5C, 0xDE, 0x10, 0x08 + .asciz "IQ:#>52.$m0 " + .align 2,0 .global gUnknown_810DE80 gUnknown_810DE80: @ 810DE80 - .incbin "baserom.gba", 0x10DE80, 0x18 + .byte 0x70, 0xDE, 0x10, 0x08 + .asciz "Tactics:#>52.$m0 " + .align 2,0 .global gUnknown_810DE98 gUnknown_810DE98: @ 810DE98 - .incbin "baserom.gba", 0x10DE98, 0x1C + .byte 0x84, 0xDE, 0x10, 0x08 + .asciz "Species:#>54.#C6$m0#R " + .align 2,0 .global gUnknown_810DEB4 gUnknown_810DEB4: @ 810DEB4 - .incbin "baserom.gba", 0x10DEB4, 0x14 + .byte 0x9C, 0xDE, 0x10, 0x08 + .asciz "Friend Area: " + .align 2,0 .global gUnknown_810DEC8 gUnknown_810DEC8: @ 810DEC8 - .incbin "baserom.gba", 0x10DEC8, 0x14 + .byte 0xB8, 0xDE, 0x10, 0x08 + .asciz "#>22.#C4$i0#R" + .align 2,0 .global gUnknown_810DEDC gUnknown_810DEDC: @ 810DEDC - .incbin "baserom.gba", 0x10DEDC, 0x18 + .incbin "baserom.gba", 0x10DEDC, 0x18 .global gUnknown_810DEF4 gUnknown_810DEF4: @ 810DEF4 diff --git a/ld_script.txt b/ld_script.txt index 662dc749..6f567a94 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -69,6 +69,8 @@ SECTIONS { asm/code_800B540.o(.text); src/flash.o(.text); asm/code_800D090.o(.text); + src/code_80118A4.o(.text); + asm/code_80118A4.o(.text); src/save.o(.text); asm/save.o(.text); src/save1.o(.text); diff --git a/src/code_80118A4.c b/src/code_80118A4.c new file mode 100644 index 00000000..34569d04 --- /dev/null +++ b/src/code_80118A4.c @@ -0,0 +1,13 @@ +#include "global.h" + +extern void sub_8011924(void); +extern void sub_801199C(u16 r0); +extern void sub_800BFD0(u8 r0); +extern void sub_800C3F8(u16 r0, u8 r1); + +void sub_80118A4(void) +{ + sub_8011924(); + sub_801199C(0x3e6); + sub_801199C(0x3e5); +}