code_6000

This commit is contained in:
Ethan Roseman 2020-07-31 23:39:33 -04:00
parent 823165e386
commit de4ac0b499
10 changed files with 175 additions and 192 deletions

View File

@ -1,189 +0,0 @@
# %s disassembly and split file
# generated by n64split v%s - N64 ROM splitter
# 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
.include "globals.inc"
.section .text8002AC00, "ax"
general_heap_create:
/* 006000 8002AC00 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006004 8002AC04 3C050005 */ lui $a1, 5
/* 006008 8002AC08 3C048030 */ lui $a0, 0x8030
/* 00600C 8002AC0C 2484B800 */ addiu $a0, $a0, -0x4800
/* 006010 8002AC10 AFBF0010 */ sw $ra, 0x10($sp)
/* 006014 8002AC14 0C00A40C */ jal _heap_create
/* 006018 8002AC18 34A54000 */ ori $a1, $a1, 0x4000
/* 00601C 8002AC1C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006020 8002AC20 03E00008 */ jr $ra
/* 006024 8002AC24 27BD0018 */ addiu $sp, $sp, 0x18
general_heap_malloc:
/* 006028 8002AC28 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 00602C 8002AC2C 0080282D */ daddu $a1, $a0, $zero
/* 006030 8002AC30 3C048030 */ lui $a0, 0x8030
/* 006034 8002AC34 2484B800 */ addiu $a0, $a0, -0x4800
/* 006038 8002AC38 AFBF0010 */ sw $ra, 0x10($sp)
/* 00603C 8002AC3C 0C00A41B */ jal _heap_malloc
/* 006040 8002AC40 00000000 */ nop
/* 006044 8002AC44 8FBF0010 */ lw $ra, 0x10($sp)
/* 006048 8002AC48 03E00008 */ jr $ra
/* 00604C 8002AC4C 27BD0018 */ addiu $sp, $sp, 0x18
general_heap_malloc_tail:
/* 006050 8002AC50 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006054 8002AC54 0080282D */ daddu $a1, $a0, $zero
/* 006058 8002AC58 3C048030 */ lui $a0, 0x8030
/* 00605C 8002AC5C 2484B800 */ addiu $a0, $a0, -0x4800
/* 006060 8002AC60 AFBF0010 */ sw $ra, 0x10($sp)
/* 006064 8002AC64 0C00A459 */ jal _heap_malloc_tail
/* 006068 8002AC68 00000000 */ nop
/* 00606C 8002AC6C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006070 8002AC70 03E00008 */ jr $ra
/* 006074 8002AC74 27BD0018 */ addiu $sp, $sp, 0x18
general_heap_free:
/* 006078 8002AC78 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 00607C 8002AC7C 0080282D */ daddu $a1, $a0, $zero
/* 006080 8002AC80 3C048030 */ lui $a0, 0x8030
/* 006084 8002AC84 2484B800 */ addiu $a0, $a0, -0x4800
/* 006088 8002AC88 AFBF0010 */ sw $ra, 0x10($sp)
/* 00608C 8002AC8C 0C00A487 */ jal _heap_free
/* 006090 8002AC90 00000000 */ nop
/* 006094 8002AC94 8FBF0010 */ lw $ra, 0x10($sp)
/* 006098 8002AC98 03E00008 */ jr $ra
/* 00609C 8002AC9C 27BD0018 */ addiu $sp, $sp, 0x18
battle_heap_create:
/* 0060A0 8002ACA0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0060A4 8002ACA4 AFBF0010 */ sw $ra, 0x10($sp)
/* 0060A8 8002ACA8 3C050002 */ lui $a1, 2
/* 0060AC 8002ACAC 3C04803E */ lui $a0, 0x803e
/* 0060B0 8002ACB0 2484A800 */ addiu $a0, $a0, -0x5800
/* 0060B4 8002ACB4 0C00A40C */ jal _heap_create
/* 0060B8 8002ACB8 34A55800 */ ori $a1, $a1, 0x5800
/* 0060BC 8002ACBC 0040202D */ daddu $a0, $v0, $zero
/* 0060C0 8002ACC0 2402FFFF */ addiu $v0, $zero, -1
/* 0060C4 8002ACC4 0040182D */ daddu $v1, $v0, $zero
/* 0060C8 8002ACC8 54830001 */ bnel $a0, $v1, .L8002ACD0
/* 0060CC 8002ACCC 0000102D */ daddu $v0, $zero, $zero
.L8002ACD0:
/* 0060D0 8002ACD0 8FBF0010 */ lw $ra, 0x10($sp)
/* 0060D4 8002ACD4 03E00008 */ jr $ra
/* 0060D8 8002ACD8 27BD0018 */ addiu $sp, $sp, 0x18
func_8002ACDC:
/* 0060DC 8002ACDC 03E00008 */ jr $ra
/* 0060E0 8002ACE0 0000102D */ daddu $v0, $zero, $zero
heap_malloc:
/* 0060E4 8002ACE4 3C028007 */ lui $v0, 0x8007
/* 0060E8 8002ACE8 8C42419C */ lw $v0, 0x419c($v0)
/* 0060EC 8002ACEC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0060F0 8002ACF0 AFBF0010 */ sw $ra, 0x10($sp)
/* 0060F4 8002ACF4 80420070 */ lb $v0, 0x70($v0)
/* 0060F8 8002ACF8 10400007 */ beqz $v0, .L8002AD18
/* 0060FC 8002ACFC 0080282D */ daddu $a1, $a0, $zero
/* 006100 8002AD00 3C04803E */ lui $a0, 0x803e
/* 006104 8002AD04 2484A800 */ addiu $a0, $a0, -0x5800
/* 006108 8002AD08 0C00A41B */ jal _heap_malloc
/* 00610C 8002AD0C 00000000 */ nop
/* 006110 8002AD10 0800AB48 */ j .L8002AD20
/* 006114 8002AD14 00000000 */ nop
.L8002AD18:
/* 006118 8002AD18 0C00AB0A */ jal general_heap_malloc
/* 00611C 8002AD1C 00A0202D */ daddu $a0, $a1, $zero
.L8002AD20:
/* 006120 8002AD20 8FBF0010 */ lw $ra, 0x10($sp)
/* 006124 8002AD24 03E00008 */ jr $ra
/* 006128 8002AD28 27BD0018 */ addiu $sp, $sp, 0x18
heap_free:
/* 00612C 8002AD2C 3C028007 */ lui $v0, 0x8007
/* 006130 8002AD30 8C42419C */ lw $v0, 0x419c($v0)
/* 006134 8002AD34 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006138 8002AD38 AFBF0010 */ sw $ra, 0x10($sp)
/* 00613C 8002AD3C 80420070 */ lb $v0, 0x70($v0)
/* 006140 8002AD40 14400005 */ bnez $v0, .L8002AD58
/* 006144 8002AD44 0080282D */ daddu $a1, $a0, $zero
/* 006148 8002AD48 0C00AB1E */ jal general_heap_free
/* 00614C 8002AD4C 00000000 */ nop
/* 006150 8002AD50 0800AB5A */ j .L8002AD68
/* 006154 8002AD54 00000000 */ nop
.L8002AD58:
/* 006158 8002AD58 3C04803E */ lui $a0, 0x803e
/* 00615C 8002AD5C 2484A800 */ addiu $a0, $a0, -0x5800
/* 006160 8002AD60 0C00A487 */ jal _heap_free
/* 006164 8002AD64 00000000 */ nop
.L8002AD68:
/* 006168 8002AD68 8FBF0010 */ lw $ra, 0x10($sp)
/* 00616C 8002AD6C 03E00008 */ jr $ra
/* 006170 8002AD70 27BD0018 */ addiu $sp, $sp, 0x18
collision_heap_create:
/* 006174 8002AD74 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006178 8002AD78 AFBF0010 */ sw $ra, 0x10($sp)
/* 00617C 8002AD7C 3C050001 */ lui $a1, 1
/* 006180 8002AD80 3C048027 */ lui $a0, 0x8027
/* 006184 8002AD84 24848000 */ addiu $a0, $a0, -0x8000
/* 006188 8002AD88 0C00A40C */ jal _heap_create
/* 00618C 8002AD8C 34A58000 */ ori $a1, $a1, 0x8000
/* 006190 8002AD90 0040202D */ daddu $a0, $v0, $zero
/* 006194 8002AD94 2402FFFF */ addiu $v0, $zero, -1
/* 006198 8002AD98 0040182D */ daddu $v1, $v0, $zero
/* 00619C 8002AD9C 54830001 */ bnel $a0, $v1, .L8002ADA4
/* 0061A0 8002ADA0 0000102D */ daddu $v0, $zero, $zero
.L8002ADA4:
/* 0061A4 8002ADA4 8FBF0010 */ lw $ra, 0x10($sp)
/* 0061A8 8002ADA8 03E00008 */ jr $ra
/* 0061AC 8002ADAC 27BD0018 */ addiu $sp, $sp, 0x18
collision_heap_malloc:
/* 0061B0 8002ADB0 3C028007 */ lui $v0, 0x8007
/* 0061B4 8002ADB4 8C42419C */ lw $v0, 0x419c($v0)
/* 0061B8 8002ADB8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0061BC 8002ADBC AFBF0010 */ sw $ra, 0x10($sp)
/* 0061C0 8002ADC0 80420070 */ lb $v0, 0x70($v0)
/* 0061C4 8002ADC4 0080282D */ daddu $a1, $a0, $zero
/* 0061C8 8002ADC8 3C048027 */ lui $a0, 0x8027
/* 0061CC 8002ADCC 24848000 */ addiu $a0, $a0, -0x8000
/* 0061D0 8002ADD0 10400003 */ beqz $v0, .L8002ADE0
/* 0061D4 8002ADD4 00000000 */ nop
/* 0061D8 8002ADD8 3C04803E */ lui $a0, 0x803e
/* 0061DC 8002ADDC 2484A800 */ addiu $a0, $a0, -0x5800
.L8002ADE0:
/* 0061E0 8002ADE0 0C00A41B */ jal _heap_malloc
/* 0061E4 8002ADE4 00000000 */ nop
/* 0061E8 8002ADE8 8FBF0010 */ lw $ra, 0x10($sp)
/* 0061EC 8002ADEC 03E00008 */ jr $ra
/* 0061F0 8002ADF0 27BD0018 */ addiu $sp, $sp, 0x18
collision_heap_free:
/* 0061F4 8002ADF4 3C028007 */ lui $v0, 0x8007
/* 0061F8 8002ADF8 8C42419C */ lw $v0, 0x419c($v0)
/* 0061FC 8002ADFC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006200 8002AE00 AFBF0010 */ sw $ra, 0x10($sp)
/* 006204 8002AE04 80420070 */ lb $v0, 0x70($v0)
/* 006208 8002AE08 0080282D */ daddu $a1, $a0, $zero
/* 00620C 8002AE0C 3C04803E */ lui $a0, 0x803e
/* 006210 8002AE10 2484A800 */ addiu $a0, $a0, -0x5800
/* 006214 8002AE14 14400003 */ bnez $v0, .L8002AE24
/* 006218 8002AE18 00000000 */ nop
/* 00621C 8002AE1C 3C048027 */ lui $a0, 0x8027
/* 006220 8002AE20 24848000 */ addiu $a0, $a0, -0x8000
.L8002AE24:
/* 006224 8002AE24 0C00A487 */ jal _heap_free
/* 006228 8002AE28 00000000 */ nop
/* 00622C 8002AE2C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006230 8002AE30 03E00008 */ jr $ra
/* 006234 8002AE34 27BD0018 */ addiu $sp, $sp, 0x18
/* 006238 8002AE38 00000000 */ nop
/* 00623C 8002AE3C 00000000 */ nop

