From 41ed0379352b929283e1489c703b146c617e55fa Mon Sep 17 00:00:00 2001 From: curt mayer Date: Wed, 19 Feb 2020 02:47:25 -0800 Subject: [PATCH 01/23] fixes for make diff --- Binary/Apps/Tunes/Makefile | 12 ++++++------ Source/CPM3/Makefile | 2 +- Source/HBIOS/Makefile | 10 ++++++++++ Source/Images/Makefile | 2 ++ Source/ZPM3/Makefile | 9 +++++++-- Tools/Makefile.inc | 7 +++++-- Tools/unix/casefn.sh | 8 ++++++-- 7 files changed, 37 insertions(+), 13 deletions(-) diff --git a/Binary/Apps/Tunes/Makefile b/Binary/Apps/Tunes/Makefile index b643ef0f..4b7b57e7 100644 --- a/Binary/Apps/Tunes/Makefile +++ b/Binary/Apps/Tunes/Makefile @@ -1,6 +1,6 @@ -TOOLS = ../../../Tools - -include $(TOOLS)/Makefile.inc - -clean:: - rm -f *.pt? *.mym +TOOLS = ../../../Tools + +include $(TOOLS)/Makefile.inc + +clobber:: + -rm -f *.pt3 *.mym diff --git a/Source/CPM3/Makefile b/Source/CPM3/Makefile index f3ad7abc..1e1c2e12 100644 --- a/Source/CPM3/Makefile +++ b/Source/CPM3/Makefile @@ -11,7 +11,7 @@ TOOLS = ../../Tools include $(TOOLS)/Makefile.inc BIOSOBJS = bioskrnl.rel scb.rel boot.rel chario.rel -BIOSOBJS += move.rel drvtbl.rel diskio.rel +BIOSOBJS += move.rel drvtbl.rel diskio.rel util.rel COMMA := , NULL := SPACE := $(NULL) $(NULL) diff --git a/Source/HBIOS/Makefile b/Source/HBIOS/Makefile index c227ab1a..1e7879d0 100644 --- a/Source/HBIOS/Makefile +++ b/Source/HBIOS/Makefile @@ -4,7 +4,17 @@ DEST = ../../Binary/Apps TOOLS =../../Tools OTHERS = *.bin *.z80 cpm.sys zsys.sys Build.inc include $(TOOLS)/Makefile.inc +DIFFPATH = $(DIFFTO)/Binary ZETA2_std.rom: bash Build.sh ZETA2 std 512 + +hbios_rom.bin: hbios.asm + $(TASM) -dROMBOOT hbios.asm hbios_rom.bin + +hbios_app.bin: hbios.asm + $(TASM) -dAPPBOOT hbios.asm hbios_app.bin + +hbios_img.bin: hbios.asm + $(TASM) -dIMGBOOT hbios.asm hbios_img.bin diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 1bffcee4..1118e3d1 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -16,6 +16,8 @@ DEST=../../Binary TOOLS = ../../Tools include $(TOOLS)/Makefile.inc +DIFFPATH = $(DIFFTO)/Binary + hd_combo.img: $(HDIMGS) cat $(HDIMGS) > $@ diff --git a/Source/ZPM3/Makefile b/Source/ZPM3/Makefile index 9eebbc35..0574dfa0 100644 --- a/Source/ZPM3/Makefile +++ b/Source/ZPM3/Makefile @@ -1,6 +1,9 @@ -OBJECTS = zpmldr.com zpmldr.sys cpm3.sys zinstal.zpm startzpm.com zccp.com \ +OBJECTS = zpmldr.com zpmldr.sys cpm3.sys startzpm.com zccp.com \ setz3.com clrhist.com autotog.com -OTHERS = biosldr.rel gencpm.com gencpm.dat bnkbios3.spr +ifndef REBUILD_ZPM_TOOLS +NODELETE = setz3.com clrhist.com autotog.com +endif +OTHERS = zpmldr.bin loader.bin biosldrd.rel biosldrc.rel gencpm.com gencpm.dat bnkbios3.spr TOOLS =../../Tools include $(TOOLS)/Makefile.inc @@ -43,8 +46,10 @@ zinstal.zpm: ../ZCCP/zinstal.zpm startzpm.com: ../ZCCP/startzpm.com cp $< $@ +ifdef REBUILD_ZPM_TOOLS setz3.com: setz3.z80 clrhist.com: clrhist.z80 autotog.com: autotog.z80 +endif diff --git a/Tools/Makefile.inc b/Tools/Makefile.inc index beb67b1c..02783e14 100644 --- a/Tools/Makefile.inc +++ b/Tools/Makefile.inc @@ -24,7 +24,7 @@ RELPATH := $(subst $(TREEROOT),,$(HERE)) # # where's a copy of this tree for windows so we can diff binaries # -DIFFTO := /Volumes/Github/RomWBW +DIFFTO := $(shell cd $(TREEROOT)/../RomWBW.windows; pwd) DIFFPATH := $(DIFFTO)/$(RELPATH) # @@ -144,9 +144,12 @@ diff:: sf=$$($(CASEFN) $$i) ; \ df=$$($(CASEFN) $(DIFFPATH)/$$i) ; \ if [ -f $$df -a -f $$sf ] ; then \ + if [ "$(VERBOSEDIFF)" ] ; then \ + echo compare $$sf and $$df ; \ + fi ; \ if ! cmp -s $$sf $$df ; then \ echo $$sf and $$df differ ; \ - if [ "$(VERBOSEDIFF)" ] ; then \ + if [ "$(VERBOSEDIFF)" = "2" ] ; then \ cmp -bl $$sf $$df ; \ hexdump -Cv $$sf > $$sf.dump ; \ hexdump -Cv $$df > $$(basename $$df).dump.diff ; \ diff --git a/Tools/unix/casefn.sh b/Tools/unix/casefn.sh index 2b2939dd..5bade162 100755 --- a/Tools/unix/casefn.sh +++ b/Tools/unix/casefn.sh @@ -12,7 +12,7 @@ function cleanup { rm -f $all $search $in } -trap cleanup EXIT +#trap cleanup EXIT cleanup if [ $# -lt 1 ] ; then @@ -53,10 +53,14 @@ for dn in ${dirs[@]} ; do cd $here cd $dn for i in * ; do + # skip any file names containing a space + if echo "$i" | grep -sq " " ; then + continue + fi echo $dn/$(echo "$i" | tr '[A-Z]' '[a-z]')",$dn/$i" >> $in done done -sort $in > $all +sort -t, -k 1,1 $in > $all join -t, -o 1.2 $all $search | sort -u > $in if [ $(wc -l < $in) -gt 0 ] ; then From 9d37b4a59bb5a48334f2b97eab35c3a3c171ea02 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:29:04 -0800 Subject: [PATCH 02/23] fixed broken usage of .ds. should have been .fill --- Source/Apps/FDU/FDU.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Apps/FDU/FDU.asm b/Source/Apps/FDU/FDU.asm index c27cf356..da176f06 100644 --- a/Source/Apps/FDU/FDU.asm +++ b/Source/Apps/FDU/FDU.asm @@ -2168,7 +2168,7 @@ FSST_COUNT .EQU (($ - FSST) / FSST_ENTSIZ) ; # ENTRIES IN TABLE ; FCP_CMD .DB 000H ; INPUT: COMMAND CODE FCP_BUFLEN .DB 00H -FCP_BUF .DS 10H +FCP_BUF .FILL 10H FCP_BUFSIZ .EQU $-FCP_BUF FCP_XFRCNT .DW 00H ; BYTES TRANSFERRED DURING COMMAND PHASE ; @@ -2182,7 +2182,7 @@ FXP_BC .DW 00H ; LAST VALUE OF REG BC RECORDED DURING EXECUTION FXP_DE .DW 00H ; LAST VALUE OF REG DE RECORDED DURING EXECUTION FXP_HL .DW 00H ; LAST VALUE OF REG HL RECORDED DURING EXECUTION FXP_BUFLEN .DB 00H -FXP_BUF .DS 50H ; USED FOR CERTAIN EXEC ROUTINES (FORMAT TRACK) +FXP_BUF .FILL 50H ; USED FOR CERTAIN EXEC ROUTINES (FORMAT TRACK) FXP_BUFSIZ .EQU $-FXP_BUF ; ; FDC STATUS From 8fb73c95f470e66eb3b37a2f51bdb861f08ed113 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:31:49 -0800 Subject: [PATCH 03/23] coding changes for clean diff --- Source/HBIOS/Build.sh | 70 ++++++++++++++++++++++--------------------- Source/HBIOS/Makefile | 8 ++++- 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/Source/HBIOS/Build.sh b/Source/HBIOS/Build.sh index 4faf1991..48f21bc4 100755 --- a/Source/HBIOS/Build.sh +++ b/Source/HBIOS/Build.sh @@ -36,13 +36,14 @@ fi echo Building for $romname for $platform $config $romsize if [ $platform == UNA ] ; then - CBIOS=../CBIOS/cbios_una.bin + BIOS=una else - CBIOS=../CBIOS/cbios_wbw.bin + BIOS=wbw fi Apps=(assign fdu format mode osldr rtc survey syscopy sysgen talk timer xm inttest) timestamp=$(date +%Y-%m-%d) +timestamp="2020-02-20" blankfile=Blank${romsize}.dat romdiskfile=RomDisk.tmp @@ -52,15 +53,6 @@ outdir=../../Binary echo "creating empty rom disk of size $romsize in $blankfile" LANG=en_US.US-ASCII tr '\000' '\345' build.inc ; RomWBW Configured for $platform $config $timestamp ; @@ -72,44 +64,54 @@ ROMSIZE .EQU $romsize ; EOF -cp ../CPM22/OS2CCP.bin ccp.bin -cp ../CPM22/OS3BDOS.bin bdos.bin -cp ../ZCPR-DJ/zcpr.bin zcpr.bin -cp ../ZSDOS/zsdos.bin zsdos.bin cp ../Forth/camel80.bin camel80.bin +cp ../Fonts/font*.asm . -make -f Makefile dbgmon.bin prefix.bin romldr.bin eastaegg.bin nascom.bin \ - tastybasic.bin imgpad.bin imgpad0.bin +make dbgmon.bin prefix.bin romldr.bin eastaegg.bin nascom.bin \ + tastybasic.bin game.bin usrrom.bin imgpad.bin imgpad0.bin if [ $platform != UNA ] ; then - make -f Makefile hbios_rom.bin hbios_app.bin hbios_img.bin + make hbios_rom.bin hbios_app.bin hbios_img.bin fi -cat ccp.bin bdos.bin $CBIOS >cpm.bin -cat zcpr.bin zsdos.bin $CBIOS >zsys.bin - -cat prefix.bin cpm.bin >cpm.sys -cat prefix.bin zsys.bin >zsys.sys +echo "Building $romname output files..." -cat romldr.bin eastaegg.bin dbgmon.bin cpm.bin zsys.bin >osimg.bin -cat camel80.bin nascom.bin tastybasic.bin imgpad0.bin >osimg1.bin +cat romldr.bin eastaegg.bin dbgmon.bin ../CPM22/cpm_$BIOS.bin ../ZSDOS/zsys_$BIOS.bin >osimg.bin +cat camel80.bin nascom.bin tastybasic.bin game.bin imgpad0.bin usrrom.bin >osimg1.bin echo "Building ${romsize}KB $romname ROM disk data file..." + cp $blankfile $romdiskfile -$CPMCP -f $romfmt $romdiskfile ../RomDsk/ROM_${romsize}KB/*.* 0: -if [ $(find ../RomDsk/$platform -type f -print 2>/dev/null | wc -l) -gt 0 ] ; then - $CPMCP -f $romfmt $romdiskfile ../RomDsk/$platform/*.* 0: -fi +echo placing files into $romdiskfile -for i in ${apps[@]} ; do - $CPMCP -f $romfmt $romdiskfile ../../Binary/Apps/$i.com 0: +for file in $(ls -1 ../RomDsk/ROM_${romsize}KB/* | sort -V) ; do + echo " " $file + $CPMCP -f $romfmt $romdiskfile $file 0: done -for i in *.sys ; do - $CPMCP -f $romfmt $romdiskfile $i 0: +if [ -d ../RomDsk/$platform ] ; then + for file in ../RomDsk/$platform/* ; do + echo " " $file + $CPMCP -f $romfmt $romdiskfile $file 0: + done +fi + +echo "adding apps to $romdiskfile" +for i in assign fdu format mode osldr rtc survey syscopy sysgen talk timer xm inttest ; do + f=$(../../Tools/unix/casefn.sh ../../Binary/Apps/$i.com) + if [ "$f" = "nofile" ] ; then + echo " " $i "not found" + else + echo " " $f + $CPMCP -f $romfmt $romdiskfile $f 0: + fi done -if [ $platform != UNA ] ; then +echo "copying systems to $romdiskfile" +$CPMCP -f $romfmt $romdiskfile ../CPM22/cpm_$BIOS.sys 0:cpm.sys +$CPMCP -f $romfmt $romdiskfile ../ZSDOS/zsys_$BIOS.sys 0:zsys.sys + +if [ $platform = UNA ] ; then cp osimg.bin $outdir/UNA_WBW_SYS.bin cp $romdiskfile $outdir/UNA_WBW_ROM$romsize.bin cat ../UBIOS/UNA-BIOS.BIN osimg.bin ../UBIOS/FSFAT.BIN $romdiskfile >$romname.rom diff --git a/Source/HBIOS/Makefile b/Source/HBIOS/Makefile index 1e7879d0..e8be95bc 100644 --- a/Source/HBIOS/Makefile +++ b/Source/HBIOS/Makefile @@ -1,6 +1,12 @@ +VERBOSEDIFF=2 OBJECTS = ZETA2_std.rom +MOREDIFF = camel80.bin game.bin hbios_rom.bin nascom.bin prefix.bin usrrom.bin \ + dbgmon.bin hbios_app.bin imgpad0.bin osimg1.bin romldr.bin \ + eastaegg.bin hbios_img.bin imgpad.bin osimg.bin tastybasic.bin \ + game.bin usrrom.bin + SUBDIRS = -DEST = ../../Binary/Apps +DEST = ../../Binary TOOLS =../../Tools OTHERS = *.bin *.z80 cpm.sys zsys.sys Build.inc include $(TOOLS)/Makefile.inc From 0264711f9f106ab377ed5719356b5e133d9312f7 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:32:10 -0800 Subject: [PATCH 04/23] fix for TASM bug using single quote inside string --- Source/HBIOS/nascom.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/HBIOS/nascom.asm b/Source/HBIOS/nascom.asm index 51517cc9..671513de 100644 --- a/Source/HBIOS/nascom.asm +++ b/Source/HBIOS/nascom.asm @@ -512,7 +512,7 @@ ERRORS: .BYTE "NEXT without FOR",0 .BYTE "Out of string space",0 .BYTE "String too long",0 .BYTE "String formula too complex",0 - .BYTE "Can't CONTinue",0 + .BYTE "Can",$27,"t CONTinue",0 .BYTE "Undefined FN function",0 .BYTE "Missing operand",0 .BYTE "HEX",0 From 1099b358a0b9741d4a860d5c5d50aa77c10bff29 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:33:11 -0800 Subject: [PATCH 05/23] fixed 2 syntax errors that TASM allows --- Source/HBIOS/hbios.asm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/HBIOS/hbios.asm b/Source/HBIOS/hbios.asm index fa3d5471..36a35b15 100644 --- a/Source/HBIOS/hbios.asm +++ b/Source/HBIOS/hbios.asm @@ -658,7 +658,7 @@ HBX_BUF .FILL HBX_BUFSIZ,0 .DW HBX_IDENT ; ADDRESS OF HBIOS PROXY START (DEPRECATED) .DW HBX_IDENT ; ADDRESS OF HBIOS IDENT INFO DATA BLOCK ; - .FILL $MEMTOP - $ ; FILL TO END OF MEMORY (AS NEEDED) + .FILL MEMTOP - $ ; FILL TO END OF MEMORY (AS NEEDED) .ORG HBX_IMG + HBX_SIZ ; RESET ORG ; ;================================================================================================== @@ -3778,7 +3778,7 @@ PS_FLP_DSTR: .TEXT "SD$" ; PS_FLPSD ; CHARACTER DEVICE STRINGS ; PS_SDSTRREF: - .DW PS_SDUART, PS_SDASCI, PS_SDTERM, + .DW PS_SDUART, PS_SDASCI, PS_SDTERM .DW PS_SDPRPCON, PS_SDPPPCON, PS_SDSIO, PS_SDACIA, PS_SDPIO,PS_SDUF ; PS_SDUART .TEXT "UART$" From 1c227f72709d646158486904040d394732a9fb6f Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:33:52 -0800 Subject: [PATCH 06/23] removed extra HBIOS --- Source/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Makefile b/Source/Makefile index 7c69b6f0..816021f3 100644 --- a/Source/Makefile +++ b/Source/Makefile @@ -10,7 +10,6 @@ SUBDIRS += ZPM3 SUBDIRS += Forth NOTDONE += Fonts SUBDIRS += BPBIOS -SUBDIRS += HBIOS SUBDIRS += Images TOOLS = ../Tools include $(TOOLS)/Makefile.inc From c585594197750f89e162e9517c474fdab03d34c4 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:35:46 -0800 Subject: [PATCH 07/23] added extra rule for diffing --- Source/Images/Makefile | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 1118e3d1..3261e8df 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -39,7 +39,7 @@ blankhd: @echo Making Blank Hd of size $(HDSIZE)k @LANG=en_US.US-ASCII tr '\000' '\345' /dev/null -%.img:: $(SYSTEMS) blank144 blankhd +%.img:: $(SYSTEMS) blank144 blankhd Makefile @sys= ; \ case $@ in \ (*cpm22*) sys=../CPM22/cpm_wbw.sys;; \ @@ -54,6 +54,10 @@ blankhd: d=$$(echo $(basename $@) | sed s/$$type//) ; \ echo Generating $@ ; \ cp $$proto $@ ; \ + if [ "$$sys" ] ; then \ + echo copying system $$sys to $@ ; \ + $(BINDIR)/mkfs.cpm -f $$fmt -b $$sys $@ ; \ + fi ; \ for u in $$(seq 0 15) ; do \ dir=d_$$d/u$$u ; \ if [ -d $$dir ] ; then \ @@ -72,8 +76,19 @@ blankhd: fi ; \ done ; \ fi ; \ - if [ "$$sys" ] ; then \ - echo copying system $$sys to $@ ; \ - dd if=$$sys of=$@ conv=notrunc 2>/dev/null ; \ - fi + +clean:: + rm -f *.ls + +imgdiff: + @for i in $(FDIMGS) $(HDIMGS) ; do \ + echo $$i ; \ + if echo $$i | grep -q ^f ; then \ + fmt=wbw_fd144 ; \ + else \ + fmt=wbw_hd0 ; \ + fi ; \ + $(BINDIR)/cpmls -f $$fmt $$i > $$i.ls ; \ + $(BINDIR)/cpmls -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \ + done \ From 2cc61c3804f655f5437430cbcd06284560db97c8 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:36:30 -0800 Subject: [PATCH 08/23] slightly more verbose diff --- Tools/Makefile.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/Makefile.inc b/Tools/Makefile.inc index 02783e14..75f652fb 100644 --- a/Tools/Makefile.inc +++ b/Tools/Makefile.inc @@ -140,7 +140,7 @@ diff:: @for dir in $(SUBDIRS) ; do \ ( echo "diff in $(HERE)/$$dir" ; cd "$$dir" ; make diff ) ; \ done - @for i in $(OBJECTS) ; do \ + @for i in $(OBJECTS) $(MOREDIFF) ; do \ sf=$$($(CASEFN) $$i) ; \ df=$$($(CASEFN) $(DIFFPATH)/$$i) ; \ if [ -f $$df -a -f $$sf ] ; then \ @@ -148,7 +148,7 @@ diff:: echo compare $$sf and $$df ; \ fi ; \ if ! cmp -s $$sf $$df ; then \ - echo $$sf and $$df differ ; \ + echo " " $$sf and $$df differ ; \ if [ "$(VERBOSEDIFF)" = "2" ] ; then \ cmp -bl $$sf $$df ; \ hexdump -Cv $$sf > $$sf.dump ; \ From a03d15fd2fb5bc4c3f23908ef32c690cd7d39e4a Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 11:38:32 -0800 Subject: [PATCH 09/23] handle .ds correctly, and forward refs in .if --- Tools/unix/uz80as/pp.c | 2 +- Tools/unix/uz80as/uz80as.c | 47 +++++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Tools/unix/uz80as/pp.c b/Tools/unix/uz80as/pp.c index b2d6a067..842247a2 100644 --- a/Tools/unix/uz80as/pp.c +++ b/Tools/unix/uz80as/pp.c @@ -631,7 +631,7 @@ static void pif(const char *p) return; p = skipws(p + sizeof(IFSTR) - 1); - if (!expr(p, &v, s_pc, 0, &ex_ec, &ep)) { + if (!expr(p, &v, s_pc, 1, &ex_ec, &ep)) { s_skipon = 1; exprint(ex_ec, s_line, ep); newerr(); diff --git a/Tools/unix/uz80as/uz80as.c b/Tools/unix/uz80as/uz80as.c index b7081470..6f03829b 100644 --- a/Tools/unix/uz80as/uz80as.c +++ b/Tools/unix/uz80as/uz80as.c @@ -51,6 +51,7 @@ static const char *d_export(const char *); static const char *d_end(const char *); static const char *d_equ(const char *); static const char *d_fill(const char *); +static const char *d_ds(const char *); static const char *d_list(const char *); static const char *d_lsfirst(const char *); static const char *d_module(const char *); @@ -76,7 +77,7 @@ static struct direc { { "CHK", d_chk }, { "CODES", d_codes }, { "DB", d_byte }, - { "DS", d_fill }, + { "DS", d_ds }, { "DW", d_word }, { "ECHO", d_echo }, { "EJECT", d_eject }, @@ -681,6 +682,50 @@ static const char *d_fill(const char *p) return p; } +static const char *d_ds(const char *p) +{ + int n, v, er; + const char *q; + enum expr_ecode ecode; + const char *ep, *eps; + + eps = p; + er = 0; + p = expr(p, &n, s_pc, 0, &ecode, &ep); + if (p == NULL) { + exprint(ecode, s_pline, ep); + newerr(); + return NULL; + } + + if (n < 0) { + eprint(_("number of positions to space over is negative (%d)\n"), n); + eprcol(s_pline, eps); + exit(EXIT_FAILURE); + } + + v = 255; + p = skipws(p); + if (*p == ',') { + p = skipws(p + 1); + q = expr(p, &v, s_pc, s_pass == 0, &ecode, &ep); + if (q == NULL) { + er = 1; + exprint(ecode, s_pline, ep); + newerr(); + } else { + p = q; + } + } + + s_pc += n; + + if (er) + return NULL; + else + return p; +} + static const char *d_lsfirst(const char *p) { s_msbword = 0; From 8fc0274044dc5577a2c764e1774c58ceb5c72f7a Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 15:23:39 -0800 Subject: [PATCH 10/23] linux build using good defaults --- Tools/unix/cpmtools/Makefile | 7 +++++-- Tools/unix/cpmtools/config.h | 2 +- Tools/unix/cpmtools/cpmfs.c | 29 ++++++++++++++++++++--------- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/Tools/unix/cpmtools/Makefile b/Tools/unix/cpmtools/Makefile index 12c1f508..8c56b657 100644 --- a/Tools/unix/cpmtools/Makefile +++ b/Tools/unix/cpmtools/Makefile @@ -10,11 +10,14 @@ CFLAGS = -g DEFFORMAT = ibm-3740 DEVICE = posix +DISKDEFS=$(shell cd ../../cpmtools ; pwd)/diskdefs +DEFFORMAT=wbw_fd144 + CPPFLAGS = -DDISKDEFS=\"$(DISKDEFS)\" -DFORMAT=\"$(DEFFORMAT)\" DEVICEOBJ = device_posix.o -OBJECTS = cpmls cpmrm cpmcp cpmchmod cpmchattr mkfs.cpm fsck.cpm +OBJECTS = cpmls cpmrm cpmcp cpmchmod cpmchattr mkfs.cpm fsck.cpm fsed.cpm all: $(OBJECTS) $(DEST) cp $(OBJECTS) $(DEST) @@ -41,7 +44,7 @@ fsck.cpm: fsck.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) $(CC) $(LDFLAGS) -o $@ fsck.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) fsed.cpm: fsed.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) - $(CC) $(LDFLAGS) -o $@ fsed.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) + $(CC) $(LDFLAGS) -o $@ fsed.cpm.o cpmfs.o getopt.o getopt1.o $(DEVICEOBJ) -lncurses $(DEST): mkdir -p $(DEST) diff --git a/Tools/unix/cpmtools/config.h b/Tools/unix/cpmtools/config.h index 2b5cd544..45bf194d 100644 --- a/Tools/unix/cpmtools/config.h +++ b/Tools/unix/cpmtools/config.h @@ -8,7 +8,7 @@ #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_MODE_T 0 -#define NEED_NCURSES 0 +#define NEED_NCURSES 1 #define HAVE_NCURSES_NCURSES_H 0 #if HAVE_SYS_STAT_H diff --git a/Tools/unix/cpmtools/cpmfs.c b/Tools/unix/cpmtools/cpmfs.c index 750b3ce6..dfd43b92 100644 --- a/Tools/unix/cpmtools/cpmfs.c +++ b/Tools/unix/cpmtools/cpmfs.c @@ -668,6 +668,24 @@ void cpmglob(int optin, int argc, char * const argv[], struct cpmInode *root, in } /*}}}*/ +FILE *open_diskdefs() +{ + FILE *fp; + char *ddenv = getenv("DISKDEFS"); + + if (fp=fopen("diskdefs","r")) + return fp; + if (fp=fopen(DISKDEFS,"r")) + return fp; + if (ddenv) + if (fp=fopen(ddenv,"r")) + return fp; + fprintf(stderr,"%s: Neither diskdefs%s%s%s nor %s could be opened.\n", + cmd, + ddenv ? ", ": "", ddenv ? ddenv : "", ddenv ? "," : "" , DISKDEFS); + exit(1); +} + /* superblock management */ /* diskdefReadSuper -- read super block from diskdefs file */ /*{{{*/ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) @@ -675,18 +693,11 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) char line[256]; FILE *fp; int insideDef=0,found=0; - char *ddenv = getenv("DISKDEFS"); d->libdskGeometry[0] = '\0'; d->type=0; - if ( - (fp=fopen("diskdefs","r"))==(FILE*)0 && - (ddenv && ((fp=fopen(ddenv,"r"))==(FILE*)0)) && - (fp=fopen(DISKDEFS,"r"))==(FILE*)0) - { - fprintf(stderr,"%s: Neither `diskdefs' nor `" DISKDEFS "' could be opened.\n",cmd); - exit(1); - } + fp = open_diskdefs(); + while (fgets(line,sizeof(line),fp)!=(char*)0) { int argc; From 3d916a90d4a994fa315f1879bd2c0542eeeb759c Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 15:39:55 -0800 Subject: [PATCH 11/23] avoid having any non-tunes in Tunes directory --- Source/Apps/Tune/Makefile | 4 +++- Source/Apps/Tune/Tunes/Makefile | 9 --------- 2 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 Source/Apps/Tune/Tunes/Makefile diff --git a/Source/Apps/Tune/Makefile b/Source/Apps/Tune/Makefile index ff962a15..3c4d8dcd 100644 --- a/Source/Apps/Tune/Makefile +++ b/Source/Apps/Tune/Makefile @@ -1,4 +1,3 @@ -SUBDIRS = Tunes OBJECTS = Tune.com DEST = ../../../Binary/Apps TOOLS = ../../../Tools @@ -7,3 +6,6 @@ include $(TOOLS)/Makefile.inc Tune.com: Tune.asm $(TASM) Tune.asm Tune.com + +all:: + cp Tunes/* $(DEST)/Tunes diff --git a/Source/Apps/Tune/Tunes/Makefile b/Source/Apps/Tune/Tunes/Makefile deleted file mode 100644 index 8c5f4697..00000000 --- a/Source/Apps/Tune/Tunes/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -OBJECTS = *.pt3 *.mym -NODELETE = $(OBJECTS) -DEST = ../../../../Binary/Apps/Tunes -TOOLS = ../../../../Tools - -include $(TOOLS)/Makefile.inc - -clobber:: - -rm -f $(DEST)/*.pt3 $(DEST)/*.mym From 174722f38779b20dcf99fa2fbe4a3e26ac833f02 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 15:42:09 -0800 Subject: [PATCH 12/23] added more diff support --- Source/Images/Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 3261e8df..65c60ea5 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -9,7 +9,7 @@ HDIMGS = hd_cpm22.img hd_zsdos.img hd_nzcom.img \ hd_cpm3.img hd_zpm3.img hd_ws4.img hd_bp.img OBJECTS = $(FDIMGS) $(HDIMGS) hd_combo.img -OTHERS = $(SYSTEMS) blank144 blankhd +OTHERS = blank144 blankhd DEST=../../Binary @@ -39,7 +39,7 @@ blankhd: @echo Making Blank Hd of size $(HDSIZE)k @LANG=en_US.US-ASCII tr '\000' '\345' /dev/null -%.img:: $(SYSTEMS) blank144 blankhd Makefile +%.img: $(SYSTEMS) blank144 blankhd Makefile @sys= ; \ case $@ in \ (*cpm22*) sys=../CPM22/cpm_wbw.sys;; \ @@ -62,13 +62,18 @@ blankhd: dir=d_$$d/u$$u ; \ if [ -d $$dir ] ; then \ echo " " copying directory $$dir ; \ - $(CPMCP) -f $$fmt $@ $$($(CASEFN) $$dir/*.*) $$u: ; \ + for i in $$dir/* ; do \ + f=$$($(CASEFN) $$i) ; \ + echo " " $$f ; \ + $(CPMCP) -f $$fmt $@ $$f $$u: ; \ + done ; \ fi ; \ done ; \ if [ -f d_$$d.txt ] ; then \ echo " " copying files from d_$$d.txt ; \ grep -v ^# d_$$d.txt | tr -d '\r' | while read file user ; do \ - rf=$$($(CASEFN) $$file) ; \ + rf=$$($(CASEFN) $$file | sort -V) ; \ + echo " " $$rf ; \ if [ "$$rf" = nofile ] ; then \ echo " " $$file missing ; \ else \ @@ -89,6 +94,6 @@ imgdiff: else \ fmt=wbw_hd0 ; \ fi ; \ - $(BINDIR)/cpmls -f $$fmt $$i > $$i.ls ; \ - $(BINDIR)/cpmls -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \ + $(BINDIR)/cpmls -i -f $$fmt $$i > $$i.ls ; \ + $(BINDIR)/cpmls -i -f $$fmt $(DIFFPATH)/$$i > $$i.diff.ls ; \ done \ From bac0c76a6d8b46e559321715cb2e2f7e40bd283a Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 15:45:09 -0800 Subject: [PATCH 13/23] can't have non-tunes in Tunes --- Binary/Apps/Makefile | 6 ++++-- Binary/Apps/Tunes/Makefile | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 Binary/Apps/Tunes/Makefile diff --git a/Binary/Apps/Makefile b/Binary/Apps/Makefile index a979319b..ca8f776a 100644 --- a/Binary/Apps/Makefile +++ b/Binary/Apps/Makefile @@ -1,7 +1,9 @@ TOOLS = ../../Tools -SUBDIRS = Tunes include $(TOOLS)/Makefile.inc +all:: + mkdir -p Tunes + clean:: - rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.COM *.BIN + rm -f *.bin *.com *.img *.rom *.pdf *.log *.eeprom *.COM *.BIN Tunes/* diff --git a/Binary/Apps/Tunes/Makefile b/Binary/Apps/Tunes/Makefile deleted file mode 100644 index 4b7b57e7..00000000 --- a/Binary/Apps/Tunes/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -TOOLS = ../../../Tools - -include $(TOOLS)/Makefile.inc - -clobber:: - -rm -f *.pt3 *.mym From ab100bf3bc239075283ba884ec55f68b3c741e27 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 16:29:26 -0800 Subject: [PATCH 14/23] silenced clean --- Source/BPBIOS/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/BPBIOS/Makefile b/Source/BPBIOS/Makefile index 64c07d60..8fddd3f5 100644 --- a/Source/BPBIOS/Makefile +++ b/Source/BPBIOS/Makefile @@ -31,7 +31,7 @@ zcpr33n.rel zcpr33t.rel: all:: $(HD0IMG) clobber:: - rm -f $(HD0IMG) + @rm -f $(HD0IMG) %.img: zcpr33n.rel zcpr33t.rel $(eval VER := $(subst .img,,$(subst bp,,$@))) From ec899e6920b9c371e85995f5f1d3ff250733ad62 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 16:55:09 -0800 Subject: [PATCH 15/23] clean diff --- Source/CPM3/Makefile | 4 ++-- Source/HBIOS/Makefile | 1 - Source/Makefile | 5 +++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/CPM3/Makefile b/Source/CPM3/Makefile index 1e1c2e12..3c134d52 100644 --- a/Source/CPM3/Makefile +++ b/Source/CPM3/Makefile @@ -21,10 +21,10 @@ DEFCPM3 = bnk #DEFCPM3 = res clean:: biosclean - rm -f bios3.spr bnkbios3.spr zpmbios3.spr cpmldr.com gencpm.dat options.lib + @rm -f bios3.spr bnkbios3.spr zpmbios3.spr cpmldr.com gencpm.dat options.lib biosclean: - rm -f $(BIOSOBJS) + @rm -f $(BIOSOBJS) cpm3res: make biosclean diff --git a/Source/HBIOS/Makefile b/Source/HBIOS/Makefile index e8be95bc..537767af 100644 --- a/Source/HBIOS/Makefile +++ b/Source/HBIOS/Makefile @@ -1,4 +1,3 @@ -VERBOSEDIFF=2 OBJECTS = ZETA2_std.rom MOREDIFF = camel80.bin game.bin hbios_rom.bin nascom.bin prefix.bin usrrom.bin \ dbgmon.bin hbios_app.bin imgpad0.bin osimg1.bin romldr.bin \ diff --git a/Source/Makefile b/Source/Makefile index 816021f3..a1f417e6 100644 --- a/Source/Makefile +++ b/Source/Makefile @@ -4,8 +4,9 @@ NOTDONE = Doc SUBDIRS = Prop SUBDIRS += Apps -SUBDIRS += CBIOS HBIOS -SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS CPM3 +SUBDIRS += CBIOS +SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS +SUBDIRS += HBIOS CPM3 SUBDIRS += ZPM3 SUBDIRS += Forth NOTDONE += Fonts From 5e1022bb8698ad8e274e6142bc9c6e155bc2d94c Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 16:55:40 -0800 Subject: [PATCH 16/23] added hack to handle tunes --- Source/Images/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 65c60ea5..2de29bc7 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -72,7 +72,9 @@ blankhd: if [ -f d_$$d.txt ] ; then \ echo " " copying files from d_$$d.txt ; \ grep -v ^# d_$$d.txt | tr -d '\r' | while read file user ; do \ - rf=$$($(CASEFN) $$file | sort -V) ; \ + hack= ; \ + if [ "$$file" = "../../Binary/Apps/Tunes/*.*" ] ; then hack=../../Binary/Apps/Tunes/Makefile ; fi ; \ + rf=$$($(CASEFN) $$hack $$file | sort -V) ; \ echo " " $$rf ; \ if [ "$$rf" = nofile ] ; then \ echo " " $$file missing ; \ @@ -84,7 +86,7 @@ blankhd: clean:: - rm -f *.ls + @rm -f *.ls imgdiff: @for i in $(FDIMGS) $(HDIMGS) ; do \ From a7bc7bb16fc16f09dbae2cb3f64b019e842bce8d Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 16:56:23 -0800 Subject: [PATCH 17/23] quiet clean --- Tools/Makefile.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tools/Makefile.inc b/Tools/Makefile.inc index 75f652fb..86dc033e 100644 --- a/Tools/Makefile.inc +++ b/Tools/Makefile.inc @@ -121,13 +121,13 @@ all:: $(OBJECTS) done ; fi clean:: - -rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS))) + @-rm -f $$($(CASEFN) make.out *.sym *.lst *.prn *.diff *.dump $(OTHERS) $(filter-out $(NODELETE),$(OBJECTS))) @for dir in $(SUBDIRS) ; do \ ( echo "cleaning in `pwd`/$$dir" ; cd "$$dir" ; make clean ) ; \ done clobber:: clean - -rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS))) + @-rm -f $$($(CASEFN) $(filter-out $(NODELETE),$(OBJECTS))) @for dir in $(SUBDIRS) ; do \ ( echo "clobbering in `pwd`/$$dir" ; cd "$$dir" ; make clobber ) ; \ done From 1d149c3f756acc7616d0329cc0f5d52a4a27b7ec Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 16:56:58 -0800 Subject: [PATCH 18/23] added chmod for execution --- Tools/unix/bst/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Tools/unix/bst/Makefile b/Tools/unix/bst/Makefile index 6a6978c4..0d269dea 100644 --- a/Tools/unix/bst/Makefile +++ b/Tools/unix/bst/Makefile @@ -13,6 +13,7 @@ DEST = ../../$(UNAME) all: $(DEST) -for i in *.$(SUFFIX) ; do \ + chmod +x $$i ; \ cp $$i $(DEST)/$$(basename $$i .$(SUFFIX)) ; \ done From 25ce6721060f2608944a4280f1d93bab69c12690 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 16:57:40 -0800 Subject: [PATCH 19/23] suppress warnings --- Tools/unix/uz80as/uz80as.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Tools/unix/uz80as/uz80as.c b/Tools/unix/uz80as/uz80as.c index 6f03829b..ca2955b7 100644 --- a/Tools/unix/uz80as/uz80as.c +++ b/Tools/unix/uz80as/uz80as.c @@ -467,6 +467,7 @@ found: static const char * d_null(const char *p) { + p = sync(p); while (*p != '\0' && *p != '\\') { if (!isspace(*p)) { wprint(_("invalid characters after directive\n")); @@ -515,6 +516,7 @@ static const char *d_codes(const char *p) static const char *d_module(const char *p) { + p = sync(p); while (*p != '\0' && *p != '\\') { if (!isspace(*p)) { wprint(_("invalid characters after directive\n")); From bc9d44b4769c53fd4c2affdd8926ebb9168b6d02 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Thu, 20 Feb 2020 17:17:44 -0800 Subject: [PATCH 20/23] Multi-boot fixes --- Doc/ChangeLog.txt | 1 + ReadMe.txt | 2 +- Source/Apps/OSLdr.asm | 15 +++-- Source/CBIOS/cbios.asm | 93 ++++++++++++++++++++++------ Source/CBIOS/ver.inc | 2 +- Source/CPM22/ver.inc | 2 +- Source/CPM3/biosldr.z80 | 25 ++++++-- Source/CPM3/boot.z80 | 131 ++++++++++++++-------------------------- Source/CPM3/diskio.z80 | 30 ++++----- Source/CPM3/ver.inc | 2 +- Source/HBIOS/ver.inc | 2 +- Source/ZSDOS/ver.inc | 2 +- 12 files changed, 169 insertions(+), 138 deletions(-) diff --git a/Doc/ChangeLog.txt b/Doc/ChangeLog.txt index 32bf83b9..c6697e08 100644 --- a/Doc/ChangeLog.txt +++ b/Doc/ChangeLog.txt @@ -49,6 +49,7 @@ Version 2.9.2 - PMS: Added "user" rom module template - PMS: Added CP/M 3 manuals - WBW: Boot from any slice +- C?M: Added Unix build process Version 2.9.1 ------------- diff --git a/ReadMe.txt b/ReadMe.txt index 98e06e8c..4fab1c64 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -7,7 +7,7 @@ *********************************************************************** Wayne Warthen (wwarthen@gmail.com) -Version 2.9.2-pre.31, 2020-02-18 +Version 2.9.2-pre.32, 2020-02-20 https://www.retrobrewcomputers.org/ RomWBW is a ROM-based implementation of CP/M-80 2.2 and Z-System for diff --git a/Source/Apps/OSLdr.asm b/Source/Apps/OSLdr.asm index 4ca2973f..15037790 100644 --- a/Source/Apps/OSLdr.asm +++ b/Source/Apps/OSLdr.asm @@ -58,6 +58,9 @@ ; could occur if the BIOS image does not conform to the ; expected structure (size, meta data location, entry point ; location, etc.) +; 3) Hardware platform has been removed from the bootloader, so the +; platform check has been removed for OS loading. This is fine +; unless you attempt to switch between UNA and RomWBW. ;_______________________________________________________________________________ ; ;=============================================================================== @@ -476,11 +479,11 @@ chkos: ; check for signature ; Already verified in chkhdr - ; compare platform id - ld a,(bioplt) ; get current HBIOS platform ID - ld hl,osplt ; point to OS image platform ID - cp (hl) ; compare - jp nz,errplt ; if not equal platform error + ;; compare platform id + ;ld a,(bioplt) ; get current HBIOS platform ID + ;ld hl,osplt ; point to OS image platform ID + ;cp (hl) ; compare + ;jp nz,errplt ; if not equal platform error ; bypass version check if UNA running ld a,(unamod) ; get UNA mode flag @@ -991,7 +994,7 @@ bufptr .dw 0 ; active pointer into buffer ; ; Messages ; -msgban .db "OSLDR v1.1 for RomWBW, 16-Jan-2018",0 +msgban .db "OSLDR v1.2 for RomWBW, 20-Feb-2020",0 msghb .db " (HBIOS Mode)",0 msgub .db " (UBIOS Mode)",0 msguse .db "Usage: OSLDR [/F] []\r\n" diff --git a/Source/CBIOS/cbios.asm b/Source/CBIOS/cbios.asm index 737280ce..d3e1cf27 100644 --- a/Source/CBIOS/cbios.asm +++ b/Source/CBIOS/cbios.asm @@ -1886,10 +1886,6 @@ INIT: LD A,DEF_IOBYTE ; LOAD DEFAULT IOBYTE LD (IOBYTE),A ; STORE IT - ; INIT DEFAULT DRIVE TO A: FOR NOW - XOR A ; ZERO - LD (DEFDRIVE),A ; STORE IT - ; CBIOS BANNER CALL NEWLINE2 ; FORMATTING LD DE,STR_BANNER ; POINT TO BANNER @@ -1998,23 +1994,49 @@ AUTOSUB: ; ; SETUP AUTO SUBMIT COMMAND (IF REQUIRED FILES EXIST) LD A,(DEFDRIVE) ; GET DEFAULT DRIVE + + ;CALL PRTHEXBYTE + + PUSH AF + INC A ; CONVERT FROM DRIVE NUM TO FCB DRIVE CODE LD (FCB_SUB),A ; SET DRIVE OF SUBMIT.COM FCB LD (FCB_PRO),A ; SET DRIVE OF PROFILE.SUB FCB +; + LD C,13 ; RESET DISK SYSTEM + CALL BDOS + + ;CALL PC_PERIOD + + POP AF +; + ;DEC A ; BACK TO ZERO INDEX + + ;LD E,A ; PUT IN E + ;LD C,14 ; SELECT DISK FUNCTION + ;CALL BDOS ; DO IT + + ;CALL PC_PERIOD ; LD C,17 ; BDOS FUNCTION: FIND FIRST LD DE,FCB_SUB ; CHECK FOR SUBMIT.COM CALL BDOS ; INVOKE BDOS TO LOOK FOR FILE + + ;CALL PRTHEXBYTE + INC A ; CHECK FOR ERR, $FF --> $00 RET Z ; ERR, DO NOT ATTEMPT AUTO SUBMIT ; LD C,17 ; BDOS FUNCTION: FIND FIRST LD DE,FCB_PRO ; CHECK FOR PROFILE.SUB CALL BDOS ; INVOKE BDOS TO LOOK FOR FILE + + ;CALL PRTHEXBYTE + INC A ; CHECK FOR ERR, $FF --> $00 RET Z ; ERR, DO NOT ATTEMPT AUTO SUBMIT ; - LD HL,CMD ; ADDRESS OF STARTUP COMMANDs + LD HL,CMD ; ADDRESS OF STARTUP COMMANDS LD DE,CCP_LOC + 7 ; START OF COMMAND BUFFER IN CCP LD BC,CMDLEN ; LENGTH OF AUTOSTART COMMAND LDIR ; PATCH COMMAND LINE INTO CCP @@ -2273,6 +2295,9 @@ CLRRAM3: #IFDEF PLTUNA ; DRV_INIT: + ; INIT DEFAULT DRIVE TO A: FOR NOW + XOR A ; ZERO + LD (DEFDRIVE),A ; STORE IT ; ; PERFORM UBIOS SPECIFIC INITIALIZATION ; BUILD DRVMAP BASED ON AVAILABLE UBIOS DISK DEVICE LIST @@ -2391,6 +2416,14 @@ DRV_INIT: ; GET BOOT UNIT/SLICE INFO LD DE,(HCB + HCB_BOOTVOL) ; BOOT VOLUME (UNIT, SLICE) LD (BOOTVOL),DE ; D -> UNIT, E -> SLICE +; + ; INIT DEFAULT + LD A,D ; BOOT UNIT? + CP 1 ; IF ROM BOOT, DEF DRIVE SHOULD BE B: + JR Z,DRV_INIT1 ; ... SO LEAVE AS IS AND SKIP AHEAD + XOR A ; ELSE FORCE TO DRIVE A: +DRV_INIT1: + LD (DEFDRIVE),A ; STORE IT ; ; SETUP THE DRVMAP STRUCTURE LD HL,(HEAPTOP) ; GET CURRENT HEAP TOP @@ -2502,6 +2535,14 @@ DRV_INIT5: ; LD B,E ; COUNT TO B ; LD C,0 ; USE C AS DEVICE LIST INDEX ; + LD DE,(HCB + HCB_BOOTVOL) ; BOOT VOLUME (UNIT, SLICE) + LD A,1 ; ROM DISK UNIT? + CP D ; CHECK IT + JR Z,DRV_INIT5A ; IF SO, SKIP BOOT DRIVE + LD B,1 ; JUST ONE SLICE PLEASE + CALL DRV_INIT8A ; DO THE BOOT DEVICE +; +DRV_INIT5A: LD A,(DRVLSTC) ; ACTIVE DRIVE LIST COUNT TO ACCUM LD B,A ; ... AND MOVE TO B FOR LOOP COUNTER LD HL,DRVLST ; HL IS PTR TO ACTIVE DRIVE LIST @@ -2532,7 +2573,21 @@ DRV_INIT7: ; PROCESS UNIT LD A,(HDSPV) ; GET SLICES PER VOLUME TO ACCUM LD B,A ; MOVE TO B FOR LOOP COUNTER ; -DRV_INIT8: ; SLICE CREATION LOOP +DRV_INIT8: + ; SLICE CREATION LOOP + ; DE=UNIT/SLICE, B=SLICE CNT + LD A,(BOOTVOL + 1) ; GET BOOT UNIT + CP 1 ; ROM BOOT? + JR Z,DRV_INIT8A ; IF SO, OK TO CONTINUE + CP D ; COMPARE TO CUR UNIT + JR NZ,DRV_INIT8A ; IF NE, OK TO CONTINUE + LD A,(BOOTVOL) ; GET BOOT SLICE + CP E ; COMPARE TO CUR SLICE + JR NZ,DRV_INIT8A ; IF NE, OK TO CONTINUE + INC E ; IS BOOT DU/SLICE, SKIP IT + JR DRV_INIT8 ; AND RESTART LOOP +; +DRV_INIT8A: ; ENTRY POINT TO SKIP BOOT DISK/LU CHECK ; ; INC DRVMAP ENTRY COUNT AND ENFORCE FOR 16 ENTRY MAXIMUM LD HL,(DRVMAPADR) ; POINT TO DRIVE MAP @@ -2615,20 +2670,20 @@ DPH_INIT1: CALL PRTDRV ; PRINT DRIVE INFO LD A,D ; A := UNIT PUSH HL ; SAVE DRIVE MAP POINTER - PUSH AF ; SAVE UNIT - ; MATCH AND SAVE DEFAULT DRIVE BASED ON BOOT UNIT/SLICE - LD HL,BOOTVOL + 1 ; POINT TO BOOT UNIT - LD A,D ; LOAD CURRENT UNIT - CP (HL) ; MATCH? - JR NZ,DPH_INIT1A ; BYPASS IF NOT BOOT UNIT - DEC HL ; POINT TO BOOT SLICE - LD A,E ; LOAD CURRENT SLICE - CP (HL) ; MATCH? - JR NZ,DPH_INIT1A ; BYPASS IF NOT BOOT SLICE - LD A,C ; LOAD THE CURRENT DRIVE NUM - LD (DEFDRIVE),A ; SAVE AS DEFAULT + ;PUSH AF ; SAVE UNIT + ;; MATCH AND SAVE DEFAULT DRIVE BASED ON BOOT UNIT/SLICE + ;LD HL,BOOTVOL + 1 ; POINT TO BOOT UNIT + ;LD A,D ; LOAD CURRENT UNIT + ;CP (HL) ; MATCH? + ;JR NZ,DPH_INIT1A ; BYPASS IF NOT BOOT UNIT + ;DEC HL ; POINT TO BOOT SLICE + ;LD A,E ; LOAD CURRENT SLICE + ;CP (HL) ; MATCH? + ;JR NZ,DPH_INIT1A ; BYPASS IF NOT BOOT SLICE + ;LD A,C ; LOAD THE CURRENT DRIVE NUM + ;LD (DEFDRIVE),A ; SAVE AS DEFAULT DPH_INIT1A: - POP AF ; RESTORE UNIT + ;POP AF ; RESTORE UNIT LD DE,(DPHTOP) ; GET ADDRESS OF NEXT DPH PUSH DE ; ... AND SAVE IT ; INVOKE THE DPH BUILD ROUTINE diff --git a/Source/CBIOS/ver.inc b/Source/CBIOS/ver.inc index 1711ccfe..14d90170 100644 --- a/Source/CBIOS/ver.inc +++ b/Source/CBIOS/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.31" +#DEFINE BIOSVER "2.9.2-pre.32" diff --git a/Source/CPM22/ver.inc b/Source/CPM22/ver.inc index 1711ccfe..14d90170 100644 --- a/Source/CPM22/ver.inc +++ b/Source/CPM22/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.31" +#DEFINE BIOSVER "2.9.2-pre.32" diff --git a/Source/CPM3/biosldr.z80 b/Source/CPM3/biosldr.z80 index 2068d5f7..de97bb36 100644 --- a/Source/CPM3/biosldr.z80 +++ b/Source/CPM3/biosldr.z80 @@ -67,10 +67,14 @@ boot1: pop af sub '0' - jr c,boot1 - cp 10 ; !!! Need to test against max disk unit num !!! - jr nc,boot1 ld (unit),a + jr c,selerr + + ld bc,0F810h ; HBIOS, get disk unit count + call 0FFF0h ; do it, E := disk unit count + ld a,(unit) ; get unit num back + cp e ; compare to entry + jr nc,selerr ; loop if too high ld de,msgslc call writestr @@ -80,11 +84,19 @@ boot1: pop af sub '0' - jr c,boot1 - cp 10 - jr nc,boot1 ld (slice),a + jr c,selerr + cp 10 + jr nc,selerr + + jr boot2 + +selerr: + ld de,msginv + call writestr + jr boot1 +boot2: ld de,crlf call writestr @@ -346,6 +358,7 @@ mult8_noadd: msgunit db 13,10,13,10,'Boot CP/M 3 from Disk Unit: $' msgslc db ' Slice: $' +msginv db 13,10,13,10,'*** Invalid Selection ***$' crlf db 13,10,'$' dpb$start: diff --git a/Source/CPM3/boot.z80 b/Source/CPM3/boot.z80 index ca0a0041..99c7bbda 100644 --- a/Source/CPM3/boot.z80 +++ b/Source/CPM3/boot.z80 @@ -124,20 +124,6 @@ dinit: or a ; set flags ret z ; !!! handle zero devices (albeit poorly) !!! -; ; loop thru devices to count total hard disk volumes -; push bc ; save the device count -; ld c,0 ; use c as device list index -; ld e,0 ; init e for hard disk volume count -; -;dinit2: -; push bc ; save loop control -; call dinit3 ; check drive -; pop bc ; restore loop control -; inc c ; next unit -; djnz dinit2 ; loop -; pop bc ; restore unit count in b -; jr dinit4 ; continue - ; loop thru devices to count total hard disk volumes ld c,0 ; init c as device list index ld d,0 ; init d as total device count @@ -152,17 +138,6 @@ dinit2: ld (drvlstc),a ; save the count jr dinit4 ; continue -;dinit3: -; push de ; save de (hard disk volume counter) -; ld b,017h ; hbios func: report device info -; rst 08 ; call hbios, unit to c -; ld a,d ; device type to a -; pop de ; restore de -; cp 050h ; hard disk device? -; ret c ; nope, return -; inc e ; increment hard disk count -; ret ; and return - dinit3: push de ; save de (hard disk volume counter) push hl ; save drive list ptr @@ -204,16 +179,6 @@ dinit3a: ret ; and return -;dinit4: ; set slices per volume (hdspv) based on hard disk volume count -; ld a,e ; hard disk volume count to a -; ld e,8 ; assume 8 slices per volume -; dec a ; dec accum to check for count = 1 -; jr z,dinit5 ; yes, skip ahead to implement 8 hdspv -; ld e,4 ; now assume 4 slices per volume -; dec a ; dec accum to check for count = 2 -; jr z,dinit5 ; yes, skip ahead to implement 4 hdspv -; ld e,2 ; in all other cases, we use 2 hdspv - dinit4: ; set slices per volume (hdspv) based on hard disk volume count ; ; *** debug *** @@ -240,40 +205,24 @@ dinit4: ; set slices per volume (hdspv) based on hard disk volume count jr z,dinit5 ; yes, skip ahead to implement 4 hdspv ld e,2 ; in all other cases, we use 2 hdspv -;dinit5: -; ld a,e ; slices per volume value to accum -; ld (hdspv),a ; save it -; -; ; setup to enumerate devices to build drvmap -; ld b,0F8h ; SYS GET -; ld c,010h ; Disk Drive Unit Count -; rst 08 ; e := disk unit count -; ld b,e ; count to b -; ld c,0 ; use c as device list index -; ld hl,0 ; dph index - dinit5: ld a,e ; slices per volume value to accum ld (hdspv),a ; save it + ld hl,0 ; dph index + + ld a,(@bootdu) ; boot disk unit + ld d,a ; ... to d + ld a,(@bootsl) ; boot slice + ld e,a ; ... to e + ld b,1 ; one slice please + call dinit8a ; make DPH for A: + ld a,(drvlstc) ; active drive list count to accum ld b,a ; ... and move to b for loop counter ld de,drvlst ; de is ptr to active drive list - ld hl,0 ; dph index -;dinit6: ; loop thru all units available -; push bc ; preserve loop control -; push hl ; preserve dph pointer -; ld b,017h ; hbios func: report device info -; rst 08 ; call hbios, d := device type -; pop hl ; restore dph pointer -; pop bc ; get unit index back in c -; push bc ; resave loop control -; call dinit7 ; update dph entries -; pop bc ; restore loop control -; inc c ; increment list index -; djnz dinit6 ; loop as needed - -dinit6: ; loop thru all units available +dinit6: + ; loop thru all units available push de ; preserve drive list ptr ex de,hl ; list ptr to hl ld c,(hl) ; get unit num from list @@ -310,18 +259,28 @@ dinit6a: djnz dinit6a ret ; finished -dinit7: ; process unit +dinit7: ; process a unit (all slices) ld e,0 ; initialize slice index ld b,1 ; default loop counter ld a,d ; device type to accum ld d,c ; unit number to d - cp 050h ; hard disk device? + cp 030h ; hard disk device? jr c,dinit8 ; nope, leave loop count at 1 ld a,(hdspv) ; get slices per volume to accum ld b,a ; move to b for loop counter -dinit8: - ; d=unit, e=slice, l=dph# +dinit8: ; test to avoid reallocating boot disk unit/slice + ld a,(@bootdu) ; boot disk unit to accum + cp d ; compare to cur unit + jr nz,dinit8a ; if ne, ok to continue + ld a,(@bootsl) ; boot slice to accum + cp e ; compare to cur slice + jr nz,dinit8a ; if ne, ok to continue + inc e ; is boot du/slice, skip it + jr dinit8 ; and restart loop + +dinit8a: + ; d=unit, e=slice, l=dph#, b=slice cnt ld a,l ; dph # to accum cp 16 ; dph table size ret z ; bail out if overflow @@ -337,9 +296,9 @@ dinit8: ld (hl),e ; update slice number dec hl ; backup to unit number ld (hl),d ; update unit number - inc e ; next slice pop hl ; restore dph # inc hl ; next dph # + inc e ; next slice djnz dinit8 ; loop till done with unit ret @@ -362,25 +321,25 @@ stpsiz equ $ - stpimg ?ldccp: - if zpm - - ; Swap A: and system drive (make A: the system drive) - ld bc,(@dtbl) ; get drive A DPH - ld hl,@dtbl ; point to boot drive DPH - ld a,(@sysdr) - rlca - call addhla - ld e,(hl) ; set boot drive to drive A DPH - ld (hl),c ; ... and save boot drive DPH - inc hl - ld d,(hl) - ld (hl),b - ld (@dtbl),de ; set drive a DPH to boot drive - - xor a ; update @sysdr - ld (@sysdr),a - - endif + ;if zpm + ; + ;; Swap A: and system drive (make A: the system drive) + ;ld bc,(@dtbl) ; get drive A DPH + ;ld hl,@dtbl ; point to boot drive DPH + ;ld a,(@sysdr) + ;rlca + ;call addhla + ;ld e,(hl) ; set boot drive to drive A DPH + ;ld (hl),c ; ... and save boot drive DPH + ;inc hl + ;ld d,(hl) + ;ld (hl),b + ;ld (@dtbl),de ; set drive a DPH to boot drive + ; + ;xor a ; update @sysdr + ;ld (@sysdr),a + ; + ;endif ; Force CCP to use system boot drive as initial default ld a,(@sysdr) ; get system boot drive diff --git a/Source/CPM3/diskio.z80 b/Source/CPM3/diskio.z80 index d5d27c57..154d601d 100644 --- a/Source/CPM3/diskio.z80 +++ b/Source/CPM3/diskio.z80 @@ -323,21 +323,21 @@ dpb_fd111: ; 8" DS/DD Floppy Drive (1.11M) ; called for first time initialization. dsk$init: - ld a,(@rdrv) ; unit being initialized - ld hl,@bootdu - cp (hl) ; compare to boot unit - ret nz ; done if no match - - inc de ; point to slice in XDPH - inc de - inc de - ld a,(de) ; get slice - ld hl,@bootsl - cp (hl) ; compare to boot slice - ret nz ; done if not zero - - ld a,(@adrv) ; get cp/m drive - ld (@sysdr),a ; and save it + ;ld a,(@rdrv) ; unit being initialized + ;ld hl,@bootdu + ;cp (hl) ; compare to boot unit + ;ret nz ; done if no match + ; + ;inc de ; point to slice in XDPH + ;inc de + ;inc de + ;ld a,(de) ; get slice + ;ld hl,@bootsl + ;cp (hl) ; compare to boot slice + ;ret nz ; done if not zero + ; + ;ld a,(@adrv) ; get cp/m drive + ;ld (@sysdr),a ; and save it ret ; lxi h,init$table diff --git a/Source/CPM3/ver.inc b/Source/CPM3/ver.inc index edf94f0c..54c9bafd 100644 --- a/Source/CPM3/ver.inc +++ b/Source/CPM3/ver.inc @@ -3,5 +3,5 @@ rmn equ 9 rup equ 2 rtp equ 0 biosver macro - db "2.9.2-pre.31" + db "2.9.2-pre.32" endm diff --git a/Source/HBIOS/ver.inc b/Source/HBIOS/ver.inc index 1711ccfe..14d90170 100644 --- a/Source/HBIOS/ver.inc +++ b/Source/HBIOS/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.31" +#DEFINE BIOSVER "2.9.2-pre.32" diff --git a/Source/ZSDOS/ver.inc b/Source/ZSDOS/ver.inc index 1711ccfe..14d90170 100644 --- a/Source/ZSDOS/ver.inc +++ b/Source/ZSDOS/ver.inc @@ -2,4 +2,4 @@ #DEFINE RMN 9 #DEFINE RUP 2 #DEFINE RTP 0 -#DEFINE BIOSVER "2.9.2-pre.31" +#DEFINE BIOSVER "2.9.2-pre.32" From 8cab37226755cc51aa5df9443ea01cd84a587f49 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 17:29:08 -0800 Subject: [PATCH 21/23] the windows build somehow thinks that these filesystems are cpm3. --- Source/Images/diskdefs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Images/diskdefs b/Source/Images/diskdefs index 937bfcf2..5ba6b05b 100644 --- a/Source/Images/diskdefs +++ b/Source/Images/diskdefs @@ -332,7 +332,8 @@ diskdef wbw_hd0 maxdir 512 skew 0 boottrk 1 - os 2.2 + # os 2.2 + os 3 end diskdef wbw_hd1 @@ -389,7 +390,8 @@ diskdef wbw_fd144 maxdir 256 skew 0 boottrk 2 - os 2.2 + # os 2.2 + os 3 end # RomWBW 360K floppy media From c41d73b8503976747d40c9d37f44eba554ed8952 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Thu, 20 Feb 2020 17:29:56 -0800 Subject: [PATCH 22/23] credit and primitive instructions --- Readme.unix | 52 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/Readme.unix b/Readme.unix index fcc12ca3..710487c6 100644 --- a/Readme.unix +++ b/Readme.unix @@ -1,7 +1,49 @@ -prerequisites: +this tree now contains makefiles and tools to build on Linux and MacosX +Linux is rather more thoroughly tested compared to os-x. -gcc -yacc -make -g++ +to get here, TASM and the propeller generation tools needed to be replaced, +and since the unix filesystem is usually case-sensitive, and CP/M and windows +are not, the cpm tools were made case-insensitive. +TASM was replaced with uz80as, which implements a subset of TASM and fixes some +bugs. however, I needed to add some functionality to make it build the sources +as they exist in this tree. in particular, one thing to be very careful of is +that TASM is not entirely consistent with respect to the .DS directive. +it's usually a bad idea to mix .DS, .FILL, .DB with .ORG. + .DS n is best thought of as .ORG $ + n + .ORG changes the memory pointer, but does not change the file output point. + it works a lot more like M80, SLR* .phase + +it assumes that you have some standard system tools and libraries installed +specifically: gcc, gnu make, libncurses + +to build: + cd to the top directory and type make. + +heavy use is made of make's include facility and pattern rules. +the master rule set is in Tools/Makefile.inc. changes here will affect +almost every Makefile, and where exceptions are needed, the overrides are +applied in the lower Makefiles. + +these tools can run a windows-linux regression test, where all the binaries are +compared to a baseline windows build. + +Credit: + + uz80as was written by Jorge Giner Cordero, jorge.giner@hotmail.com, + and the original source can be found at https://github.com/jorgicor/uz80as + + the propeller tools use bstc and openspin, parallax tools from + http://www.fnarfbargle.com/bst.html https://github.com/parallaxinc/OpenSpin + note that bst is not open source or even currently maintained, so I could + not generate a version for 64 bit osx. + + cpmtools were the most current I could find, and it has been hacked to do + case-insensitivity. these are not marked, and are not extensive. + + zx is from distributed version, and also has local hacks for case insensitivity. + both zx and cpmtools ship with an overly complicated makefile generation system + and this is ignored. + + this whole linux build framework is the work of Curt Mayer, curt@zen-room.org. + use it for whatever you like; this is not my day job. From d139b592ed23fcb85e72182b2fc757992bc69764 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Thu, 20 Feb 2020 18:36:28 -0800 Subject: [PATCH 23/23] Update sd.asm Cosmetic fix. --- Source/HBIOS/sd.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/HBIOS/sd.asm b/Source/HBIOS/sd.asm index 22e23c31..2930fa72 100644 --- a/Source/HBIOS/sd.asm +++ b/Source/HBIOS/sd.asm @@ -735,7 +735,7 @@ SD_RESET: CALL SD_SELUNIT ; SET CUR UNIT ; RE-INITIALIZE THE SD CARD TO ACCOMMODATE HOT SWAPPING CALL SD_INITCARD ; RE-INIT SELECTED UNIT -#IF (SDTRACE == 1) +#IF (SDTRACE >= 3) CALL SD_PRTERR ; PRINT ANY ERRORS #ENDIF OR A ; SET RESULT FLAGS