ATR: chpt.9: Resident Disk Handler

From: Doug Wokoun (aa384)
Date: 12/25/89-05:57:50 AM Z


From: aa384 (Doug Wokoun)
Subject: ATR: chpt.9: Resident Disk Handler
Date: Mon Dec 25 05:57:50 1989


                                   CHAPTER 9
     
     
                           THE RESIDENT DISK HANDLER
     
     
     The resident disk handler is separate from DOS and is part of the
     permanent operating system ROM.  The disk handler does not use CIO.
     
     The resident disk handler works with one sector at a time.  It is used
     by setting the drive number, sector number, and operation code in the
     device control block.  The program then jumps (JSR) to the handler
     entry vector, DSKINV [$E453 (58451)].
     
               Device control block (for resident disk handler)
     
     
     DDEVIC [$0300 (768)]
     
          Serial bus I.D.  Set by handler
     
     DUNIT  [$0301 (769)]
     
          Drive number
     
     DCOMND [$0302 (770)]
     
          Command byte
     
     DSTATS [$0303 (771)]
     
          status byte
     
     DBUFLO [$0304 (772)]
     DBUFHI [$0305 (773)]
     
     Pointer to 128 byte memory block for data storage.
     
     DTIMLO [$0306 (774)]
     
          Timeout value (response time limit) in seconds
     
     DBYTLO [$0308 (776)]
     DBYTHI [$0309 (777)]
     
          number of bytes transferred, set by handler
     
     DAUX1  [$030A (778)]
     DAUX2  [$030B (779)]
     
          sector number
     
     DISK HANDLER COMMANDS
    
     GET SECTOR
     
     Before the JSR to DSKINV is made the following parameters are set.
     
                             GET SECTOR parameters
     
     
          DCOMND = $52 (82)
          DUNIT  = (1 - 4)
          DBUFHI
          and
          DBUFLO = address of 128 byte buffer
          DAUX1
          and
          DAUX2  = Sector number (LSB,MSB)
     
     This operation will read the specified sector and put the data into
     the specified buffer.
     
     PUT SECTOR
     
     PUT SECTOR is used the same as GET SECTOR except for DCOMND.
     
                             PUT SECTOR parameters
     
          DCOMND = $50 (80)
     
     This operation sends the data in the specified buffer to the specified
     disk sector.
     
     PUT SECTOR WITH VERIFY
     
     PUT SECTOR WITH VERIFY is used the same as PUT SECTOR except for
     DCOMND.
     
                       PUT SECTOR WITH VERIFY parameters
     
          DCOMND = $57 (87)
     
     This operation sends the data in the specified buffer to the specified
     disk sector then checks for errors.
     
     GET STATUS
     
     Only the DUNIT and DCOMND need to be set
     
                             GET STATUS parameters
     
     
          DCOMND = $53 (83)
          DUNIT  = (1 - 4)
    
    
     The status information will be put in three bytes starting at DVSTAT
     [$02EA (746)].
     
     
                                 Status format
     
                          7 6 5 4 3 2 1 0
                         -----------------
          DVSTAT + 0     | command stat   |
                         -----------------
                 + 1     | hardware stat  |
                         -----------------
                 + 2     | timeout value  |
                         -----------------
     
     
     The command status byte gives the following information.
     
     
        Bit
     
     
          0    1 = invalid command frame received
          1    1 = invalid data frame received
          2    1 = unsuccessful PUT operation
          3    1 = disk is write protected
          4    1 = active/standby
     
     
     The hardware status byte contains the status register of the ISN1771-1
     disk controller chip.
     
     The timeout byte contains the maximum allowable response time for the
     drive in seconds.
     
     FORMAT DISK
     
     The handler will format then verify the the disk.  The numbers of all
     bad sectors (up to 63) will be put into the specified buffer followed
     by two bytes of $FF.
     
     The following parameters are set before the call.
     
                               FORMAT parameters
     
          DCOMND = $21 (33)
          DUNIT  = (1 - 4)
          DBUFLO
          and
          DBUFHI = address of bad sector list (buffer)


     After the operation the status byte is set.  Also, DBYTLO and DBYTHI
     will contain the number of bytes of bad sector information (not
     including the two $FF bytes).
     
     
                   Useful data base variables and OS equates
     
     
     DVSTAT $02EA,3      (746): device status block, 3 bytes
     DDEVIC $0300        (768): serial bus I.D.
     DUNIT  $0301        (769): device number
     DCOMND $0302        (770): command byte
     DSTATS $0303        (771): status byte
     DBUFLO $0304        (772): data buffer
     DBUFHI $0305        (773):  pointer
     DTIMLO $0306        (774): timeout value
     DBYTLO $0308        (776): number of bytes transfered
     DBYTHI $0309        (777):
     DAUX1  $030A        (778): sector
     DAUX2  $030B        (779):  number
     DSKINV $E453      (58451): disk handler entry vector
     
                                                                           
-- 
-- 


-----------------------------------------
Return to message index