Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Peter Norton Programmer's Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

  As we mentioned near the beginning of this chapter, the ROM BIOS maintains
  a set of disk-base tables that describe the capabilities of each diskette
  drive and fixed-disk drive in the computer. During system startup, the ROM
  BIOS associates an appropriate disk-base table with each fixed-disk drive.
  (In the PC/AT and PS/2s, a data byte in the nonvolatile CMOS RAM
  designates which of several ROM tables to use.) There is no reason to
  change the parameters in the fixed-disk tables once they have been set up
  by the ROM BIOS. Doing so may lead to garbled data on the disk.

  The situation is different in the case of diskette drives. The parameters
  in the disk-base table associated with a diskette drive may need to be
  updated to accommodate different diskette formats. We'll spend the next
  few pages describing the structure of a disk-base table for a diskette
  drive and showing how a modified table can be useful.

  The disk-base table comprises the 11 bytes shown in Figure 10-7.

  Bytes 0 and 1 are referred to as the specify bytes. They are part of the
  command strings sent to the diskette-drive controller, which in IBM's
  technical reference manuals is also called the NEC (Nippon Electric
  Company) controller. The 4 high-order bits of byte 0 specify the step-rate
  time (SRT), which is the time the drive controller allows for the drive
  heads to move from track to track. The default ROM BIOS SRT value for
  diskette drives is conservative; for some drives, DOS reduces this value
  to speed up drive performance.

  Byte 2 specifies how long the diskette motor is to be left running after
  each operation. The motor is left on in case the diskette is needed again.
  The value is in units of clock ticks (roughly 18.2 ticks per second). All
  versions of the table have this set to 37 (25H)--meaning that the motor
  stays on for about 2 seconds.

  Offset         Use
  --------------------------------------------------------------------------
  00H            Specify byte 1: step-rate time, head-unload time
  01H            Specify byte 2: head-load time, DMA mode
  02H            Wait time until diskette motor turned off
  03H            Bytes per sector: 0 = 128; 1 = 256; 2 = 512; 3 = 1024
  04H            Last sector number
  05H            Gap length between sectors for read/write operations
  06H            Data length when sector length not specified
  07H            Gap length between sectors for formatting operations
  08H            Data value stored in formatted sectors
  09H            Head-settle time
  0AH            Motor start-up time
  --------------------------------------------------------------------------

  Figure 10-7.  The use of the 11 bytes in the disk-base table for a
  diskette drive.

  Byte 3 gives the sector length code--the same N code used in the format
  operation. (See page 203 under service 05H.) This is normally set to 2,
  representing the customary sector length of 512 bytes. In any read, write,
  or verify operation, the length code in the disk base must be set to the
  proper value, especially when working with sectors of unconventional
  length.

  Byte 4 gives the sector number of the last sector on the track.

  Byte 5 specifies the gap size between sectors, which is used when reading
  or writing data. In effect, it tells the diskette-drive controller how
  long to wait before looking for the next sector's address marking so that
  it can avoid looking at nonsense on the diskette. This length of time is
  known as the search gap.

  Byte 6 is called the data transfer length (DTL) and is set to FFH (decimal
  255). This byte sets the maximum data length when the sector length is not
  specified.

  Byte 7 sets the gap size between sectors when a track is formatted.
  Naturally, it is bigger than the search gap at offset 5. The normal format
  gap-size value varies with the diskette drive. For example, the value is
  54H for the PC/AT's 1.2 MB drive and 6CH for 3-1/2-inch PS/2 diskette
  drives.

  Byte 8 provides the data value stored in each byte of the sectors when a
  diskette track is formatted. The default value is F6H, the division
  symbol. You can change it to anything you want, if you can think of a good
  reason to do so.

  Byte 9 sets the head-settle time, which is how long the system waits for
  vibration to end after seeking to a new track. This value also depends on
  the drive hardware. On the original PC, the value was 19H (25
  milliseconds), but the ROM BIOS default for the PC/AT 1.2 MB drive and the
  PS/2 diskette drives is only 0FH (15 milliseconds).

  Byte 0AH (decimal 10), the final byte of the disk-base table, sets the
  amount of time allowed for the diskette-drive motor to get up to speed and
  is measured in 1/8 seconds.

  It's fun to tinker with the disk-base values; there are enough of them to
  give you an opportunity for all sorts of excitement and mischief. To do
  this, you need to write a program that builds your customized disk-base
  table in a buffer in memory. Then tell the ROM BIOS to use your table by
  carrying out the following steps:

  1.  Save the segmented address of the current disk base table. (This is
      the value in the interrupt 1EH vector, 0000:0078H.)

  2.  Store the segmented address of your modified table in the interrupt
      1EH vector.

  3.  Call ROM BIOS disk service 00H to reset the disk system. The ROM BIOS
      will reinitialize the diskette-drive controller with parameters from
      your table.

  When you're finished, be sure to restore the address of the previous
  disk-base table and reset the disk system again.

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson