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

  1.  
  2.             Specification of Fixed Disk I/O
  3.                  -------------------------------
  4. Function:
  5.  
  6.         AH = 00h  Reset disk system
  7.         AH = 01h  Read status of last operation
  8.         AH = 02h  Read desired sectors into memory
  9.         AH = 03h  Write desired sectors from memory
  10.         AH = 04h  Verify desired sectors
  11.         AH = 05h  Format desired cylinder
  12.         AH = 06h  Invalid function call
  13.         AH = 07h  Invalid function call
  14.         AH = 08h  Read drive parameters
  15.         AH = 09h  Initialize drive pair characteristics
  16.         AH = 0ah  Read long
  17.         AH = 0bh  Write long
  18.         AH = 0ch  Seek
  19.         AH = 0dh  Alternate disk reset
  20.         AH = 0eh  Invalid function call
  21.         AH = 0fh  Invalid function call
  22.         AH = 10h  Test drive ready
  23.         AH = 11h  Recalibrate
  24.         AH = 12h  Invalid function call
  25.         AH = 13h  Invalid function call
  26.         AH = 14h  Invalid function call
  27.         AH = 15h  Read DASD type
  28.         AH = 16h  Invalid function call
  29.         AH = 17h  Invalid function call
  30.         AH = 18h  Invalid function call
  31.         AH = 19h  Park heads
  32.  
  33. Input:
  34.  
  35.         AH = function number   (value check)
  36.         AL = number of sectors (non-value check)
  37.         DH = head number       (non-value check)
  38.         DL = drive number      (80H based, value check)
  39.         CH = cylinder number - low 8 bits  (non-value check)
  40.         CL = sector number - bits 0-5      (non-value check)
  41.              bits 6-7 are high 2 cylinder bits
  42.         ES:BX = transfer buffer address
  43.  
  44. Output:
  45.  
  46.         40:74 = last fixed disk operation status
  47.            AH = status of operation
  48.            CF = 1 - status is non 0
  49.                 0 - status is 0
  50.  
  51.  
  52.  
  53.  
  54. Referenced BIOS data area:
  55.  
  56.         40:72 = reset flag
  57.         40:74 = last fixed disk operation status
  58.         40:75 = number of fixed disk drives attached
  59.         40:8c = dixed disk drive controller status
  60.         40:8d = dixed disk drive controller error status
  61.         40:8e = fixed disk drive interrupt control
  62.  
  63. Port definition: 
  64.  
  65.         port 1F0h -- Data Register                         R/W
  66.         port 1F1h -- Error Register                        R
  67.         port 1F2h -- Sector Count Register                 R/W
  68.         port 1F3h -- Sector Number Register                R/W
  69.         port 1F4h -- Cylinder Low                          R/W
  70.         port 1F5h -- Cylinder High                         R/W
  71.         port 1F6h -- SDH Register                          R/W
  72.         port 1F7h -- Status Register                       R
  73.                      Command Register                      W
  74.         port 3F6h -- Alternate Status Register             R
  75.         port 3F7h -- Drive Address Register                R
  76.  
  77. Note 1 :   Enter this software interrupt service routine, the value of
  78.            function number (ah) and drive number (dl) must be checked
  79.            before executing relative service request. Error return code 01
  80.            -- invalid function request will return when value invalid.
  81.  
  82. Note 2 :   The status of fixed disk can be get from port 3F6H or 1F7H. The
  83.        Difference between port 3F6H and 1F7H is taht fixed disk interrupt
  84.        pending signal can be clear by using port 1F7H, but port 3F6H can
  85.        not.
  86.  
  87. Note 3 :   For power saving consideration in laptop machine, user can set
  88.        desired time to make WDC enter idle mode after last read/write/
  89.        verify/seek operation.
  90.  
  91. Note 4 :   There are three modes for WDC in laptop machine : READ/WRITE,
  92.        SEEKING, and IDLE mode. The READ/WRITE mode occurs when data is 
  93.        being read from or written to the disk. The SEEKING mode while 
  94.        the head is in motion. The IDLE mode occurs when the drive is not 
  95.        reading,writing or seeking.  The motor is up to speed and DRIVE
  96.        READY condition exists.  Head is residing on last accessed track.
  97.  
  98.          -- To be continue --
  99.  
  100. Note 5 :   For seeking command, some WDC support parameters to change seek
  101.        speed. But new WDC will use top seek speed and don't care parameter
  102.        in seek command.
  103.  
  104. Note 6 :   The Conner WDD will turn off motor automaticlly when power supply 
  105.        unstable, and turn on motor after about 1 minute.
  106.  
  107. Note 7 :   For performance consideration, disk service routine does not use
  108.        DMA in data transfer.
  109.  
  110. Note 8 :   For performance consideration, please use in/out string instruction
  111.        in data transfer.
  112.  
  113. Note 9 :   The fixed disk service routine support 2 WDD drive only.
  114.  
  115. Note 10:   The WDC use IRQ 0EH to acknowlege the fixed disk service that the
  116.        command completion or data transfer completion.
  117.  
  118. Note 11:   The fixed disk type information stores in CMOS. Please reference
  119.        CMOS definition.
  120.  
  121.  
  122. RESET DISK SYSTEM
  123.  
  124.         input :      AH = 00h, 0Dh
  125.                   DL = drive no. (bit 7 = 1 - fixed disk drive
  126.                                           0 - diskette drive   )
  127.  
  128.         output:   AH = status of operation
  129.                   CF = 1 - status is non 0 (error occured)
  130.                        0 - status is 0 (no error)
  131.  
  132. Note 1 :   The diskette system is also reset for all values of dl.
  133.  
  134. Note 2 :   Prior to waiting for the fixed disk reset, call INT 15,
  135.            ah = 90h (device bysy) with al = 00h (type = disk)
  136.            informing the operating system of the wait.
  137.  
  138. Note 3 :   This function include 3 sub-functions : reset disk, initialize
  139.        disk, and recalibrate.
  140.  
  141.  
  142. READ STATUS OF LAST OPERATION
  143.  
  144.         input :   AH = 01h
  145.                   DL = drive no. bit 7 = 1 for fixed disk drive (80H - base)
  146.  
  147.         output:   AH = status of operation
  148.                   AL = last fixed disk operation status
  149.                   CF = 1 - status is non 0 (error occured)
  150.                        0 - status is 0 (no error)
  151.  
  152. Note 1 :   Disk status(40:74H) is reset to 0
  153.  
  154.  
  155.  
  156. READ DESIRED SECTORS INTO MEMORY
  157.  
  158.  
  159.         input :   AH = 02h
  160.                   DL = drive no. bit 7 = 1 for fixed disk drive (80H-base)
  161.                   DH = head no. (0-base)
  162.                   CH = cylinder low (0-base)
  163.                   CL = bit 7, 6 - cylinder high
  164.                        bit 5 - 0 - sector no. (1-base)
  165.                   AL = number of sector
  166.                ES:BX = address of buffer
  167.  
  168.         output:      AH = status of operation
  169.                   CF = 1 - status is non 0 (error occured)
  170.                        0 - status is 0 (no error)
  171.  
  172. Note 1 :   Wait interrupt before transfer 512 bytes.
  173.  
  174.  
  175.  
  176. WRITE DESIRED SECTORS FROM MEMORY
  177.  
  178.  
  179.         input :   AH = 03h
  180.                   DL = drive no. bit 7 = 1 for fixed disk drive (80H-base)
  181.                   DH = head no. (0-base)
  182.                   CH = cylinder low (0-base)
  183.                   CL = bit 7, 6 - cylinder high
  184.                        bit 5 - 0 - sector no. (1-base)
  185.                   AL = number of sector
  186.                ES:BX = address of buffer
  187.  
  188.         output:   AH = status of operation
  189.                   CF = 1 - status is non 0 (error occured)
  190.                        0 - status is 0 (no error)
  191.  
  192. Note 1 :    Wait interrupt after transfer 512 bytes.
  193.  
  194.  
  195. VERIFY DESIRED SECTORS
  196.  
  197.         input :   AH = 04h
  198.                   DL = drive no. bit 7 = 1 for fixed disk drive (80H-base)
  199.                   DH = head no. (0-base)
  200.                   CH = cylinder low (0-base)
  201.                   CL = bit 7, 6 -cylinder high
  202.                        bit 5 - 0 - sector no. (1-base)
  203.                   AL = number of sector
  204.  
  205.         output:      AH = status of operation
  206.                   CF = 1 - status is non 0 (error occured)
  207.                        0 - status is 0 (no error)
  208.  
  209.  
  210.  
  211. FORMAT DESIRED CYLINDER
  212.  
  213.         input :   AH = 05h
  214.                   DL = drive no. bit 7 = 1 for fixed disk drive (80H-base)
  215.                   DH = head no. (0-base)
  216.                   CH = cylinder low (0-base)
  217.                   CL = bit 7, 6 -cylinder high
  218.                ES:BX = point to a 512-byte buffer.
  219.                        The first 2 x (sectors per cylinder) bytes
  220.                        contain F, N for each sector :
  221.                                F = 00h - good sector
  222.                                N - sector no.
  223.  
  224.         output:   AH = status of operation
  225.                   CF = 1 - status is non 0 (error occured)
  226.                        0 - status is 0 (no error)
  227.  
  228. Note 1 :   For MS-DOS limitation, this function only support WDD that have
  229.        cylinders below 1024. So please check cylinder before execution.
  230.  
  231.  
  232.  
  233. READ DRIVE PARAMETERS
  234.  
  235.         input :   AH = 08h
  236.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  237.  
  238.         output:   AH = status of operation
  239.                   DL = number of consecutive drives attached
  240.                   DH = maximum head number
  241.                   CH = cylinder low
  242.                   CL = cylinder high (high order 2 bits)
  243.                   CF = 1 - status is non 0 (error occured)
  244.                        0 - status is 0 (no error)
  245.  
  246.  
  247.  
  248. INITIALIZE DRIVE PAIR CHARACTERISTICS
  249.  
  250.  
  251.         input :   AH = 09h
  252.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  253.  
  254.         output:   AH = status of operation
  255.                   CF = 1 - status is non 0 (error occured)
  256.                        0 - status is 0 (no error)
  257.  
  258. note 1 :    INT 41H point to a parameter table for drive 0.
  259.  
  260. note 2 :    INT 46H point to a parameter table for drive 1.
  261.  
  262.  
  263. READ LONG
  264.  
  265.  
  266.         input :   AH = 0ah
  267.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  268.                   DH = head no. (0-base)
  269.                   CH = cylinder low (0-base)
  270.                   CL = bit 7, 6 -cylinder high
  271.                        bit 5 - 0 - sector no. (1-base)
  272.                   AL = no. of sector to be transfered
  273.                ES:BX = address of buffer
  274.  
  275.         output:      AH = status of operation
  276.                   CF = 1 - status is non 0 (error occured)
  277.                        0 - status is 0 (no error)
  278.  
  279. note 1 :    The read long request read 512-byte data and 4-byte ECC.
  280.  
  281. note 2 :    In this function WDC would not do ECC check.
  282.  
  283. note 3 :    The data bytes and ECC bytes must be read seperately.
  284.  
  285.  
  286. WRITE LONG
  287.  
  288.         input :   AH = 0bh
  289.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  290.                   DH = head no. (0-base)
  291.                   CH = cylinder low (0-base)
  292.                   CL = bit 7, 6 -cylinder high
  293.                        bit 5 - 0 - sector no. (1-base)
  294.                   AL = no. of sector to be transfered
  295.                ES:BX = address of buffer
  296.  
  297.         output:      AH = status of operation
  298.                   CF = 1 - status is non 0 (error occured)
  299.                        0 - status is 0 (no error)
  300.  
  301. note 1 :    The write long request write 512-byte data and 4-byte ECC.
  302.  
  303. note 2 :    In this function WDC would not do ECC check.
  304.  
  305. note 3 :    The data bytes and ECC bytes must be write seperately.
  306.  
  307.  
  308.  
  309. SEEK
  310.  
  311.         input :   AH = 0ch
  312.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  313.                   DH = head no. (0-base)
  314.                   CH = cylinder low (0-base)
  315.                   CL = bit 7, 6 -cylinder high
  316.  
  317.         output:      AH = status of operation
  318.                   CF = 1 - status is non 0 (error occured)
  319.                        0 - status is 0 (no error)
  320.  
  321.  
  322.  
  323. ALTERNATE DISK RESET
  324.  
  325.         input :   AH = 0dh
  326.                   DL = drive no. bit 7 = 1 for fixed disk drive (0 - base)
  327.  
  328.         output:      AH = status of operation
  329.                   AL = last fixed disk operation status
  330.                   CF = 1 - status is non 0 (error occured)
  331.                        0 - status is 0 (no error)
  332.  
  333. note 1 :    The disk status is reset to 0
  334.  
  335. note 2 :    This function same as ah = 00h
  336.  
  337.  
  338. TEST DRIVE READY
  339.  
  340.  
  341.         input :   AH = 10h
  342.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  343.  
  344.         output:      AH = status of operation
  345.                   CF = 1 - status is non 0 (error occured)
  346.                        0 - status is 0 (no error)
  347.  
  348.  
  349. RECALIBRATE
  350.  
  351.  
  352.         input :   AH = 11h
  353.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  354.  
  355.         output:      AH = status of operation
  356.                   CF = 1 - status is non 0 (error occured)
  357.                        0 - status is 0 (no error)
  358.  
  359.  
  360.  
  361. READ DASD TYPE
  362.  
  363.  
  364.         input :   AH = 15h
  365.                   DL = drive no. (bit 7 = 1 - fixed disk drive
  366.                                           0 - diskette drive  )
  367.  
  368.         output:      AH = 00h - drive not present or (dl) invalid
  369.                        01h - reserved for diskette interface
  370.                        02h - reserved for diskette interface
  371.                        03h - fixed disk
  372.                CX,DX = number of 512-byte blocks
  373.                        if AH = 0 then CX = DX = 0
  374.                   CF = 0 - operation successfully completed
  375.  
  376.  
  377.  
  378. PARK HEADS
  379.  
  380.  
  381.         input :   AH = 19h
  382.                   DL = drive no. bit 7 = 1 for fixed disk drive (80-base)
  383.  
  384.         output:      AH = status of operation
  385.                   CF = 1 - status is non 0 (error occured)
  386.                        0 - status is 0 (no error)
  387.  
  388.  
  389. INVALID FUNCTION REQUEST
  390.  
  391.  
  392.         input :   AH = 06h, 07h, 12h, 13h, 14H, 0eh, 0fh
  393.                        16h to 18h,
  394.                        19h to FFh
  395.                   DL = greater than number of fixed disk drive attached
  396.  
  397.         output:   AH = 1 -- invalid function request
  398.  
  399. note 1 :    The INT 13H check the value of AH and DL, and return 01 if
  400.             invalid.
  401.  
  402. note 2 :    The bit 7 of DL must be cleared before checking, and DL is
  403.             0-based, it must be increased one before compared to number of
  404.             drive attached.
  405.  
  406.  
  407.