home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Unsorted BBS Collection
/
thegreatunsorted.tar
/
thegreatunsorted
/
programming
/
misc_programming
/
fd.spc
< prev
next >
Wrap
Text File
|
1990-01-05
|
11KB
|
332 lines
Specification of Diskette service (INT 13h)
-------------------------------------------
function:
AH = 00H reset diskette drive
AH = 01H read status
AH = 02H read the desired sectors into buffer
AH = 03H write the desired sectors from buffer
AH = 04H verify the desired sectors
AH = 05H format the desired track
AH = 06H - 07H reserved
AH = 08H read drive parameters
AH = 09H - 14H reserved
AH = 15H read DASD type
AH = 16H disk change line status
AH = 17H set DASD type for format
AH = 18H set media type for format
AH = 19H - 0FFH reserved
input :
AH = function number (value check)
AL = number of sectors (non-value check)
DH = head number (non-value check)
DL = drive number (value check)
CH = cylinder number - low 8 bits (non-value check)
CL = sector number - bits 0-5 (non-value check)
bits 6-7 are high 2 cylinder bits
ES:BX = transfer buffer address
output :
carry flag = 1 operation error
0 operation correct
AH -- status of operation
= 80H - time out
= 00H - no error
reference BIOS data area:
03EH -- byte -- seek status
03FH -- byte -- motor status port 3F2H
040H -- byte -- motor off count
041H -- byte -- diskette status
042H - 48H (7 bytes)
08BH -- byte -- data transfer rate save area
08FH -- reserved
090H (drive 0) 091H (drive 1) -- byte -- diskette state machine
094H (drive 0) 095H (drive 1) -- byte -- present cylinder number
port definition:
port 3F0H -- status register A (read-only)
port 3F1H -- status register B (read-only)
port 3F2H -- digital output register (write-only)
port 3F4H -- main status register(read-only)
port 3F5H -- data register(read/write)
note 1 : This interrupt support 2 diskette drives
note 2 : This interrupt support 360K, 720K, 1.2M and 1.44M diskette
drives.
note 3 : This interrupt supprot the following drive and media
combination:
media drive data rate sector/track
320K 360K 250K bps 8
360K 360K 250K bps 9
320K 1.2M 300K bps 8
360K 1.2M 300K bps 9
1.2M 1.2M 500K bps 15
720K 720K 250K bps 9
720K 1.44M 250K bps 9
1.44M 1.44M 500K bps 18
note 4 : When read or write memory (read/write/verify/format diskette),
use DMA channel 2.
note 5 : The FDC use IRQ6 to acknowlege command completion. In PC/AT,
EISA, it use edge trigger so IRQ6's service routine just set flag
before send EOI to interrupt controller(8259). In PS/2 MCA, it use
level trigger so IRQ6's service routine must clear interrupt
pending signal before send EOI to interrupt controller(8259).
note 6 : The INT 1EH point to active diskette parameter table
note 7 : Issuing a command, you must delay 45 micro-second between one
command byte and next command byte.
note 8 : It must turn motor on before issue any command to FDC or read
disk change line's status.
note 9 : It means media changed when disk change line active. depend on
model, disk change line may be active high or active low. Please
check it before designning.
note 10: It must delay about 550 ms after turn motor on. This time is
called motor start time. The motor from off to on and speed up
spindle to 360 rps will spend 550 ms.
note 11: This interrupt just support turn motor on and set motor off
time. Depend on motor off time, system timer service routine
(INT 8) will turn motor off.
note 12: It must delay about 15 ms after moving read/write head. This
time called head settling time. The head settling time used to
let head settle down at desired track.
note 13: It must reset FDC when disk change line inactive and FDC
abnormal. -- FOR DEC NET problem
note 14: Prior to waiting for the disk interrupt, call INT 15, ah = 90h
(device bysy) with al = 01h (type = diskette) informing the
operating system of the wait.
note 15: Prior to turn motor on, call INT 15, ax = 90fdh(diskette drive
motor start) informing the operating system to perform a different
task.
note 16: DASD - Direct Access Storge Device
RESET DISKETTE
input : AH = 0
DL = drive number
output: AH = status
CY = 1 if error , CY=0 if ok
note 1 : This function must reserved motor status during reset FDC.
note 2 : This function must clear corresponding BIOS data.
note 3 : This function must send specify command to FDC
READ THE STATUS
input : AH = 1
DL = drive number
output: AH = status of the system
CY = 1 if error , CY=0 if ok
READ SECTORS
input : AH = 2
AL - number of sectors
CH - track number
CL - sector number - bits 0-5 (non-value check)
bits 6-7 are high 2 cylinder bits
DL - drive number
DH - head number
ES:BX - address of buffer
output: AH = status
AL = number of transfer
CY = 1 if error , CY=0 if ok
WRITE SECTORS
input : AH = 3
AL - number of sectors
CH - track number
CL - sector number - bits 0-5 (non-value check)
bits 6-7 are high 2 cylinder bits
DL - drive number
DH - head number
ES:BX - address of buffer
output: AH = status
AL = number of transfer
CY = 1 if error , CY=0 if ok
VERIFY SECTORS
input : AH = 4
AL - number of sectors
CH - track number
CL - sector number - bits 0-5 (non-value check)
bits 6-7 are high 2 cylinder bits
DL - drive number
DH - head number
output: AH = status
AL = number of transfer
CY = 1 if error , CY=0 if ok
FORMAT TRACK
input : AH = 5
AL - number of sectors
CH - track number
CL - sector number - bits 0-5 (non-value check)
bits 6-7 are high 2 cylinder bits
DL - drive number
DH - head number
ES:BX - address of buffer
output: AH = status
CY = 1 if error , CY=0 if ok
note 1 : The no. of fields in the buffer is the same as the no. of
sectors in a track.
note 2 : Each field contains 4 bytes. The following is the field format:
1'st byte -- track number
2'nd byte -- head number
3'th byte -- sector number
4'th byte -- byte/sector
00 - 128 bytes
01 - 256 bytes
02 - 512 bytes
03 - 1024 bytes
note 3 : This function doesn't support change data rate. Before issue
this function, user must issue function 17H or 18H to set desired
data rate.
READ DRIVE PARAMETERS
input : ah = 8
dl - drive number
output: AX = 0
BH = 0
BL - bit 7 - 4 = 0
3 - 0 - valid drive type
01 - 360K drive
02 - 1.2M drive
03 - 720K drive
04 - 1.44 drive
CH - maximum number of tracks (low order 8 bits)
CL - bit 7,6 - maximum number of tracks (high order 2 bits)
DL = drive number
READ DASD TYPE
input : ah = 15H
dl - drive number
output: AH - 00 - drive not present
01 - diskette, no change line available
02 - diskette, change line available
03 - fixed disk
DISK CHANGE LINE
input : AH = 16H
DL = drive (0-1)
output: AH = 00H ,CY=0 disk change line not active
01H ,CY=1 invalid drive number
06H ,CY=1 disk change line active & carry bit on
80H ,CY=1 diskette drive not ready
SET DASD TYPE FOR FORMAT
input : AH = 17H
AL - 00 - invalid request
01 - 360K diskette in 360K diskette drive
02 - 360K diskette in 1.2M diskette drive
03 - 1.2M diskette in 1.2M diskette drive
04 - 720K diskette in 720K diskette drive
05-0FFH -- invalid request
DL - drive number
output: AH = status of operation
CY = 0 successful operation
CY = 1 failed operation
note 1 : This function will try to inactive disk change line. If the
attempt succeeds, set the desired data rate for format. If the
attempt fails, return time out error code.
SET MEDIA TYPE FOR FORMAT
input : AH = 18H
CH - number of tracks (low order 8 bits)
CL - bit 7,6 - number of tracks (high order 2 bits)
bit 5 - 0 - sector per track
DL - drive number
output: AH = status of operation
CY = 0 successful operation
CY = 1 failed operation
ES:DI = point to 11-byte parameter table for desired
media type, unchanged if AH <> 0.
note 1 : This function will try to inactive disk change line. If the
attempt succeeds, set the desired data rate for format. If the
attempt fails, return time out error code.
note 2 : The following is the format of parameter table :
1'st byte - 1'st specify byte
2'nd byte - 2'nd specify byte
3'th byte - motor off time
4'th byte - 512 bytes/sector
5'th byte - EOT : last sector on track
6'th byte - GAP length
7'th byte - DTL
8'th byte - GAP length for format
9'th byte - fill byte for format
10'th byte - head settling time
11'th byte - motor start time