;==============================================================================
;REVISION HISTORY:
;AN000 - New for DOS Version 3.4 - J.K.
;AC000 - Changed for DOS Version 3.4 - J.K.
;ANxxx - PTR, DCRs
;==============================================================================
;AN001 - d9  Double word MOV instruction for 80386 based machine.    7/1/87 J.K.
;AN002 - d25 Change DASD ERP to that recommended by Storage Systems. 7/29/87 J.K.
;AN003; d304 Boot record structure change for OS2		     11/9/87 J.K.
;==============================================================================
	EXTRN	INIT:NEAR

	PUBLIC	START$
START$:
	JMP	INIT			;START$ PATCH BY INIT TO POINT TO
					;HDRIVE BPB
;	PUBLIC	FORMAT_PATCH
;FORMAT_PATCH:				 ;ARR 2.42
;	JMP	FMTSET			;MJB001 DISPATCH FOR CALL FROM FORMAT UTILITY


	PATHSTART 001,BIO

;	DB	20 DUP (0)		;IBM WANTS SOME ZEROED AREA (DELETED)


;HEADER  DB	 "Ver 2.45"
;--------------------------------------------------------------
;
;	COMMAND JUMP TABLES
;
;	BEWARE - THESE TABLES OVERLAP SOMEWHAT! -C.P.
;
	ODD
DSKTBL	LABEL	BYTE
	DB	24			; THIS IS THE SIZE OF THE TABLE YUK!!!!
	DW	DSK$INIT
	DW	MEDIA$CHK
	DW	GET$BPB
	DW	CMDERR			;RS
	DW	DSK$READ
	DW	BUS$EXIT
	DW	EXIT
	DW	EXIT
	DW	DSK$WRIT
	DW	DSK$WRITV
	DW	EXIT			;ARR 2.41
	DW	EXIT			;ARR 2.41
	DW	CMDERR			;RS

	PUBLIC	TABLE_PATCH
TABLE_PATCH LABEL WORD			   ;ARR 2.42
	DW	DSK$OPEN		;ARR 2.41
	DW	DSK$CLOSE		;ARR 2.41
	DW	DSK$REM 		;ARR 2.41
	DW	EXIT
	DW	EXIT
	DW	EXIT
	DW	GENERIC$IOCTL		; KGS	3.20
	DW	EXIT
	DW	EXIT
	DW	EXIT
	DW	IOCTL$GETOWN		; RS 3.20
	DW	IOCTL$SETOWN		; RE 3.20

	ODD
CONTBL	LABEL	BYTE
	DB	10
	DW	EXIT
	DW	EXIT
	DW	EXIT
	DW	CMDERR
	DW	CON$READ
	DW	CON$RDND
	DW	EXIT
	DW	CON$FLSH
	DW	CON$WRIT
	DW	CON$WRIT
	DW	EXIT			;ARR 2.41

;	DW	CMDERR			;J.K. 4/29/86 for CON$GENIOCTL support
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CMDERR			;J.K. 4/29/86
;	DW	CON$GENIOCTL		;J.K. 4/29/86

	ODD
AUXTBL	LABEL	BYTE
	DB	10
	DW	EXIT
	DW	EXIT
	DW	EXIT
	DW	CMDERR
	DW	AUX$READ
	DW	AUX$RDND
	DW	EXIT
	DW	AUX$FLSH
	DW	AUX$WRIT
	DW	AUX$WRIT
	DW	AUX$WRST

	ODD
TIMTBL	LABEL	BYTE
	DB	9
	DW	EXIT
	DW	EXIT
	DW	EXIT
	DW	CMDERR
	DW	TIM$READ
	DW	BUS$EXIT
	DW	EXIT
	DW	EXIT
	DW	TIM$WRIT
	DW	TIM$WRIT

	ODD
