Skip to content

Commit b461cf8

Browse files
authored
Merge pull request #92 from RevoSucks/fixes
Fixes
2 parents bcf09c6 + e9551b0 commit b461cf8

File tree

5 files changed

+63
-9
lines changed

5 files changed

+63
-9
lines changed

Makefile

+9-2
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ default: all
354354

355355
LD_SCRIPT = $(TARGET).ld
356356

357+
rom: $(ROM)
358+
357359
all: $(BUILD_DIR) $(BUILD_DIR)/$(ROM) verify
358360

359361
distclean:
@@ -369,7 +371,12 @@ split:
369371
rm -rf $(DATA_DIRS) $(ASM_DIRS) && ./tools/n64splat/split.py $(SPLAT_YAML)
370372

371373
setup: distclean submodules split
372-
374+
375+
expected:
376+
$(RM) -r expected/
377+
mkdir -p expected/
378+
cp -r $(BUILD_DIR) expected/$(BUILD_DIR)
379+
373380
$(BUILD_DIR):
374381
echo $(C_FILES)
375382
mkdir $(BUILD_DIR)
@@ -379,7 +386,7 @@ $(BUILD_DIR)/$(LD_SCRIPT): $(LD_SCRIPT)
379386
$(CPP) -P -DBUILD_DIR=$(BUILD_DIR) -o $@ $<
380387

381388
$(BUILD_DIR)/$(TARGET).bin: $(BUILD_DIR)/$(TARGET).elf
382-
$(OBJCOPY) $< $@ -O binary
389+
$(OBJCOPY) $< $@ -O binary --gap-fill 0xFF
383390

384391
$(BUILD_DIR)/$(TARGET).elf: $(O_FILES) $(BUILD_DIR)/$(LD_SCRIPT)
385392
@$(LD) $(LDFLAGS) -o $@

splat.yaml

+12-5
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ segments:
5555
- [0xC030, c] # extra sprites loader
5656
- [0xC3D0, asm, exception_set] # exception functions
5757
- [0xC3F0, hasm, yay0] # Yay0 decoder
58-
- [0xC4B0, bin, libleo_bootdisk] # These are libleo's bootdisk and bootstrap files, but
59-
- [0xC910, bin, libleo_bootstrap] # have issues being disassembled, so are bins for now.
58+
- [0xC4A0, hasm, abs] # abs function
59+
- [0xC4B0, asm, libleo_bootdisk] # These are libleo's bootdisk and bootstrap files, but
60+
- [0xC910, hasm, libleo/bootstrap]
6061
- [0xC970, c]
6162
- [0xCE80, c] #
6263
- [0xD470, c] #
@@ -1485,11 +1486,17 @@ segments:
14851486
- [0x798CD0, bin]
14861487
- [0x7994B0, bin]
14871488
- [0x79AFB0, bin]
1488-
- [0x79B8F0, bin] # not a file, just so it doesnt complain
1489-
- [0x7C0000]
1489+
- [0x79B8F0]
14901490

14911491
# rest of ROM.. part 2. This area and beyond NEEDS to be hard-aligned to this address.
14921492
# for the ROM to be shiftable, we need a way to fix this area beyond here to this address and for the prior area
14931493
# to be filled with FFs instead of being binned. TODO: Make it shift
1494-
- [0x7C0000, bin]
1494+
- name: late_assets
1495+
type: code
1496+
bss_size: 0x0
1497+
start: 0x7C0000
1498+
vram: 0x8FC00000 # unknown vram. Another unused one? Might be 8FC00000?
1499+
ld_align_segment_start: 0x7C0000
1500+
subsegments:
1501+
- [0x7C0000, bin]
14951502
- [0x2000000]

