home *** CD-ROM | disk | FTP | other *** search
/ The Unsorted BBS Collection / thegreatunsorted.tar / thegreatunsorted / programming / misc_programming / fd.spc < prev    next >
Text File  |  1990-01-05  |  11KB  |  332 lines

  1.  
  2.                    Specification of Diskette service (INT 13h)
  3.                    -------------------------------------------
  4.  
  5. function:
  6.  
  7.         AH = 00H  reset diskette drive
  8.         AH = 01H  read status
  9.         AH = 02H  read the desired sectors into buffer
  10.         AH = 03H  write the desired sectors from buffer
  11.         AH = 04H  verify the desired sectors
  12.         AH = 05H  format the desired track
  13.         AH = 06H - 07H reserved
  14.         AH = 08H  read drive parameters
  15.         AH = 09H - 14H reserved
  16.         AH = 15H  read DASD type
  17.         AH = 16H  disk change line status
  18.         AH = 17H  set DASD type for format
  19.         AH = 18H  set media type for format
  20.         AH = 19H - 0FFH reserved
  21.  
  22. input :
  23.  
  24.         AH = function number   (value check)
  25.         AL = number of sectors (non-value check)
  26.         DH = head number       (non-value check)
  27.         DL = drive number      (value check)
  28.         CH = cylinder number - low 8 bits  (non-value check)
  29.         CL = sector number - bits 0-5      (non-value check)
  30.              bits 6-7 are high 2 cylinder bits
  31.         ES:BX = transfer buffer address
  32.  
  33. output :
  34.  
  35.         carry flag = 1 operation error
  36.                      0 operation correct
  37.  
  38.         AH -- status of operation
  39.               = 80H - time out
  40.               = 00H - no error
  41.  
  42.  
  43. reference BIOS data area:
  44.  
  45.         03EH -- byte -- seek status
  46.         03FH -- byte -- motor status  port 3F2H
  47.         040H -- byte -- motor off count
  48.         041H -- byte -- diskette status
  49.         042H - 48H  (7 bytes)
  50.         08BH -- byte -- data transfer rate save area
  51.         08FH -- reserved
  52.         090H (drive 0) 091H (drive 1) -- byte -- diskette state machine
  53.         094H (drive 0) 095H (drive 1) -- byte -- present cylinder number
  54.  
  55. port definition:
  56.  
  57.         port 3F0H -- status register A (read-only)
  58.         port 3F1H -- status register B (read-only)
  59.         port 3F2H -- digital output register (write-only)
  60.         port 3F4H -- main status register(read-only)
  61.         port 3F5H -- data register(read/write)
  62.  
  63.  
  64. note 1 :   This interrupt support 2 diskette drives
  65.  
  66. note 2 :   This interrupt support 360K, 720K, 1.2M and 1.44M diskette 
  67.            drives.
  68.  
  69. note 3 :   This interrupt supprot the following drive and media 
  70.            combination:
  71.  
  72.             media     drive       data rate     sector/track
  73.  
  74.             320K      360K        250K bps       8
  75.             360K      360K        250K bps       9
  76.             320K      1.2M        300K bps       8
  77.             360K      1.2M        300K bps       9
  78.             1.2M      1.2M        500K bps       15
  79.             720K      720K        250K bps       9
  80.             720K      1.44M       250K bps       9
  81.             1.44M     1.44M       500K bps       18
  82.  
  83. note 4 :   When read or write memory (read/write/verify/format diskette),
  84.            use DMA channel 2.
  85.  
  86. note 5 :   The FDC use IRQ6 to acknowlege command completion. In PC/AT, 
  87.          EISA, it use edge trigger so IRQ6's service routine just set flag
  88.          before send EOI to interrupt controller(8259). In PS/2 MCA, it use
  89.          level trigger so IRQ6's service routine must clear interrupt 
  90.          pending signal before send EOI to interrupt controller(8259).
  91.  
  92.  
  93. note 6 :   The INT 1EH point to active diskette parameter table
  94.  
  95. note 7 :   Issuing a command, you must delay 45 micro-second between one
  96.            command byte and next command byte.
  97.  
  98. note 8 :   It must turn motor on before issue any command to FDC or read
  99.        disk change line's status.
  100.  
  101. note 9 :   It means media changed when disk change line active. depend on
  102.        model, disk change line may be active high or active low. Please
  103.        check it before designning.
  104.  
  105. note 10:   It must delay about 550 ms after turn motor on. This time is
  106.        called motor start time. The motor from off to on and speed up
  107.        spindle to 360 rps will spend 550 ms.
  108.  
  109. note 11:   This interrupt just support turn motor on and set motor off
  110.          time. Depend on motor off time, system timer service routine
  111.          (INT 8) will turn motor off.
  112.  
  113. note 12:   It must delay about 15 ms after moving read/write head. This
  114.          time called head settling time. The head settling time used to
  115.          let head settle down at desired track.
  116.  
  117. note 13:   It must reset FDC when disk change line inactive and FDC 
  118.          abnormal. --  FOR DEC NET problem
  119.  
  120. note 14:   Prior to waiting for the disk interrupt, call INT 15, ah = 90h 
  121.        (device bysy) with al = 01h (type = diskette) informing the 
  122.        operating system of the wait.
  123.  
  124. note 15:   Prior to turn motor on, call INT 15, ax = 90fdh(diskette drive
  125.        motor start) informing the operating system to perform a different
  126.        task.
  127.  
  128. note 16: DASD - Direct Access Storge Device
  129.  
  130.  
  131. RESET DISKETTE
  132.  
  133.         input :   AH = 0
  134.                   DL = drive number
  135.  
  136.         output:   AH = status
  137.                   CY = 1 if error , CY=0 if ok
  138.  
  139. note 1 :   This function must reserved motor status during reset FDC.
  140.  
  141. note 2 :   This function must clear corresponding BIOS data.
  142.  
  143. note 3 :   This function must send specify command to FDC
  144.  
  145.  
  146. READ THE STATUS
  147.  
  148.         input :   AH = 1
  149.                   DL = drive number
  150.  
  151.         output:   AH = status of the system
  152.                   CY = 1 if error , CY=0 if ok
  153.  
  154.       
  155. READ SECTORS
  156.  
  157.         input :   AH = 2
  158.                   AL - number of sectors
  159.                   CH - track number
  160.                   CL - sector number - bits 0-5      (non-value check)
  161.                        bits 6-7 are high 2 cylinder bits
  162.                   DL - drive number
  163.                   DH - head number
  164.                   ES:BX - address of buffer
  165.  
  166.         output:   AH = status
  167.                   AL = number of transfer
  168.                   CY = 1 if error , CY=0 if ok
  169.  
  170.  
  171.  
  172. WRITE SECTORS
  173.  
  174.         input :      AH = 3
  175.                   AL - number of sectors
  176.                   CH - track number
  177.                   CL - sector number - bits 0-5      (non-value check)
  178.                        bits 6-7 are high 2 cylinder bits
  179.                   DL - drive number
  180.                   DH - head number
  181.                   ES:BX - address of buffer
  182.  
  183.         output:   AH = status
  184.                   AL = number of transfer
  185.                   CY = 1 if error , CY=0 if ok
  186.  
  187.  
  188. VERIFY SECTORS
  189.  
  190.         input :   AH = 4
  191.                   AL - number of sectors
  192.                   CH - track number
  193.                   CL - sector number - bits 0-5      (non-value check)
  194.                        bits 6-7 are high 2 cylinder bits
  195.                   DL - drive number
  196.                   DH - head number
  197.  
  198.         output:   AH = status
  199.                   AL = number of transfer
  200.                   CY = 1 if error , CY=0 if ok
  201.  
  202.  
  203. FORMAT TRACK
  204.  
  205.         input :   AH = 5
  206.                   AL - number of sectors
  207.                   CH - track number
  208.                   CL - sector number - bits 0-5      (non-value check)
  209.                        bits 6-7 are high 2 cylinder bits
  210.                   DL - drive number
  211.                   DH - head number
  212.                   ES:BX - address of buffer
  213.  
  214.         output:   AH  = status
  215.                   CY  = 1 if error , CY=0 if ok
  216.  
  217. note 1 :   The no. of fields in the buffer is the same as the no. of
  218.          sectors in a track.
  219.  
  220. note 2 :   Each field contains 4 bytes. The following is the field format:
  221.  
  222.                1'st byte -- track number
  223.                2'nd byte -- head number
  224.                3'th byte -- sector number
  225.                4'th byte -- byte/sector
  226.                        00 - 128  bytes
  227.                        01 - 256  bytes
  228.                        02 - 512  bytes
  229.                        03 - 1024 bytes
  230.  
  231. note 3 :   This function doesn't support change data rate. Before issue
  232.        this function, user must issue function 17H or 18H to set desired
  233.        data rate.
  234.  
  235.       
  236. READ DRIVE PARAMETERS
  237.  
  238.         input :   ah = 8
  239.                   dl - drive number
  240.  
  241.         output:      AX = 0
  242.                   BH = 0
  243.                   BL - bit 7 - 4 = 0
  244.                            3 - 0 - valid drive type
  245.                             01 - 360K drive
  246.                             02 - 1.2M drive
  247.                             03 - 720K drive
  248.                             04 - 1.44 drive
  249.                   CH - maximum number of tracks (low order 8 bits)
  250.                   CL - bit 7,6 - maximum number of tracks (high order 2 bits)
  251.                   DL = drive number
  252.  
  253.  
  254. READ DASD TYPE
  255.  
  256.         input :   ah = 15H
  257.                   dl - drive number
  258.  
  259.         output:   AH - 00 - drive not present
  260.                        01 - diskette, no change line available
  261.                        02 - diskette, change line available
  262.                        03 - fixed disk
  263.  
  264.  
  265.  
  266. DISK CHANGE LINE
  267.  
  268.         input :   AH = 16H
  269.                   DL = drive (0-1)
  270.  
  271.         output:   AH = 00H ,CY=0 disk change line not active
  272.                        01H ,CY=1 invalid drive number
  273.                        06H ,CY=1 disk change line active & carry bit on
  274.                        80H ,CY=1 diskette drive not ready
  275.  
  276.       
  277. SET DASD TYPE FOR FORMAT
  278.  
  279.         input :   AH = 17H
  280.                   AL -  00 - invalid request
  281.                         01 - 360K diskette in 360K diskette drive
  282.                         02 - 360K diskette in 1.2M diskette drive
  283.                         03 - 1.2M diskette in 1.2M diskette drive
  284.                         04 - 720K diskette in 720K diskette drive
  285.                         05-0FFH -- invalid request
  286.                   DL - drive number
  287.  
  288.         output:   AH  = status of operation
  289.  
  290.                   CY  = 0 successful operation
  291.                   CY  = 1 failed operation
  292.  
  293. note 1 :   This function will try to inactive disk change line. If the 
  294.        attempt succeeds, set the desired data rate for format. If the
  295.        attempt fails, return time out error code.
  296.  
  297.  
  298. SET MEDIA TYPE FOR FORMAT
  299.  
  300.         input :   AH = 18H
  301.                   CH - number of tracks (low order 8 bits)
  302.                   CL - bit 7,6 - number of tracks (high order 2 bits)
  303.                        bit 5 - 0 - sector per track
  304.                   DL - drive number
  305.  
  306.  
  307.         output:   AH  = status of operation
  308.  
  309.                   CY  = 0 successful operation
  310.                   CY  = 1 failed operation
  311.         
  312.           ES:DI = point to 11-byte parameter table for desired
  313.               media type, unchanged if AH <> 0.
  314.  
  315. note 1 :   This function will try to inactive disk change line. If the 
  316.        attempt succeeds, set the desired data rate for format. If the
  317.        attempt fails, return time out error code.
  318.  
  319. note 2 :   The following is the format of parameter table :
  320.  
  321.         1'st  byte  -   1'st specify byte 
  322.         2'nd  byte  -   2'nd specify byte
  323.         3'th  byte  -   motor off time
  324.         4'th  byte  -   512 bytes/sector
  325.         5'th  byte  -   EOT : last sector on track
  326.         6'th  byte  -   GAP length
  327.         7'th  byte  -   DTL
  328.         8'th  byte  -   GAP length for format
  329.         9'th  byte  -   fill byte for format
  330.         10'th byte  -   head settling time
  331.         11'th byte  -   motor start time
  332.