PRNTBL	LABEL	BYTE
	DB	24
	DW	EXIT			;INIT
	DW	EXIT
	DW	EXIT
	DW	CMDERR
	DW	EXIT$ZER		;INDICATE ZERO CHARS READ
	DW	BUS$EXIT
	DW	EXIT
	DW	EXIT
	DW	PRN$WRIT
	DW	PRN$WRIT
	DW	PRN$STAT
	DW	EXIT
	DW	EXIT			;ARR 2.41
	DW	EXIT			;ARR 2.41
	DW	EXIT			;ARR 2.41
	DW	EXIT			;ARR 2.41
	DW	PRN$TILBUSY
	DW	EXIT			;RS 3.20
	DW	EXIT			;RS 3.20
	DW	PRN$GENIOCTL		;RS 3.20
	DW	EXIT			;RS 3.20
	DW	EXIT			;RS 3.20
	DW	EXIT			;RS 3.20
	DW	CMDERR			;RS 3.20
	DW	CMDERR			;RS 3.20

	EVENB
	PUBLIC	OLD13			;(MOVED HERE FROM IBMBIO2)
OLD13	label	DWORD
	db	'5986'                  ;J.K. 11/7/86 Secrete Code for DOS 3.30 IBMBIO.
	  PUBLIC ORIG13
ORIG13	label	DWORD
	db	'21',0,0                ;J.K. 11/8/86 This is my employee serial # !!!

	EVENB
	PUBLIC	PTRSAV
PTRSAV	DD	0
	PUBLIC	AUXBUF
AUXBUF	DB	0,0,0,0   ;SET OF 1 BYTE BUFFERS FOR COM 1,2,3, AND 4

	EVENB
	PUBLIC PREVOPER,NUMBER_OF_SEC
PREVOPER	DW	?	; HOLDS INT 13 REQUEST (I.E. REGISTER AX).
NUMBER_OF_SEC	DB	?	; HOLDS NUMBER OF SECTORS TO READ ON AN ECC ERROR

	IF	($-CODE) GT 100H
	    %OUT VDISK BUFFER NOT CORRECTLY LOCATED
	ELSE
	    ORG 100H
	ENDIF
	PUBLIC	VDISK_AREA
VDISK_AREA DB	108 DUP(0)		;FOR USE BY VDISK

	EVENB
; WARNING!!!  THESE ARE ADDRESSED TOGETHER IN GETDX
AUXNUM	DB	0			;WHICH AUX DEVICE WAS REQUESTED
	DB	0

	EVENB
	PUBLIC	CONHEADER
CONHEADER LABEL   WORD			  ;HEADER FOR DEVICE "CON"
	DD	AUXDEV2
	DW	1000000000010011B ;CON IN AND CON OUT + SPECIAL
	DW	STRATEGY
	DW	CON$IN
	DB	'CON     '

	EVENB
	PUBLIC	AUXDEV2
AUXDEV2  LABEL	 WORD			 ;HEADER FOR DEVICE "AUX"
	DD	PRNDEV2
	DW	1000000000000000B
	DW	STRATEGY
	DW	AUX0$IN
	DB	'AUX     '

	EVENB
	PUBLIC	PRNDEV2
PRNDEV2  LABEL	 WORD			 ;HEADER FOR DEVICE "PRN"
	DD	TIMDEV
	DW	CHARDEV + OUTTILBUSY + DEV320
	DW	STRATEGY
	DW	PRN0$IN
	DB	'PRN     '

	EVENB
	PUBLIC TIMDEV
TIMDEV	LABEL	WORD
	DD	DSKDEV
	DW	1000000000001000B
	DW	STRATEGY
	DW	TIM$IN
	DB	'CLOCK$  '

	EVENB
	PUBLIC	DSKDEV
DSKDEV	LABEL	WORD
	DD	COM1DEV
	DW	0000100001000010B	;J.K.I1. 32 bit sector calculation
	DW	STRATEGY
	DW	DSK$IN
DRVMAX	DB	4
	PUBLIC DRVMAX

	PUBLIC STEP_DRV
