Fix CP/M 3 ZZRCC RAM/ROM disk handling

- Clearing of RAM disk was corrupting non-RAM Disk banks on ZZRCC.
- On ZZRCC, CP/M 3 failed to make RAM/ROM disk DPB adjustments at startup.
This commit is contained in:
Wayne Warthen
2021-03-16 19:17:19 -07:00
parent 63a31593b4
commit 75d2cc4dfe
5 changed files with 78 additions and 5 deletions

View File

@@ -317,8 +317,14 @@ clrram:
di ; no interrupts
ld a,(0FFE0h) ; get current bank
push af ; save it
;ld a,(bnkramd) ; first bank of ram disk
ld a,080h ; first bank of ram disk
ld b,0FAh ; HBIOS Peek Function
ld a,(@hbbio) ; HBIOS bank id
ld d,a ; ... goes in D
ld hl,1DCh ; Offset 1DCh is ram disk bank 0
rst 08 ; Call HBIOS, value in E
ld a,e ; move to A for bank sel
cp 0FFh
jr z,clrram3
;call hb_bnksel ; select bank
call 0FFF3h ; select bank
@@ -348,7 +354,6 @@ clrram2:
or 0ffh ; flag value for cleared
ld (clrflg),a ; save it
clrram3:
;ld a,(bnkuser) ; usr bank (tpa)
pop af ; recover original bank
;call hb_bnksel ; select bank
call 0FFF3h ; select bank

View File

@@ -15,6 +15,7 @@
public @sysdr
extrn @bootdu,@bootsl
extrn @hbbio
; Variables containing parameters passed by BDOS
@@ -354,6 +355,54 @@ dpb$hdnew: ; 8MB Hard Disk Drive (new format)
; called for first time initialization.
dsk$init:
ld b,0FAh ; HBIOS Peek Function
ld a,(@hbbio) ; HBIOS bank id
ld d,a ; ... goes in D
ld hl,10Ch ; Offset 10Ch is ROM bank cnt
rst 08 ; Call HBIOS, value in E
ld a,e ; move count to accum
sub 4 ; reduce by # reserved banks
ld ix,dpb$rom ; address of DPB
call dsk$init1 ; fix it up
ld b,0FAh ; HBIOS Peek Function
ld a,(@hbbio) ; HBIOS bank id
ld d,a ; ... goes in D
ld hl,10Bh ; Offset 10Bh is RAM bank cnt
rst 08 ; Call HBIOS, value in E
ld a,e ; move count to accum
sub 8 ; reduce by # reserved banks
ld ix,dpb$ram ; address of DPB
call dsk$init1 ; fix it up
ret ; done
dsk$init1:
; Setup HL with bank count
ld l,a ; lsb
ld h,0 ; msb is always zero
; Update EXM field
ld a,l ; lsb of bank count
cp 16 + 1 ; compare to EXM threshold
ld a,1 ; assume <= 16 banks, EXM := 0
jr c,dsk$init2 ; done if so
xor a ; > 16 banks, EXM := 0
dsk$init2:
ld (ix + 4),a ; save new EXM value
; Update DSM field
ld b,4 ; prepare to mult by 16
dsk$init3:
sla l ; shift lsb
rl h ; shift msb w/ carry
djnz dsk$init3 ; repeat as needed
dec hl ; subtract 1 for proper DSM value
ld (ix+5),l ; save updated
ld (ix+6),h ; ... DSM value
ret
;ld a,(@rdrv) ; unit being initialized
;ld hl,@bootdu
;cp (hl) ; compare to boot unit