View File

@ -0,0 +1,24 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "globals.inc"
battle_heap_create:
/* 0060A0 8002ACA0 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0060A4 8002ACA4 AFBF0010 */ sw $ra, 0x10($sp)
/* 0060A8 8002ACA8 3C050002 */ lui $a1, 2
/* 0060AC 8002ACAC 3C04803E */ lui $a0, 0x803e
/* 0060B0 8002ACB0 2484A800 */ addiu $a0, $a0, -0x5800
/* 0060B4 8002ACB4 0C00A40C */ jal _heap_create
/* 0060B8 8002ACB8 34A55800 */ ori $a1, $a1, 0x5800
/* 0060BC 8002ACBC 0040202D */ daddu $a0, $v0, $zero
/* 0060C0 8002ACC0 2402FFFF */ addiu $v0, $zero, -1
/* 0060C4 8002ACC4 0040182D */ daddu $v1, $v0, $zero
/* 0060C8 8002ACC8 54830001 */ bnel $a0, $v1, .L8002ACD0
/* 0060CC 8002ACCC 0000102D */ daddu $v0, $zero, $zero
.L8002ACD0:
/* 0060D0 8002ACD0 8FBF0010 */ lw $ra, 0x10($sp)
/* 0060D4 8002ACD4 03E00008 */ jr $ra
/* 0060D8 8002ACD8 27BD0018 */ addiu $sp, $sp, 0x18
.set reorder