STEP_DRV	DB     -2		; ARR 2.20 LAST DRIVE ACCESSED

	PUBLIC PHYS_DRV
PHYS_DRV	DB	0		; USED BY SETDRIVE FOR GETTING BDS FOR
					; LOGICAL DRIVE, OR PHYSICAL DRIVE.
	PUBLIC FHAVE96
FHAVE96 	DB	0		; FLAG TO INDICATE PRESENCE OF
					;   96TPI SUPPORT
	PUBLIC SINGLE
SINGLE		DB	0		; USED TO DETECT SINGLE DRIVE SYSTEMS

	PUBLIC FHAVEK09
FHAVEK09	DB	0		;INDICATES IF THIS IS A K09 OR NOT
					; USED BY CONSOLE DRIVER.
	PUBLIC NEW_ROM
NEW_ROM 	DB	0		;SET TO 1 IF WE HAVE A ROM THAT CAN
					; HANDLE STRANGE MEDIA LAYOUTS.

	PUBLIC FSETOWNER
FSETOWNER	DB	?		;=1 IF WE ARE SETTING THE OWNER OF A
					;DRIVE. (EXAMINED BY CHECKSINGLE).
	public	Secrete_Code
Secrete_Code	dw	'jk'            ;J.K. 11/7/86 Secrete code for DOS 3.30 IBMBIO.

	EVENB
	PUBLIC COM1DEV
COM1DEV LABEL	WORD
	DD	LPT1DEV
	DW	1000000000000000B
	DW	STRATEGY
	DW	AUX0$IN
	DB	'COM1    '

	EVENB
	PUBLIC LPT1DEV
LPT1DEV LABEL	WORD
	DD	LPT2DEV
	DW	CHARDEV + OUTTILBUSY + DEV320
	DW	STRATEGY
	DW	PRN1$IN
	DB	'LPT1    '

	EVENB
	PUBLIC	LPT2DEV
LPT2DEV LABEL	WORD
	DD	LPT3DEV
	DW	CHARDEV + OUTTILBUSY + DEV320
	DW	STRATEGY
	DW	PRN2$IN
	DB	'LPT2    '

	EVENB
	PUBLIC	LPT3DEV
LPT3DEV LABEL	WORD
	DD	COM2DEV
	DW	CHARDEV + OUTTILBUSY + DEV320
	DW	STRATEGY
	DW	PRN3$IN
	DB	'LPT3    '

	EVENB
	PUBLIC	COM2DEV
COM2DEV LABEL	WORD
	DD	COM3DEV
	DW	1000000000000000B
	DW	STRATEGY
	DW	AUX1$IN
	DB	'COM2    '

	EVENB
	PUBLIC	COM3DEV
COM3DEV LABEL	WORD			;EDK
	DD	COM4DEV
	DW	1000000000000000B
	DW	STRATEGY
	DW	AUX2$IN
	DB	'COM3    '

	EVENB
	PUBLIC	COM4DEV
COM4DEV LABEL	WORD			;EDK
	DW	-1,CODE
	DW	1000000000000000B
	DW	STRATEGY
	DW	AUX3$IN
	DB	'COM4    '

; HARD-WIRE THE LINK TO THE NEXT INT2F HANDLER.
		EVENB
	PUBLIC	NEXT2F_13
NEXT2F_13	LABEL	WORD
	EXTRN INT2F_DISK:FAR		;IBMBIO2
		DD	INT2F_DISK

	EVENB
	PUBLIC START_BDS
START_BDS LABEL WORD
       DD      BDS1	       ;START OF BDS LINKED LIST.
	PUBLIC ACCESSCOUNT
ACCESSCOUNT	DB	0		; NUMBER OF TIMES MEDIA CHECK CALLED
	PUBLIC TIM_DRV
TIM_DRV 	DB	-1		; TIME WHEN LAST DISK I/O PERFORMED
	PUBLIC FLAGBITS
