Skip to content

Commit

Permalink
Improve OS Boot Drive Assignment
Browse files Browse the repository at this point in the history
- Modified the Disk Device function call (DIODEVICE) to provide new attributes related to disk size and removability.
- Leveraged API change to allow handling drive assignment differently depending on ATAPI vs. ATA interface.
  • Loading branch information
wwarthen committed Jun 20, 2023
1 parent 8f5cc51 commit 5457a7e
Show file tree
Hide file tree
Showing 31 changed files with 230 additions and 149 deletions.
Binary file modified Doc/RomWBW Applications.pdf
Binary file not shown.
Binary file modified Doc/RomWBW Disk Catalog.pdf
Binary file not shown.
Binary file modified Doc/RomWBW Errata.pdf
Binary file not shown.
Binary file modified Doc/RomWBW ROM Applications.pdf
Binary file not shown.
Binary file modified Doc/RomWBW System Guide.pdf
Binary file not shown.
Binary file modified Doc/RomWBW User Guide.pdf
Binary file not shown.
6 changes: 5 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
**RomWBW ReadMe** \
Version 3.3 \
Wayne Warthen ([wwarthen@gmail.com](mailto:wwarthen@gmail.com)) \
06 Jun 2023
20 Jun 2023

# Overview

Expand Down Expand Up @@ -183,6 +183,10 @@ let me know if I missed you!

- The RomWBW Disk Catalog document was produced by Mykl Orders.

- Rob Prouse has created many of the supplemental disk images including
Aztec C, HiTech C, SLR Z80ASM, Turbo Pascal, Microsoft BASIC Compiler,
Microsoft Fortran Compiler, and a Games compendium.

Contributions of all kinds to RomWBW are very welcome.

# Licensing
Expand Down
6 changes: 5 additions & 1 deletion ReadMe.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RomWBW ReadMe
Wayne Warthen (wwarthen@gmail.com)
06 Jun 2023
20 Jun 2023



Expand Down Expand Up @@ -185,6 +185,10 @@ let me know if I missed you!

- The RomWBW Disk Catalog document was produced by Mykl Orders.

- Rob Prouse has created many of the supplemental disk images
including Aztec C, HiTech C, SLR Z80ASM, Turbo Pascal, Microsoft
BASIC Compiler, Microsoft Fortran Compiler, and a Games compendium.

Contributions of all kinds to RomWBW are very welcome.


