
	MACLIB	CPM3

; Diskformate des mc-CP/M-Computers
;
;**************************************************************
; Disk timing
; Replace with values for your disk
; Define headload, steprate and headunloadtime
;**************************************************************

; Refer to your disk drive data sheet
; and uPD 765 / I 8272 data sheet.

;**************************************************************
; Teac FD-55 G drives and most other 8 Zoll drives
;**************************************************************

hltg	equ	32	; Head load time in ms for 8 Mhz
			; clock, 2 ms increments (2-254)
hutg	equ	240	; Head unloadload time in ms for 8 Mhz
			; clock, 16 ms increments (16-240)
srtg	equ	3	; Step rate in ms for 8 Mhz
			; clock, 1 ms increments (1-16)

specg	equ	((hltg)/2)*512 + (16-srtg)*16 + (hutg+15)/16


;**************************************************************
; Teac FD-55 F drives and most other 96 tpi 5 Zoll drives
;**************************************************************

hltf	equ	32/2	; Head load time in ms for 8 Mhz
			; clock, 2 ms increments (2-254)
hutf	equ	480/2	; Head unloadload time in ms for 8 Mhz
			; clock, 16 ms increments (16-240)
srtf	equ	4/2	; Step rate in ms for 8 Mhz
			; clock, 1 ms increments (1-16)

specf	equ	((hltf)/2)*512 + (16-srtf)*16 + (hutf+15)/16


;**************************************************************
; Teac FD-55 B drives and most other 48 tpi 5 Zoll drives
;**************************************************************

hltb	equ	32	; Head load time in ms for 8 Mhz
			; clock, 2 ms increments (2-254)
hutb	equ	240	; Head unloadload time in ms for 8 Mhz
			; clock, 16 ms increments (16-240)
srtb	equ	6/2	; Step rate in ms for 8 Mhz
			; clock, 1 ms increments (1-16)

specb	equ	((hltb)/2)*512 + (16-srtb)*16 + (hutb+15)/16


;**************************************************************
; Type byte flag definiton
;**************************************************************
;
; Typebyteaufbau
;
; | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
;   |   |   |   |   |   |   |   |___ 0-MFM-Aufzeichnung
;   |   |   |   |   |   |   |        1-FM-Aufzeichnung
;   |   |   |   |   |   |   |
;   |   |   |   |   |   |   |_______ 0-8"-Laufwerk
;   |   |   |   |   |   |            1-5"-Laufwerk
;   |   |   |   |   |   |
;   |   |   |   |   |   |___________ 0-normale Trackzaehlung
;   |   |   |   |   |                1-Trackzaehlung:
;   |   |   |   |   |                   0-39 Kopf 0 Track 0-39
;   |   |   |   |   |                  40-79 Kopf 1 Track 0-39
;   |   |   |   |   |
;   |   |   |   |   |_______________ nicht benutzt
;   |   |   |   |
;   |   |   |   |___________________ nicht benutzt
;   |   |   |
;   |   |   |_______________________ 0-zweiseitig benutzt (DS)
;   |   |                            1-einseitig benutzt  (SS)
;   |   |
;   |   |___________________________ 0-normale Trackposition
;   |                                1-Doppelsteppositionierung
;   |
;   |_______________________________ nicht benutzt
;
;   

tyskip		equ	40h
tysingle	equ	20h
tyreverse	equ	04h
ty5zoll		equ	02h
tymfm		equ	00h
tyfm		equ	01h

	dseg	; disk parameter headers are switched

;**************************************************************
; Extended Disk Parameter Headers (XDPHs)
;**************************************************************

xdpha:	ds	12		; do not change
DPHA:	dph	xlt4,dpb4

xdphb:	ds	12		; do not change
DPHB:	dph	xlt4,dpb4

xdphc:	ds	12		; do not change
DPHC:	dph	xlt4,dpb4

xdphd:	ds	12		; do not change
DPHD:	dph	xlt4,dpb4

	cseg	; DPB & DTBL must be resident

@DTBL:	dtbl	<DPHA,DPHB,DPHC,DPHD>


;**************************************************************
; Disk Parameter Block chain
;**************************************************************

; First some definitions ...