View File

@ -0,0 +1,24 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "globals.inc"
collision_heap_create:
/* 006174 8002AD74 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006178 8002AD78 AFBF0010 */ sw $ra, 0x10($sp)
/* 00617C 8002AD7C 3C050001 */ lui $a1, 1
/* 006180 8002AD80 3C048027 */ lui $a0, 0x8027
/* 006184 8002AD84 24848000 */ addiu $a0, $a0, -0x8000
/* 006188 8002AD88 0C00A40C */ jal _heap_create
/* 00618C 8002AD8C 34A58000 */ ori $a1, $a1, 0x8000
/* 006190 8002AD90 0040202D */ daddu $a0, $v0, $zero
/* 006194 8002AD94 2402FFFF */ addiu $v0, $zero, -1
/* 006198 8002AD98 0040182D */ daddu $v1, $v0, $zero
/* 00619C 8002AD9C 54830001 */ bnel $a0, $v1, .L8002ADA4
/* 0061A0 8002ADA0 0000102D */ daddu $v0, $zero, $zero
.L8002ADA4:
/* 0061A4 8002ADA4 8FBF0010 */ lw $ra, 0x10($sp)
/* 0061A8 8002ADA8 03E00008 */ jr $ra
/* 0061AC 8002ADAC 27BD0018 */ addiu $sp, $sp, 0x18
.set reorder

