From 0a07b18626f0735f7c919ae78fdbae41e55fb2eb Mon Sep 17 00:00:00 2001 From: Romain Dolbeau Date: Sat, 28 Jun 2025 08:12:27 +0200 Subject: [PATCH] ROM patch to support 128 MiB in the 3/160 ROM (tested in TME only) --- RomPatcher/Sun3_160MaxMemory/Makefile | 41 +++++++++++++++++++++++++ RomPatcher/Sun3_160MaxMemory/input.txt | 2 ++ RomPatcher/Sun3_160MaxMemory/rompatch.s | 9 ++++++ 3 files changed, 52 insertions(+) create mode 100644 RomPatcher/Sun3_160MaxMemory/Makefile create mode 100644 RomPatcher/Sun3_160MaxMemory/input.txt create mode 100644 RomPatcher/Sun3_160MaxMemory/rompatch.s diff --git a/RomPatcher/Sun3_160MaxMemory/Makefile b/RomPatcher/Sun3_160MaxMemory/Makefile new file mode 100644 index 0000000..ea41906 --- /dev/null +++ b/RomPatcher/Sun3_160MaxMemory/Makefile @@ -0,0 +1,41 @@ +RETRO68=/home/dolbeau/Retro68/build/toolchain +AS=${RETRO68}/bin/m68k-apple-macos-as +CC=${RETRO68}/bin/m68k-apple-macos-gcc +LD=${RETRO68}/bin/m68k-apple-macos-ld +STRIP=${RETRO68}/bin/m68k-apple-macos-strip +OBJCOPY=${RETRO68}/bin/m68k-apple-macos-objcopy +NM=${RETRO68}/bin/m68k-apple-macos-nm + +HOSTCC=gcc +HOSTCFLAGS=-O2 + +ARCHFLAGS=-march=68020 -mcpu=68020 +CFLAGS=-O2 -mpcrel + +GENLINK=../patcher/genlink +PATCHER=../patcher/patcher + +all: sun3-carrera-rev-3.0.bin + +show: rompatch.elf + $(NM) $< | sort + +sun3-carrera-rev-3.0.bin: ../ rompatch.raw input.txt + /bin/cp ../sun3-carrera-rev-3.0.bin sun3-carrera-rev-3.0.bin + ${PATCHER} -i rompatch.raw -p sun3-carrera-rev-3.0.bin -d input.txt + +linker.ld: input.txt rompatch.s + ${GENLINK} -d $< >| $@ + echo $(shell for X in `grep .section rompatch.s | awk '{ print $$2 }' `; do grep -q $$X linker.ld || echo " $$X has no entry in linker.ld" && /bin/false; done) + +rompatch.o: rompatch.s + ${AS} ${ARCHFLAGS} $< -o $@ -a > rompatch.l + +rompatch.elf: linker.ld rompatch.o ${CSRC:.c=.o} # linker script must be first + ${LD} -o $@ -T $^ + +rompatch.raw: rompatch.elf + ${OBJCOPY} $^ $@ --input-target=elf32-m68k --output-target=binary + +clean: + rm -f res.inc ${CSRC_ASM} *.o rompatch.srec rompatch.raw rompatch.dir rompatch.l linker.ld rompatch.elf diff --git a/RomPatcher/Sun3_160MaxMemory/input.txt b/RomPatcher/Sun3_160MaxMemory/input.txt new file mode 100644 index 0000000..22460bc --- /dev/null +++ b/RomPatcher/Sun3_160MaxMemory/input.txt @@ -0,0 +1,2 @@ +0x0c5a2, 6, replace1 +0x0c60a, 6, replace2 diff --git a/RomPatcher/Sun3_160MaxMemory/rompatch.s b/RomPatcher/Sun3_160MaxMemory/rompatch.s new file mode 100644 index 0000000..d2e3892 --- /dev/null +++ b/RomPatcher/Sun3_160MaxMemory/rompatch.s @@ -0,0 +1,9 @@ + .section .text.replace1 +replace1: + cmp.l #0x08000000,%A5 + .section .text.finishedreplace1 + + .section .text.replace2 +replace2: + move.l #0x01fe0000,%D5 + .section .text.finishedreplace2