; Number of disk parameter blocks

DPBNR:	db	10	; This version contains 10 disk
			; parameter blocks. Please adapt this
			; number if you use more or fewer disk
			; formats

; Number of tracks until the reverse seek-option will be chosen

REVTRK:	db	40	; NCR DM-V 40 tracks, adapt it
			; if incorrect

;**************************************************************
; DRIVE 1  Layout  FD-55 F 9*512 2*80  5" DS/DD
;**************************************************************

sect	set	512	; sector size
mxsc	set	9	; sectors per track
mxtr	set	80	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	2	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	128	; number of directory entries
off	set	4	; offset for system tracks
type	set	tymfm+ty5zoll

xdpb1:	db	2	; NUM physischer Sektorlaengencode
	db	mxsc
	db	1ah	; Gap 3
	db	-1	; DTL = -1 bei NUM > 0
			; sonst Bytes/Sektor
	dw	specf	; specify parameter
	db	type	; type byte
	dw	xlt1	; einzustellende SKEW-Tabelle

DPB1:	dpb	sect,mxsc,xtrk,blk,dir,off

;**************************************************************
; DRIVE 2  Layout  FD-55 G 16*512 2*80  8" DS/DD
;**************************************************************

sect	set	512	; sector size
mxsc	set	16	; sectors per track
mxtr	set	80	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	2	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	256	; number of directory entries
off	set	4	; offset for system tracks
skew2	equ	3	; skew factor
type	set	tymfm

xdpb2:	db	2	; NUM physischer Sektorlaengencode
	db	mxsc
	db	7	; Gap 3
	db	-1	; DTL
	dw	specg	; specify parameter
	db	type	; type byte
	dw	xlt2	; einzustellende SKEW-Tabelle

DPB2:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 3  Layout  FD-55 F  5*1024  2*80  5" DS/DD
;**************************************************************

sect	set	1024	; sector size
mxsc	set	5	; sectors per track
mxtr	set	80	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	4	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	128	; number of directory entries
off	set	4	; offset for system tracks
skew3	equ	6	; skew factor
type	set	tymfm+ty5zoll

xdpb3:	db	3	; NUM physischer Sektorlaengencode
	db	mxsc
	db	25h	; Gap 3
	db	-1	; DTL
	dw	specf	; specify parameter
	db	type	; type byte
	dw	xlt3	; einzustellende SKEW-Tabelle

DPB3:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 4  Layout  FD-55 G  9*1024  2*80  8" DS/DD
;**************************************************************

sect	set	1024	; sector size
mxsc	set	9	; sectors per track
mxtr	set	80	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	2	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	256	; number of directory entries
off	set	4	; offset for system tracks
skew4	equ	5	; skew factor
type	set	tymfm

xdpb4:	db	3	; NUM physischer Sektorlaengencode
	db	mxsc
	db	7	; Gap 3
	db	-1	; DTL
	dw	specg	; specify parameter
	db	type	; type byte
	dw	xlt4	; einzustellende SKEW-Tabelle

DPB4:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 5  Layout  FD-55 G  15*512  2*77  8" DS/DD
;**************************************************************

sect	set	512	; sector size
mxsc	set	15	; sectors per track
mxtr	set	77	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	2	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	128	; number of directory entries
off	set	4	; offset for system tracks
skew5	equ	5	; skew factor
type	set	tymfm

xdpb5:	db	2	; NUM physischer Sektorlaengencode
	db	mxsc
	db	18h	; Gap 3
	db	-1	; DTL
	dw	specg	; specify parameter
	db	type	; type byte
	dw	xlt5	; einzustellende SKEW-Tabelle

DPB5:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 6  Layout  FD-55 B 10*512  2*40  5" DS/DD
;**************************************************************

sect	set	512	; sector size
mxsc	set	10	; sectors per track
mxtr	set	40	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	2	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	64	; number of directory entries
off	set	4	; offset for system tracks
;skew6	equ	nondef	; skew factor
type	set	tymfm+ty5zoll

xdpb6:	db	2	; NUM physischer Sektorlaengencode
	db	mxsc
	db	10h	; Gap 3
	db	-1	; DTL
	dw	specb	; specify parameter
	db	type	; type byte
	dw	xlt6	; einzustellende SKEW-Tabelle