Expand Down
15 changes: 7 additions & 8 deletions Source/Apps/assign.asm
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
; 2021-12-06 [WBW] Fix inverted ROM/RAM DPB mapping in buffer alloc
; 2022-02-28 [WBW] Use HBIOS to swap banks under CP/M 3
; Use CPM3 BDOS direct BIOS call to get DRVTBL adr
; 2023-06-19 [WBW] Update for revised DIODEVICE API
;_______________________________________________________________________________
;
; ToDo:
; 1) Do something to prevent assigning slices when device does not support them
; 2) ASSIGN C: causes drive map to be reinstalled unnecessarily
; 1) ASSIGN C: causes drive map to be reinstalled unnecessarily
;_______________________________________________________________________________
;
;===============================================================================
Expand Down Expand Up @@ -1405,12 +1405,11 @@ chkdev: ; HBIOS variant
; get device/unit info
ld b,$17 ; hbios func: diodevice
ld c,a ; unit to C
rst 08 ; call hbios, D := device, E := unit
ld a,d ; device to A
rst 08 ; call hbios, C := device attributes
;
; check slice support
cp $30 ; A has device/unit, in hard disk range?
jr c,chkdev1 ; if not hard disk, check slice val
bit 5,c ; high capacity device?
jr z,chkdev1 ; if not high cap, check slice val
xor a ; otherwise, signal OK
ret
;
Expand Down Expand Up @@ -1943,10 +1942,10 @@ stack .equ $ ; stack top
; Messages
;
indent .db " ",0
msgban1 .db "ASSIGN v1.5 for RomWBW CP/M ",0
msgban1 .db "ASSIGN v1.6 for RomWBW CP/M ",0
msg22 .db "2.2",0
msg3 .db "3",0
msbban2 .db ", 28-Feb-2022",0
msbban2 .db ", 16-Jun-2023",0
msghb .db " (HBIOS Mode)",0
msgub .db " (UBIOS Mode)",0
msgban3 .db "Copyright 2021, Wayne Warthen, GNU GPL v3",0
Expand Down
64 changes: 27 additions & 37 deletions Source/CBIOS/cbios.asm
Original file line number Diff line number Diff line change
Expand Up @@ -2291,8 +2291,8 @@ INIT2:
LD C,(HL) ; PUT UNIT NUM IN C
RST 08 ; CALL HBIOS
LD A,C ; GET ATTRIBUTES
AND %00111000 ; ISOLATE TYPE BITS
CP %00101000 ; TYPE = RAM?
AND %10001111 ; ISOLATE TYPE BITS
CP %00000101 ; NOT FLOPPY, TYPE = RAM?
JR NZ,INIT2X ; IF NOT THEN DONE
;
; CHECK IF SECOND UNIT IS ROM OR FLASH
Expand All @@ -2303,10 +2303,10 @@ INIT2:
LD C,(HL) ; PUT UNIT NUM IN C
RST 08 ; CALL HBIOS
LD A,C ; GET ATTRIBUTES
AND %00111000 ; ISOLATE TYPE BITS
CP %00100000 ; TYPE = ROM?
AND %10001111 ; ISOLATE TYPE BITS
CP %00000100 ; NOT FLOPPY, TYPE = ROM?
JR Z,INIT2A ; IF SO, ADJUST DEF DRIVE
CP %00111000 ; TYPE = FLASH?
CP %00000111 ; NOT FLOPPY, TYPE = FLASH?
JR NZ,INIT2X ; IF NOT THEN DONE
;
INIT2A:
Expand Down Expand Up @@ -2904,61 +2904,51 @@ DRV_INIT:
LD HL,DRVLST ; INIT HL PTR TO DRIVE LIST
;
DRV_INIT2:
PUSH BC ; SAVE LOOP CNT & UNIT
CALL DRV_INIT3 ; CHECK DRIVE
POP BC ; RECOVER LOOP CNT & UNIT
INC C ; NEXT UNIT
DJNZ DRV_INIT2 ; LOOP
LD A,D ; TOTAL DEVICE COUNT TO D
LD A,D ; TOTAL DEVICE COUNT TO A
LD (DRVLSTC),A ; SAVE THE COUNT
JR DRV_INIT4 ; CONTINUE
;
DRV_INIT3:
; GET DEVICE ATTRIBUTES
PUSH DE ; SAVE DE (HARD DISK VOLUME COUNTER)
PUSH HL ; SAVE DRIVE LIST PTR
PUSH BC ; SAVE LOOP CONTROL
LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO
RST 08 ; CALL HBIOS, UNIT TO C
LD A,D ; DEVICE TYPE TO A
LD A,C ; DEVICE ATTRIBUTES TO A
POP BC ; RESTORE LOOP CONTROL
POP HL ; RESTORE DRIVE LIST PTR
POP DE ; RESTORE DE
CP DIODEV_IDE ; HARD DISK DEVICE?
JR NC,DRV_INIT3A ; IF SO, HANDLE SPECIAL
LD (HL),C ; SAVE UNIT NUM IN LIST
INC HL ; BUMP PTR
INC D ; INC TOTAL DEVICE COUNT
RET
LD B,A ; ATTRIBUTES TO B
;
DRV_INIT3A:
; CHECK FOR HARD DISK REMOVABLE CARTRIDGE DRIVES
CP DIODEV_PPA ; PPA (ZIP DRIVE) IS REMOVABLE
JR Z,DRV_INIT3B ; IF SO, SKIP MEDIA CHECK
CP DIODEV_IMM ; IMM (ZIP DRIVE) IS REMOVABLE
JR Z,DRV_INIT3B ; IF SO, SKIP MEDIA CHECK
CP DIODEV_SYQ ; IMM (ZIP DRIVE) IS REMOVABLE
JR Z,DRV_INIT3B ; IF SO, SKIP MEDIA CHECK

; CHECK FOR ACTIVE AND RETURN IF NOT
; IF DEVICE IS NOT REMOVABLE, THEN CHECK TO ENSURE IT IS
; ACTUALLY ONLINE. IF NOT, SKIP UNIT ENTIRELY.
BIT 6,B ; REMOVABLE?
JR NZ,DRV_INIT3A ; IF SO, SKIP MEDIA CHECK
PUSH DE ; SAVE DE (HARD DISK VOLUME COUNTER)
PUSH HL ; SAVE DRIVE LIST PTR
PUSH BC ; SAVE LOOP CONTROL

LD B,BF_DIOMEDIA ; HBIOS FUNC: SENSE MEDIA
LD E,1 ; PERFORM MEDIA DISCOVERY
RST 08

