

                                IDE-CD
                          

           
   IDE-CD.      ,   
     .   (  
    ) IDE- (    ATA-R4C.*).
               CD-ROM 
     VIDE-CDD.SYS.    
        .  ,
       CD  Linux   
   ,    ""   
         MS-DOS.


                        .

        ,  IDE-CD 
    ,   - 170h.      ,
     17x   1Fx, 1E8+x  168+x.

     = 18.2 .

        .

    ,       / CD   
    co    (    PC,    - ).

    AP - Atapi , 12    CD-Rom.  
             .
    AK - Atapi 
    M  -    BCD
    S  -    BCD
    F  -     BCD


                      I.   CD  

           Atapi-CD  :

        1.       (Master/Slave) 
            176.
        2.   ( 80   177)
        3.    -  .

              (  8   177
          1-3 ),     . 
        CD   c     
        .

        4.   177   ECh    .
        5.   174 (.. = 14h)   175 (.. = EBh).

           ,   ,   IDE-
         Atapi .     
         Atapi-.


                     II.  

          AK :
        1.    (Master/Slave)
        2.   (  177)
        3.       174 (.)
            175 (. )     ,  
             .
        4.  177   A0h.
        5.    ( 177).
        6.        170 6  AP.
        7.      ,  
                 .
           :
        8.  .
        9.    174  175   ()
           .
        10.   =0 -  ,    
                   . 8
        11.   .

               170.

                     III.  

               :
        ) 
                 ,     AP. 
                    .
                  CD    , 
                     
                IDE- (171  177)   
                   .
        )  
                       AP
                  CD   (   ),
                  ,   CD, .
                       CD 
                 , CD        ()
                .
        )  
                      AP.     D
                  .



                        IV. IDE 

         CD    ,  
         ,     IDE .

          :
        A0h -   AP.
        A1h -  .   ECh  IDE-, 
                   
        ECh -   ,    174  175 
                 14 EB -  Atapi 
        08h - .    .


        ,       ,
           .      
         ,       .



                V.   ATAPI-

   AP   .   , 
 .  11   , 
  .

----------------------------------------------------------------------
  00h - 

 :
        db  0
        db  11*dup(0)   ; *

          ,      

          :   "*",  ,   CD,
               0

------------------------------------------------------------------------
  01h -    

 :
        db 01h
        db 12*dup(0)    ; *
          (  ).

----------------------------------------------------------------------
  03h -   

 :
        db 03h
        db 3*dup(0)     ; *
        db Len          ;   
        db 7*dup(0)     ; *

            12h ,     
         2, 0  0D -     .

--------------------------------------------------------------------------
  012h -     

 :
        db 12h
        db  0h,0h       ;     
        db  0h          ; *
        db  Len         ;   
        db  7*dup(0)    ; *

             (  )
           CD-Rom.      
           .

---------------------------------------------------------------------------
  01Bh -    

 :
        db 1Bh
        db 3*dup(0)     ; *
        db Func         ; 
        db 7*dup(0)     ; *

         .

        :
        0 -    Sleep
        1 -  /
        2 -  
        3 -  

---------------------------------------------------------------------------
  01Eh -  

 :
        db 1Eh
        db 3*dup(?)     ; *
        db Func         ; 
        db 7*dup(?)     ; *

         .

          Func= 0 -  
                        = 1 -  

---------------------------------------------------------------------------
  025h -     .

 :
        db 25h
        db 11*dup(0)    ; *

         .

              8 :
        dd Sectors      ;     
        dd SectSize     ;   ( ,  
                        ;     930h)
---------------------------------------------------------------------------
  02Bh - Seek

 :
        db 2Bh
        db 2*dup(0)     ; *
        db M,S,F        ;  
        db 6*dup(0)     ; *

         .
----------------------------------------------------------------------------
 042h -   ( )