View File

@ -0,0 +1,29 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "globals.inc"
collision_heap_free:
/* 0061F4 8002ADF4 3C028007 */ lui $v0, 0x8007
/* 0061F8 8002ADF8 8C42419C */ lw $v0, 0x419c($v0)
/* 0061FC 8002ADFC 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 006200 8002AE00 AFBF0010 */ sw $ra, 0x10($sp)
/* 006204 8002AE04 80420070 */ lb $v0, 0x70($v0)
/* 006208 8002AE08 0080282D */ daddu $a1, $a0, $zero
/* 00620C 8002AE0C 3C04803E */ lui $a0, 0x803e
/* 006210 8002AE10 2484A800 */ addiu $a0, $a0, -0x5800
/* 006214 8002AE14 14400003 */ bnez $v0, .L8002AE24
/* 006218 8002AE18 00000000 */ nop
/* 00621C 8002AE1C 3C048027 */ lui $a0, 0x8027
/* 006220 8002AE20 24848000 */ addiu $a0, $a0, -0x8000
.L8002AE24:
/* 006224 8002AE24 0C00A487 */ jal _heap_free
/* 006228 8002AE28 00000000 */ nop
/* 00622C 8002AE2C 8FBF0010 */ lw $ra, 0x10($sp)
/* 006230 8002AE30 03E00008 */ jr $ra
/* 006234 8002AE34 27BD0018 */ addiu $sp, $sp, 0x18
/* 006238 8002AE38 00000000 */ nop
/* 00623C 8002AE3C 00000000 */ nop
.set reorder

View File

@ -0,0 +1,26 @@
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.include "globals.inc"
collision_heap_malloc:
/* 0061B0 8002ADB0 3C028007 */ lui $v0, 0x8007
/* 0061B4 8002ADB4 8C42419C */ lw $v0, 0x419c($v0)
/* 0061B8 8002ADB8 27BDFFE8 */ addiu $sp, $sp, -0x18
/* 0061BC 8002ADBC AFBF0010 */ sw $ra, 0x10($sp)
/* 0061C0 8002ADC0 80420070 */ lb $v0, 0x70($v0)
/* 0061C4 8002ADC4 0080282D */ daddu $a1, $a0, $zero
/* 0061C8 8002ADC8 3C048027 */ lui $a0, 0x8027
/* 0061CC 8002ADCC 24848000 */ addiu $a0, $a0, -0x8000
/* 0061D0 8002ADD0 10400003 */ beqz $v0, .L8002ADE0
/* 0061D4 8002ADD4 00000000 */ nop
/* 0061D8 8002ADD8 3C04803E */ lui $a0, 0x803e
/* 0061DC 8002ADDC 2484A800 */ addiu $a0, $a0, -0x5800
.L8002ADE0:
/* 0061E0 8002ADE0 0C00A41B */ jal _heap_malloc
/* 0061E4 8002ADE4 00000000 */ nop
/* 0061E8 8002ADE8 8FBF0010 */ lw $ra, 0x10($sp)
/* 0061EC 8002ADEC 03E00008 */ jr $ra
/* 0061F0 8002ADF0 27BD0018 */ addiu $sp, $sp, 0x18
.set reorder

