From ca67ee41c5c82e89e9080d1c8c88c9afc672b857 Mon Sep 17 00:00:00 2001 From: Wayne Warthen Date: Mon, 6 Dec 2021 13:22:27 -0800 Subject: [PATCH] Fix CBIOS Bug - Corrects the dynamic disk buffer allocation routine in CBIOS and ASSIGN.COM. They had the DPB assignments inverted causing slightly wrong buffer allocations for RAM and ROM disks. Credit to Andrew Lynch for discovering this issue. --- Source/Apps/assign.asm | 24 +++++++++++++++++++++--- Source/CBIOS/cbios.asm | 10 +++++----- Source/ver.inc | 2 +- Source/ver.lib | 2 +- 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Source/Apps/assign.asm b/Source/Apps/assign.asm index c080991b..a3ed2981 100644 --- a/Source/Apps/assign.asm +++ b/Source/Apps/assign.asm @@ -27,6 +27,7 @@ ; 2020-05-06 [WBW] Add patch level to version compare ; 2020-05-10 [WBW] Set media change flag in XDPH for CP/M 3 ; 2020-05-12 [WBW] Back out media change flag +; 2021-12-06 [WBW] Fix inverted ROM/RAM DPB mapping in buffer alloc ;_______________________________________________________________________________ ; ; ToDo: @@ -639,7 +640,7 @@ makdphwbw: ; determine appropriate dpb (WBW mode, unit number in A) jr nz,makdph00 ; if not, skip ahead to other types ld a,e ; physical unit number to A ld e,1 ; assume rom - cp $00 ; rom? + cp $01 ; rom? jr z,makdph0 ; yes, jump ahead ld e,2 ; otherwise ram jr makdph0 ; jump ahead @@ -1567,6 +1568,23 @@ prtdec2: call prtchr ret ; +; Print a byte buffer in hex pointed to by DE +; Register A has size of buffer +; +prthexbuf: + or a + ret z ; empty buffer +; + ld b,a +prthexbuf1: + ld a,' ' + call prtchr + ld a,(de) + call prthex + inc de + djnz prthexbuf1 + ret +; ; Start a new line ; crlf2: @@ -1893,10 +1911,10 @@ stack .equ $ ; stack top ; Messages ; indent .db " ",0 -msgban1 .db "ASSIGN v1.4 for RomWBW CP/M, 12-May-2020",0 +msgban1 .db "ASSIGN v1.4a for RomWBW CP/M, 6-Dec-2021",0 msghb .db " (HBIOS Mode)",0 msgub .db " (UBIOS Mode)",0 -msgban2 .db "Copyright 2020, Wayne Warthen, GNU GPL v3",0 +msgban2 .db "Copyright 2021, Wayne Warthen, GNU GPL v3",0 msguse .db "Usage: ASSIGN D:[=[{D:|[]:[]}]][,...]",13,10 .db " ex. ASSIGN (display all active assignments)",13,10 .db " ASSIGN /? (display version and usage)",13,10 diff --git a/Source/CBIOS/cbios.asm b/Source/CBIOS/cbios.asm index 4bb0b22e..0c8c14d8 100644 --- a/Source/CBIOS/cbios.asm +++ b/Source/CBIOS/cbios.asm @@ -3059,12 +3059,12 @@ MAKDPH0: ; RAM/ROM DISK DPB DERIVATION ; TYPE OF MEMORY DISK (RAM/ROM) DETERMINED BY PHYSICAL UNIT NUMBER LD A,E ; LOAD PHYSICAL UNIT NUMBER - LD DE,DPB_ROM ; PRELOAD ROM DISK DPB - OR A ; UNIT=0 (ROM)? - JR Z,MAKDPH1 ; IF UNIT=0, IT IS ROM, PROCEED TO DPH CREATION LD DE,DPB_RAM ; PRELOAD RAM DISK DPB - CP $01 ; UNIT=1 (RAM)? - JR Z,MAKDPH1 ; IF UNIT=0, IT IS ROM, PROCEED TO DPH CREATION + OR A ; UNIT=0 (RAM)? + JR Z,MAKDPH1 ; IF SO, CREATE RAM DISK DPH + LD DE,DPB_ROM ; PRELOAD ROM DISK DPB + CP $01 ; UNIT=1 (ROM)? + JR Z,MAKDPH1 ; IF SO, CREATE ROM DISK DPH CALL PANIC ; OTHERWISE UNKNOWN, NOT POSSIBLE, JUST PANIC ; #ENDIF diff --git a/Source/ver.inc b/Source/ver.inc index f6f1e50c..9da70da2 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.141" +#DEFINE BIOSVER "3.1.1-pre.142" diff --git a/Source/ver.lib b/Source/ver.lib index 3f1fcee4..e0ffb279 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.141" + db "3.1.1-pre.142" endm