home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 11 / 11.iso / m / m111 / 2.img / GRPCT2.EXE / CDROM.TXT < prev    next >
Encoding:
Text File  |  1990-02-22  |  4.5 KB  |  241 lines

  1.  
  2.     exit
  3.  
  4. ;
  5. ;    CDINIT
  6. ;
  7. ;    Check for CD-ROM driver and setup @drive
  8. ;
  9. cdinit:
  10.     int 0x2f 0x1500,0
  11.     if @bx
  12.         global drive chr(@cx+asc("A"))
  13.     else
  14.         global drive ""
  15.     endif
  16.     return
  17.  
  18. cdplay:
  19.     cdtrack    @1 @3 @4 @5
  20.     cdcmd    132,@0,@2*75
  21.     cdcheck    @0,cdplay
  22.     return
  23.  
  24. ;
  25. ;    CDPLAYTO TRACK MINUTES SECONDS FRAMES TRACK MINUTES SECONDS FRAMES
  26. ;
  27. ;
  28. cdplayto:
  29.     cdtrack    @1 @2 @3 @4
  30.     local    begin @0
  31.     cdtrack    @5 @6 @7 @8
  32.     local    end @0
  33.     cdcmd    132,@begin,@end-@begin
  34.     cdcheck    @0,cdplayto
  35.     return
  36.  
  37. ;
  38. ;    CDSTOP
  39. ;
  40. ;    Stop playing immediately
  41. ;
  42. cdstop:
  43.     cdcmd    133,0,0
  44.     cdcheck    @0,cdstop
  45.     return
  46.  
  47. ;
  48. ;    CDRESUME
  49. ;
  50. ;    Resume playing from where we issued a CDSTOP
  51. ;
  52. cdresume:
  53.     cdcmd    136,0,0
  54.     cdcheck    @0,cdresume
  55.     return
  56.  
  57. ;
  58. ;    CDSEEK TRACK {MINUTES SECONDS FRAMES}
  59. ;
  60. ;    Seek the CD player head to a track to minimize play startup time.
  61. ;    Parameters are the same as CDPLAY.
  62. ;
  63. cdseek:
  64.     cdtrack @1 @2 @3 @4
  65.     cdcmd 131,@0,0
  66.     cdcheck    @0,cdseek
  67.     return
  68.  
  69. ;
  70. ;    CDEJECT
  71. ;
  72. ;    Open the CD drive's tray/door
  73. ;
  74. cdeject:
  75.     local    buf ofs("1")
  76.     local    bseg seg(@buf);
  77.     poke    @bseg @buf 0                ;Eject Disk
  78.     cdcmd    12,@buf|(@bseg<<16),1            ;WRITE IOCTL Output
  79.     cdcheck    @0,cdeject
  80.     return
  81.  
  82. ;
  83. ;    CDCLOSE
  84. ;
  85. ;    Close the CD drive's tray/door
  86. ;
  87. cdclose:
  88.     local    buf ofs("1")
  89.     local    bseg seg(@buf);
  90.     poke    @bseg @buf 5                ;Close Tray
  91.     cdcmd    12,@buf|(@bseg<<16),1            ;WRITE IOCTL Output
  92.     cdcheck    @0,cdclose
  93.     return
  94.  
  95.  
  96. ;
  97. ;    CDSTATUS
  98. ;
  99. ;    Return CD Drive status and setup global variables @first and @last
  100. ;
  101. cdstatus:
  102.     local    buf ofs("123456")
  103.     local    bseg seg(@buf);
  104.     poke    @bseg @buf 10                ;Audio Disk Info
  105.     cdcmd    3,@buf|(@bseg<<16),6            ;READ IOCTL Input
  106.     cdcheck    @0,cdstatus
  107.     global    first peek(@bseg,@buf+1)+0
  108.     global    last  peek(@bseg,@buf+2)+0
  109.     poke    @bseg @buf 6                ;Device status
  110.     cdcmd    3,@buf|(@bseg<<16),5            ;READ IOCTL Input
  111.     cdcheck    @0,cdstatus
  112.     return    peekl(@bseg,@buf+1)
  113.  
  114. ;
  115. ;    CDTRACK TRACK MINUTES SECONDS FRAMES
  116. ;
  117. ;    Return the absolute sector number of a track
  118. ;
  119. cdtrack:
  120.     local    buf ofs("1234567")
  121.     local    bseg seg(@buf);
  122.     poke    @bseg @buf 11                ;Get Audio Track Info
  123.     poke    @bseg @buf+1 @1             ;track number
  124.     cdcmd    3,@buf|(@bseg<<16),7            ;READ IOCTL Input
  125.     cdcheck    @0,cdtrack
  126.     return    peekl(@bseg,@buf+2)+(@2*60+@3)*75+@4    ;return track address
  127.  
  128.  
  129. cdcmd:
  130.     local req ofs("12345678901234567890123456")
  131.     local rseg seg(@req)
  132.     poke  @rseg @req 13                ;param length
  133.     poke  @rseg @req+1 0                ;subunit
  134.     poke  @rseg @req+2 @1                ;command code
  135.     pokew @rseg @req+3 0                ;status
  136.     pokel @rseg @req+5 0 0                ;reserved
  137.     poke  @rseg @req+13 1                ;address mode
  138.     pokel @rseg @req+14 @2                ;begin
  139.     pokel @rseg @req+18 @3                ;length
  140.     pokel @rseg @req+22 0                ;reserved
  141.     int 0x2f 0x1510,@req,asc(@drive)-asc("A"),,,,,seg(@req)
  142.     if peek(@rseg,@req+4)&0x80
  143.         databegin
  144.             "Unknown Error"
  145.             "Write-protect violation"
  146.             "Unknown unit"
  147.             "Drive not Ready"
  148.             "Unknown command"
  149.             "CRC error"
  150.             "Bad drive request structure length"
  151.             "Seek Error"
  152.             "Unknown media"
  153.             "Sector not found"
  154.             "Printer out of paper"
  155.             "Write Fault"
  156.             "Read Fault"
  157.             "General failure"
  158.             "Reserved 1"
  159.             "Reserved 2"
  160.             "Invalid disk change"
  161.         dataend
  162.         if peek(@rseg,@req+3)<16
  163.             dataskip peek(@rseg,@req+3)+1
  164.         endif
  165.         return @
  166.     else
  167.         return ""
  168.     endif
  169.  
  170.  
  171. cdcheck:
  172.     if @1!=""
  173.         text chr(10)$@2$": "$@1$chr(10)
  174.     endif
  175.     return
  176.  
  177.  
  178. prtstatus:
  179.     if @1&1
  180.         text "Door Open"$chr(10)
  181.     else
  182.         text "Door Closed"$chr(10)
  183.     endif
  184.  
  185.     if @1&2
  186.         text "Door unlocked"$chr(10)
  187.     else
  188.         text "Door locked"$chr(10)
  189.     endif
  190.  
  191.     if @1&4
  192.         text "Supports cooked and raw reading"$chr(10)
  193.     else
  194.         text "Supports only cooked reading"$chr(10)
  195.     endif
  196.  
  197.     if @1&8
  198.         text "Read/write"$chr(10)
  199.     else
  200.         text "Read only"$chr(10)
  201.     endif
  202.  
  203.     if @1&16
  204.         text "Data read and plays audio/video tracks"$chr(10)
  205.     else
  206.         text "Data read only"$chr(10)
  207.     endif
  208.  
  209.     if @1&32
  210.         text "Supports ISO-9660 interleaving using interleave size and skip factor"$chr(10)
  211.     else
  212.         text "No interleaving"$chr(10)
  213.     endif
  214.  
  215.     if @1&128
  216.         text "Supports prefetching requests"$chr(10)
  217.     else
  218.         text "No Prefetching"$chr(10)
  219.     endif
  220.  
  221.     if @1&256
  222.         text "Supports audio channel manipulation"$chr(10)
  223.     else
  224.         text "No audio channel manipulation"$chr(10)
  225.     endif
  226.  
  227.     if @1&512
  228.         text "Supports HSG and Red Book addressing modes"$chr(10)
  229.     else
  230.         text "Supports HSG addressing mode"$chr(10)
  231.     endif
  232.  
  233.     if @1&2048
  234.         text "No disc is present in the drive"$chr(10)
  235.     else
  236.         text "Disc is present in the drive"$chr(10)
  237.     endif
  238.  
  239.     return
  240.  
  241.