:
        db      42h
        db      ScMsf   ; 0/2 -    (MSF   )
        db      FullInfo;   (/ - 4
        db      Func    ; 
        db      3*dup(0); *
        db      LenHi   ;    
        db      LenLo   ;  -------//----------
        db      3*dup(0); *

         ,    :

        00h db   0h     ;  
        01h db    :
                      11h -  
                      12h -  
                      13h -    
                      14h -     
                      15h - 
        02h db  0h

        03h     Func   40h  Fullinfo
         40h  ( Func  ):
              03h db  00h
         40h   Func   2  3
              03h db  0Ch
              04h db  01h
              05h db  Ctrl/Addr
              06h db  TrackNumber
              07h db  Point or Index
              08h db  ?
              09h db  3*dup(?) - MSF/SECTOR  
              0Ch db  0h
              0Dh db  3*dup(?) - MSF/SECTOR  
              10h -   
               -- 2-- ( UPC )
              03h db  14h
              04h db  02h
              05h db  3h*dup(?0)
              08h db  80h        -   UPC ( ,  UPC )
              09h db  0Ch*dup(?) -   UPC  (6   BCD )
              15h db  3*dup(?)   -  -     MSF
               -- 3--
              03h db  14h
              04h db  03h
              05h db  ?         ; ,   
              06h db  2*dup(0)
              08h db  80h -   (  02h)
              09h db   

-----------------------------------------------------------------------------
 043h -   

:
        db      43h
        db      ScMsf   ;    (MSF/)
        db      4*dup(0); *
        db      BegTrk  ;   ( 1; 0   1)
        db      LenHi   ;    
        db      LenLo   ;  -------//----------
        db      Func    ;    (0/40h/80h)
        db      2*dup(0); *

         ,   .

        Func    = 00    ;    
                = 40    ;   
                = 80    ;      

           :
        dw      Len             ;     
        db      BegTrk          ;  
        db      EndTrk          ;  
        d?      <track_Def>     ;  

          ..  :

        1) 5    ( ,   ):
                db      Type            ;    
                db      Index           ;   ()
                db*3    Start           ;   

        2) 8    (Func=0h/40h):
                db      Res1
                db      Type            ;    
                db      Index           ;   ()
                db      Res2
                db*4    Start           ;   

        3) 11    (Func = 80h):
                db      Res1
                db      Type            ;  
                db      Res2
                db      Index           ;  
                db      Res3
                db      Res4
                db      Res5
                db*4    Start           ;   

        Type  -  :
                14h - ROM
                10h - Audio

        Index -   BCD       
        01-99.  A0     ,   
           ,     -
           ,      ..

        Start -    ,     ,
             MSF.

-----------------------------------------------------------------------------
 044h -      (Read TOC HEADER)

:
        db      44h
        db      SL      ;  2 -     
                        ; (    )
        db      0       ; *
        db      M,S,F   ;  
        db      0       ; *
        dw      Len     ;   
        db      3*dup(0); *

         ,     8 :

        db      SectorType      ;   
        db      4*dup(0)
        db      M,S,F           ;  

             ,  CD   
            .

-----------------------------------------------------------------------------
 047h -  Audio   MSF

:
        db 47h
        db 2*dup(?)     ; *
        db M,S,F        ;   (FF:FF:FF -  )
        db M,S,F        ;  
        db 3*dup(?)     ; *
         .
-----------------------------------------------------------------------------
 04Bh - Start/stop Audio

 :
        db  4Bh
        db  7*dup(0)    ; *
        db  Func
        db  4*dup(0)    ; *

         .

          Func= 0 - 
                        = 1 - 
---------------------------------------------------------------------------
 04Eh -  
:
        db 4eh
        db 11*dup(?)    ; *
         .
---------------------------------------------------------------------------
 0B9h -  

:
        db B9h  ;
        db Fmt  ;   = 00h   
                ;              08h  CD- ( )
                ;              10h\  
                ;              14h/      Green XA
        db 0    ; *
        db M,S,F;  
        db M,S,F;  
        db Flg  ;    :
                ; 01   
                ; 02     
                ; 04           
                ; 08  EDC/Zero/ECC
                ; 10     (data)
                ; 20     (head)
                ; 40    (sub)
                ; 80    (sync)
                ;      ,  
                ;  .     
                ; ,  .
        db 0    ;  .. =0,   (?)
        db 0    ; *

          .
         =,    
           .      .

--------------------------------------------------------------------------
 0BEh -     
:
        db B9h  ;
        db Fmt  ;
        db 0    ; *
        db Sec*3;   ( )
        db 0    ; *
        db ScNum;  
        db Flg  ;    
        db 0    ;  .. =0,   (?)
        db 0    ; *
            B9,    AP.

--------------------------------------------------------------------------
     
   028h/0A8h -     
   055h/05Ah - /  ( ..  )
   024h/0A5h -      ( ).
    ()  ,     
       .