DPB6:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 7  Layout  FD-55 B 16*256  1*40  5" SS/DD
; Format: Ecma 70
;**************************************************************

sect	set	256	; sector size
mxsc	set	16	; sectors per track
mxtr	set	40	; tracks per surface
side	set	1	; number of surfaces
xtrk	set	mxtr*side
blks	set	1	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	64	; number of directory entries
off	set	4	; offset for system tracks
skew7	equ	1	; skew factor
type	set	tymfm+ty5zoll+tysingle

xdpb7:	db	1	; NUM physischer Sektorlaengencode
	db	mxsc
	db	20h	; Gap 3
	db	-1	; DTL
	dw	specb	; specify parameter
	db	type	; type byte
	dw	xlt7	; einzustellende SKEW-Tabelle

DPB7:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 8  Layout  26*128  1*77  8" SS/SD
; Format: IBM 3740 Standard
;**************************************************************

sect	set	128	; sector size
mxsc	set	26	; sectors per track
mxtr	set	77	; tracks per surface
side	set	1	; number of surfaces
xtrk	set	mxtr*side
blks	set	1	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	64	; number of directory entries
off	set	2	; offset for system tracks
skew8	equ	6	; skew factor
type	set	tyfm+tysingle

xdpb8:	db	0	; NUM physischer Sektorlaengencode
	db	mxsc
	db	7	; Gap 3
	db	128	; DTL
	dw	specg	; specify parameter
	db	type	; type byte
	dw	xlt8	; einzustellende SKEW-Tabelle

DPB8:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 9  Layout  8*512  2*40 Tracks reverse  5" DS/DD
; Format: NCR F3
;**************************************************************

sect	set	512	; sector size
mxsc	set	8	; sectors per track
mxtr	set	40	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	2	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	128	; number of directory entries
off	set	3	; offset for system tracks
skew9	equ	1	; skew factor
type	set	tymfm+ty5zoll+tyreverse

xdpb9:	db	2	; NUM physischer Sektorlaengencode
	db	mxsc
	db	2ah	; Gap 3
	db	-1	; DTL
	dw	specb	; specify parameter
	db	type	; type byte
	dw	xlt9	; einzustellende SKEW-Tabelle

DPB9:	dpb	sect,mxsc,xtrk,blk,dir,off


;**************************************************************
; DRIVE 10 Layout  14*512  2*80  8" DS/DD
; Format:
;**************************************************************

sect	set	512	; sector size
mxsc	set	14	; sectors per track
mxtr	set	80	; tracks per surface
side	set	2	; number of surfaces
xtrk	set	mxtr*side
blks	set	4	; number of blocksizes in kbyte
blk	set	1024*blks
dir	set	128	; number of directory entries
off	set	4	; offset for system tracks
skew10	equ	3	; skew factor
type	set	tymfm

xdpb10:	db	2	; NUM physischer Sektorlaengencode
	db	mxsc
	db	25h	; Gap 3
	db	-1	; DTL
	dw	specg	; specify parameter
	db	type	; type byte
	dw	xlt10	; einzustellende SKEW-Tabelle

DPB10:	dpb	sect,mxsc,xtrk,blk,dir,off

	dseg

;**************************************************************
; Sector translate tables
;**************************************************************

xlt1:	db	1,4,7,2,5,8,3,6,9	; Standard FD-55 F

xlt2:	skew	16,skew2,1		; 16x512x2x80

xlt3:	skew	5,skew3,1		; 5x1024x2x80

xlt4:	skew	9,skew4,1		; 9x1024x2x80

xlt5:	skew	15,skew5,1		; Standard FD 55 G / 8"
					; 15x512x2x77

xlt6:	db	1,4,7,10,3,6,9,2,5,8	; Standard FD 55 B
					; 10x512x2x40

xlt7:	skew	16,skew7,1		; Ecma 70

xlt8:	skew	26,skew8,1		; FD-55 G/8"
					; Standard IBM 340

xlt9:	skew	8,skew9,1		; NCR F3

xlt10:	skew	14,skew10,1		; 14x512x2x80