src/libleo/bootstrap.s

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
.include "macro.inc"
2+
3+
/* assembler directives */
4+
.set noat /* allow manual use of $at */
5+
.set noreorder /* don't insert nops after branches */
6+
.set gp=64 /* allow use of 64-bit general purpose registers */
7+
8+
.section .text, "ax"
9+
10+
/* Generated by spimdisasm 1.27.0 */
11+
12+
/* Handwritten function */
13+
glabel __LeoBootGame3
14+
/* C910 8000BD10 3C088000 */ lui $t0, %hi(D_80000000)
15+
/* C914 8000BD14 25080000 */ addiu $t0, $t0, %lo(D_80000000)
16+
/* C918 8000BD18 25094000 */ addiu $t1, $t0, 0x4000
17+
/* C91C 8000BD1C 2529FFE0 */ addiu $t1, $t1, -0x20
18+
/* C920 8000BD20 4080E000 */ mtc0 $zero, $28 /* handwritten instruction */
19+
/* C924 8000BD24 4080E800 */ mtc0 $zero, $29 /* handwritten instruction */
20+
.L8000BD28:
21+
/* C928 8000BD28 BD080000 */ cache 0x08, 0x0($t0) /* handwritten instruction */
22+
/* C92C 8000BD2C 0109082B */ sltu $at, $t0, $t1
23+
/* C930 8000BD30 1420FFFD */ bnez $at, .L8000BD28
24+
/* C934 8000BD34 25080020 */ addiu $t0, $t0, 0x20
25+
/* C938 8000BD38 3C088000 */ lui $t0, 0x8000
26+
/* C93C 8000BD3C 240A2000 */ addiu $t2, $zero, 0x2000
27+
/* C940 8000BD40 010A4821 */ addu $t1, $t0, $t2
28+
/* C944 8000BD44 2529FFF0 */ addiu $t1, $t1, -0x10
29+
.L8000BD48:
30+
/* C948 8000BD48 BD010000 */ cache 0x01, 0x0($t0) /* handwritten instruction */
31+
/* C94C 8000BD4C 0109082B */ sltu $at, $t0, $t1
32+
/* C950 8000BD50 1420FFFD */ bnez $at, .L8000BD48
33+
/* C954 8000BD54 25080010 */ addiu $t0, $t0, (0x80000010 & 0xFFFF)
34+
/* C958 8000BD58 00800008 */ jr $a0
35+
/* C95C 8000BD5C 00000000 */ nop
36+
/* C960 8000BD60 00000000 */ nop
37+
/* C964 8000BD64 00000000 */ nop
38+
/* C968 8000BD68 00000000 */ nop
39+
/* C96C 8000BD6C 00000000 */ nop

tools/m2ctx.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"-DVERSION_US",
2020
"-DTARGET_N64",
2121
"-D_LANGUAGE_C",
22-
"-DF3DEX_GBI",
22+
"-DF3DEX_GBI_2",
2323
"-D_MIPS_SZLONG=32",
2424
"-ffreestanding",
2525
"-nostdinc",

tools/symbol_addrs.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ LEOwrite_pointer = 0x801006C4;
203203
LEOc2ctrl_que_buf = 0x801006F0;
204204
LEOasic_bm_ctl_shadow = 0x801006CC;
205205
LEOasic_seq_ctl_shadow = 0x801006D0;
206-
LeoBootGame = 0x8000B8B0;
206+
LeoBootGame = 0x8000B8B0; // defined:true
207207
__LeoBootGame2 = 0x8000B9EC;
208208
__LeoBootGame3 = 0x8000BD10;
209209
leomain = 0x80051EC0;
@@ -740,3 +740,4 @@ _798CD0_ROM_START = 0x798CD0; // defined:true
740740
_7994B0_ROM_START = 0x7994B0; // defined:true
741741
_79AFB0_ROM_START = 0x79AFB0; // defined:true
742742
_79AFB0_ROM_END = 0x79B8F0; // defined:true
743+
abs = 0x8000B8A0; // defined:true

0 commit comments

Comments
 (0)