FLAGBITS	DW	0		; BITS TO SET IN FLAG FIELD WHEN DOING
					; A SET_CHANGED_DL
	PUBLIC	MEDBYT
MEDBYT		DB	?

		EVENB
	PUBLIC WRTVERIFY
WRTVERIFY LABEL WORD
	PUBLIC RFLAG
RFLAG		DB	ROMREAD 		;2 FOR READ, 3 FOR WRITE
VERIFY		DB	0			;1 IF VERIFY AFTER WRITE
	PUBLIC SECCNT
SECCNT		DW	0
	  PUBLIC HARDNUM
HARDNUM 	DB	99			;LOGICAL DRIVE NUMBER OF FIRST HARDFILE
	PUBLIC MOTORSTARTUP,SETTLECURRENT,SETTLESLOW
MOTORSTARTUP	DB  ?			; VALUE FROM TABLE
SETTLECURRENT	DB  ?			; VALUE FROM TABLE
SETTLESLOW	DB  ?			; SLOW SETTLE VALUE

NEXTSPEED	DB  ?			; VALUE OF SPEED TO BE USED
	public	save_head_sttl
Save_head_sttl	db  ?		;used by READ_SECTOR routine

	    PUBLIC EOT
EOT		DB  9

		EVENB
	PUBLIC DPT
DPT		DD  ?

;KEEP THE NEXT TWO ITEMS CONTIGUOUS - SEE IOCTL_BLOCK FOR REASON
	PUBLIC CURSEC,CURHD,CURTRK,SPSAV
CURSEC	DB	0			;CURRENT SECTOR
CURHD	DB	0			;CURRENT HEAD
CURTRK	DW	0			;CURRENT TRACK
SPSAV	DW	0			;SAVE THE STACK POINTER

; THE FOLLOWING ARE USED FOR IOCTL FUNCTION CALLS
	PUBLIC FORMT_EOT,HDNUM,TRKNUM,GAP_PATCH
FORMT_EOT	DB	8		    ; EOT USED FOR FORMAT
HDNUM		DB	0		    ; HEAD NUMBER
TRKNUM		DW	0		    ; TRACK BEING MANIPULATED
GAP_PATCH	DB	50H		    ; FORMAT GAP PATCHED INTO DPT

;DISK ERRORS RETURNED FROM THE IBM ROM
	PUBLIC ERRIN
ERRIN	LABEL	BYTE
	db	0cch			;AN002; Write Fault error
	DB	80H			;NO RESPONSE
	DB	40H			;SEEK FAILURE
	DB	10H			;BAD CRC
	DB	8			;DMA OVERRUN
	DB	6			; MEDIA CHANGE
	DB	4			;SECTOR NOT FOUND
	DB	3			;WRITE ATTEMPT TO WRITE-PROTECT DISK
	PUBLIC LSTERR
LSTERR	DB	0			;ALL OTHER ERRORS

;RETURNED ERROR CODES CORRESPONDING TO ABOVE
	PUBLIC ERROUT
ERROUT	LABEL	BYTE
	db	10			;AN002; Write Fault error
	DB	2			;NO RESPONSE
	DB	6			;SEEK FAILURE
	DB	4			;BAD CRC
	DB	4			;DMA OVERRUN
	DB	15			; INVALID MEDIA CHANGE
	DB	8			;SECTOR NOT FOUND
	DB	0			;WRITE ATTEMPT ON WRITE-PROTECT DISK
	DB	12			;GENERAL ERROR
	PUBLIC NUMERR
NUMERR	=	ERROUT-ERRIN

;-------------------------------------------------------------

;   READ IN BOOT SECTOR HERE,  READ DONE IN READBOOT.
;   ALSO READ SECTOR FOR DMA CHECK FOR HARD DISK.

