1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
####################
# Read Disk Sector #
####################
System programming:
-------------------
(Int 13h, ah=2)
in 1f7 until BSY cleared
out 1f2, AL # number of sectors
out 1f3, cl (bits 0-5) # starting sector number
out 1f4, ch # cylinder number bits 0..7, 0 based
out 1f5, cl (bits 6,7) & dh (bits 6,7) # cyl, bits 8..9, 10..11
out 1f6, dh (bits 0..3) --> bits 0..3 # head number
dh (bits 4..5) --> ??? # head number
dl (bit 0) --> bit 4 # drive number
out 1f7, 0x20 # read sectors command normal
Drive response:
---------------
* drive sets the busy bit in Status Reg to 1
* if command parameters are wrong:
> drive sets the aborted-command bit in the Error register and
error bit in the Status register to 1.
> Drive also sets the busy bit in the Status register to 0.
> Drive then generates an interrupt to the system.
* else:
> drive executes an implied seek to desired track and
reads sectors into sector buffer
> when sector buffer is filled and the data is ready to be
transferred, the drive sets the data-request bit to 1, sets
the busy bit to 0, and generates an interrupt.
> on a single-sector transfer, after the system has transferred
the data, the drive sets the data-request bit and the busy bit to 0.
> on a multiple-sector transfer, after the system has transferred
the first sector of data, the drive sets the data-request bit to 0,
and the busy bit to 1. When each subsequent sector is ready to be
transferred, the drive sets the data-request bit to 1, the busy bit to 0,
and generates an interrupt. When the system has tranferred the last sector,
the drive sets the data-request bit and busy bit to 0.
|