diff --git a/Makefile b/Makefile index 5a463b5e..9760fc81 100644 --- a/Makefile +++ b/Makefile @@ -354,6 +354,8 @@ default: all LD_SCRIPT = $(TARGET).ld +rom: $(ROM) + all: $(BUILD_DIR) $(BUILD_DIR)/$(ROM) verify distclean: @@ -369,7 +371,12 @@ split: rm -rf $(DATA_DIRS) $(ASM_DIRS) && ./tools/n64splat/split.py $(SPLAT_YAML) setup: distclean submodules split - + +expected: + $(RM) -r expected/ + mkdir -p expected/ + cp -r $(BUILD_DIR) expected/$(BUILD_DIR) + $(BUILD_DIR): echo $(C_FILES) mkdir $(BUILD_DIR) @@ -379,7 +386,7 @@ $(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT) $(CPP) -P -DBUILD_DIR=$(BUILD_DIR) -o $@ $< $(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf - $(OBJCOPY) $< $@ -O binary + $(OBJCOPY) $< $@ -O binary --gap-fill 0xFF $(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT) @$(LD) $(LDFLAGS) -o $@ diff --git a/splat.yaml b/splat.yaml index e4b4d6f6..2a87c51d 100644 --- a/splat.yaml +++ b/splat.yaml @@ -55,8 +55,9 @@ segments: - [0xC030, c] # extra sprites loader - [0xC3D0, asm, exception_set] # exception functions - [0xC3F0, hasm, yay0] # Yay0 decoder - - [0xC4B0, bin, libleo_bootdisk] # These are libleo's bootdisk and bootstrap files, but - - [0xC910, bin, libleo_bootstrap] # have issues being disassembled, so are bins for now. + - [0xC4A0, hasm, abs] # abs function + - [0xC4B0, asm, libleo_bootdisk] # These are libleo's bootdisk and bootstrap files, but + - [0xC910, hasm, libleo/bootstrap] - [0xC970, c] - [0xCE80, c] # - [0xD470, c] # @@ -1485,11 +1486,17 @@ segments: - [0x798CD0, bin] - [0x7994B0, bin] - [0x79AFB0, bin] - - [0x79B8F0, bin] # not a file, just so it doesnt complain - - [0x7C0000] + - [0x79B8F0] # rest of ROM.. part 2. This area and beyond NEEDS to be hard-aligned to this address. # for the ROM to be shiftable, we need a way to fix this area beyond here to this address and for the prior area # to be filled with FFs instead of being binned. TODO: Make it shift - - [0x7C0000, bin] + - name: late_assets + type: code + bss_size: 0x0 + start: 0x7C0000 + vram: 0x8FC00000 # unknown vram. Another unused one? Might be 8FC00000? + ld_align_segment_start: 0x7C0000 + subsegments: + - [0x7C0000, bin] - [0x2000000] diff --git a/src/libleo/bootstrap.s b/src/libleo/bootstrap.s new file mode 100644 index 00000000..e2c10959 --- /dev/null +++ b/src/libleo/bootstrap.s @@ -0,0 +1,39 @@ +.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.27.0 */ + +/* Handwritten function */ +glabel __LeoBootGame3 +/* C910 8000BD10 3C088000 */ lui $t0, %hi(D_80000000) +/* C914 8000BD14 25080000 */ addiu $t0, $t0, %lo(D_80000000) +/* C918 8000BD18 25094000 */ addiu $t1, $t0, 0x4000 +/* C91C 8000BD1C 2529FFE0 */ addiu $t1, $t1, -0x20 +/* C920 8000BD20 4080E000 */ mtc0 $zero, $28 /* handwritten instruction */ +/* C924 8000BD24 4080E800 */ mtc0 $zero, $29 /* handwritten instruction */ +.L8000BD28: +/* C928 8000BD28 BD080000 */ cache 0x08, 0x0($t0) /* handwritten instruction */ +/* C92C 8000BD2C 0109082B */ sltu $at, $t0, $t1 +/* C930 8000BD30 1420FFFD */ bnez $at, .L8000BD28 +/* C934 8000BD34 25080020 */ addiu $t0, $t0, 0x20 +/* C938 8000BD38 3C088000 */ lui $t0, 0x8000 +/* C93C 8000BD3C 240A2000 */ addiu $t2, $zero, 0x2000 +/* C940 8000BD40 010A4821 */ addu $t1, $t0, $t2 +/* C944 8000BD44 2529FFF0 */ addiu $t1, $t1, -0x10 +.L8000BD48: +/* C948 8000BD48 BD010000 */ cache 0x01, 0x0($t0) /* handwritten instruction */ +/* C94C 8000BD4C 0109082B */ sltu $at, $t0, $t1 +/* C950 8000BD50 1420FFFD */ bnez $at, .L8000BD48 +/* C954 8000BD54 25080010 */ addiu $t0, $t0, (0x80000010 & 0xFFFF) +/* C958 8000BD58 00800008 */ jr $a0 +/* C95C 8000BD5C 00000000 */ nop +/* C960 8000BD60 00000000 */ nop +/* C964 8000BD64 00000000 */ nop +/* C968 8000BD68 00000000 */ nop +/* C96C 8000BD6C 00000000 */ nop diff --git a/tools/m2ctx.py b/tools/m2ctx.py index 2ac74cbc..ba5a600e 100755 --- a/tools/m2ctx.py +++ b/tools/m2ctx.py @@ -19,7 +19,7 @@ "-DVERSION_US", "-DTARGET_N64", "-D_LANGUAGE_C", - "-DF3DEX_GBI", + "-DF3DEX_GBI_2", "-D_MIPS_SZLONG=32", "-ffreestanding", "-nostdinc", diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index b5ebd6d7..1d645a7a 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -203,7 +203,7 @@ LEOwrite_pointer = 0x801006C4; LEOc2ctrl_que_buf = 0x801006F0; LEOasic_bm_ctl_shadow = 0x801006CC; LEOasic_seq_ctl_shadow = 0x801006D0; -LeoBootGame = 0x8000B8B0; +LeoBootGame = 0x8000B8B0; // defined:true __LeoBootGame2 = 0x8000B9EC; __LeoBootGame3 = 0x8000BD10; leomain = 0x80051EC0; @@ -740,3 +740,4 @@ _798CD0_ROM_START = 0x798CD0; // defined:true _7994B0_ROM_START = 0x7994B0; // defined:true _79AFB0_ROM_START = 0x79AFB0; // defined:true _79AFB0_ROM_END = 0x79B8F0; // defined:true +abs = 0x8000B8A0; // defined:true