preliminary RAM expansion patch

This commit is contained in:
Romain Dolbeau
2023-08-01 10:26:10 +02:00
parent ebf13784d2
commit 89432abf12
3 changed files with 95 additions and 0 deletions

View File

@@ -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: IIsi.ROM
show: rompatch.elf
$(NM) $< | sort
IIsi.ROM: ../IIsiRemoveChecksumCheck/IIsi.ROM rompatch.raw input.txt
/bin/cp ../IIsiRemoveChecksumCheck/IIsi.ROM IIsi.ROM
${PATCHER} -i rompatch.raw -p IIsi.ROM -d input.txt
linker.ld: input.txt rompatch.s
${GENLINK} -d $< >| $@
$(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 VidRom*.s

View File

@@ -0,0 +1,3 @@
0x00396e, 32, raminfo
0x003cc4, 316, gary
0x0419e8, 20, findinfopatch

View File

@@ -0,0 +1,51 @@
MAPBASE=0x20000000
MAPSIZE=0x0f000000
MAPEND=MAPBASE+MAPSIZE
/* ************************************************************************ */
/* updated table */
.section .text.raminfo
.long MAPBASE
.long MAPEND
.long 0x04000000
.long 0x08000000
.long 0x00000000
.long 0x04000000
.long 0xFFFFFFFF
.long 0xFFFFFFFF
/* ************************************************************************ */
.section .text.gary
fixchunk: /* 316 bytes available */
/* recreate the table but with one more chunk, as the original code assumes two chunks and turns them into three */
move.l %D4,(%A1)+
move.l %D5,(%A1)+
move.l %D2,(%A1)+
move.l %D3,(%A1)+
add.l %D5,%D4
move.l %D4,(%A1)+
move.l %D1,(%A1)+
/* here comes the bonus */
move.l #MAPBASE,(%A1)+
move.l #MAPSIZE,(%A1)+
/* here ends the bonus */
moveq #-1,%D4
move.l %D4,(%A1)+
move.l %D4,(%A1)+
jmp (%pc,returnfindinfopatch)
/* ************************************************************************ */
.section .text.findinfopatch
findinfopatch: /* 20 bytes available */
jmp (%pc,fixchunk)
.section .text.returnfindinfopatch
returnfindinfopatch:
/* */
.end