aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-06-01 15:37:56 -0700
committerH. Peter Anvin <hpa@zytor.com>2014-06-01 15:37:56 -0700
commit8dce4ce7da12dfc035c1b6e76f536f128709e4ef (patch)
tree27d1415f0c1f60190ab9df9dc9e28ece30dcc2f4
parent7bb2f72cc1c688447f446ccbc440310a296e22d9 (diff)
downloadabc80-8dce4ce7da12dfc035c1b6e76f536f128709e4ef.tar.gz
abc80-8dce4ce7da12dfc035c1b6e76f536f128709e4ef.tar.xz
abc80-8dce4ce7da12dfc035c1b6e76f536f128709e4ef.zip
cbios: it is the DPB that can be dynamic, not the DPH
BDOS gets really unhappy about a shared DPH Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--data/cbios.asm53
1 files changed, 26 insertions, 27 deletions
diff --git a/data/cbios.asm b/data/cbios.asm
index 77746ae..b6c7b12 100644
--- a/data/cbios.asm
+++ b/data/cbios.asm
@@ -48,17 +48,28 @@ v24vec: defw irq_v24
; disk parameter header (16 bytes for each drive),
; the chk and alv get dynamically adjusted
-dpbase:
+alvsize: equ 120
+dpm: macro ndisk
dw 0 ; sector translation table (0 = no translation)
dw 0 ; must be 0
dw 0 ; must be 0
dw 0 ; must be 0
dw dirbf ; DIRBUF (address of shared 128 byte scratch pad area)
dw dpblk ; DPB (disk parameter block)
-dp_csv: dw csv ; CSV (unique scratch pad used to check for changed disks)
-dp_alv: dw alv ; ALV (unique scratch pad for allocation information)
+ dw csv ; CSV (unique scratch pad used to check for changed disks)
+ dw alv+alvsize*ndisk ; ALV (unique scratch pad for allocation information)
+ endm
-ndisks: equ 8 ; number of disks we defined
+dpbase:
+ dpm 0
+ dpm 1
+ dpm 2
+ dpm 3
+ dpm 4
+ dpm 5
+ dpm 6
+ dpm 7
+ndisks: equ 8 ; number of disks we defined
; disk parameter block (can be shared by all disks with same configuration)
; each volue is 15,597,568 bytes (238*256*256), which is too much for
@@ -414,6 +425,7 @@ reader: ; read character from reader device (which we don't have)
seldsk: ; select disk indicated by register C
ld hl, 0 ; return code 0 indicates error
+ ld b,h ; = 0
ld a, c
cp ndisks
ret nc ; return (with error code) if C >= ndisks ie illegal drive
@@ -425,15 +437,14 @@ seldsk: ; select disk indicated by register C
ld a,119
sd1: ld (curxtrk), a ; store track offset (+119 for odd volume)
; compute proper disk parameter header address in HL
-
- ; Each allocation vector is 120 bytes long
- ld a,120
- ld e,c
- ld d,h ; = 0
- ld hl,alv
- call multiply_add
- ld (dp_alv),hl
+ ld a,c
+ add a
+ add a
+ add a
+ add a
+ ld c,a
ld hl,dpbase
+ add hl,bc
ret
home: ld bc, 0
@@ -532,18 +543,6 @@ sc_wait_ok:
ret c
jr sc_wait_ok
-multiply_add: ; HL <- HL + DE * A, trashes B
- ld b,8
-m1:
- rrca
- jr nc,m2
- add hl,de
-m2:
- sla e
- rl d
- djnz m1
- ret
-
bootmsg: db "CP/M BIOS (H. Peter Anvin, 2014-06-01)\r\n"
db "CP/M 2.2 Copyright 1979 (c) by Digital Research\r\n"
zero:
@@ -560,6 +559,6 @@ curdmaaddr: dw 0
conflag: db 0
; scratch RAM used by BDOS
-dirbf: ds 128 ; directory scratch area
-alv: ds 120*ndisks ; allocation vectors, each (DSM/8)+1 byte
-csv: ds 0*ndisks ; check vectors, each CKS bytes
+dirbf: ds 128 ; directory scratch area
+alv: ds alvsize*ndisks ; allocation vectors, each (DSM/8)+1 byte
+csv: ds 0*ndisks ; check vectors, each CKS bytes