From e544e21f047120af8f68210f0131c279a86a61d9 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Wed, 28 Jul 2021 16:28:02 -0700 Subject: [PATCH] Make Refactoring --- .github/workflows/commit.yml | 4 +- .github/workflows/release.yml | 2 +- Binary/Makefile | 2 +- Makefile | 3 + Source/HBIOS/Build.cmd | 37 ++++++++++ Source/HBIOS/Build.sh | 135 +++++++++++++++++----------------- Source/HBIOS/Makefile | 93 ++++++++++++----------- Source/ver.inc | 2 +- Source/ver.lib | 2 +- Tools/Makefile.inc | 4 +- 10 files changed, 161 insertions(+), 123 deletions(-) diff --git a/.github/workflows/commit.yml b/.github/workflows/commit.yml index 39efadf0..e2e2af8a 100644 --- a/.github/workflows/commit.yml +++ b/.github/workflows/commit.yml @@ -23,7 +23,7 @@ jobs: export TZ='America/Los_Angeles' sudo apt-get install libncurses-dev sudo apt-get install srecord - make + make dist make clean rm -rf .git* @@ -49,7 +49,7 @@ jobs: run: | export TZ='America/Los_Angeles' brew install srecord - make + make dist make clean rm -rf .git* diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e5fbaaf..4a814905 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -26,7 +26,7 @@ jobs: - name: Build run: | sudo apt-get install libncurses-dev - make + make dist make clean rm -rf .git* diff --git a/Binary/Makefile b/Binary/Makefile index c5a288e1..cdca45ae 100644 --- a/Binary/Makefile +++ b/Binary/Makefile @@ -5,4 +5,4 @@ SUBDIRS = Apps CPM3 ZPM3 include $(TOOLS)/Makefile.inc clobber:: - @rm -f *.bin *.com *.img *.rom *.hex *.pdf *.log *.eeprom *.dat + @rm -f *.bin *.com *.img *.rom *.upd *.hex *.pdf *.log *.eeprom *.dat diff --git a/Makefile b/Makefile index 40ad2bcd..a9c1abae 100644 --- a/Makefile +++ b/Makefile @@ -15,3 +15,6 @@ clobber: diff: $(MAKE) --directory Source diff + +dist: + $(MAKE) ROM_PLATFORM=dist diff --git a/Source/HBIOS/Build.cmd b/Source/HBIOS/Build.cmd index 64bd4a01..7283590f 100644 --- a/Source/HBIOS/Build.cmd +++ b/Source/HBIOS/Build.cmd @@ -1,6 +1,8 @@ @echo off setlocal +if %1 == dist goto :dist + :: :: Build [ [ [ []]]] :: @@ -158,3 +160,38 @@ tasm -t80 -g3 -fFF %1.asm %1.bin %1.lst || exit /b goto :eof +:: +:: Build all of the official distribution ROMs +:: + +:dist + +call Build SBC std 512 || exit /b +call Build SBC simh 512 || exit /b +call Build MBC std 512 || exit /b +call Build ZETA std 512 || exit /b +call Build ZETA2 std 512 || exit /b +call Build N8 std 512 || exit /b +call Build MK4 std 512 || exit /b +call Build RCZ80 std 512 || exit /b +call Build RCZ80 skz 512 || exit /b +call Build RCZ80 kio 512 || exit /b +call Build RCZ80 mt 512 || exit /b +call Build RCZ80 duart 512 || exit /b +call Build RCZ80 zrc 512 || exit /b +call Build RCZ180 ext 512 || exit /b +call Build RCZ180 nat 512 || exit /b +call Build RCZ280 ext 512 || exit /b +call Build RCZ280 nat 512 || exit /b +call Build RCZ280 nat_zz 512 || exit /b +call Build RCZ280 nat_zzr 256 || exit /b +call Build SCZ180 126 512 || exit /b +call Build SCZ180 130 512 || exit /b +call Build SCZ180 131 512 || exit /b +call Build SCZ180 140 512 || exit /b +call Build EZZ80 std 512 || exit /b +call Build EZZ80 tz80 512 || exit /b +call Build DYNO std 512 || exit /b +call Build UNA std 512 || exit /b + +goto :eof diff --git a/Source/HBIOS/Build.sh b/Source/HBIOS/Build.sh index 4f4b9544..3ced548c 100755 --- a/Source/HBIOS/Build.sh +++ b/Source/HBIOS/Build.sh @@ -3,101 +3,102 @@ # fail on any error set -e -timestamp=$(date +%Y-%m-%d) -#timestamp="2020-02-24" - -if [ $1 == '-d' ] ; then - shift - diffdir=$1 - shift - if [ -f $diffdir/build.inc ] ; then - timestamp=$(grep TIMESTAMP $diffdir/build.inc | awk '{print $3}' | tr -d '\015"') - echo diff build using $timestamp - fi +export ROM_PLATFORM +export ROM_CONFIG +export ROMSIZE + +if [ "${ROM_PLATFORM}" == "dist" ] ; then + echo "!!!DISTRIBUTION BUILD!!!" + ROM_PLATFORM="DYNO"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="EZZ80"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="EZZ80"; ROM_CONFIG="tz80"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="MK4"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="N8"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ180"; ROM_CONFIG="ext"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ180"; ROM_CONFIG="nat"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="ext"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="nat"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="nat_zz"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ280"; ROM_CONFIG="nat_zzr"; ROMSIZE="256"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="kio"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="mt"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="duart"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="skz"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="RCZ80"; ROM_CONFIG="zrc"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="SBC"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="SBC"; ROM_CONFIG="simh"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="MBC"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="126"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="130"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="131"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="SCZ180"; ROM_CONFIG="140"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="UNA"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="ZETA"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + ROM_PLATFORM="ZETA2"; ROM_CONFIG="std"; ROMSIZE="512"; bash Build.sh + exit fi -# positional arguments -platform=$1 -config=$2 -romsize=$3 -romname=$4 - -export platform +###if [ $1 == '-d' ] ; then +### shift +### diffdir=$1 +### shift +### if [ -f $diffdir/build.inc ] ; then +### timestamp=$(grep TIMESTAMP $diffdir/build.inc | awk '{print $3}' | tr -d '\015"') +### echo diff build using $timestamp +### fi +###fi # prompt if no match platforms=($(find Config -name \*.asm -print | \ sed -e 's,Config/,,' -e 's/_.*$//' | sort -u)) -while ! echo ${platforms[@]} | grep -q -w -s "$platform" ; do +while ! echo ${platforms[@]} | grep -q -w -s "${ROM_PLATFORM}" ; do echo -n "Enter platform [" ${platforms[@]} "] :" - read platform + read ROM_PLATFORM done -configs=$(find Config -name ${platform}_\* -print | \ - sed -e 's,Config/,,' -e "s/${platform}_//" -e "s/.asm//") -while ! echo ${configs[@]} | grep -s -w -q "$config" ; do +configs=$(find Config -name ${ROM_PLATFORM}_\* -print | \ + sed -e 's,Config/,,' -e "s/${ROM_PLATFORM}_//" -e "s/.asm//") +while ! echo ${configs[@]} | grep -s -w -q "${ROM_CONFIG}" ; do echo -n "Enter config for $platform [" ${configs[@]} "] :" - read config + read ROM_CONFIG done -configfile=Config/${platform}_${config}.asm -while [ ! '(' "$romsize" = 1024 -o "$romsize" = 512 -o "$romsize" = 256 -o "$romsize" = 128 ')' ] ; do +CONFIGFILE=Config/${ROM_PLATFORM}_${ROM_CONFIG}.asm + +while [ ! '(' "${ROMSIZE}" = 1024 -o "${ROMSIZE}" = 512 -o "${ROMSIZE}" = 256 -o "${ROMSIZE}" = 128 ')' ] ; do echo -n "Romsize :" - read romsize + read ROMSIZE done -if [ -z "$romname" ] ; then - romname=${platform}_${config} +if [ -z "${ROMNAME}" ] ; then + ROMNAME=${ROM_PLATFORM}_${ROM_CONFIG} fi -echo Building for $romname for $platform $config $romsize -if [ $platform == UNA ] ; then - BIOS=una -else - BIOS=wbw -fi +TIMESTAMP=$(date +%Y-%m-%d) -outdir=../../Binary +CONFIGFILE=Config/${ROM_PLATFORM}_${ROM_CONFIG}.asm -# Help make realize that build.inc has changed -sleep 1 +echo Building $ROMNAME for $ROM_PLATFORM $ROM_CONFIG $ROMSIZE cat <<- EOF > build.inc -; RomWBW Configured for $platform $config $timestamp +; RomWBW Configured for ${ROM_PLATFORM} ${ROM_CONFIG} ${TIMESTAMP} ; -#DEFINE TIMESTAMP "$timestamp" +#DEFINE TIMESTAMP "${TIMESTAMP}" ; -ROMSIZE .EQU $romsize +ROMSIZE .EQU ${ROMSIZE} ; -#INCLUDE "$configfile" +#INCLUDE "${CONFIGFILE}" ; EOF -make prereq - -make dbgmon.bin romldr.bin - -if [ $platform != UNA ] ; then - make nascom.bin tastybasic.bin game.bin eastaegg.bin updater.bin usrrom.bin imgpad2.bin - make hbios_rom.bin hbios_app.bin hbios_img.bin +export OBJECTS +OBJECTS="${ROMNAME}.rom" +if [ "${ROM_PLATFORM}" != "UNA" ] ; then + OBJECTS+=" ${ROMNAME}.com ${ROMNAME}.upd" fi -echo "Building $romname output files..." +#echo OBJECTS=${OBJECTS} -cat romldr.bin dbgmon.bin ../ZSDOS/zsys_$BIOS.bin ../CPM22/cpm_$BIOS.bin >osimg.bin -cat romldr.bin dbgmon.bin ../ZSDOS/zsys_$BIOS.bin >osimg_small.bin - -if [ $platform != UNA ] ; then - cat camel80.bin nascom.bin tastybasic.bin game.bin eastaegg.bin netboot.mod updater.bin usrrom.bin >osimg1.bin - cat imgpad2.bin >osimg2.bin -fi - -if [ $platform = UNA ] ; then - cp osimg.bin $outdir/UNA_WBW_SYS.bin - cp ../RomDsk/rom${romsize}_una.dat $outdir/UNA_WBW_ROM$romsize.bin - cat ../UBIOS/UNA-BIOS.BIN osimg.bin ../UBIOS/FSFAT.BIN ../RomDsk/rom${romsize}_una.dat >$romname.rom -else - cat hbios_rom.bin osimg.bin osimg1.bin osimg2.bin ../RomDsk/rom${romsize}_wbw.dat >$romname.rom - cat hbios_rom.bin osimg.bin osimg1.bin osimg2.bin >$romname.upd - cat hbios_app.bin osimg_small.bin > $romname.com -fi +make ROM_PLATFORM=${ROM_PLATFORM} ROM_CONFIG=${ROM_CONFIG} ROMSIZE=${ROMSIZE} diff --git a/Source/HBIOS/Makefile b/Source/HBIOS/Makefile index 19d4eade..b243380a 100644 --- a/Source/HBIOS/Makefile +++ b/Source/HBIOS/Makefile @@ -1,38 +1,3 @@ -ifndef ROM_CONFIG - ROM_CONFIG=std -endif - -ifdef ROM_PLATFORM - OBJECTS = ${ROM_PLATFORM}_${ROM_CONFIG}.rom ${ROM_PLATFORM}_${ROM_CONFIG}.com ${ROM_PLATFORM}_${ROM_CONFIG}.upd -else - OBJECTS += DYNO_std.rom DYNO_std.com DYNO_std.upd - OBJECTS += EZZ80_std.rom EZZ80_std.com EZZ80_std.upd - OBJECTS += EZZ80_tz80.rom EZZ80_tz80.com EZZ80_tz80.upd - OBJECTS += MK4_std.rom MK4_std.com MK4_std.upd - OBJECTS += N8_std.rom N8_std.com N8_std.upd - OBJECTS += RCZ180_ext.rom RCZ180_ext.com RCZ180_ext.upd - OBJECTS += RCZ180_nat.rom RCZ180_nat.com RCZ180_nat.upd - OBJECTS += RCZ280_ext.rom RCZ280_ext.com RCZ280_ext.upd - OBJECTS += RCZ280_nat.rom RCZ280_nat.com RCZ280_nat.upd - OBJECTS += RCZ280_nat_zz.rom RCZ280_nat_zz.com RCZ280_nat_zz.upd - OBJECTS += RCZ280_nat_zzr.rom RCZ280_nat_zzr.com RCZ280_nat_zzr.upd - OBJECTS += RCZ80_kio.rom RCZ80_kio.com RCZ80_kio.upd - OBJECTS += RCZ80_mt.rom RCZ80_mt.com RCZ80_mt.upd - OBJECTS += RCZ80_duart.rom RCZ80_duart.com RCZ80_duart.upd - OBJECTS += RCZ80_std.rom RCZ80_std.com RCZ80_std.upd - OBJECTS += RCZ80_skz.rom RCZ80_skz.com RCZ80_skz.upd - OBJECTS += RCZ80_zrc.rom RCZ80_zrc.com RCZ80_zrc.upd - OBJECTS += SBC_std.rom SBC_std.com SBC_std.upd - OBJECTS += SBC_simh.rom SBC_simh.com SBC_simh.upd - OBJECTS += MBC_std.rom MBC_std.com MBC_std.upd - OBJECTS += SCZ180_126.rom SCZ180_126.com SCZ180_126.upd - OBJECTS += SCZ180_130.rom SCZ180_130.com SCZ180_130.upd - OBJECTS += SCZ180_131.rom SCZ180_131.com SCZ180_131.upd - OBJECTS += SCZ180_140.rom SCZ180_140.com SCZ180_140.upd - OBJECTS += UNA_std.rom - OBJECTS += ZETA_std.rom ZETA_std.com ZETA_std.upd - OBJECTS += ZETA2_std.rom ZETA2_std.com ZETA2_std.upd -endif MOREDIFF = camel80.bin game.bin hbios_rom.bin nascom.bin prefix.bin usrrom.bin \ dbgmon.bin hbios_app.bin imgpad2.bin osimg1.bin osimg2.bin romldr.bin \ @@ -42,16 +7,16 @@ MOREDIFF = camel80.bin game.bin hbios_rom.bin nascom.bin prefix.bin usrrom.bin \ SUBDIRS = DEST = ../../Binary TOOLS =../../Tools -OTHERS = *.img *.rom *.com *.bin *.z80 cpm.sys zsys.sys Build.inc font*.asm *.dat +OTHERS = *.img *.rom *.com *.upd *.bin *.z80 cpm.sys zsys.sys Build.inc font*.asm *.dat include $(TOOLS)/Makefile.inc FONTS := font8x11c.asm font8x11u.asm font8x16c.asm font8x16u.asm font8x8c.asm font8x8u.asm -ifneq ($(findstring $(platform), N8 MK4 RCZ180 SCZ180 DYNO),) +ifneq ($(findstring $(ROM_PLATFORM), N8 MK4 RCZ180 SCZ180 DYNO),) TASM=$(BINDIR)/uz80as -t hd64180 endif -ifneq ($(findstring $(platform), RCZ280),) +ifneq ($(findstring $(ROM_PLATFORM), RCZ280),) TASM=$(BINDIR)/uz80as -t z280 endif @@ -61,15 +26,47 @@ endif DIFFPATH = $(DIFFTO)/Binary -ROMSIZE=512 +DEPS=prereq dbgmon.bin romldr.bin nascom.bin tastybasic.bin game.bin eastaegg.bin updater.bin usrrom.bin imgpad2.bin -N8_std.rom: ROMSIZE=512 -RCZ280_nat_zzr.rom: ROMSIZE=256 +ifeq ($(ROM_PLATFORM),UNA) + ROMDEPS=romldr.bin dbgmon.bin + BIOS=una +else + ROMDEPS=hbios_rom.bin hbios_app.bin hbios_img.bin + BIOS=wbw +endif + +ROMNAME=${ROM_PLATFORM}_${ROM_CONFIG} + +#$(info DEPS=$(DEPS)) +#$(info ROM_PLATFORM=$(ROM_PLATFORM)) +#$(info ROM_CONFIG=$(ROM_CONFIG)) +#$(info ROMSIZE=$(ROMSIZE)) +#$(info ROMNAME=$(ROMNAME)) + +all:: + if [ -z "$(OBJECTS)" ] ; then \ + chmod +x Build.sh + bash Build.sh ; \ + fi + +$(ROMNAME).rom $(ROMNAME).com $(ROMNAME).img &: $(ROMDEPS) + cat romldr.bin dbgmon.bin ../ZSDOS/zsys_$(BIOS).bin ../CPM22/cpm_$(BIOS).bin >osimg.bin + cat romldr.bin dbgmon.bin ../ZSDOS/zsys_$(BIOS).bin >osimg_small.bin + if [ $(ROM_PLATFORM) != UNA ] ; then \ + cat camel80.bin nascom.bin tastybasic.bin game.bin eastaegg.bin netboot.mod updater.bin usrrom.bin >osimg1.bin ; \ + cat imgpad2.bin >osimg2.bin ; \ + fi + if [ $(ROM_PLATFORM) = UNA ] ; then \ + cp osimg.bin $(DEST)/UNA_WBW_SYS.bin ; \ + cp ../RomDsk/rom$(ROMSIZE)_una.dat $(DEST)/UNA_WBW_ROM$(ROMSIZE).bin ; \ + cat ../UBIOS/UNA-BIOS.BIN osimg.bin ../UBIOS/FSFAT.BIN ../RomDsk/rom$(ROMSIZE)_una.dat >$(ROMNAME).rom ; \ + else \ + cat hbios_rom.bin osimg.bin osimg1.bin osimg2.bin ../RomDsk/rom$(ROMSIZE)_wbw.dat >$(ROMNAME).rom ; \ + cat hbios_rom.bin osimg.bin osimg1.bin osimg2.bin >$(ROMNAME).upd ; \ + cat hbios_app.bin osimg_small.bin > $(ROMNAME).com ; \ + fi -%.rom %.upd %.com: - chmod +x Build.sh - bash Build.sh $(DIFFBUILD) $(shell echo $* | sed 's/_/ /') $(ROMSIZE) - prereq: $(FONTS) camel80.bin font%.asm: @@ -78,13 +75,13 @@ font%.asm: camel80.bin: cp ../Forth/$@ . -hbios_rom.bin: hbios.asm build.inc +hbios_rom.bin: hbios.asm build.inc $(DEPS) $(TASM) -dROMBOOT hbios.asm hbios_rom.bin hbios_rom.lst -hbios_app.bin: hbios.asm build.inc +hbios_app.bin: hbios.asm build.inc $(DEPS) $(TASM) -dAPPBOOT hbios.asm hbios_app.bin hbios_app.lst -hbios_img.bin: hbios.asm build.inc +hbios_img.bin: hbios.asm build.inc $(DEPS) $(TASM) -dIMGBOOT hbios.asm hbios_img.bin hbios_img.lst romldr.bin: build.inc diff --git a/Source/ver.inc b/Source/ver.inc index e08be308..aff97ccb 100644 --- a/Source/ver.inc +++ b/Source/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 1 #DEFINE RUP 1 #DEFINE RTP 0 -#DEFINE BIOSVER "3.1.1-pre.98" +#DEFINE BIOSVER "3.1.1-pre.99" diff --git a/Source/ver.lib b/Source/ver.lib index ff52a610..7b5ac37c 100644 --- a/Source/ver.lib +++ b/Source/ver.lib @@ -3,5 +3,5 @@ rmn equ 1 rup equ 1 rtp equ 0 biosver macro - db "3.1.1-pre.98" + db "3.1.1-pre.99" endm diff --git a/Tools/Makefile.inc b/Tools/Makefile.inc index 32ad2bb0..48910ec8 100644 --- a/Tools/Makefile.inc +++ b/Tools/Makefile.inc @@ -126,13 +126,13 @@ all:: $(OBJECTS) @for dir in $(SUBDIRS) ; do \ $(MAKE) --directory $$dir all ; \ done - @if [ "$(DEST)" ] ; then for file in $(filter-out $(NOCOPY),$(OBJECTS)) ; do \ + @if [ "$(DEST)" ] && [ "$(OBJECTS)" ] ; then for file in $(filter-out $(NOCOPY),$(OBJECTS)) ; do \ mkdir -p $(DEST) ; \ echo Copying $$file to $(DEST) ; \ rm -f /tmp/casefn.cache ; \ cp $$($(CASEFN) $$file) $(DEST) ; \ done ; fi - @if [ "$(DOCDEST)" ] ; then for file in $(DOCS) ; do \ + @if [ "$(DOCDEST)" ] && [ "$(DOCS)" ] ; then for file in $(DOCS) ; do \ mkdir -p $(DOCDEST) ; \ echo Copying $$file to $(DOCDEST) ; \ rm -f /tmp/casefn.cache ; \