From c2b05b2f9ae06dafbc7d7e519cb30aa12c207488 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Mon, 8 Aug 2022 12:53:17 +0200
Subject: [PATCH] Allow to assemble for different hardware types.
The first script parameter is used to set the ca65 symbol HW_TYPE. Without parameter, HW_TYPE is set to 0.
---
Apple2/assemble.cmd | 70 +++++++++++++++++++++++----------------------
Apple2/assemble.sh | 70 +++++++++++++++++++++++----------------------
2 files changed, 72 insertions(+), 68 deletions(-)
diff --git a/Apple2/assemble.cmd b/Apple2/assemble.cmd
index 48cef15..f2b075a 100644
--- a/Apple2/assemble.cmd
+++ b/Apple2/assemble.cmd
@@ -1,87 +1,89 @@
-ca65 DriveFirmware.asm -D SLOT=0 -o DriveSlot0.o
+@if "%1" == "" (set HW_TYPE=0) else (set HW_TYPE=%1)
+
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o DriveSlot0.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=1 -o DriveSlot1.o
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o DriveSlot1.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=2 -o DriveSlot2.o
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o DriveSlot2.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=3 -o DriveSlot3.o
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o DriveSlot3.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=4 -o DriveSlot4.o
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o DriveSlot4.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=5 -o DriveSlot5.o
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o DriveSlot5.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=6 -o DriveSlot6.o
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o DriveSlot6.o
@if errorlevel 1 goto exit
-ca65 DriveFirmware.asm -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255
+ca65 DriveFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=0 -o MenuSlot0.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o MenuSlot0.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=1 -o MenuSlot1.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o MenuSlot1.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=2 -o MenuSlot2.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o MenuSlot2.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=3 -o MenuSlot3.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o MenuSlot3.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=4 -o MenuSlot4.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o MenuSlot4.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=5 -o MenuSlot5.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o MenuSlot5.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=6 -o MenuSlot6.o
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o MenuSlot6.o
@if errorlevel 1 goto exit
-ca65 MenuFirmware.asm -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255
+ca65 MenuFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=0 -o CommandSlot0.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o CommandSlot0.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=1 -o CommandSlot1.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o CommandSlot1.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=2 -o CommandSlot2.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o CommandSlot2.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=3 -o CommandSlot3.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o CommandSlot3.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=4 -o CommandSlot4.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o CommandSlot4.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=5 -o CommandSlot5.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o CommandSlot5.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=6 -o CommandSlot6.o
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o CommandSlot6.o
@if errorlevel 1 goto exit
-ca65 CommandFirmware.asm -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255
+ca65 CommandFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=0 -o FileAccessSlot0.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=0 -o FileAccessSlot0.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=1 -o FileAccessSlot1.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=1 -o FileAccessSlot1.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=2 -o FileAccessSlot2.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=2 -o FileAccessSlot2.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=3 -o FileAccessSlot3.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=3 -o FileAccessSlot3.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=4 -o FileAccessSlot4.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=4 -o FileAccessSlot4.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=5 -o FileAccessSlot5.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=5 -o FileAccessSlot5.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=6 -o FileAccessSlot6.o
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=6 -o FileAccessSlot6.o
@if errorlevel 1 goto exit
-ca65 FileAccessFirmware.asm -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255
+ca65 FileAccessFirmware.asm -D HW_TYPE=%HW_TYPE% -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255
@if errorlevel 1 goto exit
ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
copy /b DriveFirmware.bin + CommandFirmware.bin + FileAccessFirmware.bin + MenuFirmware.bin AT28C64B.bin
-ca65 Shell.asm -o Shell.o --listing Shell.lst
+ca65 Shell.asm -D HW_TYPE=%HW_TYPE% -o Shell.o --listing Shell.lst
@if errorlevel 1 goto exit
ld65 Shell.o -o Shell.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
-ca65 RPi.Command.asm -o RPi.Command.o --listing RPi.Command.lst
+ca65 RPi.Command.asm -D HW_TYPE=%HW_TYPE% -o RPi.Command.o --listing RPi.Command.lst
@if errorlevel 1 goto exit
ld65 RPi.Command.o -o RPi.Command.bin -C ../.cicd/none.cfg
@if errorlevel 1 goto exit
diff --git a/Apple2/assemble.sh b/Apple2/assemble.sh
index d2fda5c..4013f1d 100755
--- a/Apple2/assemble.sh
+++ b/Apple2/assemble.sh
@@ -1,52 +1,54 @@
#!/bin/sh
-ca65 DriveFirmware.asm -D SLOT=0 -o DriveSlot0.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=1 -o DriveSlot1.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=2 -o DriveSlot2.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=3 -o DriveSlot3.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=4 -o DriveSlot4.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=5 -o DriveSlot5.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=6 -o DriveSlot6.o || exit 1
-ca65 DriveFirmware.asm -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255 || exit 1
+HW_TYPE=${1-0}
+
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o DriveSlot0.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o DriveSlot1.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o DriveSlot2.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o DriveSlot3.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o DriveSlot4.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o DriveSlot5.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o DriveSlot6.o || exit 1
+ca65 DriveFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o DriveSlot7.o --listing DriveFirmware.lst --list-bytes 255 || exit 1
ld65 DriveSlot0.o DriveSlot1.o DriveSlot2.o DriveSlot3.o DriveSlot4.o DriveSlot5.o DriveSlot6.o DriveSlot7.o -o DriveFirmware.bin -C ../.cicd/none.cfg || exit 1
-ca65 MenuFirmware.asm -D SLOT=0 -o MenuSlot0.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=1 -o MenuSlot1.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=2 -o MenuSlot2.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=3 -o MenuSlot3.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=4 -o MenuSlot4.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=5 -o MenuSlot5.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=6 -o MenuSlot6.o || exit 1
-ca65 MenuFirmware.asm -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255 || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o MenuSlot0.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o MenuSlot1.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o MenuSlot2.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o MenuSlot3.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o MenuSlot4.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o MenuSlot5.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o MenuSlot6.o || exit 1
+ca65 MenuFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o MenuSlot7.o --listing MenuFirmware.lst --list-bytes 255 || exit 1
ld65 MenuSlot0.o MenuSlot1.o MenuSlot2.o MenuSlot3.o MenuSlot4.o MenuSlot5.o MenuSlot6.o MenuSlot7.o -o MenuFirmware.bin -C ../.cicd/none.cfg || exit 1
-ca65 CommandFirmware.asm -D SLOT=0 -o CommandSlot0.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=1 -o CommandSlot1.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=2 -o CommandSlot2.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=3 -o CommandSlot3.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=4 -o CommandSlot4.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=5 -o CommandSlot5.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=6 -o CommandSlot6.o || exit 1
-ca65 CommandFirmware.asm -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255 || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o CommandSlot0.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o CommandSlot1.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o CommandSlot2.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o CommandSlot3.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o CommandSlot4.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o CommandSlot5.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o CommandSlot6.o || exit 1
+ca65 CommandFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o CommandSlot7.o --listing CommandFirmware.lst --list-bytes 255 || exit 1
ld65 CommandSlot0.o CommandSlot1.o CommandSlot2.o CommandSlot3.o CommandSlot4.o CommandSlot5.o CommandSlot6.o CommandSlot7.o -o CommandFirmware.bin -C ../.cicd/none.cfg || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=0 -o FileAccessSlot0.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=1 -o FileAccessSlot1.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=2 -o FileAccessSlot2.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=3 -o FileAccessSlot3.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=4 -o FileAccessSlot4.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=5 -o FileAccessSlot5.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=6 -o FileAccessSlot6.o || exit 1
-ca65 FileAccessFirmware.asm -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255 || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=0 -o FileAccessSlot0.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=1 -o FileAccessSlot1.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=2 -o FileAccessSlot2.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=3 -o FileAccessSlot3.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=4 -o FileAccessSlot4.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=5 -o FileAccessSlot5.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=6 -o FileAccessSlot6.o || exit 1
+ca65 FileAccessFirmware.asm -D HW_TYPE=$HW_TYPE -D SLOT=7 -o FileAccessSlot7.o --listing FileAccessFirmware.lst --list-bytes 255 || exit 1
ld65 FileAccessSlot0.o FileAccessSlot1.o FileAccessSlot2.o FileAccessSlot3.o FileAccessSlot4.o FileAccessSlot5.o FileAccessSlot6.o FileAccessSlot7.o -o FileAccessFirmware.bin -C ../.cicd/none.cfg || exit 1
cat \
DriveFirmware.bin CommandFirmware.bin FileAccessFirmware.bin MenuFirmware.bin \
> AT28C64B.bin
-ca65 Shell.asm -o Shell.o --listing Shell.lst || exit 1
+ca65 Shell.asm -D HW_TYPE=$HW_TYPE -o Shell.o --listing Shell.lst || exit 1
ld65 Shell.o -o Shell.bin -C ../.cicd/none.cfg || exit 1
-ca65 RPi.Command.asm -o RPi.Command.o --listing RPi.Command.lst || exit 1
+ca65 RPi.Command.asm -D HW_TYPE=$HW_TYPE -o RPi.Command.o --listing RPi.Command.lst || exit 1
ld65 RPi.Command.o -o RPi.Command.bin -C ../.cicd/none.cfg || exit 1
rm ./*.o