View File

@ -395,7 +395,7 @@ def dump_objfile():
if not os.path.isfile(refobjfile):
fail(f'Please ensure an OK .o file exists at "{refobjfile}".')
objdump_flags = ["-drz"]
objdump_flags = ["-drz", "-m" "mips:4300"]
return (
objfile,
(objdump_flags, refobjfile, args.start),

View File

@ -13,7 +13,8 @@ typedef struct {
/* 0x068 */ u16 demoButtonInput;
/* 0x06A */ s8 demoStickX;
/* 0x06B */ s8 demoStickY;
/* 0x06C */ char unk_6C[0x5];
/* 0x06C */ char unk_6C[0x4];
/* 0x070 */ s8 unk_70;
/* 0x071 */ s8 demoState;
/* 0x072 */ char unk_72[3];
/* 0x075 */ s8 unk_75;

View File

@ -49,7 +49,7 @@ SECTIONS
/* 0x8002AC00 006000-006240 [240] */
.text8002AC00 0x8002AC00 : AT(0x006000) {
build/asm/code_6000.o(.text8002AC00);
build/src/code_6000.o(.text);
}
/* 0x8002AE40 006240-006E40 [C00] */

View File

@ -0,0 +1,63 @@
#include "common.h"
extern s32 D_80268000;
extern s32 D_802FB800;
extern s32 D_803DA800;
//s32 _heap_free(s32 addr, s32 size);
s32 general_heap_create(void) {
return _heap_create(&D_802FB800, 0x54000);
}
s32 general_heap_malloc(s32 size) {
return _heap_malloc(&D_802FB800, size);
}
s32 general_heap_malloc_tail(s32 size) {
return _heap_malloc_tail(&D_802FB800, size);
}
s32 general_heap_free(s32 size) {
return _heap_free(&D_802FB800, size);
}
INCLUDE_ASM(code_6000, battle_heap_create);
/*s32 battle_heap_create(void) {
if (_heap_create(&D_803DA800, 0x25800) != -1) {
return -1;
} else {
return 0;
}
}*/
s32 func_8002ACDC(void) {
return 0;
}
s32 heap_malloc(s32 size) {
if ((*gGameStatusPtr)->unk_70 == 0) {
return general_heap_malloc(size);
} else {
return _heap_malloc(&D_803DA800, size);
}
}
s32 heap_free(s32 size) {
if ((*gGameStatusPtr)->unk_70 != 0) {
return _heap_free(&D_803DA800, size);
} else {
return general_heap_free(size);
}
}
INCLUDE_ASM(code_6000, collision_heap_create);
INCLUDE_ASM(code_6000, collision_heap_malloc);
INCLUDE_ASM(code_6000, collision_heap_free);
/*s32 collision_heap_free(s32 size) {
s32 unk_70 = (*gGameStatusPtr)->unk_70;
return _heap_free((unk_70 == 0) ? (&D_80268000) : (&D_803DA800), size);
}*/

View File

@ -20,12 +20,17 @@ D_802DBD40 = 0x802DBD40;
D_802E0D90 = 0x802E0D90;
D_802EB3D0 = 0x802EB3D0;
D_80268000 = 0x80268000;
D_802FB800 = 0x802FB800;
D_803DA800 = 0x803DA800;
D_003169F0 = 0x003169F0;
D_00316A70 = 0x00316A70;
D_00316C00 = 0x00316C00;
D_00316D90 = 0x00316D90;
D_00316F30 = 0x00316F30;
gGameStatusPtr = 0x8007419C;
D_8014F140 = 0x8014F140;