Skip to content

Commit b0161ff

Browse files
committed
Automate X16 C charset rom generation as make rule for new ROM versions
1 parent 722d941 commit b0161ff

File tree

4 files changed

+25
-5
lines changed

4 files changed

+25
-5
lines changed

Makefile

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ recompile_forths = $(patsubst forth/%, $(recompile_dir)/%, \
6161
forth_binaries = devenv-uF83
6262
forth_t64_files = $(patsubst %, autostart-c64/%.T64, $(forth_binaries))
6363

64+
# emulator files
65+
x16emu_rom = $(shell emulator/which-x16emu-rom.sh)
66+
6467

6568
all: c64 c16 x16 etc
6669

@@ -276,7 +279,7 @@ sut: autostart-c64/cc64.T64 autostart-c16/cc64.T64 x16files/cc64 \
276279
autostart-c64/cc64pe.T64 autostart-c16/cc64pe.T64 \
277280
autostart-c64/peddi.T64 autostart-c16/peddi.T64 \
278281
autostart-c64/cc64prof.T64 \
279-
$(c64dir_files) $(c16dir_files) $(x16dir_files)
282+
$(c64dir_files) $(c16dir_files) $(x16dir_files) emulator/x16-c-rom.bin
280283

281284
# cc64 build rules
282285

@@ -400,6 +403,9 @@ emulator/c-chargen: emulator/c-char-rom-gen
400403
x64 -virtualdev +truedrive -drive8type 1541 -fs8 emulator \
401404
-keybuf 'load"c-char-rom-gen",8\nrun\n'
402405

406+
emulator/x16-c-rom.bin: $(x16emu_rom)
407+
patch-c-charset -n 99328 $< $@
408+
touch -m -r $< $@
403409

404410
# Generic T64 tape image rules
405411

Usage.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ The first 2k contain the upper/graphics charset, the second the lower/upper,
333333
first normal followed by inverse:
334334

335335
```
336-
patch-c-charset chargen-orig chargen-patched -n 2048 -i 3072
336+
patch-c-charset -n 2048 -i 3072 chargen-orig chargen-patched
337337
```
338338

339339
#### C16:
@@ -346,7 +346,7 @@ the normal charset needs to be patched; the lower/upper case charset starts
346346
at $d400, so 5k into the image:
347347

348348
```
349-
patch-c-charset kernal-orig kernal-patched -n 5120
349+
patch-c-charset -n 5120 kernal-orig kernal-patched
350350
```
351351

352352
#### X16:
@@ -364,7 +364,7 @@ the lower/upper case charset starts right after the 1k-long upper/graphics
364364
charset, so it is 97k into the image:
365365

366366
```
367-
patch-c-charset rom-orig.bin rom-patched.bin -n 99328
367+
patch-c-charset -n 99328 rom-orig.bin rom-patched.bin
368368
```
369369

370370
You'll find these calls in the main Makefile, with the ROM image paths as

emulator/run-in-x16emu.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ fi
6161
rom=""
6262
# temporarily disable -rom so r46 uses its default rom until I have
6363
# figured out a new/better way to generate and set a C charset rom.
64-
# rom=-rom "${x16rom}"
64+
if [ -s "${x16rom}" ]
65+
then
66+
rom="-rom ${x16rom}"
67+
fi
6568

6669
x16emu \
6770
-keymap de \

emulator/which-x16emu-rom.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
set -e
3+
4+
emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
5+
source "${emulatordir}/basedir.shlib"
6+
7+
x16emu_name="$(which x16emu)"
8+
x16emu_binary="$(realpath "--relative-to=$PWD" "${x16emu_name}")"
9+
x16emu_dir="$(dirname "${x16emu_binary}")"
10+
x16emu_rom="${x16emu_dir}/rom.bin"
11+
echo "${x16emu_rom}"

0 commit comments

Comments
 (0)