;J.K. The buffer for a disk sector is going to be at a double word boundary
;     for 80386 machine.

	IF ($-CODE) Mod 4				;AN001;
		Org ($-CODE)+4-(($-CODE) Mod 4) 	;AN001;
	ENDIF						;AN001;

       PUBLIC DISKSECTOR
DiskSector		DB	11 DUP(?) ; TAKE CARE OF 3 JUMP BYTES PLUS OEM NAME.
	PUBLIC BPB_IN_SECTOR
Bpb_In_Sector		DW	?
	PUBLIC SECPERCLUSINSECTOR
SecPerClusInSector	DB	?
			DW	?
	public NumberOfFats
NumberOfFats		DB	?
			DW	?
			DW	?
	PUBLIC MEDIABYTE
MediaByte		DB	?
			DW	?
			DW	?
			DW	?
			DW	?
			DW	?	;AN000; Extended Hidden sector (high)
			DW	?	;AN000; Extended Total sector (low)
			DW	?	;AN000; Extended Total sector (high)
			db	?	;AN003; PHYDRV in boot record.
			db	?	;AN003; CURRENT HEAD in boot record.
	public Ext_Boot_Sig
Ext_Boot_Sig		DB	?	;AN000; Extended Boot record sig. (=90h)
	public Boot_Serial_L
Boot_Serial_L		DW	?	;AN000; Boot volume serial number (Low)
	public Boot_Serial_H
Boot_Serial_H		DW	?	;AN000; Boot volume serial number (High)
	public Boot_Volume_Label
Boot_Volume_Label	DB	11 dup (' ') ;AN000; Volume label
	public Boot_System_ID
Boot_System_ID		DB	8  dup (' ') ;AN000; File system Id.
			DB	512-($-DISKSECTOR) DUP (?)

;*********************************************************************
;	"BDS" CONTAINS INFORMATION FOR EACH DRIVE IN THE SYSTEM.
;	VARIOUS VALUES ARE PATCHED WHENEVER ACTIONS ARE PERFORMED.
;	SECTORS/ALLOC. UNIT IN BPB INITIALLY SET TO -1 TO SIGNIFY THAT
;	THE BPB HAS NOT BEEN FILLED. LINK ALSO SET TO -1 TO SIGNIFY END
;	OF LIST. # OF CYLINDERS IN MAXPARMS INITIALIZED TO -1 TO INDICATE
;	THAT THE PARAMETERS HAVE NOT BEEN SET.
;
	EVENB
BDS1	LABEL	WORD
	DD	BDS2			;LINK TO NEXT STRUCTURE
	DB	0			;INT 13 DRIVE NUMBER
	DB	0			;LOGICAL DRIVE LETTER
	PUBLIC	FDRIVE1
