diff --git a/modflash/Makefile b/modflash/Makefile new file mode 100644 index 0000000..67624da --- /dev/null +++ b/modflash/Makefile @@ -0,0 +1,37 @@ +# Supported environments: +# * GNU/Linux +# * Windows NT (using MinGW/MSYS/Cygwin/WSL) + +ifeq ($(OS),Windows_NT) +GENROM = GenRom.exe +ADDITEM = AddItem.exe +else +GENROM = GenRom +ADDITEM = AddItem +endif + +.PHONY: all +all: | FLASHempty.ZX1 $(GENROM) $(ADDITEM) ./addroms.sh ./addcores.sh roms.txt cores.txt + cp FLASHempty.ZX1 FLASH.ZX1 + ./addroms.sh + ./addcores.sh + +ifneq ($(OS),Windows_NT) +$(GENROM): GenRom.c + $(CC) $(CFLAGS) $< -o $@ + +$(ADDITEM): AddItem.c + $(CC) $(CFLAGS) $< -o $@ +endif + +.PHONY: clean +clean: +ifeq ($(OS),Windows_NT) + # Nothing to do +else + rm -f $(GENROM) $(ADDITEM) +endif + +.PHONY: dist-clean +dist-clean: clean + rm -f FLASH.ZX1 diff --git a/modflash/README.md b/modflash/README.md new file mode 100644 index 0000000..251c9db --- /dev/null +++ b/modflash/README.md @@ -0,0 +1,31 @@ +# Target + +File `FLASH.ZX1`. + +# Windows + +## Build + +```batch +make.bat +``` + +# GNU/Linux + +## Build + +```bash +make +``` + +## Clean + +```bash +make clean +``` + +or even to remove `FLASH.ZX1` file: + +```bash +make dist-clean +``` diff --git a/modflash/addcore.bat b/modflash/addcore.bat index fe738d2..f4a4938 100644 --- a/modflash/addcore.bat +++ b/modflash/addcore.bat @@ -1,49 +1,6 @@ @echo off set /a i=2 -call :AddCore 0 "Apple 2" cores\Apple2.ZX1 -call :AddCore 0 "Atari 2600" cores\Atari2600.ZX1 -call :AddCore 0 "Atari 800 XL" cores\Atari800XL.ZX1 -call :AddCore 0 "Acorn Atom" cores\Atom.ZX1 -call :AddCore 0 "BBC Micro" cores\BBCMicro.ZX1 -call :AddCore 0 "C16" cores\C16.ZX1 -call :AddCore 0 "C64" cores\C64.ZX1 -call :AddCore 0 "Test" cores\Test.ZX1 -call :AddCore 0 "ColecoVision" cores\Coleco.ZX1 -call :AddCore 0 "CPC464" cores\CPC464.ZX1 -call :AddCore 0 "CPC6128" cores\CPC6128.ZX1 -call :AddCore 0 "Acorn Electron" cores\Electron.ZX1 -call :AddCore 0 "Galaksija" cores\Galaksija.zx1 -call :AddCore 0 "Jupiter Ace" cores\JupAce.ZX1 -call :AddCore 0 "Spectrum Kyp" cores\Kyp.ZX1 -call :AddCore 0 "MSX" cores\MSX.ZX1 -call :AddCore 0 "Nintendo NES" cores\NES.ZX1 -call :AddCore 0 "Oric" cores\Oric.ZX1 -call :AddCore 0 "PC" cores\PC.ZX1 -call :AddCore 0 "PC2M" cores\PC2M.ZX1 -call :AddCore 0 "Sam Coupe" cores\SamCoupe.ZX1 -call :AddCore 0 "Sega Master System" cores\SMS.ZX1 -call :AddCore 0 "TBBlue" cores\TBBlue.ZX1 -call :AddCore 0 "Vectrex" cores\Vectrex.ZX1 -call :AddCore 0 "VIC-20" cores\VIC20.ZX1 -call :AddCore 0 "Arcade Pacman" cores\Arcades\pacman.ZX1 -call :AddCore 0 "Arcade Galaxian" cores\Arcades\galaxian.ZX1 -call :AddCore 0 "Arcade Phoenix" cores\Arcades\phoenix.ZX1 -call :AddCore 0 "Arcade The Glob" cores\Arcades\theblob.ZX1 -call :AddCore 0 "Arcade Scramble" cores\Arcades\scramble.ZX1 -call :AddCore 0 "Arcade Frogger" cores\Arcades\frogger.ZX1 -call :AddCore 0 "Arcade Moon Cresta" cores\Arcades\mooncresta.ZX1 -call :AddCore 0 "Arcade Jump Shot" cores\Arcades\jumpshot.ZX1 -call :AddCore 0 "Arcade Amidar" cores\Arcades\amidar.ZX1 -call :AddCore 0 "Arcade Black Hole" cores\Arcades\blackhole.ZX1 -call :AddCore 0 "Arcade Crush Roller" cores\Arcades\crush2.ZX1 -call :AddCore 0 "Arcade Galaga" cores\Arcades\galaga.ZX1 -call :AddCore 0 "Arcade Gorkans" cores\Arcades\gorkans.ZX1 -call :AddCore 0 "Arcade Lizard Wizard" cores\Arcades\lizwiz.ZX1 -call :AddCore 0 "Arcade Mr. Do" cores\Arcades\mrdo.ZX1 -call :AddCore 0 "Arcade Ms. Pacman" cores\Arcades\mspacman.ZX1 -call :AddCore 0 "Arcade Orbitron" cores\Arcades\orbitron.ZX1 -call :AddCore 0 "Arcade Pac Miner" cores\Arcades\pacminer.ZX1 -call :AddCore 0 "Arcade Pacman Plus" cores\Arcades\pacplus.ZX1 +for /f "eol=# tokens=1,2,3 delims=;" %%a in (cores.txt) do call :AddCore %%a %%b %%c exit /b :AddCore diff --git a/modflash/addcores.sh b/modflash/addcores.sh new file mode 100755 index 0000000..48bb1c4 --- /dev/null +++ b/modflash/addcores.sh @@ -0,0 +1,27 @@ +#!/bin/bash -e +GENROM=./GenRom +ADDITEM=./AddItem +i=2 + +Error() { + echo "ERROR: Exit status $1. Stopped." >&2 + exit $1 +} + +AddCore() { + local f=${3%.*}.tap + echo "Adding core $i: \"$2\" ($3)..." + $GENROM $1 "$2" $3 $f || Error $? + $ADDITEM CORE$i $f || Error $? + rm -f $f + let i+=1 +} + +OnExit() { + rm -f addcores.tmp +} + +trap OnExit EXIT + +awk -F \; '/^[^#]+/{print "AddCore " $1 " " $2 " " gensub(/\\/, "/", "g", $3)}' cores.txt >addcores.tmp +. ./addcores.tmp diff --git a/modflash/addrom.bat b/modflash/addrom.bat index cee4039..d82c649 100644 --- a/modflash/addrom.bat +++ b/modflash/addrom.bat @@ -1,32 +1,6 @@ @echo off set /a i=0 -call :AddROM xdnlh17 "ZX Spectrum 48K" roms\48.rom -call :AddROM xtdnh1 "ZX Spectrum 128K EN" roms\128en.rom -call :AddROM xt "ZX Spectrum +2A EN" roms\plus3en41.rom -call :AddROM xdlh "48K Cargando Leches" roms\leches.rom -call :AddROM xdnlh17 "Inves Spectrum+" roms\inves.rom -call :AddROM xdnlh17 "Microdigital TK95" roms\tk95.rom -call :AddROM xdnlh17 "Looking Glass 1.07" roms\lg18v07.rom -call :AddROM xdnmlh17 "Timex Computer 2048" roms\tc2048.rom -call :AddROM xmh1 "Timex Computer 2068" roms\tc2068.rom -call :AddROM xpch1 "Pentagon 128" roms\pentagon.rom -call :AddROM xdlh17 "Pokemon" roms\pokemon48.rom -call :AddROM xdnlh17 "Gosh Wonderful v1.33" roms\gw03v33.rom -call :AddROM xdh1 "SE Basic IV 4.0 Anya" roms\se.rom -call :AddROM xtdnh1 "Derby+" roms\derbyp.rom -call :AddROM xt "DivMMC +3e ES 1.43" roms\plus3es143.rom -call :AddROM xt "Next +3e 1.53" roms\next.rom -call :AddROM xth1ru "BBC Micro" roms\BBCBasic.rom -call :AddROM xth1ru "Jupiter Ace" roms\jupace.rom -call :AddROM xth1ru "ZX81" roms\zx81.rom -call :AddROM xlh17ru "Manic Miner (1983)" roms\ManicMiner.rom -call :AddROM xlh17ru "Jet Set Willy (1984)" roms\JetSetWilly.rom -call :AddROM xlh17ru "Jet Pac (1983)" roms\JetPac.rom -call :AddROM xlh17ru "Cookie (1983)" roms\Cookie.rom -call :AddROM xlh17ru "Tranz Am (1983)" roms\TranzAm.rom -call :AddROM xlh17ru "Planetoids (1983)" roms\Planetoids.rom -call :AddROM xlh17ru "Space Raiders (1983)" roms\SpaceRaiders.rom -call :AddROM xlh17ru "Misco Jones (2013)" roms\MiscoJones.rom +for /f "eol=# tokens=1,2,3 delims=;" %%a in (roms.txt) do call :AddROM %%a %%b %%c exit /b :AddROM diff --git a/modflash/addroms.sh b/modflash/addroms.sh new file mode 100755 index 0000000..0b1c013 --- /dev/null +++ b/modflash/addroms.sh @@ -0,0 +1,29 @@ +#!/bin/bash -e +GENROM=./GenRom +ADDITEM=./AddItem +i=0 + +Error() { + echo "ERROR: Exit status $1. Stopped." >&2 + exit $1 +} + +AddROM() { + local n=`stat --printf "%s" $3` + local i1=$((i+n/16384-1)) + local f=${3%.*}.tap + echo "Adding ROM in slots $i-$i1: \"$2\" ($3)..." + $GENROM $1 "$2" $3 $f || Error $? + $ADDITEM ROM $i $f || Error $? + rm -f $f + let i=i1+1 +} + +OnExit() { + rm -f addroms.tmp +} + +trap OnExit EXIT + +awk -F \; '/^[^#]+/{print "AddROM " $1 " " $2 " " gensub(/\\/, "/", "g", $3)}' roms.txt >addroms.tmp +. ./addroms.tmp diff --git a/modflash/cores.txt b/modflash/cores.txt new file mode 100644 index 0000000..cf52814 --- /dev/null +++ b/modflash/cores.txt @@ -0,0 +1,44 @@ +0; "Apple 2"; cores\Apple2.ZX1 +0; "Atari 2600"; cores\Atari2600.ZX1 +0; "Atari 800 XL"; cores\Atari800XL.ZX1 +0; "Acorn Atom"; cores\Atom.ZX1 +0; "BBC Micro"; cores\BBCMicro.ZX1 +0; "C16"; cores\C16.ZX1 +0; "C64"; cores\C64.ZX1 +0; "Test"; cores\Test.ZX1 +0; "ColecoVision"; cores\Coleco.ZX1 +0; "CPC464"; cores\CPC464.ZX1 +0; "CPC6128"; cores\CPC6128.ZX1 +0; "Acorn Electron"; cores\Electron.ZX1 +0; "Galaksija"; cores\Galaksija.zx1 +0; "Jupiter Ace"; cores\JupAce.ZX1 +0; "Spectrum Kyp"; cores\Kyp.ZX1 +0; "MSX"; cores\MSX.ZX1 +0; "Nintendo NES"; cores\NES.ZX1 +0; "Oric"; cores\Oric.ZX1 +0; "PC"; cores\PC.ZX1 +0; "PC2M"; cores\PC2M.ZX1 +0; "Sam Coupe"; cores\SamCoupe.ZX1 +0; "Sega Master System"; cores\SMS.ZX1 +0; "TBBlue"; cores\TBBlue.ZX1 +0; "Vectrex"; cores\Vectrex.ZX1 +0; "VIC-20"; cores\VIC20.ZX1 +0; "Arcade Pacman"; cores\Arcades\pacman.ZX1 +0; "Arcade Galaxian"; cores\Arcades\galaxian.ZX1 +0; "Arcade Phoenix"; cores\Arcades\phoenix.ZX1 +0; "Arcade The Glob"; cores\Arcades\theblob.ZX1 +0; "Arcade Scramble"; cores\Arcades\scramble.ZX1 +0; "Arcade Frogger"; cores\Arcades\frogger.ZX1 +0; "Arcade Moon Cresta"; cores\Arcades\mooncresta.ZX1 +0; "Arcade Jump Shot"; cores\Arcades\jumpshot.ZX1 +0; "Arcade Amidar"; cores\Arcades\amidar.ZX1 +0; "Arcade Black Hole"; cores\Arcades\blackhole.ZX1 +0; "Arcade Crush Roller"; cores\Arcades\crush2.ZX1 +0; "Arcade Galaga"; cores\Arcades\galaga.ZX1 +0; "Arcade Gorkans"; cores\Arcades\gorkans.ZX1 +0; "Arcade Lizard Wizard"; cores\Arcades\lizwiz.ZX1 +0; "Arcade Mr. Do"; cores\Arcades\mrdo.ZX1 +0; "Arcade Ms. Pacman"; cores\Arcades\mspacman.ZX1 +0; "Arcade Orbitron"; cores\Arcades\orbitron.ZX1 +0; "Arcade Pac Miner"; cores\Arcades\pacminer.ZX1 +0; "Arcade Pacman Plus"; cores\Arcades\pacplus.ZX1 diff --git a/modflash/roms.txt b/modflash/roms.txt new file mode 100644 index 0000000..c30ade6 --- /dev/null +++ b/modflash/roms.txt @@ -0,0 +1,27 @@ +xdnlh17; "ZX Spectrum 48K"; roms\48.rom +xtdnh1; "ZX Spectrum 128K EN"; roms\128en.rom +xt; "ZX Spectrum +2A EN"; roms\plus3en41.rom +xdlh; "48K Cargando Leches"; roms\leches.rom +xdnlh17; "Inves Spectrum+"; roms\inves.rom +xdnlh17; "Microdigital TK95"; roms\tk95.rom +xdnlh17; "Looking Glass 1.07"; roms\lg18v07.rom +xdnmlh17; "Timex Computer 2048"; roms\tc2048.rom +xmh1; "Timex Computer 2068"; roms\tc2068.rom +xpch1; "Pentagon 128"; roms\pentagon.rom +xdlh17; "Pokemon"; roms\pokemon48.rom +xdnlh17; "Gosh Wonderful v1.33"; roms\gw03v33.rom +xdh1; "SE Basic IV 4.0 Anya"; roms\se.rom +xtdnh1; "Derby+"; roms\derbyp.rom +xt; "DivMMC +3e ES 1.43"; roms\plus3es143.rom +xt; "Next +3e 1.53"; roms\next.rom +xth1ru; "BBC Micro"; roms\BBCBasic.rom +xth1ru; "Jupiter Ace"; roms\jupace.rom +xth1ru; "ZX81"; roms\zx81.rom +xlh17ru; "Manic Miner (1983)"; roms\ManicMiner.rom +xlh17ru; "Jet Set Willy (1984)"; roms\JetSetWilly.rom +xlh17ru; "Jet Pac (1983)"; roms\JetPac.rom +xlh17ru; "Cookie (1983)"; roms\Cookie.rom +xlh17ru; "Tranz Am (1983)"; roms\TranzAm.rom +xlh17ru; "Planetoids (1983)"; roms\Planetoids.rom +xlh17ru; "Space Raiders (1983)"; roms\SpaceRaiders.rom +xlh17ru; "Misco Jones (2013)"; roms\MiscoJones.rom