Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #92

Merged
merged 3 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,8 @@ default: all

LD_SCRIPT = $(TARGET).ld

rom: $(ROM)

all: $(BUILD_DIR) $(BUILD_DIR)/$(ROM) verify

distclean:
Expand All @@ -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)
Expand All @@ -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 $@
Expand Down
17 changes: 12 additions & 5 deletions splat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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] #
Expand Down Expand Up @@ -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]
39 changes: 39 additions & 0 deletions src/libleo/bootstrap.s
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tools/m2ctx.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"-DVERSION_US",
"-DTARGET_N64",
"-D_LANGUAGE_C",
"-DF3DEX_GBI",
"-DF3DEX_GBI_2",
"-D_MIPS_SZLONG=32",
"-ffreestanding",
"-nostdinc",
Expand Down
3 changes: 2 additions & 1 deletion tools/symbol_addrs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Loading