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