From 4a278981fec2229a143fa7ea82b026c1cb8b52ae Mon Sep 17 00:00:00 2001 From: Zorchenhimer Date: Sun, 28 Dec 2025 19:26:15 -0500 Subject: [PATCH] Add BB-RAM stuff The SRAM stuff is kinda jank. Mesen saves disk modifications as .ips patches. Which is painful. The BB-RAM ROM is patched with this modification and disassembled. --- Makefile | 13 ++++++++++++ sf_bb-ram_postcopy.cfg | 41 +++++++++++++++++++++++++++++++++++++ sf_bb-ram_precopy.cfg | 27 ++++++++++++++++++++++++ sf_bb-ram_save_postcopy.cfg | 22 ++++++++++++++++++++ sf_bb-ram_save_precopy.cfg | 16 +++++++++++++++ sf_rom-qd_file1_precopy.cfg | 1 - 6 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 sf_bb-ram_postcopy.cfg create mode 100644 sf_bb-ram_precopy.cfg create mode 100644 sf_bb-ram_save_postcopy.cfg create mode 100644 sf_bb-ram_save_precopy.cfg diff --git a/Makefile b/Makefile index ac4f303..562be6f 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,10 @@ all: dasm/ bins/ labels/ \ dasm/dk3.asm \ dasm/dk3_file3.asm \ dasm/dk3_file4-post-copy.asm \ + dasm/sf_bb-ram_precopy.asm \ + dasm/sf_bb-ram_postcopy.asm \ + dasm/sf_bb-ram_save_precopy.asm \ + dasm/sf_bb-ram_save_postcopy.asm \ dasm/sf_rom-qd_file1_precopy.asm \ dasm/sf_rom-qd_file1_postcopy.asm \ dasm/sf_slow_rom-qd_file1_precopy.asm \ @@ -36,6 +40,9 @@ dasm/sf_slow_rom_file1_postcopy.asm: bins/sf_slow_rom_file1.bin dasm/sf_slow_qd_file1_precopy.asm: bins/sf_slow_qd_file1.bin dasm/sf_slow_qd_file1_postcopy.asm: bins/sf_slow_qd_file1.bin dasm/sf_slow_rom-qd_postromcopy.asm: bins/sf_slow_rom-qd_file1.bin +dasm/sf_bb-ram_precopy.asm: bins/sf_bb-ram_file1.bin +dasm/sf_bb-ram_postcopy.asm: bins/sf_bb-ram_file1.bin +dasm/sf_bb-ram_save_precopy.asm: bins/sf_bb-ram_save_file1.bin clean: -rm dasm/* bins/* labels/* @@ -43,6 +50,9 @@ clean: %/: -mkdir $@ +roms/sf_bb-ram_save.fds: roms/sf_bb-ram_save.ips roms/sf_bb-ram.fds + flips --apply $^ $@ + dasm/dk3_rom.asm: bins/dk3_file2.bin bins/dk3_file3.bin dk3_rom.cfg tail -c 6144 bins/dk3_file2.bin > bins/dk3_rom.bin cat bins/dk3_file3.bin >> bins/dk3_rom.bin @@ -67,6 +77,9 @@ dk3_file4-post-copy.cfg.tmp: dk3_file4-post-copy.cfg rom-qd.cfg labels.cfg labels/%.mlb: %.cfg.tmp dasm2mlb $^ $@ --rom-start 0xE000 --ram-start 0x5000 +bins/sf_bb-ram_file1.bin: roms/sf_bb-ram.fds + fdsextract --side 0 --file-num 1 --output $@ $^ + bins/dk3_file2.bin: roms/sf_dk3.fds fdsextract --side 0 --file-num 2 --output $@ $^ diff --git a/sf_bb-ram_postcopy.cfg b/sf_bb-ram_postcopy.cfg new file mode 100644 index 0000000..554a96b --- /dev/null +++ b/sf_bb-ram_postcopy.cfg @@ -0,0 +1,41 @@ +global { + cpu "6502"; + inputname "bins/sf_bb-ram_file1.bin"; + startaddr $5100; + inputoffs $0800; + commentcolumn 50; + comments 3; +}; + +label { addr $5100; name "BB_PostCopy_Entry"; }; +label { addr $5103; name "MenuLoop"; }; +label { addr $5147; name "BB_ScreenSaveError"; }; +label { addr $516B; name "BB_ScreenEjectDisk"; }; +label { addr $51D4; name "BB_ScreenSetDisk"; }; +label { addr $5211; name "BB_FormatDisk"; }; +label { addr $529C; name "BB_SramCopy"; }; +label { addr $52C7; name "BB_Xfer"; paramsize 3; }; +label { addr $535C; name "BB_FDS_ResetIO"; }; +label { addr $5367; name "BB_ScreenSaveWait"; }; +label { addr $5386; name "BB_VRAMStructWrite"; }; +label { addr $5156; name "BB_NextDisk"; }; + +label { addr $5391; name "cv5391"; size 2; }; + +range { start $51BA; end $51BB; type addrtable; }; +range { start $51BC; end $51D3; type bytetable; }; + +range { start $51F7; end $51F8; type addrtable; }; +range { start $51F9; end $5210; type bytetable; }; + +range { start $5384; end $5385; type addrtable; }; +range { start $539D; end $53B4; type bytetable; }; + +#range { start $53B3; end $53B4; type addrtable; }; +#range { start $53B5; end $53CC; type bytetable; }; + +range { start $518E; end $518F; type addrtable; }; +range { start $5190; end $51A7; type bytetable; }; + +range { start $5250; end $529B; type bytetable; }; +range { start $52A3; end $52C6; name "SramCopy_Structs"; type bytetable; unit 4; }; diff --git a/sf_bb-ram_precopy.cfg b/sf_bb-ram_precopy.cfg new file mode 100644 index 0000000..df4e3a2 --- /dev/null +++ b/sf_bb-ram_precopy.cfg @@ -0,0 +1,27 @@ +global { + cpu "6502"; + inputname "bins/sf_bb-ram_file1.bin"; + startaddr $D000; + commentcolumn 50; + comments 3; +}; + +label { addr $DE00; name "BB_Reset"; }; +label { addr $DFC0; name "BB_NMI"; }; +label { addr $DFF0; name "BB_EmptyVector"; }; +label { addr $DE24; name "BB_InitScreen"; }; +label { addr $DE05; name "loop_outer"; }; +label { addr $DE07; name "loop_inner"; }; +label { addr $DDFF; name "var_Counter"; }; + + +range { start $D000; end $D7FF; name "Garbo_Probably"; type bytetable; }; +range { start $D800; end $DDFF; name "CopiedCode"; type bytetable; }; +range { start $DE00; end $DE21; type code; }; +range { start $DE69; end $DFBF; type bytetable; }; + +range { start $DFE3; end $DFEF; type bytetable; }; + +range { start $DFC0; end $DFE0; type code; }; +range { start $DFF1; end $DFF5; type bytetable; }; + diff --git a/sf_bb-ram_save_postcopy.cfg b/sf_bb-ram_save_postcopy.cfg new file mode 100644 index 0000000..3adf6d7 --- /dev/null +++ b/sf_bb-ram_save_postcopy.cfg @@ -0,0 +1,22 @@ +global { + cpu "6502"; + inputname "bins/sf_bb-ram_save_file1.bin"; + startaddr $5100; + inputoffs $2000; + commentcolumn 50; + comments 3; +}; + +label { addr $5100; name "BB_PostCopy_Entry"; }; +label { addr $51E0; name "BB_FDS_ResetIO"; }; +label { addr $514B; name "BB_Xfer"; paramsize 3; }; +label { addr $5124; name "doXfer"; }; +label { addr $511E; name "BB_ClearReg"; }; +label { addr $5120; name "BB_SetReg"; }; + +range { start $512B; end $514A; type bytetable; unit 4; }; + +range { start $514B; end $51DF; type code; }; + +range { start $51E0; end $51E4; type code; }; +range { start $51EB; end $51F6; type bytetable; }; diff --git a/sf_bb-ram_save_precopy.cfg b/sf_bb-ram_save_precopy.cfg new file mode 100644 index 0000000..aea568f --- /dev/null +++ b/sf_bb-ram_save_precopy.cfg @@ -0,0 +1,16 @@ +global { + cpu "6502"; + inputname "bins/sf_bb-ram_save_file1.bin"; + startaddr $B800; + commentcolumn 50; + comments 3; +}; + +label { addr $DFF0; name "BB_EmptyVector"; }; +label { addr $DFD0; name "BB_PreCopy_Entry"; }; +label { addr $DFD5; name "loop_outer"; }; +label { addr $DFD7; name "loop_inner"; }; + +range { start $B800; end $DFCF; type bytetable; }; +range { start $DFD0; end $DFEB; type code; }; + diff --git a/sf_rom-qd_file1_precopy.cfg b/sf_rom-qd_file1_precopy.cfg index bd1dea6..2fbc07c 100644 --- a/sf_rom-qd_file1_precopy.cfg +++ b/sf_rom-qd_file1_precopy.cfg @@ -6,7 +6,6 @@ global { comments 3; }; - range { start $DFE3; end $DFEF; type bytetable; }; range { start $DFC0; end $DFE0; type code; name "LDFC0_reset"; }; range { start $DF00; end $DF1B; type code; };