From d7232abb60f00d467ba8c1db1e5499dc4a55bce3 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Tue, 18 Feb 2020 22:03:23 -0800 Subject: [PATCH 1/6] clean build --- Tools/unix/zx/config.h.darwin | 3 ++- Tools/unix/zx/config.h.linux | 1 + Tools/unix/zx/zx.h | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Tools/unix/zx/config.h.darwin b/Tools/unix/zx/config.h.darwin index d3a4bdb0..cc4b425c 100644 --- a/Tools/unix/zx/config.h.darwin +++ b/Tools/unix/zx/config.h.darwin @@ -2,10 +2,11 @@ #define HAVE_DIRENT_H #define HAVE_UTIME_H #define HAVE_FCNTL_H +#define HAVE_UNISTD_H #define BINDIR80 getenv("ZXBINDIR") #define LIBDIR80 getenv("ZXLIBDIR") #define INCDIR80 getenv("ZXINCDIR") -#define LINUX +#define DARWIN #include #include #define _S_IFDIR S_IFDIR diff --git a/Tools/unix/zx/config.h.linux b/Tools/unix/zx/config.h.linux index bca1a709..a015591c 100644 --- a/Tools/unix/zx/config.h.linux +++ b/Tools/unix/zx/config.h.linux @@ -3,6 +3,7 @@ #define HAVE_UTIME_H #define HAVE_FCNTL_H #define HAVE_SYS_VFS_H +#define HAVE_UNISTD_H #define BINDIR80 getenv("ZXBINDIR") #define LIBDIR80 getenv("ZXLIBDIR") #define INCDIR80 getenv("ZXINCDIR") diff --git a/Tools/unix/zx/zx.h b/Tools/unix/zx/zx.h index c2fd0930..dac69ce0 100644 --- a/Tools/unix/zx/zx.h +++ b/Tools/unix/zx/zx.h @@ -31,7 +31,7 @@ #include #include #include -#ifdef LINUX +#if defined(LINUX) || defined(DARWIN) #include #define _isatty(a) isatty(a) #define _fileno(a) fileno(a) @@ -87,7 +87,7 @@ extern char **argv; extern int argc; extern byte RAM[65536]; /* The Z80's address space */ -extern usestdio; +extern int usestdio; /* Z80 CPU emulation */ From ae9ec4c1d8ab07851ee687ac5c3a086ba9f02463 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Tue, 18 Feb 2020 23:05:54 -0800 Subject: [PATCH 2/6] clean build --- Makefile | 1 + Source/BPBIOS/Makefile | 7 ++++++- Source/CPM22/Makefile | 4 ++-- Source/CPM3/Makefile | 28 ++++++++++++++++++++++------ Source/Makefile | 7 ++++++- Source/ZPM3/Makefile | 20 ++++++++++++++------ Source/ZSDOS/Makefile | 13 +++++++++++-- Tools/Makefile.inc | 11 ++++++----- Tools/unix/cpmtools/cpmfs.c | 2 +- 9 files changed, 69 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index f63a0567..44d7847e 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,7 @@ clobber: cd Tools/unix ; make clobber cd Source ; make clobber cd Binary ; make clobber + rm -f typescript diff: cd Source ; make diff diff --git a/Source/BPBIOS/Makefile b/Source/BPBIOS/Makefile index 3eda8896..64c07d60 100644 --- a/Source/BPBIOS/Makefile +++ b/Source/BPBIOS/Makefile @@ -18,7 +18,12 @@ SUBDIRS = ZCPR33 NZFCP13 Z34RCP11 include $(TOOLS)/Makefile.inc $(HD0IMG): $(IMGFILES) - $(CPMCP) -f wbw_hd0 $(HD0IMG) $(IMGFILES) $(DISTFILES) 0: + if [ -f $(HD0IMG) ] ; then \ + for f in $(IMGFILES) $(DISTFILES) ; do \ + $(BINDIR)/cpmrm -f wbw_hd0 $(HD0IMG) 0:$$f ; \ + done ; \ + $(CPMCP) -f wbw_hd0 $(HD0IMG) $(IMGFILES) $(DISTFILES) 0: ; \ + fi zcpr33n.rel zcpr33t.rel: (cd ZCPR33 ; make) diff --git a/Source/CPM22/Makefile b/Source/CPM22/Makefile index d13a30cc..2b1da28c 100644 --- a/Source/CPM22/Makefile +++ b/Source/CPM22/Makefile @@ -6,7 +6,7 @@ TOOLS = ../../Tools include $(TOOLS)/Makefile.inc cpm_wbw.sys: loader.bin OS2CCP.bin OS3BDOS.bin ../CBIOS/cbios_wbw.bin - cat loader.bin OS2CCP.bin OS3BDOS.bin ../CBIOS/cbios_wbw.bin > cpm_wbw.sys + cat loader.bin OS2CCP.bin OS3BDOS.bin ../CBIOS/cbios_wbw.bin > $@ cpm_una.sys: loader.bin OS2CCP.bin OS3BDOS.bin ../CBIOS/cbios_una.bin - cat loader.bin OS2CCP.bin OS3BDOS.bin ../CBIOS/cbios_una.bin > cpm_una.sys + cat loader.bin OS2CCP.bin OS3BDOS.bin ../CBIOS/cbios_una.bin > $@ diff --git a/Source/CPM3/Makefile b/Source/CPM3/Makefile index 3f86379a..f3ad7abc 100644 --- a/Source/CPM3/Makefile +++ b/Source/CPM3/Makefile @@ -4,8 +4,8 @@ # # it does this by overriding OBJECTS in an invoked sub-make # -OBJECTS = cpmldr.com cpm3res cpm3bnk zpmbios3 cpm3.sys gencpm.dat -OTHERS = cpmldr.rel biosldr.rel cpm3res.sys cpm3bnk.sys zpmbios3.spr +OBJECTS = cpmldr.com cpmldr.sys cpm3res cpm3bnk zpmbios3 cpm3.sys gencpm.dat +OTHERS = cpmldr.rel biosldr.rel cpm3res.sys cpm3bnk.sys zpmbios3.spr loader.bin cpmldr.bin TOOLS = ../../Tools include $(TOOLS)/Makefile.inc @@ -51,6 +51,24 @@ zpmbios3: make OBJECTS=zpmbios3.spr rm gencpm.dat +cpmldr.bin: biosldrd.rel cpmldr.rel + $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD + mv cpmldrd.com cpmldr.bin + +cpmldr.com: biosldrc.rel cpmldr.rel + $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC + mv cpmldrc.com cpmldr.com + +biosldrc.rel: biosldr.z80 optcmd.lib + cp optcmd.lib ldropts.lib + $(ZXCC) $(TOOLS)/cpm/bin/Z80ASM -BIOSLDR/MF + mv biosldr.rel biosldrc.rel + +biosldrd.rel: biosldr.z80 optdsk.lib + cp optdsk.lib ldropts.lib + $(ZXCC) $(TOOLS)/cpm/bin/Z80ASM -BIOSLDR/MF + mv biosldr.rel biosldrd.rel + bios3.spr: $(BIOSOBJS) $(ZXCC) $(CPM)/LINK -bios3[OS]=$(BIOSNAMES) @@ -60,13 +78,11 @@ bnkbios3.spr: $(BIOSOBJS) zpmbios3.spr: $(BIOSOBJS) $(ZXCC) $(TOOLS)/cpm/bin/LINK -zpmbios3[B]=$(BIOSNAMES) -cpmldr.com: cpmldr.rel biosldr.rel - $(ZXCC) $(TOOLS)/cpm/bin/LINK -cpmldr[L100]=cpmldr,biosldr - rm -f cpmldr.sym - cpm3.sys: cpm3$(DEFCPM3).sys cp cpm3$(DEFCPM3).sys cpm3.sys gencpm.dat: gen$(DEFCPM3).dat cp gen$(DEFCPM3).dat gencpm.dat +cpmldr.sys: loader.bin cpmldr.bin + cat loader.bin cpmldr.bin > $@ diff --git a/Source/Makefile b/Source/Makefile index 06d19b78..7c69b6f0 100644 --- a/Source/Makefile +++ b/Source/Makefile @@ -1,6 +1,11 @@ +# +# order is actually important, because of build dependencies +# NOTDONE = Doc SUBDIRS = Prop -SUBDIRS += Apps CPM22 ZCPR ZCPR-DJ ZSDOS CBIOS CPM3 +SUBDIRS += Apps +SUBDIRS += CBIOS HBIOS +SUBDIRS += CPM22 ZCPR ZCPR-DJ ZSDOS CPM3 SUBDIRS += ZPM3 SUBDIRS += Forth NOTDONE += Fonts diff --git a/Source/ZPM3/Makefile b/Source/ZPM3/Makefile index 344c6543..9eebbc35 100644 --- a/Source/ZPM3/Makefile +++ b/Source/ZPM3/Makefile @@ -1,12 +1,20 @@ -OBJECTS = zpmldr.com cpm3.sys zinstal.zpm startzpm.com zccp.com \ - setz3.com clrhist.com autotog.com cpmldr.com +OBJECTS = zpmldr.com zpmldr.sys cpm3.sys zinstal.zpm startzpm.com zccp.com \ + setz3.com clrhist.com autotog.com OTHERS = biosldr.rel gencpm.com gencpm.dat bnkbios3.spr TOOLS =../../Tools include $(TOOLS)/Makefile.inc -zpmldr.com: zpm3ldr.rel biosldr.rel - $(ZXCC) $(CPM)/LINK -ZPMLDR[L100]=ZPM3LDR,BIOSLDR +zpmldr.bin: zpm3ldr.rel biosldrd.rel + $(ZXCC) $(CPM)/LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD + mv zpmldrd.com zpmldr.bin + +zpmldr.com: zpm3ldr.rel biosldrc.rel + $(ZXCC) $(CPM)/LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC + mv zpmldrc.com zpmldr.com + +zpmldr.sys: zpmldr.bin loader.bin + cat loader.bin zpmldr.bin > $@ cpm3.sys: gencpm.com gencpm.dat bnkbios3.spr $(ZXCC) gencpm -auto -display @@ -20,10 +28,10 @@ gencpm.dat: ../CPM3/genbnk.dat gencpm.com: ../CPM3/gencpm.com cp $< $@ -biosldr.rel: ../CPM3/biosldr.rel +biosldrc.rel: ../CPM3/biosldrc.rel cp $< $@ -cpmldr.com: ../CPM3/cpmldr.com +biosldrd.rel: ../CPM3/biosldrd.rel cp $< $@ zccp.com: ../ZCCP/ccp.com diff --git a/Source/ZSDOS/Makefile b/Source/ZSDOS/Makefile index 483a2915..72cff2b3 100644 --- a/Source/ZSDOS/Makefile +++ b/Source/ZSDOS/Makefile @@ -1,6 +1,9 @@ -OBJECTS = zsdos.bin -OTHERS = zsdos.rel zsdos.err +SYSFILES = zsys_wbw.sys zsys_una.sys +OBJECTS = $(SYSFILES) +OTHERS = zsdos.rel zsdos.err loader.bin TOOLS = ../../Tools +CCP = ../ZCPR-DJ/zcpr.bin + include $(TOOLS)/Makefile.inc zsdos.rel: zsdos.z80 @@ -9,3 +12,9 @@ zsdos.rel: zsdos.z80 zsdos.bin: zsdos.rel $(ZXCC) $(CPM)/LINK -$@=$<[LD800] +zsys_wbw.sys: loader.bin $(CCP) zsdos.bin ../CBIOS/cbios_wbw.bin + cat loader.bin $(CCP) zsdos.bin ../CBIOS/cbios_wbw.bin > $@ + +zsys_una.sys: loader.bin $(CCP) zsdos.bin ../CBIOS/cbios_una.bin + cat loader.bin $(CCP) zsdos.bin ../CBIOS/cbios_una.bin > $@ + diff --git a/Tools/Makefile.inc b/Tools/Makefile.inc index 9614238a..beb67b1c 100644 --- a/Tools/Makefile.inc +++ b/Tools/Makefile.inc @@ -11,6 +11,7 @@ # .azm: zsm sources # UNAME := $(shell uname) +BINDIR = $(TOOLS)/$(UNAME) # # since this file is included from below, it's handy to have an idea @@ -32,11 +33,11 @@ DIFFPATH := $(DIFFTO)/$(RELPATH) # CASEFN = $(TOOLS)/unix/casefn.sh -ZXCC=$(TOOLS)/$(UNAME)/zx -TASM=$(TOOLS)/$(UNAME)/uz80as -OPENSPIN=$(TOOLS)/$(UNAME)/openspin -BSTC=$(TOOLS)/$(UNAME)/bstc -CPMCP=$(TOOLS)/$(UNAME)/cpmcp +ZXCC=$(BINDIR)/zx +TASM=$(BINDIR)/uz80as +OPENSPIN=$(BINDIR)/openspin +BSTC=$(BINDIR)//bstc +CPMCP=$(BINDIR)/cpmcp # # directory containing cpm binaries diff --git a/Tools/unix/cpmtools/cpmfs.c b/Tools/unix/cpmtools/cpmfs.c index eaba3ad4..750b3ce6 100644 --- a/Tools/unix/cpmtools/cpmfs.c +++ b/Tools/unix/cpmtools/cpmfs.c @@ -681,7 +681,7 @@ static int diskdefReadSuper(struct cpmSuperBlock *d, const char *format) d->type=0; if ( (fp=fopen("diskdefs","r"))==(FILE*)0 && - (ddenv && ((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); From 155959b4302b441fcb065a6c74133f2840d7f61d Mon Sep 17 00:00:00 2001 From: curt mayer Date: Tue, 18 Feb 2020 23:06:53 -0800 Subject: [PATCH 3/6] clean merge --- Source/BPBIOS/util.z80 | 2 ++ Source/CPM3/.gitignore | 1 + Source/ZPM3/.gitignore | 4 ++++ Source/ZSDOS/.gitignore | 2 ++ 4 files changed, 9 insertions(+) diff --git a/Source/BPBIOS/util.z80 b/Source/BPBIOS/util.z80 index cf71b8ee..4602fcfa 100644 --- a/Source/BPBIOS/util.z80 +++ b/Source/BPBIOS/util.z80 @@ -90,6 +90,8 @@ PC_PRTCHR: POP AF RET +NEWLINE2: + CALL NEWLINE NEWLINE: CALL PC_CR CALL PC_LF diff --git a/Source/CPM3/.gitignore b/Source/CPM3/.gitignore index c493d7f9..cea6e4e1 100644 --- a/Source/CPM3/.gitignore +++ b/Source/CPM3/.gitignore @@ -2,6 +2,7 @@ *.lst *.sys *.rel +*.bin cpmldr.com gencpm.dat bios3.spr diff --git a/Source/ZPM3/.gitignore b/Source/ZPM3/.gitignore index 72fd99a9..bd363121 100644 --- a/Source/ZPM3/.gitignore +++ b/Source/ZPM3/.gitignore @@ -13,3 +13,7 @@ setz3.com clrhist.com autotog.com cpmldr.com +biosldrc.rel +biosldrd.rel +loader.bin +zpmldr.bin diff --git a/Source/ZSDOS/.gitignore b/Source/ZSDOS/.gitignore index 9823a537..dad55a3c 100644 --- a/Source/ZSDOS/.gitignore +++ b/Source/ZSDOS/.gitignore @@ -2,3 +2,5 @@ *.rel *.prn *.sym +*.sys +*.lst From c4146642009d8a08cce204bf0f0e4c14b8ddaeb9 Mon Sep 17 00:00:00 2001 From: curt mayer Date: Wed, 19 Feb 2020 00:17:58 -0800 Subject: [PATCH 4/6] build fix for images --- Source/Images/Makefile | 46 ++++++++++++++---------------------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/Source/Images/Makefile b/Source/Images/Makefile index 5b9e0a6a..1bffcee4 100644 --- a/Source/Images/Makefile +++ b/Source/Images/Makefile @@ -1,10 +1,14 @@ # # this makefile subsumes all the work done in Build.cmd, Build{Hd,Fd}.* # -SYSTEMS = cpm_wbw.sys cpm_una.sys zsys_wbw.sys zsys_una.sys -FDIMGS = fd_cpm22.img fd_zsdos.img fd_nzcom.img fd_cpm3.img fd_zpm3.img fd_ws4.img -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) +SYSTEMS = ../CPM22/cpm_wbw.sys ../ZSDOS/zsys_wbw.sys ../CPM3/cpmldr.sys + +FDIMGS = fd_cpm22.img fd_zsdos.img fd_nzcom.img \ + fd_cpm3.img fd_zpm3.img fd_ws4.img +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 DEST=../../Binary @@ -12,32 +16,8 @@ DEST=../../Binary TOOLS = ../../Tools include $(TOOLS)/Makefile.inc -# -# create the os's, which are the bootloader, ccp, bdos and bios -# -cpm_wbw.sys: - cat $$($(CASEFN) \ - ../BL/bl.bin \ - ../CPM22/os2ccp.bin ../CPM22/OS3BDOS.BIN \ - ../CBIOS/cbios_wbw.bin) > cpm_wbw.sys - -cpm_una.sys: - cat $$($(CASEFN) \ - ../BL/bl.bin \ - ../CPM22/os2ccp.bin ../CPM22/OS3BDOS.BIN \ - ../CBIOS/cbios_una.bin) > cpm_una.sys - -zsys_wbw.sys: - cat $$($(CASEFN) \ - ../BL/bl.bin \ - ../ZCPR-DJ/zcpr.bin ../ZSDOS/ZSDOS.BIN \ - ../CBIOS/cbios_wbw.bin) > zsys_wbw.sys - -zsys_una.sys: - cat $$($(CASEFN) \ - ../BL/bl.bin \ - ../ZCPR-DJ/zcpr.bin ../ZSDOS/ZSDOS.BIN \ - ../CBIOS/cbios_una.bin) > zsys_una.sys +hd_combo.img: $(HDIMGS) + cat $(HDIMGS) > $@ # # this somewhat impenetrable and fragile code is used to build each of the images @@ -59,7 +39,11 @@ blankhd: %.img:: $(SYSTEMS) blank144 blankhd @sys= ; \ - case $@ in (*cpm22*) sys=cpm_wbw.sys;; (*zsdos* | *nzcom) sys=zsys_wbw.sys;; esac ; \ + case $@ in \ + (*cpm22*) sys=../CPM22/cpm_wbw.sys;; \ + (*zsdos* | *nzcom*) sys=../ZSDOS/zsys_wbw.sys;; \ + (*cpm3* | *zpm3*) sys=../CPM3/cpmldr.sys;; \ + esac ; \ if echo $@ | grep -q ^f ; then \ fmt=wbw_fd144 ; type=fd_ ; proto=blank144 ; \ else \ From 331cbce5c968605a89ee695f79aff7c9c34dd5d7 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Wed, 19 Feb 2020 11:08:39 -0800 Subject: [PATCH 5/6] Update Clean.cmd --- Source/BPBIOS/Clean.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/BPBIOS/Clean.cmd b/Source/BPBIOS/Clean.cmd index 5bcf9d9e..f713819a 100644 --- a/Source/BPBIOS/Clean.cmd +++ b/Source/BPBIOS/Clean.cmd @@ -8,6 +8,7 @@ if exist *.img del *.img if exist bp*.rel del bp*.rel if exist zcpr33*.rel del zcpr33*.rel if exist *.bak del *.bak +if exist def-ww.lib del def-ww.lib setlocal & cd ZCPR33 && call Clean.cmd & endlocal setlocal & cd Z34RCP11 && call Clean.cmd & endlocal From 6ea1a8f840b020d304a9eae1543ff8e0fb1f85d8 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Wed, 19 Feb 2020 13:02:01 -0800 Subject: [PATCH 6/6] Update biosldr.z80 --- Source/CPM3/biosldr.z80 | 42 +++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/Source/CPM3/biosldr.z80 b/Source/CPM3/biosldr.z80 index 87d3ff6a..2068d5f7 100644 --- a/Source/CPM3/biosldr.z80 +++ b/Source/CPM3/biosldr.z80 @@ -55,34 +55,47 @@ boot: if cmdline -boot1: ld (stksav),sp ld sp,stack - ld de,prompt +boot1: + ld de,msgunit call writestr - call cin - push af call cout - ld de,crlf - call writestr pop af - ld sp,(stksav) - sub '0' jr c,boot1 cp 10 ; !!! Need to test against max disk unit num !!! jr nc,boot1 - ld (unit),a + + ld de,msgslc + call writestr + call cin + push af + call cout + pop af + sub '0' + jr c,boot1 + cp 10 + jr nc,boot1 + ld (slice),a + + ld de,crlf + call writestr + + ld sp,(stksav) + ld bc,0F9E0h ; HBIOS func: set boot info - ld d,a ; Unit - ld e,0 ; Slice - ld l,0 ; Bank + ld a,(unit) ; get unit + ld d,a ; put in D + ld a,(slice) ; get slice + ld e,a ; put in E + ld l,0 ; Bank is always zero call 0FFF0h ; do it else @@ -331,7 +344,8 @@ mult8_noadd: djnz mult8_loop ret -prompt db 13,10,'Boot CP/M 3 from Disk Unit: $' +msgunit db 13,10,13,10,'Boot CP/M 3 from Disk Unit: $' +msgslc db ' Slice: $' crlf db 13,10,'$' dpb$start: @@ -506,4 +520,4 @@ dtabuf ds 512 ; sector buffer stack equ $ stksav dw 0 - end \ No newline at end of file + end