FDRIVE1 DW	512			;PHYSICAL SECTOR SIZE IN BYTES
	DB	-1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	64			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	00000000B		;MEDIA DESCRIPTOR, INITIALLY 00H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	1			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT (low word)
	dw	0			;J.K. Hidden sector (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	0			; TRUE => LARGE FATS
OPCNT1	DW	0			;OPEN REF. COUNT

	DB	3			;FORM FACTOR
FLAGS1	DW	0020H			;VARIOUS FLAGS
;	DB	9 DUP (0)		;RESERVED FOR FUTURE USE
	DW	40			; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB1 DW	512			;BYTES PER SECTOR
	DB	1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	0E0H			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	0F0H			;MEDIA DESCRIPTOR, INITIALLY F0H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	2			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT(low)
	dw	0			;J.K. Hidden sector count (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	6 DUP (?)
TRACK1	DB	-1			;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO1 DW	-1			;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI1 DW	-1
VOLID1	DB	"NO NAME    ",0         ;VOLUME ID FOR THIS DISK
VOLSER1 dd	0	     ;Current volume serial number from Boot record
SYSID1	db	"FAT12   ",0 ;Current file system id from Boot record

	EVENB
BDS2	LABEL	WORD
	DD	BDS3			;LINK TO NEXT STRUCTURE
	DB	0			;INT 13 DRIVE NUMBER
	DB	0			;LOGICAL DRIVE LETTER
	PUBLIC	FDRIVE2
FDRIVE2 DW	512			;PHYSICAL SECTOR SIZE IN BYTES
	DB	-1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	64			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	00000000B		;MEDIA DESCRIPTOR, INITIALLY 00H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	1			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT (low word)
	dw	0			;J.K. Hidden sector (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	0			; TRUE => LARGE FATS
OPCNT2	DW	0			;OPEN REF. COUNT
	DB	3			;FORM FACTOR
FLAGS2	DW	0020H			;VARIOUS FLAGS
;	DB	9 DUP (0)		;RESERVED FOR FUTURE USE
	DW	40			; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB2 DW	512			;BYTES PER SECTOR
	DB	1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	0E0H			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	0F0H			;MEDIA DESCRIPTOR, INITIALLY F0H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	2			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT(low)
	dw	0			;J.K. Hidden sector count (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	6 DUP (?)
TRACK2	DB	-1			;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO2 DW	-1			;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI2 DW	-1
VOLID2	DB	"NO NAME    ",0         ;VOLUME ID FOR THIS DISK
VOLSER2 dd	0	     ;Current volume serial number from Boot record
SYSID2	db	"FAT12   ",0 ;Current file system id from Boot record

	EVENB
BDS3	LABEL	WORD
	DD	BDS4			;LINK TO NEXT STRUCTURE
	DB	0			;INT 13 DRIVE NUMBER
	DB	0			;LOGICAL DRIVE LETTER
	PUBLIC	FDRIVE3
FDRIVE3 DW	512			;PHYSICAL SECTOR SIZE IN BYTES
	DB	-1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	64			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	00000000B		;MEDIA DESCRIPTOR, INITIALLY 00H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	1			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT (low word)
	dw	0			;J.K. Hidden sector (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	0			; TRUE => LARGE FATS
OPCNT3	DW	0			;OPEN REF. COUNT
	DB	3			;FORM FACTOR
FLAGS3	DW	0020H			;VARIOUS FLAGS
;	DB	9 DUP (0)		;RESERVED FOR FUTURE USE
	DW	40			; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB3 DW	512			;BYTES PER SECTOR
	DB	1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	0E0H			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	0F0H			;MEDIA DESCRIPTOR, INITIALLY F0H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	2			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT(low)
	dw	0			;J.K. Hidden sector count (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	6 DUP (?)
TRACK3	DB	-1			;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO3 DW	-1			;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI3 DW	-1
VOLID3	DB	"NO NAME    ",0         ;VOLUME ID FOR THIS DISK
VOLSER3 dd	0	     ;Current volume serial number from Boot record
SYSID3	db	"FAT12   ",0 ;Current file system id from Boot record

	EVENB
BDS4	LABEL	WORD
	DW	-1			;LINK TO NEXT STRUCTURE
	DW	CODE
	DB	0			;INT 13 DRIVE NUMBER
	DB	0			;LOGICAL DRIVE LETTER
	PUBLIC	FDRIVE4
FDRIVE4 DW	512			;PHYSICAL SECTOR SIZE IN BYTES
	DB	-1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	64			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	00000000B		;MEDIA DESCRIPTOR, INITIALLY 00H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	1			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT (low word)
	dw	0			;J.K. Hidden sector (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	0			; TRUE => LARGE FATS
OPCNT4	DW	0			;OPEN REF. COUNT
	DB	3			;FORM FACTOR
FLAGS4	DW	0020H			;VARIOUS FLAGS
;	DB	9 DUP (0)		;RESERVED FOR FUTURE USE
	DW	40			; NUMBER OF CYLINDERS
; RECOMMENDED BPB FOR DRIVE.
RECBPB4 DW	512			;BYTES PER SECTOR
	DB	1			;SECTORS/ALLOCATION UNIT
	DW	1			;RESERVED SECTORS FOR DOS
	DB	2			;NO. ALLOCATION TABLES
	DW	0E0H			;NUMBER DIRECTORY ENTRIES
	DW	9*40			;NUMBER SECTORS (AT 512 BYTES EA.)
	DB	0F0H			;MEDIA DESCRIPTOR, INITIALLY F0H.
	DW	2			;NUMBER OF FAT SECTORS
	DW	9			;SECTOR LIMIT
	DW	2			;HEAD LIMIT
	DW	0			;HIDDEN SECTOR COUNT(low)
	dw	0			;J.K. Hidden sector count (high)
	dw	0			;J.K. Number sectors (low)
	dw	0			;J.K. Number sectors (high)
	DB	6 DUP (?)
TRACK4	DB	-1			;LAST TRACK ACCESSED ON THIS DRIVE
TIM_LO4 DW	-1			;KEEP THESE TWO CONTIGUOUS (?)
TIM_HI4 DW	-1
VOLID4	DB	"NO NAME    ",0         ;VOLUME ID FOR THIS DISK
VOLSER4 dd	0	     ;Current volume serial number from Boot record
SYSID4	db	"FAT12   ",0 ;Current file system id from Boot record

BPBTYPE STRUC
SPF	DB	?
SPT	DB	?
CDIRE	DB	?
CSEC	DW	?
SPA	DB	?
CHEAD	DB	?
BPBTYPE ENDS
	PUBLIC SM92
SM92	BPBTYPE <3,9,70H,2*9*80,2,2>

;-----------------------------------------------
;
;	C O N - CONSOLE DEVICE DRIVER
;
	PUBLIC	ALTAH
ALTAH	DB	0			;SPECIAL KEY HANDLING
	public	KEYRD_Func
KEYRD_Func DB	0			;AN000; Default is conventional keyboard read
	public	KEYSTS_Func
KEYSTS_Func DB	1			;AN000; Defualt if conventional keyboard status check.

;	 PUBLIC  SAV_SC_INFO		 ;J.K. 4/29/86 FOR CON$GENIOCTL
;	 PUBLIC  SAV_SC_MODE
;	 PUBLIC  SAV_SC_COLORS
;	 PUBLIC  SAV_SC_WIDTH
;	 PUBLIC  SAV_SC_LENGTH
;SAV_SC_INFO	 LABEL	 BYTE
;SAV_SC_MODE	 DB	 0
;SAV_SC_COLORS	 DW	 0
;SAV_SC_WIDTH	 DW	 0
;SAV_SC_LENGTH	 DW	 0		 ;J.K. 4/29/86 FOR CON$GENIOCTL

;-------------------------------------------------------------
;
;	P R N - PRINTER DEVICE
;
	PUBLIC PRINTDEV
PRINTDEV	DB	0		; INDEX INTO ABOVE ARRAY

; THE FOLLOWING VARIABLE CAN BE MODIFIED VIA IOCTL SUB-FUNCTION 16. IN THIS
; WAY, THE WAIT CAN BE SET TO SUIT THE SPEED OF THE PARTICULAR PRINTER BEING
; USED. ONE FOR EACH PRINTER DEVICE.

		EVENB
	PUBLIC WAIT_COUNT
WAIT_COUNT	DW	4 DUP (50H)	; ARRAY OF RETRY COUNTS FOR PRINTER

		EVENB
	PUBLIC DAYCNT
DAYCNT	DW	0


	IF	iTEST		 ;Testing Mode for IBMBIO.
	    PUBLIC  NUMBUF
NUMBUF	    DB	    5 DUP (?)
	    PUBLIC  DIGITS
DIGITS	    DB	    "0123456789ABCDEF"
	    PUBLIC  FTESTBITS
;FTESTBITS   DW      FTESTDISK+FTESTINIT
FTESTBITS   DW	    fTestDISK
;ftestbits dw ftestclock
	ENDIF

	PATHEND 001,BIO