RST 08 ; DO IT
POP BC ; RESTORE LOOP CONTROL
POP HL ; RESTORE DRIVE LIST PTR
POP DE ; RESTORE DE

RET NZ ; IF NO MEDIA, JUST RETURN

DRV_INIT3B:
; IF ACTIVE...
RET NZ ; OFFLINE, SKIP ENTIRE UNIT
;
DRV_INIT3A:
LD (HL),C ; SAVE UNIT NUM IN LIST
INC HL ; BUMP PTR
INC D ; INC TOTAL DEVICE COUNT
BIT 5,B ; HIGH CAPACITY?
RET Z ; DONE IF NOT
INC E ; INCREMENT HARD DISK COUNT
RET ; AND RETURN
RET ; DONE
;
DRV_INIT4: ; SET SLICES PER VOLUME (HDSPV) BASED ON HARD DISK VOLUME COUNT
LD A,E ; HARD DISK VOLUME COUNT TO A
Expand Down Expand Up @@ -2987,7 +2977,8 @@ DRV_INIT6: ; LOOP THRU ALL UNITS AVAILABLE
LD C,(HL) ; GET UNIT NUM FROM LIST
PUSH BC ; PRESERVE LOOP CONTROL
LD B,BF_DIODEVICE ; HBIOS FUNC: REPORT DEVICE INFO
RST 08 ; CALL HBIOS, D := DEVICE TYPE
RST 08 ; CALL HBIOS, C := DEVICE ATTRIBUTES
LD A,C ; DEVICE ATTRIBUTES TO A
POP BC ; GET UNIT INDEX BACK IN C
PUSH BC ; RESAVE LOOP CONTROL
CALL DRV_INIT7 ; MAKE DRIVE MAP ENTRY(S)
Expand All @@ -3001,10 +2992,9 @@ DRV_INIT6: ; LOOP THRU ALL UNITS AVAILABLE
DRV_INIT7: ; PROCESS UNIT
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 DIODEV_IDE ; HARD DISK DEVICE?
JR C,DRV_INIT8 ; NOPE, LEAVE LOOP COUNT AT 1
BIT 5,A ; HIGH CAPACITY DEVICE?
JR Z,DRV_INIT8 ; NOPE, LEAVE LOOP COUNT AT 1
LD A,(HDSPV) ; GET SLICES PER VOLUME TO ACCUM
LD B,A ; MOVE TO B FOR LOOP COUNTER
;
Expand Down Expand Up @@ -3415,7 +3405,7 @@ DIRBUF .DW 0 ; DIR BUF POINTER
HEAPTOP .DW BUFPOOL ; CURRENT TOP OF HEAP
BOOTVOL .DW 0 ; BOOT VOLUME, MSB=BOOT UNIT, LSB=BOOT SLICE
HDSPV .DB 2 ; SLICES PER VOLUME FOR HARD DISKS (MUST BE >= 1)
DRVLST .FILL 32 ; ACTIVE DRIVE LIST USED DURINT DRV_INIT
DRVLST .FILL 32 ; ACTIVE DRIVE LIST USED DURING DRV_INIT
DRVLSTC .DB 0 ; ENTRY COUNT FOR ACTIVE DRIVE LIST
;
#IFDEF PLTWBW
Expand Down
49 changes: 19 additions & 30 deletions Source/CPM3/boot.z80
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ dinit:
ld hl,drvlst ; init hl ptr to drive list
;
dinit2:
push bc ; save loop cnt & unit
call dinit3 ; check drive
pop bc ; recover loop cnt & unit
inc c ; next unit
djnz dinit2 ; loop
ld a,d ; total device count to d
Expand All @@ -169,48 +171,35 @@ dinit3:
push bc ; save loop control
ld b,17h ; hbios func: report device info
rst 08 ; call hbios, unit to c
ld a,d ; device type to a
ld a,c ; device attributes to a
pop bc ; restore loop control
pop hl ; restore drive list ptr
pop de ; restore de
cp 30h ; hard disk device?
jr nc,dinit3a ; if so, handle special
ld (hl),c ; save unit num in list
inc hl ; bump ptr
inc d ; inc total device count
ret
ld b,a ; attributes to b
;
dinit3a:
; check for hard disk removable cartridge drives
cp 0A0h ; ppa (zip drive) is removable
jr z,dinit3b ; if so, skip media check
cp 0B0h ; imm (zip drive) is removable
jr z,dinit3b ; if so, skip media check
cp 0C0h ; syq (syquest drive) is removable
jr z,dinit3b ; if so, skip media check

