diff --git a/Doc/RomWBW Applications.pdf b/Doc/RomWBW Applications.pdf index 275b6797..b57c4e8a 100644 Binary files a/Doc/RomWBW Applications.pdf and b/Doc/RomWBW Applications.pdf differ diff --git a/Doc/RomWBW Architecture.pdf b/Doc/RomWBW Architecture.pdf index 468e8fde..4e93b2ea 100644 Binary files a/Doc/RomWBW Architecture.pdf and b/Doc/RomWBW Architecture.pdf differ diff --git a/Doc/RomWBW Disk Catalog.pdf b/Doc/RomWBW Disk Catalog.pdf index f5f33b31..4d92d17f 100644 Binary files a/Doc/RomWBW Disk Catalog.pdf and b/Doc/RomWBW Disk Catalog.pdf differ diff --git a/Doc/RomWBW Getting Started.pdf b/Doc/RomWBW Getting Started.pdf index 225e2dda..bd96edbd 100644 Binary files a/Doc/RomWBW Getting Started.pdf and b/Doc/RomWBW Getting Started.pdf differ diff --git a/ReadMe.md b/ReadMe.md index a37f7228..7680b0e8 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -3,7 +3,7 @@ ## Z80/Z180 System Software Version 3.1 Pre-release -Saturday 16 May 2020 +Tuesday 19 May 2020 Wayne Warthen @@ -706,6 +706,10 @@ most stable and you are less likely to encounter problems. ### Notes + - You can change media, but it must be done while at the OS command + prompt and you **must** warm start CP/M by pressing ctrl-c. This is + a CP/M 2.2 constraint and is well documented in the DRI manuals. + - The original versions of DDT, DDTZ, and ZSID used the RST 38 vector which conflicts with interrupt mode 1 use of this vector. The DDT, DDTZ, and ZSID applications in RomWBW have been modified to use RTS @@ -735,6 +739,10 @@ Manual.pdf”). of the ZSDOS paths and will fail in some scenarios (use `COPY` instead). + - Although ZSDOS can recognize a media change in some cases, it will + not always work. You should only change media at a command prompt + and be sure to warm start the OS with a ctrl-c. + ## NZCOM Automatic Z-System NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM @@ -775,10 +783,16 @@ tracks. `CPMLDR.SYS` chain loads `CPM3.SYS`. used to read the current date/time for file stamping, etc. You can use the `RTC` app to set the RTC clock. - - The `COPYSYS` command described in the DRI CP/M 3 documentatin is + - The `COPYSYS` command described in the DRI CP/M 3 documentation is not provided with RomWBW. The RomWBW `SYSCOPY` command is used instead. + - Although CP/M 3 is generally able to run CP/M 2.2 programs, this is + not universally true. This is especially true of the utility + programs included with the operating system. For example, the + `SUBMIT` program of CP/M 3 is completely different from the `SUBMIT` + program of CP/M 2.2. + ## Simeon Cran’s ZPM3 ZPM3 is an interesting combination of the features of both CP/M 3 and @@ -792,8 +806,9 @@ tracks of the disk. - `ZPMLDR` is included with ZPM3, but it is not working correctly. - The ZPM operating system is contained in the file called CPM3.SYS - which is confusing, but it is the author’s intended way of using - ZPM3. + which is confusing, but this is as intended by the ZPM3 + distribution. I believe it was done this way to make it easier for + users to transition from CP/M 3 to ZPM3. ## FreeRTOS diff --git a/ReadMe.txt b/ReadMe.txt index 81a3de1e..d7c946d6 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -3,7 +3,7 @@ RomWBW Z80/Z180 System Software Version 3.1 Pre-release -Saturday 16 May 2020 +Tuesday 19 May 2020 Wayne Warthen wwarthen@gmail.com @@ -737,6 +737,10 @@ most stable and you are less likely to encounter problems. Notes +- You can change media, but it must be done while at the OS command + prompt and you must warm start CP/M by pressing ctrl-c. This is a + CP/M 2.2 constraint and is well documented in the DRI manuals. + - The original versions of DDT, DDTZ, and ZSID used the RST 38 vector which conflicts with interrupt mode 1 use of this vector. The DDT, DDTZ, and ZSID applications in RomWBW have been modified to use RTS @@ -764,6 +768,10 @@ Notes of the ZSDOS paths and will fail in some scenarios (use COPY instead). +- Although ZSDOS can recognize a media change in some cases, it will + not always work. You should only change media at a command prompt + and be sure to warm start the OS with a ctrl-c. + NZCOM Automatic Z-System NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM @@ -804,9 +812,15 @@ Notes to read the current date/time for file stamping, etc. You can use the RTC app to set the RTC clock. -- The COPYSYS command described in the DRI CP/M 3 documentatin is not +- The COPYSYS command described in the DRI CP/M 3 documentation is not provided with RomWBW. The RomWBW SYSCOPY command is used instead. +- Although CP/M 3 is generally able to run CP/M 2.2 programs, this is + not universally true. This is especially true of the utility + programs included with the operating system. For example, the SUBMIT + program of CP/M 3 is completely different from the SUBMIT program of + CP/M 2.2. + Simeon Cran’s ZPM3 ZPM3 is an interesting combination of the features of both CP/M 3 and @@ -820,8 +834,9 @@ Notes - ZPMLDR is included with ZPM3, but it is not working correctly. - The ZPM operating system is contained in the file called CPM3.SYS - which is confusing, but it is the author’s intended way of using - ZPM3. + which is confusing, but this is as intended by the ZPM3 + distribution. I believe it was done this way to make it easier for + users to transition from CP/M 3 to ZPM3. FreeRTOS diff --git a/Source/CBIOS/cbios.asm b/Source/CBIOS/cbios.asm index 47018547..6d2c1a9b 100644 --- a/Source/CBIOS/cbios.asm +++ b/Source/CBIOS/cbios.asm @@ -2103,6 +2103,7 @@ INIT: ; SOFT RESET HBIOS LD B,BF_SYSRESET ; HB FUNC: RESET + LD C,BF_SYSRES_INT ; WARM START RST 08 ; DO IT ; CREATE A TEMP COPY OF THE HBIOS CONFIG BLOCK (HCB) diff --git a/Source/CPM3/Build.cmd b/Source/CPM3/Build.cmd index 557b6c53..aa0c59c9 100644 --- a/Source/CPM3/Build.cmd +++ b/Source/CPM3/Build.cmd @@ -17,15 +17,16 @@ echo. echo *** CPM Loader *** echo. zx RMAC -CPMLDR +zx Z80ASM -UTIL/MF copy optdsk.lib ldropts.lib zx Z80ASM -BIOSLDR/MF move /Y biosldr.rel biosldrd.rel -zx LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD +zx LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD,UTIL move /Y cpmldrd.com cpmldr.bin copy optcmd.lib ldropts.lib zx Z80ASM -BIOSLDR/MF move /Y biosldr.rel biosldrc.rel -zx LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC +zx LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC,UTIL move /Y cpmldrc.com cpmldr.com rem pause diff --git a/Source/CPM3/Makefile b/Source/CPM3/Makefile index a75b03b3..d64e7e72 100644 --- a/Source/CPM3/Makefile +++ b/Source/CPM3/Makefile @@ -60,12 +60,12 @@ zpmbios3: cp optzpm.lib options.lib make OBJECTS=zpmbios3.spr DEST= -cpmldr.bin: biosldrd.rel cpmldr.rel - $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD +cpmldr.bin: biosldrd.rel cpmldr.rel util.rel + $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRD[L100]=CPMLDR,BIOSLDRD,UTIL mv cpmldrd.com cpmldr.bin -cpmldr.com: biosldrc.rel cpmldr.rel - $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC +cpmldr.com: biosldrc.rel cpmldr.rel util.rel + $(ZXCC) $(TOOLS)/cpm/bin/LINK -CPMLDRC[L100]=CPMLDR,BIOSLDRC,UTIL mv cpmldrc.com cpmldr.com biosldrc.rel: biosldr.z80 optcmd.lib diff --git a/Source/CPM3/biosldr.z80 b/Source/CPM3/biosldr.z80 index beeeb878..a414cf58 100644 --- a/Source/CPM3/biosldr.z80 +++ b/Source/CPM3/biosldr.z80 @@ -4,6 +4,11 @@ maclib cpm3.lib cseg + + extrn phex16, phex8 + extrn cin, cout + extrn crlf, crlf2 + ; BIOS Jump vector. @@ -59,7 +64,7 @@ boot: ; this routine to avoid issues. ld (stksav),sp ld sp,stack - + ; Do the real work call boot0 @@ -100,7 +105,7 @@ boot1: jr c,selerr ; loop if below 0 entered cp 10 ; check for over 9 jr nc,selerr ; loop if over 9 - ld de,crlf ; linefeed + ld de,msgcrlf ; linefeed call writestr ; ... to console jr boot2 ; boot w/ unit & slice @@ -296,6 +301,12 @@ setsec: ld (sect),bc ret setdma: + ;push hl + ;push bc + ;pop hl + ;call crlf + ;call phex16 + ;pop hl ld (dma),bc ret @@ -318,32 +329,6 @@ read: rl d ; carry bit (head) into d jr read3 ; do the disk i/o -; ; *** Simplify this to get rid of slice!!! *** -; ld b,1 ; assume it is floppy, 1 head bit -; ld c,01h ; 1 bit head mask -; push bc ; save bc -; ld a,(slice) ; get slice -; ld e,a ; slice to E -; ld h,65 ; number of tracks per slice -; call mult8 ; HL now has track offset for slice -; pop bc ; recover bc -; push hl ; save track offset for now -; ld hl,(trk) ; get track value -; ld a,l ; lsb of track to a -; and c ; apply mask -; ld d,a ; save in d -;read1: -; srl h ; shift one bit out -; rr l ; ... of hl -; djnz read1 ; do all bits -; ld a,(sect) ; get sector -; ld e,a ; stuff it in e -; ex de,hl ; DE=track, HL=head/sect -; ex (sp),hl ; save head/sect, HL = offset -; add hl,de ; HL has final track value -; pop de ; recover head/sect to de -; jr read3 - ; LBA I/O read2: ld hl,(trk) ; get track @@ -449,20 +434,20 @@ xmove: ld a,9DH halt -cin: - ; Input character from console via HBIOS - ld c,080H ; console unit to C - ld b,00H ; HBIOS func: input char - call 0FFF0H ; HBIOS reads character - ld a,e ; To A for return - ret ; done - -cout: - ; Output character to console via HBIOS - ld e,a ; output char to E - ld c,080H ; console unit to C - ld b,01H ; HBIOS func: output char - jp 0FFF0H ; output & return +;cin: +; ; Input character from console via HBIOS +; ld c,080H ; console unit to C +; ld b,00H ; HBIOS func: input char +; call 0FFF0H ; HBIOS reads character +; ld a,e ; To A for return +; ret ; done + +;cout: +; ; Output character to console via HBIOS +; ld e,a ; output char to E +; ld c,080H ; console unit to C +; ld b,01H ; HBIOS func: output char +; jp 0FFF0H ; output & return writestr: push af @@ -479,19 +464,6 @@ writestr2: pop af ret -mult8: - ; Multiply: H := H * E - ld d,0 - ld l,d - ld b,8 -mult8_loop: - add hl,hl - jr nc,mult8_noadd - add hl,de -mult8_noadd: - djnz mult8_loop - ret - rl32: ; Left shift DE:HL by B bits (B > 0) or a ; clear carry @@ -535,7 +507,7 @@ str_err_api db "HBIOS API failure","$" 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,'$' +msgcrlf db 13,10,'$' dpb$start: dpb$rom: ; 384K ROM Drive @@ -718,13 +690,28 @@ medid ds 1 ; media id lba ds 4 ; current lba sps ds 2 ; sectors per slice -csvbuf ds 128 ; length (CSV) = ((DRM+1)/4) -alvbuf ds 512 ; length (ALV) = ((DSM+1)/4) -dirbuf ds 512 ; sector buffer -dtabuf ds 512 ; sector buffer - ds 64 stack equ $ stksav ds 2 +csvbufs equ 256 +alvbufs equ 512 +dirbufs equ 512 +dtabufs equ 512 + +;csvbuf ds 256 ; length (CSV) = ((DRM+1)/4) +;alvbuf ds 512 ; length (ALV) = ((DSM+1)/4) +;dirbuf ds 512 ; sector buffer +;dtabuf ds 512 ; sector buffer + +; Trying to save space. The loader must fit underneath +; the start of BNKBDOS3 and we have a big BNKBDOS because +; of all the disk allocations. Putting these buffers +; in upper memory actually helps quite a bit. + +csvbuf equ 8000h +alvbuf equ csvbuf + csvbufs +dirbuf equ alvbuf + alvbufs +dtabuf equ dirbuf + dirbufs + end diff --git a/Source/CPM3/boot.z80 b/Source/CPM3/boot.z80 index 4f55b627..ae0bdd7b 100644 --- a/Source/CPM3/boot.z80 +++ b/Source/CPM3/boot.z80 @@ -14,9 +14,12 @@ extrn @date,@hour,@min,@sec extrn @srch1 extrn @hbbio - extrn addhla, bcd2bin, bin2bcd - extrn cout, phex8, phex16, crlf, crlf2 - + extrn addhla + ;extrn phex16, phex8 + ;extrn cin, cout + ;extrn crlf, crlf2 + extrn bcd2bin, bin2bcd + include c:ver.lib bdos equ 5 @@ -381,18 +384,18 @@ fill: ?ldccp: ; Force CCP to use system boot drive as initial default - ld a,(@sysdr) ; get system boot drive - ld (@ccpdr),a ; set CCP current drive + ;ld a,(@sysdr) ; get system boot drive + ;ld (@ccpdr),a ; set CCP current drive ; First time, load the CCP.COM file into TPA - ld a,(@sysdr) ; get system boot drive - ;ld (4),a ; save in page zero??? - inc a ; drive + 1 for FCB - ld (ccp$fcb),a ; stuff into FCB - add 'A' - 1 ; drive letter - ld (ccp$msg$drv),a ; save for load msg - xor a - ld (ccp$fcb+15),a + ;ld a,(@sysdr) ; get system boot drive + ;;ld (4),a ; save in page zero??? + ;inc a ; drive + 1 for FCB + ;ld (ccp$fcb),a ; stuff into FCB + ;add 'A' - 1 ; drive letter + ;ld (ccp$msg$drv),a ; save for load msg + ;xor a + ;ld (ccp$fcb+15),a ld hl,0 ld (fcb$nr),hl ld de,ccp$fcb @@ -683,11 +686,11 @@ signon$msg db 13,10,'ZPM3' db 13,10,13,10,0 ccp$msg db 13,10,'BIOS Err on ' -ccp$msg$drv db '?' +ccp$msg$drv db 'A' db ': No ZCCP.COM file',0 -ccp$fcb db 0,'ZCCP ','COM',0,0,0,0 +ccp$fcb db 1,'ZCCP ','COM',0,0,0,0 ds 16 fcb$nr db 0,0,0 @@ -702,11 +705,11 @@ signon$msg db 13,10,'CP/M v3.0' db 13,10,13,10,0 ccp$msg db 13,10,'BIOS Err on ' -ccp$msg$drv db '?' +ccp$msg$drv db 'A' db ': No CCP.COM file',0 -ccp$fcb db 0,'CCP ','COM',0,0,0,0 +ccp$fcb db 1,'CCP ','COM',0,0,0,0 ds 16 fcb$nr db 0,0,0 diff --git a/Source/CPM3/loader.asm b/Source/CPM3/loader.asm index 42a8082d..974cd884 100644 --- a/Source/CPM3/loader.asm +++ b/Source/CPM3/loader.asm @@ -28,11 +28,12 @@ #INCLUDE "../ver.inc" ; ; BELOW, SYS_END MUST BE SET TO THE SIZE OF CPMLDR.BIN + SYS_LOC. IF -; THE SIZE OF CPMLDR.BIN CHANGES, SYS_END MUST BE UPDATED!!! +; THE SIZE OF CPMLDR.BIN CHANGES, SYS_SIZ MUST BE UPDATED!!! ; +SYS_SIZ .EQU $0F00 ; SIZE OF CPMLDR.BIN SYS_ENT .EQU $0100 ; SYSTEM (OS) ENTRY POINT ADDRESS SYS_LOC .EQU $0100 ; STARTING ADDRESS TO LOAD SYSTEM IMAGE -SYS_END .EQU $1580 + SYS_LOC ; ENDING ADDRESS OF SYSTEM IMAGE +SYS_END .EQU SYS_SIZ + SYS_LOC ; ENDING ADDRESS OF SYSTEM IMAGE ; SEC_SIZE .EQU 512 ; DISK SECTOR SIZE BLK_SIZE .EQU 128 ; OS BLOCK/RECORD SIZE diff --git a/Source/CPM3/util.z80 b/Source/CPM3/util.z80 index aa916129..7967727d 100644 --- a/Source/CPM3/util.z80 +++ b/Source/CPM3/util.z80 @@ -1,9 +1,10 @@ title 'Utility module for RomWBW' - maclib options.lib - - public addhla, bcd2bin, bin2bcd - public phex16, phex8, cout, crlf, crlf2 + public addhla + public phex16, phex8 + public cin, cout + public crlf, crlf2 + public bcd2bin, bin2bcd cseg @@ -14,45 +15,6 @@ addhla: inc h ret -bcd2bin: - ; convert A from packed bcd to binary - push bc - ld c,a - and 0F0h - srl a - ld b,a - srl a - srl a - add a,b - ld b,a - ld a,c - and 0Fh - add a,b - pop bc - ret - -bin2bcd: - ; convert A from binary to packed bcd - push bc - ld b,10 - ld c,-1 -bin2bcd1: - inc c - sub b - jr nc,bin2bcd1 - add a,b - ld b,a - ld a,c - add a,a - add a,a - add a,a - add a,a - or b - pop bc - ret - - if 1 -; ; Print the hex word value in HL ; phex16: @@ -104,16 +66,29 @@ hexconv: daa ret ; +; input character to A +; +cin: + push bc + push de + push hl + ld bc,0080h + rst 08 + ld a,e + pop hl + pop de + pop bc + ret +; ; output character from A ; cout: - ; save all incoming registers push af push bc push de push hl ld e,a - ld bc,0100h + ld bc,0180h rst 08 pop hl pop de @@ -134,16 +109,44 @@ crlf: call cout pop af ret - - else - -phex16: -phex8: -cout: -crlf2: -crlf: - halt - - endif +; +; Convert A from packed BCD to binary +; +bcd2bin: + push bc + ld c,a + and 0F0h + srl a + ld b,a + srl a + srl a + add a,b + ld b,a + ld a,c + and 0Fh + add a,b + pop bc + ret +; +; Convert A from binary to packed BCD +; +bin2bcd: + push bc + ld b,10 + ld c,-1 +bin2bcd1: + inc c + sub b + jr nc,bin2bcd1 + add a,b + ld b,a + ld a,c + add a,a + add a,a + add a,a + add a,a + or b + pop bc + ret end diff --git a/Source/Doc/Applications.md b/Source/Doc/Applications.md index 236b02e2..463ed760 100644 --- a/Source/Doc/Applications.md +++ b/Source/Doc/Applications.md @@ -360,7 +360,7 @@ message. ## Etymology -The `SYSCOPY` command is an original product and the source code is +The `MODE` command is an original product and the source code is provided in the RomWBW distribution. `\clearpage`{=latex} diff --git a/Source/Doc/Architecture.md b/Source/Doc/Architecture.md index cb6b9807..6260d673 100644 --- a/Source/Doc/Architecture.md +++ b/Source/Doc/Architecture.md @@ -428,7 +428,7 @@ _Code_ | _Meaning_ -7 | media not present -8 | hardware not present -9 | I/O error --10 | write request to read-only media +-10 | write request to read-only media -11 | device timeout -12 | invalid configuration @@ -1565,7 +1565,7 @@ the value of the subfucntion. See subfunctions below. #### SYSRESET Subfunction 0x00 -- Internal HBIOS Reset (RESINT) | _Entry Parameters_ -| BC: 0xF000 +| BC: 0xFD00 | _Returned Values_ | A: Status (0=OK, else error) @@ -1576,7 +1576,7 @@ current OS. Does not reinitialize physical devices. #### SYSRESET Subfunction 0x01 -- Warm Start System (RESWARM) | _Entry Parameters_ -| BC: 0xF001 +| BC: 0xFD01 | _Returned Values_ | @@ -1587,7 +1587,7 @@ reinitialize physical devices. #### SYSRESET Subfunction 0x02 -- Cold Start System (RESCOLD) | _Entry Parameters_ -| BC: 0xF002 +| BC: 0xFD02 | _Returned Values_ | diff --git a/Source/Doc/GettingStarted.md b/Source/Doc/GettingStarted.md index f63ef2e3..2e6820da 100644 --- a/Source/Doc/GettingStarted.md +++ b/Source/Doc/GettingStarted.md @@ -755,6 +755,11 @@ likely to encounter problems. ### Notes +- You can change media, but it must be done while at the OS +command prompt and you **must** warm start CP/M by pressing +ctrl-c. This is a CP/M 2.2 constraint and is well documented +in the DRI manuals. + - The original versions of DDT, DDTZ, and ZSID used the RST 38 vector which conflicts with interrupt mode 1 use of this vector. The DDT, DDTZ, and ZSID applications in RomWBW have been modified @@ -783,6 +788,10 @@ Manual.pdf"). may not work as expected. The best example is PIP which is not aware of the ZSDOS paths and will fail in some scenarios (use `COPY` instead). +- Although ZSDOS can recognize a media change in some cases, it will not +always work. You should only change media at a command prompt and be +sure to warm start the OS with a ctrl-c. + ## NZCOM Automatic Z-System NZCOM is a much further refined version of Z-System (ZCPR 3.4). NZCOM @@ -823,9 +832,14 @@ system tracks. `CPMLDR.SYS` chain loads `CPM3.SYS`. used to read the current date/time for file stamping, etc. You can use the `RTC` app to set the RTC clock. -- The `COPYSYS` command described in the DRI CP/M 3 documentatin is +- The `COPYSYS` command described in the DRI CP/M 3 documentation is not provided with RomWBW. The RomWBW `SYSCOPY` command is used instead. +- Although CP/M 3 is generally able to run CP/M 2.2 programs, this is +not universally true. This is especially true of the utility programs +included with the operating system. For example, the `SUBMIT` program +of CP/M 3 is completely different from the `SUBMIT` program of CP/M 2.2. + ## Simeon Cran's ZPM3 ZPM3 is an interesting combination of the features of both CP/M 3 and @@ -840,7 +854,9 @@ tracks of the disk. - `ZPMLDR` is included with ZPM3, but it is not working correctly. - The ZPM operating system is contained in the file called CPM3.SYS -which is confusing, but it is the author's intended way of using ZPM3. +which is confusing, but this is as intended by the ZPM3 distribution. +I believe it was done this way to make it easier for users to transition +from CP/M 3 to ZPM3. ## FreeRTOS diff --git a/Source/HBIOS/dbgmon.asm b/Source/HBIOS/dbgmon.asm index 24a9f26a..69016865 100644 --- a/Source/HBIOS/dbgmon.asm +++ b/Source/HBIOS/dbgmon.asm @@ -1400,7 +1400,7 @@ DISPLAYBUF: .FILL 8,0 #ELSE ; DSKY_ENTRY: - CALL PANIC ; NO RETURN + JP EXIT ; #ENDIF ; diff --git a/Source/HBIOS/hbios.asm b/Source/HBIOS/hbios.asm index ec3af755..c86c361f 100644 --- a/Source/HBIOS/hbios.asm +++ b/Source/HBIOS/hbios.asm @@ -215,6 +215,8 @@ CB_SERDEV .DB 0 ; PRIMARY SERIAL UNIT IS UNIT #0 BY FIAT CB_CRTDEV .DB $FF ; PRIMARY CRT UNIT, $FF UNTIL AFTER HBIOS INIT CB_CONDEV .DB $FF ; CONSOLE UNIT, $FF UNTIL AFTER HBIOS INIT ; +CB_DIAGLVL .DB DIAGLVL ; ROMWBW HBIOS DIAGNOSTIC LEVEL +; ; MEMORY MANAGEMENT VARIABLES START AT $20 ; .FILL (HCB + $20 - $),0 @@ -2951,13 +2953,13 @@ HB_DISPCALL: ; CHECK INCOMING UNIT INDEX IN C FOR VAILIDITY LD A,C ; A := INCOMING DISK UNIT INDEX CP (IY-1) ; COMPARE TO COUNT - JR NC,HB_FUNCERR ; HANDLE INVALID UNIT INDEX + JR NC,HB_UNITERR ; HANDLE INVALID UNIT INDEX ; CHECK FUNCTION INDEX FOR VALIDITY LD A,B ; A := INCOMING FUNCTION NUMBER AND $0F ; LOW NIBBLE ONLY FOR FUNC INDEX CP (IY-3) ; CHECK FN NUM AGAINST MAX - JR NC,HB_UNITERR ; HANDLE FN NUM OUT OF RANGE ERROR + JR NC,HB_FUNCERR ; HANDLE FN NUM OUT OF RANGE ERROR ; BUMP IY TO ACTUAL XXX_TBL ENTRY FOR INCOMING UNIT INDEX PUSH BC ; SAVE BC @@ -3549,6 +3551,69 @@ HB_RDSEC: ; #ENDIF ; +; SYSTEM CHECK: DUMP MACHINE STATE AND CONTINUE? +; +SYSCHK: + ; CHECK DIAG LEVEL TO SEE IF WE SHOULD DISPLAY + PUSH AF ; PRESERVE INCOMING AF VALUE + LD A,(CB_DIAGLVL) ; GET DIAGNOSTIC LEVEL + CP DL_ERROR ; >= ERROR LEVEL + JR C,SYSCHK1 ; IF NOT, GO HOME + POP AF ; RESTORE INCOMING AF VALUE +; + ; DISPLAY SYSCHK MESSAGE + PUSH DE ; PRESERVE DE VALUE + LD DE,STR_SYSCHK ; POINT TO PREFIX STRING + CALL WRITESTR ; PRINT IT + POP DE ; RESTORE DE VALUE + CALL XREGDMP ; DUMP REGISTERS + JR CONTINUE ; CHECK W/ USER +; +SYSCHK1: + ; RETURN IF MESSAGING BYPASSED BY DIAG LEVEL + POP AF + RET +; +; PANIC: DUMP MACHINE STATE AND HALT +; +PANIC: + PUSH DE + LD DE,STR_PANIC + CALL WRITESTR + POP DE + CALL XREGDMP ; DUMP REGISTERS + JR SYSHALT ; FULL STOP +; +; +; +CONTINUE: + PUSH AF +CONTINUE1: + PUSH DE + LD DE,STR_CONTINUE + CALL WRITESTR + POP DE + CALL CIN + RES 5,A ; FORCE UPPERCASE (IMPERFECTLY) + CALL COUT ; ECHO + CP 'Y' + JR Z,CONTINUE3 + CP 'N' + JR Z,SYSHALT + JR CONTINUE1 +CONTINUE3: + CALL NEWLINE + POP AF + RET +; +; +; +SYSHALT: + LD DE,STR_HALT + CALL WRITESTR + DI + HALT +; ; PRINT VALUE OF HL AS THOUSANDTHS, IE. 0.000 ; PRTD3M: @@ -4354,6 +4419,10 @@ STR_SWITCH .DB "*** Activating CRT Console ***$" STR_BADINT .DB "\r\n*** BAD INT ***\r\n$" STR_LOWBAT .DB "\r\n\r\n+++ LOW BATTERY +++$" ; +STR_PANIC .TEXT "\r\n>>> PANIC: $" +STR_SYSCHK .TEXT "\r\n>>> SYSCHK: $" +STR_CONTINUE .TEXT "\r\nContinue (Y/N)? $" +; #IF (DSKYENABLE) ; 'H','B','I','O',' ',' ',' ',' ' MSG_HBVER .DB $BE,$FF,$8A,$FB,$80,$80,$80,$80 ; "HBIO " #ENDIF diff --git a/Source/HBIOS/hbios.inc b/Source/HBIOS/hbios.inc index 23c4ca93..17cbe967 100644 --- a/Source/HBIOS/hbios.inc +++ b/Source/HBIOS/hbios.inc @@ -121,7 +121,7 @@ CIO_CONSOLE .EQU $80 ; CIO UNIT NUM FOR CUR CON ERR_NONE .EQU 0 ; SUCCESS ; ERR_UNDEF .EQU -1 ; UNDEFINED ERROR -ERR_NOTIMPL .EQU -2 ; FUNC NOT IMPLEMENTED +ERR_NOTIMPL .EQU -2 ; FUNCTION NOT IMPLEMENTED ERR_NOFUNC .EQU -3 ; INVALID FUNCTION ERR_NOUNIT .EQU -4 ; INVALID UNIT NUMBER ERR_NOMEM .EQU -5 ; OUT OF MEMORY @@ -129,7 +129,7 @@ ERR_RANGE .EQU -6 ; PARAMETER OUT OF RANGE ERR_NOMEDIA .EQU -7 ; MEDIA NOT PRESENT ERR_NOHW .EQU -8 ; HARDWARE NOT PRESENT ERR_IO .EQU -9 ; I/O ERROR -ERR_READONLY .EQU -10 ; WRITE REQ TO READ-ONLY MEDIA +ERR_READONLY .EQU -10 ; WRITE REQUEST TO READ-ONLY MEDIA ERR_TIMEOUT .EQU -11 ; DEVICE TIMEOUT ERR_BADCFG .EQU -12 ; INVALID CONFIGURATION ERR_INTERNAL .EQU -13 ; INTERNAL ERROR @@ -226,8 +226,7 @@ HCB_BOOTBID .EQU $0F ; BANK ID OF ROM PAGE BOOTED (BYTE) HCB_SERDEV .EQU $10 ; PRIMARY SERIAL DEVICE/UNIT (BYTE) HCB_CRTDEV .EQU $11 ; CRT DISPLAY DEVICE/UNIT (BYTE) HCB_CONDEV .EQU $12 ; ACTIVE CONSOLE DEVICE/UNIT (BYTE) -;HCB_CUREMU .EQU $13 ; CURRENT VDA TERMINAL EMULATION (DEPRECATED) -;HCB_CURVDA .EQU $14 ; CURRENT VDA TARGET FOR EMULATION (DEPRECATED) +HCB_DIAGLVL .EQU $13 ; HBIOS DIAGNOSTIC LEVEL (BYTE) ; HCB_HEAP .EQU $20 ; DWORD ADDRESS OF START OF HEAP HCB_HEAPTOP .EQU $22 ; DWORD ADDRESS OF TOP OF HEAP diff --git a/Source/HBIOS/romldr.asm b/Source/HBIOS/romldr.asm index f17704ee..c8940431 100644 --- a/Source/HBIOS/romldr.asm +++ b/Source/HBIOS/romldr.asm @@ -285,6 +285,8 @@ runcmd: #if (BIOS == BIOS_WBW) cp 'I' ; C = set console interface jp z,setcon ; if so, do it + cp 'V' ; V = diagnostic verbosity + jp z,setdl ; is so, do it #endif ; ; Attempt ROM application launch @@ -473,6 +475,44 @@ setcon: ; #endif ; +; Set RomWBW HBIOS Diagnostic Level +; +#if (BIOS == BIOS_WBW) +; +setdl: + ; On entry DE is expected to be pointing to start + ; of command + call findws ; skip command + call skipws ; and skip it + or a ; set flags to check for null + jr z,showdl ; no parm, just display + call isnum ; do we have a number? + jp nz,err_invcmd ; if not, invalid + call getnum ; parse number into A + jp c,err_invcmd ; handle overflow error +; + ; Set diagnostic level + ld b,BF_SYSPOKE ; HBIOS func: POKE + ld d,BID_BIOS ; BIOS bank + ld e,a ; diag level value + ld hl,HCB_LOC + HCB_DIAGLVL ; offset into HCB + rst 08 ; do it + ; Fall thru to display new value +; +showdl: + ; Display current diagnostic level + ld hl,str_diaglvl ; diag level tag + call pstr ; print it + ld b,BF_SYSPEEK ; HBIOS func: PEEK + ld d,BID_BIOS ; BIOS bank + ld hl,HCB_LOC + HCB_DIAGLVL ; offset into HCB + rst 08 ; do it, E := level value + ld a,e ; put in accum + call prtdecb ; print it + ret ; done +; +#endif +; ; Restart system ; reboot: @@ -838,6 +878,10 @@ diskboot9: ld de,(bb_cpmloc) ; de := start or a ; clear carry sbc hl,de ; hl := length to load + ; If load length is not a multiple of sector size (512) + ; we need to round up to get everything loaded! + ld de,511 ; 1 less than sector size + add hl,de ; ... and roundup ld a,h ; determine 512 byte sector count rra ; ... by dividing msb by two ld (loadcnt),a ; ... and save it @@ -1079,6 +1123,8 @@ rdln_cr: ; findws: ld a,(de) ; get next char + or a ; check for eol + ret z ; done if so cp ' ' ; blank? ret z ; nope, done inc de ; bump buffer pointer @@ -1089,6 +1135,8 @@ findws: ; skipws: ld a,(de) ; get next char + or a ; check for eol + ret z ; done if so cp ' ' ; blank? ret nz ; nope, done inc de ; bump buffer pointer @@ -1740,6 +1788,7 @@ devunk .db "UNK",0 err_invcmd: ld hl,str_err_invcmd jr err +; err_nodisk: ld hl,str_err_nodisk jr err @@ -1833,6 +1882,7 @@ str_binfo3 .db "-0x",0 str_binfo4 .db ", entry @ 0x",0 str_binfo5 .db "]",0 str_ldsec .db ", Sector 0x",0 +str_diaglvl .db "\r\n\r\nHBIOS Diagnostic Level: ",0 ; str_help .db "\r\n" .db "\r\n L - List ROM Applications" @@ -1840,6 +1890,7 @@ str_help .db "\r\n" .db "\r\n R - Reboot System" #if (BIOS == BIOS_WBW) .db "\r\n I - Set Console Interface" + .db "\r\n V [] - View/Set HBIOS Diagnostic Verbosity" #endif .db "\r\n [.] - Boot Disk Unit/Slice" .db 0 diff --git a/Source/HBIOS/std.asm b/Source/HBIOS/std.asm index a6ee8022..b7459ce3 100644 --- a/Source/HBIOS/std.asm +++ b/Source/HBIOS/std.asm @@ -30,9 +30,15 @@ USEXIO .EQU 1 ; BASIC SERIAL DRIVER USEMIO .EQU 2 ; MEMORY BUFFER DRIVER WBWDEBUG .EQU USENONE ; -; DISPLAY SYSTEM CHECKS? +; DIAGNOSTIC LEVEL OPTIONS ; -SYSCHKENABLE .EQU FALSE +DL_NONE .EQU 0 ; HBIOS DISPLAY NO MESSAGES +DL_CRITICAL .EQU 4 ; HBIOS DISPLAY CRITICAL ERROR MESSAGES +DL_ERROR .EQU 8 ; HBIOS DISPLAYS ALL ERROR MESSAGES +DL_WARNING .EQU 12 ; HBIOS DISPLAYS WARNING MESSAGES +DL_INFO .EQU 16 ; HBIOS DISPLAYS INFORMATIONAL MESSAGES +DL_DETAIL .EQU 20 ; HBIOS DISPLAYS DETAILED DIAGNOSTIC MESSAGES +DL_VERBOSE .EQU 24 ; HBIOS DISPLAYS ANYTHING IT KNOWS HOW TO ; ; PRIMARY HARDWARE PLATFORMS ; @@ -62,6 +68,11 @@ BIOS_NONE .EQU 0 ; NO BIOS TYPE DEFINED BIOS_WBW .EQU 1 ; ROMWBW HBIOS BIOS_UNA .EQU 2 ; UNA UBIOS ; +; DEFAULT HBIOS DIAGNOSTIC LEVEL +; WILL ULTIMATELY BE MOVED TO CONFIG FILE +; +DIAGLVL .EQU DL_CRITICAL +; ; MEMORY MANAGERS ; MM_NONE .EQU 0 diff --git a/Source/HBIOS/util.asm b/Source/HBIOS/util.asm index ebc8cd3b..bccb3925 100644 --- a/Source/HBIOS/util.asm +++ b/Source/HBIOS/util.asm @@ -389,30 +389,6 @@ TSTPT: POP DE JR REGDMP ; DUMP REGISTERS AND RETURN ; -; SYSTEM CHECK: DUMP MACHINE STATE AND CONTINUE? -; -SYSCHK: -#IF (SYSCHKENABLE) - PUSH DE - LD DE,STR_SYSCHK - CALL WRITESTR - POP DE - CALL XREGDMP ; DUMP REGISTERS - CALL CONTINUE ; CHECK W/ USER -#ENDIF - RET -; -; PANIC: DUMP MACHINE STATE AND HALT -; -PANIC: - PUSH DE - LD DE,STR_PANIC - CALL WRITESTR - POP DE - CALL XREGDMP ; DUMP REGISTERS - DI ; NO INTERRUPTS - HALT ; FULL STOP -; ; ; REGDMP: @@ -499,35 +475,10 @@ REGDMP_SP .DW 0 ; ; ; -CONTINUE: - PUSH AF - PUSH DE - LD DE,STR_CONTINUE - CALL WRITESTR - POP DE -CONTINUE1: - CALL CIN - CP 'Y' - JR Z,CONTINUE3 - CP 'y' - JR Z,CONTINUE3 - CP 'N' - JR Z,CONTINUE2 - CP 'n' - JR Z,CONTINUE2 - JR CONTINUE1 -CONTINUE2: - HALT -CONTINUE3: - POP AF - RET -; ; ; -STR_PANIC .DB "\r\n\r\n>>> PANIC: $" -STR_SYSCHK .DB "\r\n\r\n>>> SYSCHK: $" +STR_HALT .TEXT "\r\n\r\n*** System Halted ***$" STR_TSTPT .TEXT "\r\n+++ TSTPT: $" -STR_CONTINUE .TEXT " Continue? (Y/N): $" ;STR_AF .DB " AF=$" ;STR_BC .DB " BC=$" ;STR_DE .DB " DE=$" diff --git a/Source/ZPM3/Build.cmd b/Source/ZPM3/Build.cmd index 2bf6f800..93ad5eb5 100644 --- a/Source/ZPM3/Build.cmd +++ b/Source/ZPM3/Build.cmd @@ -17,6 +17,7 @@ copy ..\ZCCP\startzpm.com . copy ..\CPM3\genbnk.dat . copy ..\CPM3\zpmbios3.spr bnkbios3.spr copy ..\CPM3\gencpm.com . +copy ..\CPM3\util.rel . copy ..\CPM3\biosldrd.rel . copy ..\CPM3\biosldrc.rel . copy ..\CPM3\cpmldr.com . @@ -27,9 +28,9 @@ echo. echo. echo *** ZPM Loader *** echo. -zx LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD +zx LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD,UTIL move /Y zpmldrd.com zpmldr.bin -zx LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC +zx LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC,UTIL move /Y zpmldrc.com zpmldr.com rem pause diff --git a/Source/ZPM3/Clean.cmd b/Source/ZPM3/Clean.cmd index 57295d69..c2471144 100644 --- a/Source/ZPM3/Clean.cmd +++ b/Source/ZPM3/Clean.cmd @@ -10,6 +10,7 @@ if exist system.epr del system.epr if exist system.evn del system.evn if exist system.odd del system.odd if exist biosldr.rel del biosldr.rel +if exist util.rel del util.rel if exist *.sym del *.sym if exist zpmldr.com del zpmldr.com if exist cpmldr.com del cpmldr.com diff --git a/Source/ZPM3/Makefile b/Source/ZPM3/Makefile index 30859cef..db2c13dc 100644 --- a/Source/ZPM3/Makefile +++ b/Source/ZPM3/Makefile @@ -5,18 +5,18 @@ OBJECTS += setz3.com clrhist.com autotog.com NODELETE = setz3.com clrhist.com autotog.com makedos.com zinstal.zpm bnkbdos3.spr resbdos3.spr #endif OBJECTS += cpmldr.com cpmldr.sys zinstal.zpm makedos.com gencpm.dat bnkbios3.spr bnkbdos3.spr resbdos3.spr -OTHERS = zpmldr.bin loader.bin biosldrd.rel biosldrc.rel gencpm.com +OTHERS = zpmldr.bin loader.bin biosldrd.rel biosldrc.rel util.rel gencpm.com DEST = ../../Binary/ZPM3/ TOOLS =../../Tools include $(TOOLS)/Makefile.inc -zpmldr.bin: zpm3ldr.rel biosldrd.rel - $(ZXCC) $(CPM)/LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD +zpmldr.bin: zpm3ldr.rel biosldrd.rel util.rel + $(ZXCC) $(CPM)/LINK -ZPMLDRD[L100]=ZPM3LDR,BIOSLDRD,UTIL mv zpmldrd.com zpmldr.bin -zpmldr.com: zpm3ldr.rel biosldrc.rel - $(ZXCC) $(CPM)/LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC +zpmldr.com: zpm3ldr.rel biosldrc.rel util.rel + $(ZXCC) $(CPM)/LINK -ZPMLDRC[L100]=ZPM3LDR,BIOSLDRC,UTIL mv zpmldrc.com zpmldr.com zpmldr.sys: zpmldr.bin loader.bin @@ -40,6 +40,9 @@ biosldrc.rel: ../CPM3/biosldrc.rel biosldrd.rel: ../CPM3/biosldrd.rel cp $< $@ +util.rel: ../CPM3/util.rel + cp $< $@ + zccp.com: ../ZCCP/ccp.com cp $< $@ diff --git a/Source/ZPM3/loader.asm b/Source/ZPM3/loader.asm index 42a8082d..cc2ffc0a 100644 --- a/Source/ZPM3/loader.asm +++ b/Source/ZPM3/loader.asm @@ -28,11 +28,12 @@ #INCLUDE "../ver.inc" ; ; BELOW, SYS_END MUST BE SET TO THE SIZE OF CPMLDR.BIN + SYS_LOC. IF -; THE SIZE OF CPMLDR.BIN CHANGES, SYS_END MUST BE UPDATED!!! +; THE SIZE OF ZPMLDR.BIN CHANGES, SYS_SIZ MUST BE UPDATED!!! ; +SYS_SIZ .EQU $0F00 ; SIZE OF CPMLDR.BIN SYS_ENT .EQU $0100 ; SYSTEM (OS) ENTRY POINT ADDRESS SYS_LOC .EQU $0100 ; STARTING ADDRESS TO LOAD SYSTEM IMAGE -SYS_END .EQU $1580 + SYS_LOC ; ENDING ADDRESS OF SYSTEM IMAGE +SYS_END .EQU SYS_SIZ + SYS_LOC ; ENDING ADDRESS OF SYSTEM IMAGE ; SEC_SIZE .EQU 512 ; DISK SECTOR SIZE BLK_SIZE .EQU 128 ; OS BLOCK/RECORD SIZE diff --git a/Source/ver.inc b/Source/ver.inc index 74eae58b..f8b3b588 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.11" +#DEFINE BIOSVER "3.1.1-pre.12" diff --git a/Source/ver.lib b/Source/ver.lib index f0a72730..ffca8b84 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.11" + db "3.1.1-pre.12" endm