------------------------------------------------------------------------


                              A
                          
                    (   CD  Linux')

/*   */
char *sense_key_texts[16] = {
0  "No sense data",
1  "Recovered error",
2  "Not ready",
3  "Medium error",
4  "Hardware error",
5  "Illegal request",
6  "Unit attention",
7  "Data protect",
8  "(reserved)",
9  "(reserved)",
a  "(reserved)",
b  "Aborted command",
c  "(reserved)",
d  "(reserved)",
e  "Miscompare",
f  "(reserved)",
};

/*     */
struct {
  short asc_ascq;
  char *text;
} sense_data_texts[] = {
  { 0x0000, "No additional sense information" },
  { 0x0011, "Audio play operation in progress" },
  { 0x0012, "Audio play operation paused" },
  { 0x0013, "Audio play operation successfully completed" },
  { 0x0014, "Audio play operation stopped due to error" },
  { 0x0015, "No current audio status to return" },
  { 0x0200, "No seek complete" },
  { 0x0400, "Logical unit not ready - cause not reportable" },
  { 0x0401, "Logical unit not ready - in progress (sic) of becoming ready" },
  { 0x0402, "Logical unit not ready - initializing command required" },
  { 0x0403, "Logical unit not ready - manual intervention required" },
  { 0x0600, "No reference position found" },
  { 0x0900, "Track following error" },
  { 0x0901, "Tracking servo failure" },
  { 0x0902, "Focus servo failure" },
  { 0x0903, "Spindle servo failure" },
  { 0x1100, "Unrecovered read error" },
  { 0x1106, "CIRC unrecovered error" },
  { 0x1500, "Random positioning error" },
  { 0x1501, "Mechanical positioning error" },
  { 0x1502, "Positioning error detected by read of medium" },
  { 0x1700, "Recovered data with no error correction applied" },
  { 0x1701, "Recovered data with retries" },
  { 0x1702, "Recovered data with positive head offset" },
  { 0x1703, "Recovered data with negative head offset" },
  { 0x1704, "Recovered data with retries and/or CIRC applied" },
  { 0x1705, "Recovered data using previous sector ID" },
  { 0x1800, "Recovered data with error correction applied" },
  { 0x1801, "Recovered data with error correction and retries applied" },
  { 0x1802, "Recovered data - the data was auto-reallocated" },
  { 0x1803, "Recovered data with CIRC" },
  { 0x1804, "Recovered data with L-EC" },
  { 0x1805, "Recovered data - recommend reassignment" },
  { 0x1806, "Recovered data - recommend rewrite" },
  { 0x1a00, "Parameter list length error" },
  { 0x2000, "Invalid command operation code" },
  { 0x2100, "Logical block address out of range" },
  { 0x2400, "Invalid field in command packet" },
  { 0x2600, "Invalid field in parameter list" },
  { 0x2601, "Parameter not supported" },
  { 0x2602, "Parameter value invalid" },
  { 0x2603, "Threshold parameters not supported" },
  { 0x2800, "Not ready to ready transition, medium may have changed" },
  { 0x2900, "Power on, reset or bus device reset occurred" },
  { 0x2a00, "Parameters changed" },
  { 0x2a01, "Mode parameters changed" },
  { 0x3000, "Incompatible medium installed" },
  { 0x3001, "Cannot read medium - unknown format" },
  { 0x3002, "Cannot read medium - incompatible format" },
  { 0x3700, "Rounded parameter" },
  { 0x3900, "Saving parameters not supported" },
  { 0x3a00, "Medium not present" },
  { 0x3f00, "ATAPI CD-ROM drive operating conditions have changed" },
  { 0x3f01, "Microcode has been changed" },
  { 0x3f02, "Changed operating definition" },
  { 0x3f03, "Inquiry data has changed" },
  { 0x4000, "Diagnostic failure on component (ASCQ)" },
  { 0x4400, "Internal ATAPI CD-ROM drive failure" },
  { 0x4e00, "Overlapped commands attempted" },
  { 0x5300, "Media load or eject failed" },
  { 0x5302, "Medium removal prevented" },
  { 0x5700, "Unable to recover table of contents" },
  { 0x5a00, "Operator request or state change input (unspecified)" },
  { 0x5a01, "Operator medium removal request" },
  { 0x5b00, "Threshold condition met" },
  { 0x5c00, "Status change" },
  { 0x6300, "End of user area encountered on this track" },
  { 0x6400, "Illegal mode for this track" },
  { 0xbf00, "Loss of streaming" },


                         B
                        
                    (  Linux')

   ( ):    audio_sample_bytes                   
                                       2352                          

  (, mode 1):       sync  head  data  EDC  zero  ECC 
                                 12     4   2048   4     8   276 

  (, mode2):        sync  head  data                   
                                 12     4   2336                   

 XA  (,                                             
                 mode2 form1):  sync  head  sub   data  EDC  ECC 
                                 12     4    8    2048   4   276 

 XA  (,                                             
                 mode2 form2):  sync  head  sub   data  EDC      
                                 12     4    8    2324   4       


#########################################################################

PS/       
          
      ATAPI-CD.
          ,
      Linux'    ACER665,
         .  
    ,  ,      
    .   ,   .

        - , ,  CD-,
      ..,    .  ,
           .

    :
    10.08.1996  -   -   
    19.09.1996  -     .


, ,   ..
                            2:5030/163.44
  (Konstantin Norvatoff, KonNor)

,      : konnor@small.spb.su