; check for active and return if not
; if device is not removable, then check to ensure it is
; actually online. if not, skip unit entirely.
bit 6,b ; removable?
jr nz,dinit3a ; if so, skip media check
push de ; save de (hard disk volume counter)
push hl ; save drive list ptr
push bc ; save loop control

ld b,18h ; hbios func: sense media
ld e,1 ; perform media discovery
rst 08

rst 08 ; do it
pop bc ; restore loop control
pop hl ; restore drive list ptr
pop de ; restore de

ret nz ; if no media, just return

dinit3b:
; if active...
ret nz ; offline, skip entire unit
;
dinit3a:
ld (hl),c ; save unit num in list
inc hl ; bump ptr
inc d ; inc total device count
bit 5,b ; high capacity?
ret z ; done if not
inc e ; increment hard disk count
ret ; and return
ret ; done

dinit4: ; set slices per volume (hdspv) based on hard disk volume count
ld a,e ; hard disk volume count to a
Expand Down Expand Up @@ -247,7 +236,8 @@ dinit6:
push bc ; preserve loop control
push hl ; preserve dph pointer
ld b,17h ; hbios func: report device info
rst 08 ; call hbios, d := device type
rst 08 ; call hbios, a := device attributes
ld a,c ; device attributes to a
pop hl ; restore dph pointer
pop bc ; get unit index back in c
push bc ; resave loop control
Expand All @@ -262,10 +252,9 @@ dinit6:
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 030h ; hard disk device?
jr c,dinit8 ; nope, leave loop count at 1
bit 5,a ; high capacity device?
jr z,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

Expand Down
5 changes: 5 additions & 0 deletions Source/Doc/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ please let me know if I missed you!

* The RomWBW Disk Catalog document was produced by Mykl Orders.

* Rob Prouse has created many of the supplemental disk images
including Aztec C, HiTech C, SLR Z80ASM, Turbo Pascal, Microsoft
BASIC Compiler, Microsoft Fortran Compiler, and a Games
compendium.

Contributions of all kinds to RomWBW are very welcome.

# Licensing
Expand Down
38 changes: 23 additions & 15 deletions Source/Doc/SystemGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -757,28 +757,36 @@ of memory because it avoids a double copy.
Reports device information about the specified Disk Unit (C). The
Status (A) is a standard HBIOS result code.

Bit 7 of the Device Attribute (C) value returned indicates whether the
device is a floppy disk. If it is a floppy disk, the Device Attribute
(C) value is encoded as follows:
The Device Attribute (C) value returned indicates various
feature indicators related to the device being referenced
by the specified Disk Unit (C). The high 3 bits apply to
all devices. The definition of the low 5 bits depends on
whether the device is a Floppy (indicated by bit 5).

The common bits are:

| **Bits** | **Definition** |
|---------:|--------------------------------------------------|
| 7 | = 1 (Floppy Disk) |
| 6-5 | Form Factor: 0=8", 1=5.25", 2=3.5", 3=Other |
| 4 | Sides: 0=SS, 1=DS |
| 3-2 | Density: 0=SD, 1=DD, 2=HD, 3=ED |
| 1-0 | Reserved |
| 7 | Floppy |
| 6 | Removable |
| 5 | High Capacity (>8 MB) |

If the Disk Unit (C) specified is a not floppy disk, then the Device
Attribute (C) encoding is as follows:
The Floppy specific bits are:

| **Bits** | **Definition** |
|---------:|--------------------------------------------------|
| 7 | = 0 (not Floppy Disk) |
| 6 | Removable |
| 5-3 | Type: 0=Hard, 1=CF, 2=SD, 3=USB, |
| | 4=ROM, 5=RAM, 6=RAMF, 7=FLASH |
| 2-0 | Reserved |
| 4-3 | Form Factor: 0=8", 1=5.25", 2=3.5", 3=Other |
| 2 | Sides: 0=SS, 1=DS |
| 1-0 | Density: 0=SD, 1=DD, 2=HD, 3=ED |

The non-Floppy specific bits are:

| **Bits** | **Definition** |
|---------:|--------------------------------------------------|
| 4 | LBA Capable |
| 3-0 | Media Type: 0=Hard Disk, 1=CF, 2=SD, 3=USB, |
| | 4=ROM, 5=RAM, 6=RAMF, 7=FLASH, 8=CD-ROM, |
| | 9=Cartridge |

Device Type (D) indicates the specific hardware driver that handles the
specified Disk Unit (C). Values are listed at the start of this
Expand Down
Loading

0 comments on commit 5457a7e

Please sign in to comment.