Ch 21 ¥úºÐ¾÷ (2)

¦b³o¤@³¹ùØ¡A¤p¤ì°¸±N­n½Í½Í¦p¦ó¥Î²Õ¦X»y¨¥¼½©ñ­µ¼Ö¥úºÐ ( audio CD ¤]¥s CD-DA )¡A©Ò¿×­µ¼Ö¥úºÐ´N¬O¿í´`¬õ¥Ö®Ñ©Ò³W½dªº¥úºÐ¡C§Ú³o¼ËÁ¿¬Û«H¤@°ï¤H¤´µM·d¤£²M·¡¡A¨Æ¹ê¤W­µ¼Ö¥úºÐ´N¬O¯à°÷¦b CD °Û½L¤W¼½©ñªº¥úºÐ¤ù°Õ¡A¥¦ªºµo©ú¬O¬°¤F¨ú¥N°Û¤ù¡A¥«­±¤W°Û¤ù¦æ©Ò½æªººq¤âªº CD ´N¬O³o¤@ºØ¥úºÐ¡C¦­¦b¹q¸£©|¥¼¬y¦æ¤§«eªº 1980 ¦~¡APhilips ©M Sony ¤½¥q¬°¤F¥H¥úºÐ¼½©ñ­µ¼Ö¦Ó¨î©wªº³W®æ¡A«á¨Ó­l¥Í¥X¨Óªº Video CD ¡NCD-I¡NData CD µ¥µ¥³£¬O¥H¥¦¬°°ò¦¡A¥@¬É¤W©Ò¦³ªº¥úºÐ¾÷³£¥i¥H¼½©ñ¦¹ºØ¥úºÐ¡C¦b¼gµ{¦¡¤§«e¡AÀ³¥ý¹ï­µ¼Ö¥úºÐªººc³y¦³©Ò¤F¸Ñ¡C

­µ¼Ö¥úºÐºc³y

¥úºÐ¤ù«O¦s¸ê®Æªº­ì²z©MºÏ¤ù¤£¦P¡A¥¦¨Ã¤£¬OÂǥѺϩʪ«½è«O¦s¸ê®Æ¡A¥úºÐ¤ù¤W­±¦³³\¦h¦×²´¬Ý¤£¨ìªº²Ó¤p§|¬} (pit)¡A²Õ¦¨¤@­ÓÁ³±Û«¬­y¹D¥Ñ¥úºÐ¤ù¥~¦V¤º©µ¦ù¡C·í¥úºÐ¾÷ªºÅª¼gÀYµo¥Xªº¹p®g¥ú·Ó¨ì¥úºÐ¤ù¤Wªº³o¨Ç§|¬}§Î¦¨¤Ï®g¡A¤ñ·Ó®g¨ì«D§|¬}¤Ï®g¥ú¦æ¸g§ó»·ªº¸ô¡A©ó¬O²£¥Í¬Û®t¡A¤ñ¸û¬Û®tªºÅܤƴN¥i§Î¦¨¤£¦Pªº°T¸¹¡C

¤@±i¼Ð·Çªº­µ¼Ö¥úºÐ³Ì¦h¥i¥H¿ý 74 ¤ÀÄÁªº­µ¼Ö¡A¥úºÐ¤Wªº¨C¤@­ººq¦±¡A³£ºÙ¬°¤@¡y­µ­y¡z(track)(µù¤@)¡A¨C¤@­ººq¦±¤§¶¡ÁÙ¦³¨â¬íÄÁªºªÅ¥Õ gap)¡C²ßºD¤W­µ¼Ö¥úºÐ¬O¥H®É¶¡ªø«×¨Óªí¥Ü¤j¤pªº¡A¹³ MM:SS:FF ³o¼Ë¡A¨ä¤¤ MM ªí¥Ü¤ÀÄÁ¡ASS ªí¥Ü¬íÄÁ¡AFF ªí¥Ü¡y®æ¡z(frame¡A¤]¦³¤HºÙ¬°ºÏ°Ï(sector))¡C¨C 75 ®æ§Î¦¨¤@¬íÄÁ¡A¨C 60 ¬í§Î¦¨¤@¤ÀÄÁ¡C®Ú¾Ú¤W­z³W«h¡A±z´N¥i¥H­pºâ²Ä´X¤À²Ä´X¬í¬Û·í©óµ´¹ïºÏ°Ï¦h¤Ö¤F¡CÁ|¨Ò¨Ó»¡¡A¦pªG±z¦b CD °Û½L¤W¬Ý¨ì²{¦b¤w¸g¨ì 02:32¡A¦]¬° CD °Û½L¨Ã¨S¦³Åã¥Ü²Ä´X®æ¡A©Ò¥H°²³]²Ä¹s®æ¡A¨º²{¦b´NÀ³¸Ó¥¿¦b¼½©ñ²Ä

2*60*75 + 32*75 = 11400

ºÏ°Ï¡A±z¤]¥i¥H­pºâ¤@±i¼Ð·Çªº­µ¼Ö°Û¤ù³Ì¦h¦³

74*60*75 = 333000

­ÓºÏ°Ï¤F¡C

CMD=03/0A/AX=1510H/INT 2FH ¨ú±o CD ¸ê°T

³o­ÓªA°Èµ{¦¡¥i¥H±o¨ì­µ¼Ö¥úºÐªº­µ­y¼Æ¤Îµ²§ôºÏ°Ï¡C©I¥s«e¤]­n¥ý³]©w device driver request header µ²ºcÅé¡A³o®É­Ô¸Óµ²ºcÅ骺©R¥O½X¬° 3¡Aªí¥Ü IOCTL INPUT¡A¥i¥H·Q¦¨¥Ñ¥úºÐ¾÷¿é¤J¸ê®Æ¨ì¥D¾÷ªO¤¤¡FµM«á¦b 0E °_©lªºÂù¦r²Õ³]©w¶Ç°e°¾²¾¦ì§}»P°Ï¬q¦ì§}¡Aªí¥Ü¦¹¦ì§}±N­n±µ¦¬¥Ñ¥úºÐ¶Ç¦^ªº¸ê°T¡A³o¤]¥i¬Ý¦¨¬O¤@­Óµ²ºcÅé¡F¦b²Ä 12H ¶}©lªº¤@­Ó¦r²Õ³]©w¥úºÐ¾÷¶Ç¨Óªº¸ê®Æªø«×¡A7¡Aªí¥Ü¦@ 7 ­Ó¦ì¤¸²Õ¡FµM«á¦b device driver request header µ²ºcÅ骺²Ä 0 ­Ó¦ì¤¸²Õ³]©w¾ã­Ó device driver request header µ²ºcÅéªø«×¬° 13H ­Ó¦ì¤¸²Õ¡F³Ì«á¦b¶Ç°e¦ì§}©Ò«üªº 7 ­Ó¦ì¤¸²Õªº²Ä¹s­Ó¦ì¤¸²Õ³]©w 0AH¡A³o­Ó 0AH ¬O­n¶Çµ¹¥úºÐ¾÷ªº©R¥O¸ê®Æ¡A·N«ä¬O­n¥úºÐ¾÷¶Ç¦^¥úºÐ¤ù¸ê°T¡C¦A±N¥úºÐ¾÷½s¸¹¦s¤J CX¡A1510H ¦s¤J AX¡A³Ì«á©I¥s INT 2FH §Y¥i¡C

·í©I¥s§¹¦¨ªð¦^®É¡A¦pªG¦¨¥\¡A¦b device driver request header ©Ò³]©wªº¶Ç°e¦ì§}·|¦s¤J¥Ñ¥úºÐ¾÷¶Ç¨Óªº­µ¼Ö¥úºÐ¤ù¸ê°Tµ²ºcÅé¡A¨ä®æ¦¡¦p¤U¡G

¦ì§}  ¤j¤p(¦ì¤¸²Õ)    ·N     ¸q
-------------------------------------------------
 00        1        ©R¥O¸ê®Æ¡A0AH¡A³o¬O©I¥s®É¥Îªº
 01        1        ¶}©l­µ­y½s¸¹¡AÀ³¸Ó³£¬O 01
 02        1        µ²§ô­µ­y½s¸¹
 03        4        µ²§ôºÏ°Ï½s¸¹

CMD=03/B/AX=1510H/INT 2FH ¨ú±o­µ­y¸ê®Æ

¨ú±o­µ­y¸ê®Æªº¤èªk©M¤W­z¨ú±o­µ¼Ö¥úºÐ¸ê®Æ¤èªkÃþ¦ü¡A©Ò¤£¦Pªº¬O¶Ç°e¦ì§}©Ò«ü©wªºµ²ºcÅé®æ¦¡¤£¦P¡G

¦ì§}  ¤j¤p(¦ì¤¸²Õ)    ·N     ¸q
-------------------------------------------------
 00        1        ©R¥O¸ê®Æ¡A0BH¡A³o¬O©I¥s®É¥Îªº
 01        1        ±ý¬d¸ß­µ­y½s¸¹
 02        4        ¸Ó­µ­y°_©lªº¦ì¸m¡A¥H¬õ¥Ö®Ñ MM:SS:FF ªí¥Ü
 06        1        Track control information

CMD=84H/AX=1510H/INT 2FH ºt«µ­µ¼Ö

©I¥s³o­ÓªA°Èµ{¦¡«e¡A¤]­n¥ý³]©wdevice driver request header¡A¨ä®æ¦¡©M«e­±¤£¤Ó¬Û¦P¡A®æ¦¡¦p¤U¡G

¦ì§}  ¤j¤p(¦ì¤¸²Õ)    ·N     ¸q
---------------------------------------------------
 00        1       device driver request header ªø«×¡A15H??
 01        1       subunit code
 02        1       84H¡A§Yºt«µ­µ¼Öªº©R¥O½X
 03        2       ¶Ç¦^ª¬ºA¡A°Ñ¦Ò²Ä 21 ³¹µù¤G
 05        8       ¬Ò³]¬° 0¡A«O¯d
 0D        0       ¦ì§}¼Ò¦¡¡A0 ªí¥Ü HSG ¤è¦¡¡A1 ªí¥Ü¬õ¥Ö®Ñ¤è¦¡
 0E        4       ºt«µ¦ì¸m¡A¨Ì¦ì§}¤è¦¡¥H HSG ©Î¬õ¥Ö®Ñ¤è¦¡ªí¥Ü
 12        4       ºt«µ®É¶¡¡A§¡¥H HSG ¤è¦¡ªí¥Ü

¥ý»¡»¡²Ä 0DH ­Ó¦ì¤¸²Õªº¦ì§}¼Ò¦¡§a¡C°²¦p³]¬°¹sªí¥Ü¥H HSG ¤è¦¡­pºâ¡A³oºØ¤è¦¡¬O¥HºÏ°Ï½s¸¹ªí¥Ü¡A¥Ñ²Ä¹s¸¹¨ì³Ì¤j 332999 ¸¹¡A¤]¬O¤º©wªº¤è¦¡¡C°²¦p¬O 1 «hªí¥Ü¬O¨Ì·Ó¬õ¥Ö®Ñªº¤è¦¡ªí¥Ü¡A¥¦¬O¥H MM:SS:FF ªº¤è¦¡ªí¥Ü¡A«h³Ì°ª¦ì§}ªº¦ì¤¸²Õ¨Ã¨S¦³¨Ï¥Î¨ì¡A³]¬°¹s¡F²Ä¤G°ªªºªí¥Ü¤ÀÄÁ¡A0 ¨ì 74 ¤À¡F²Ä¤T°ªªºªí¥Ü¬íÄÁ¡A0 ¨ì 60 ¬í¡F³Ì§C¦ì§}ªº¦ì¤¸²Õªí¥Ü®æ¡A0 ¨ì 74 ®æ¡C¨âªÌªº´«ºâ¤è¦¡¬O¡G

ºÏ°Ï=¤À*60*75 + ¬í*75 + ®æ - 150

¦Óºt«µ¦ì¸m´N¬Oµø¦ì§}¼Ò¦¡¦Ó©w¡A¥i¥H¥Î HSG ©Î¬õ¥Ö®Ñ¤è¦¡¨Ó¨M©w¡C¦ý¬Oºt«µ®É¶¡«o¥u¯à¥H HSG ¤è¦¡­q©w¡C

CMD=85H/AX=1510H/INT 2FH °±¤îºt«µ

³o­ÓªA°Èµ{¦¡¥²¶·³]©w device driver request header ¤¤ªº«e 13 ­Ó¦ì¤¸²Õ¡A¦Ó¥B©R¥O½X¬° 85H §Y¥i¡A¦p¤Uªí¡G

¦ì§}  ¤j¤p(¦ì¤¸²Õ)    ·N     ¸q
---------------------------------------------------
 00        1       device driver request header ªø«×¡A0DH
 01        1       subunit code
 02        1       85H¡A§Y°±¤îºt«µ­µ¼Öªº©R¥O½X
 03        2       ¶Ç¦^ª¬ºA¡A°Ñ¦Ò²Ä 21 ³¹µù¤G
 05        8       ¬Ò³]¬° 0¡A«O¯d

·í device driver request header ³]©w¦n¤§«á¡A¨Ï ES:BX «ü¦V¸Óªí¡ACX ¬°¥úºÐ¾÷½s¸¹¡A¨Ï AX ³]¬° 1510H¡A¦A©I¥s INT 2FH §Y¥i¡C

CMD=88H/AX=1510H/INT 2FH Ä~Äòºt«µ

³o­Ó¥\¯à¬O¨Ï¸g¥Ñ°±¤îºt«µªº¥úºÐÄ~Äòºt«µ¡A¤]¬O¥u»Ý³]©w device driver request header ¤¤ªº«e 13 ­Ó¦ì¤¸²Õ¡A¦p¤Uªí

¦ì§}  ¤j¤p(¦ì¤¸²Õ)    ·N     ¸q
---------------------------------------------------
 00        1       device driver request header ªø«×¡A0DH
 01        1       subunit code
 02        1       88H¡A§Y°±¤îºt«µ­µ¼Öªº©R¥O½X
 03        2       ¶Ç¦^ª¬ºA¡A°Ñ¦Ò²Ä 21 ³¹µù¤G
 05        8       ¬Ò³]¬° 0¡A«O¯d

·í device driver request header ³]©w¦n¤§«á¡A¨Ï ES:BX «ü¦V¸Óªí¡ACX ¬°¥úºÐ¾÷½s¸¹¡A¨Ï AX ³]¬° 1510H¡A¦A©I¥s INT 2FH §Y¥i¡C

­µ¼Ö¥úºÐºt«µµ{¦¡

©³¤U¤p¤ì°¸¼¶¼g¤F¤@­Óµ{¦¡¡A¥¦¯àÅã¥Ü­µ¼Ö¥úºÐ¦³´X­ººq¦±¡AµM«á¥Ñ¨Ï¥ÎªÌ¿é¤J­nÅ¥ªººq¦±½s¸¹¡Aµ{¦¡¯àºt«µ¥X¨Ó¡C¤p¤ì°¸±N¥¦¼g¦¨ CD_PLAY.ASM ÀÉ¡A³o­Óµ{¦¡¤£¯àÂà´«¦¨ CP_PLAY.COM ÀÉ¡A¥u¯à¥Ñ CD_PLAY.EXE ¨Ó°õ¦æ¡C°õ¦æ®É¦b DOS ¼Ò¦¡¤U¡G

H:\HomePage\SOURCE>cd_play [Enter]
³o¤ù¥úºÐ¦@¦³ 17 ­º¦±¤l¡A±z­nÅ¥²ÄÅ¥²Ä´X­º¡H03
H:\HomePage\SOURCE>

¿é¤J 03 ªí¥ÜÅ¥²Ä¤T­ººq¡C©³¤U¬O­ì©l½X¦Cªí¡G

rq      struc           ;¦ì§}---·N-----¸q-------
len     db      ?       ; 00 device driver request header ªø«×
subunit db      ?       ; 01 subunit¡A0
command db      ?       ; 02 ©R¥O½X
status  dw      ?       ; 03 ªð¦^ª¬ºA
reverse dq      ?       ; 05 «O¯d¡A0
address db      ?       ; 0D ´CÅé´y­z¤l
trn_off dw      ?       ; 0E ¶Ç°e¸ê®Æ¦ì§}¡A°¾²¾¦ì§}
trn_seg dw      ?       ;    °Ï¬q¦ì§}
len_tr  dw      ?       ; 12 ¶Ç°e¸ê®Æªø«×
rq      ends

rq1     struc           ;¦ì§}---·N-----¸q-------
len1    db      ?       ; 00 device driver request header ªø«×
subuni1 db      ?       ; 01 subunit¡A0
comman1 db      ?       ; 02 ©R¥O½X
status1 dw      ?       ; 03 ªð¦^ª¬ºA
revers1 dq      ?       ; 05 «O¯d¡A0
addres1 db      ?       ; 0D ¦ì§}¼Ò¦¡
ply_sec dd      ?       ; 0E ¶}©lºt«µºÏ°Ï
ply_tim dd      ?       ; 12 ºt«µ®É¶¡
rq1     ends

        .286
;***************************************
cd_data segment
;¤U¤@¦æ¬°¦s©ñ¨C¤@­µ­yªº°_©lºÏ°Ï½s¸¹¡A¨C¤@­µ­y¦û 4 ­Ó¦ì¤¸²Õ
track   db      100 dup ( 4 dup(0) )    ;028 °_©lºÏ°Ï¸ê®Æ

;°T®§¡G
mes1    db      '¨S¦³¥úºÐ¾÷$'
mes2    db      '³o¤ù¥úºÐ¦@¦³ '
mes2_no db      '00 ­º¦±¤l¡A±z­nÅ¥²ÄÅ¥²Ä´X­º¡H$'

;±o¨ì¥úºÐ¤ù¸ê®Æ©Ò»Ýªº device driver request header
disk_info       rq      <13h,0,3,?,0,0,offset dsk_ifo,seg cd_data,7>
dsk_ifo         db      0ah,?
total_tracks    db      ?       ;038 ­µ­yÁ`¼Æ
ending_sector   dd      ?

;±o¨ì­µ­y¸ê®Æ©Ò»Ýªº device driver request header
track_info      rq      <13h,0,3,?,0,0,offset trk_ifo,seg cd_data,7>
trk_ifo         db      0bh
track_no        db      1       ;044 ­µ­y½s¸¹
track_start     dd      ?       ;045 ¸Ó­µ­y¤§°_©l¦ì¸m¡AMM:SS:FF
track_ctl       db      ?

;ºt«µ­µ­y©Ò»Ýªº device driver request header
play            rq1     <15h,0,84h,?,0,0,?,?>

;©³¤U¬O¤@¨ÇÅܼÆ
cd_driver       dw      ?       ;052 CDROM¾÷½s¸¹
cd_data ends
;***************************************
stack   segment stack           ;055 °ïÅ|°Ï¬q
        db      20 dup ('my stack')
stack   ends
;***************************************
code    segment
        assume  cs:code,ds:cd_data
;---------------------------------------
start:  push    ds              ;062 µ{¦¡½X¶}©l
        sub     ax,ax
        push    ax
        mov     ax,cd_data
        mov     ds,ax
        mov     es,ax

        sub     bx,bx
        mov     ax,1500h
        int     2fh             ;071 ±o¨ì²Ä¤@¥xCDROM¾÷½s¸¹
        or      bx,bx
        jnz     play0
        mov     dx,offset mes1  ;074 ¨S¦³CDROM¾÷
        mov     ah,9
        int     21h
exit:   mov     ax,4c01h        ;077 µ²§ôµ{¦¡
        int     21h

play0:  mov     cd_driver,cx    ;080 ±o¨ì¥úºÐ¤ù¸ê®Æ
        mov     bx,offset disk_info
        mov     ax,1510h        ;082 ¦b¦¹µ{¦¡¤¤³Ì­«­nªº¸ê°T¬OÁ`ºq¦±¼Æ
        int     2fh             ;083 ¡A©I¥s§¹«á·|¦s©ó total_tracks

        mov     al,total_tracks ;085 ±NÁ`ºq¦±¼Æ¥H ASCII ½Xªº
        call    al2dec          ;086 §Î¦¡¦s¤J mes2 ¦r¦êùØ

;©³¤Uªºµ{¦¡¥Øªº¬O±o¨ì¨C¤@­µ­yªº°_©lºÏ°Ï½s¸¹
        mov     dl,0
        mov     di,offset track ;090 ¨C¤@­µ­yªº°_©lºÏ°Ï½s¸¹¦s©ó track ùØ
play1:  mov     cx,cd_driver
        mov     bx,offset track_info
        mov     ax,1510h
        int     2fh             ;094 ©I¥s§¹«á³o¤@­µ­yªº°_©l®É¶¡¦s©ó
        cld                     ;095 track_start ¶}©lªº 4 ­Ó¦ì¤¸²Õ
;§â°_©l®É¶¡Âà´«¦¨ºÏ°Ï½s¸¹¡AºÏ°Ï½s¸¹=¤À*60*75+¬í*75+®æ-150¡A¥B¬° 32 ¦ì¤¸
        mov     si,offset track_start
        lodsb                   ;098 AL=®æ
        cbw
        mov     bx,ax           ;100 BX=®æ
        mov     cl,75
        lodsb                   ;102 AL=’
        mul     cl              ;103 AX=’*75
        push    dx
        add     bx,ax           ;105 BX=¬í*75+®æ
        mov     cx,60*75
        sub     bx,150          ;107 BX=¬í*75+®æ-150
        lodsw
        sub     dx,dx           ;109 DX:AX=¤À
        mul     cx              ;110 DX:AX=60*75*¤À
        add     ax,bx
        adc     dx,0            ;112 DX:AX=60*75*¤À+¬í*75+®æ-150
        mov     [di],ax         ;113 ¦s¤J track °}¦CÅܼÆùØ
        inc     di
        inc     di
        mov     [di],dx
        inc     di
        pop     dx
        inc     di
        inc     track_no
        inc     dl
        cmp     dl,total_tracks
        jnz     play1

        mov     dx,offset mes2  ;125 ¦L¥XÁ`­µ­y¼Æ
        mov     ah,9
        int     21h
play2:  call    key_in          ;128 ¿é¤J­nÅ¥ªººq¦±¡A¨Ã¦s©ó BX
        cmp     bl,total_tracks ;129 Àˬd¬O§_¦bÁ`­µ­y¼Æªº½d³ò¤º
        jbe     play4
        mov     cx,2            ;131 ¤£¦b½d³ò¤º¡A­«·s¼Æ¤J«e´å¼Ð°h¦ì¨â®æ
play3:  mov     dl,08h
        mov     ah,2
        int     21h
        loop    play3
        jmp     play2
                                ;137 ±N­nÅ竵­µ­y¤Î¤U¤@­µ­yªº°_©lºÏ°Ï¦s¤J
play4:  dec     bx              ;138 device driver request header ùØ
        mov     di,offset play.ply_sec
        mov     cx,4
        shl     bx,2
        mov     si,offset track
        add     si,bx           ;143 ¨ú±o­nºt«µ­µ­y°_©lºÏ°Ï¦ì§}
        rep     movsw

;­nºt«µ­µ­yªººÏ°Ïªø«×µ¥©ó¤U¤@­µ­yªº°_©lºÏ°Ï´î­nºt«µ­µ­y°_©lºÏ°Ï
        mov     di,offset play.ply_tim
        mov     si,offset play.ply_sec
        mov     ax,[di]
        mov     bx,2
        sub     ax,[si]
        mov     [di],ax
        mov     ax,[di+bx]
        sbb     ax,[si+bx]
        mov     [di+bx],ax
        mov     bx,offset play  ;156 ºt«µ­µ­y
        mov     cx,cd_driver
        mov     ax,1510h
        int     2fh

        mov     ax,4c00h        ;161 µ²§ôµ{¦¡
        int     21h
;---------------------------------------
;§âÁ`­µ­y¼ÆÅܦ¨ ASCII ½X¨Ã¦s©ó mes2_no ³B
al2dec  proc    near
        cbw
        mov     cl,10
        mov     bx,offset mes2_no
        div     cl
        add     ax,3030h
        mov     [bx],ax
        ret
al2dec  endp
;---------------------------------------
;¿é¤J­nºt«µªº­µ­y½s¸¹¡Aªð¦^®É BX=­nºt«µªº­µ­y½s¸¹
key_in  proc    near
        sub     bx,bx
        mov     cx,0a00h
key0:   mov     ah,0
        int     16h     ;181 Áä½LªA°Èµ{¦¡
        cmp     al,'0'
        jb      key0
        cmp     al,'9'
        ja      key0
        mov     dl,al
        mov     ah,2
        int     21h
        sub     al,'0'
        cbw
        xchg    ax,bx
        mul     ch      ;192 ¥ý¿é¤J¤Q¦ì¼Æ¬GÀ³§â²Ä¤@¦¸¿é¤Jªº¼Æ
        add     bx,ax   ;193 ­¼¥H 10¡A¦A¥[¤W²{¦b¿é¤Jªº­Ó¦ì¼Æ
        inc     cl
        cmp     cl,2
        jne     key0
        ret
key_in  endp
;---------------------------------------
code    ends
;***************************************
        end     start   ;202 ­ì©lµ{¦¡µ²§ô

Åý§Ú¨Ó¸ÑÄÀ³o­Óµ{¦¡§a¡C¥ý»¡³o­Óµ{¦¡ªº¥D­n¬[ºc¡A¦A»¡»¡²Ó¸`³¡¥÷¡C¥Ñ¤p¤ì°¸©Ò¦¬¶°¨ìªº¸ê®Æ¨Ó¬Ý¡A¦pªG­n¥Ñµ{¦¡¼½©ñ­µ¼Ö¥úºÐ¤Wªº¨ä¤¤¤@­º¦±¤l¡A¨S¦³¿ìªkª½±µ«ü©w­n¼½©ñ¨º¤@­µ­y¡A¥²¶·­n§ä¥X¸Ó­µ­yªº°_©lºÏ°Ï©Î°_©l®É¶¡¡AµM«á¦A«ü©w­n¼½©ñ´X­ÓºÏ°Ï¡A¥Ñ¤W­z¸ê®Æ¥h³]©w device driver request header¡A©I¥s INT 2FH ¤¤Â_¡C¦]¦¹¤p¤ì°¸³]©w¤@­Ó track ÅܼơA§@¬°¦s©ñ¨C¤@­µ­y°_©lºÏ°Ï½s¸¹¡A¦Ó¼½©ñºÏ°Ï¼Æ´Nµ¥©ó«á­±ªº­µ­y°_©lºÏ°Ï½s¸¹´î¥h«e­±­µ­y°_©lºÏ°Ï½s¸¹¡A³o¼Ë¤j­P¬[ºc´N¦¨¤F¡C

µ{¦¡ªº«e 21 ¦æ©w¸q¤F¨â­Óµ²ºcÅé¡A³o¬Oµ¹ device driver request header ¨Ï¥Îªº¡A¦]¬°Åª¨ú­µ¼Ö¥úºÐ¸ê®Æ©Mºt«µ­µ¼Ö¥úºÐ©Ò¥Îªº device driver request header ¤£¤Ó¬Û¦P¡A©Ò¥H¤p¤ì°¸©w¸q¤F¨â­Óµ²ºcÅé¡C¦pªG±z¥Î MASM 6.11 ¨Ó²ÕĶ¡A³o¨â­Óµ²ºcÅ骺Äæ¦ì¦W¬Û¦P¨Ã¤£¼vÅT²ÕĶµ²ªG¡AMASM 6.11 ¯à¦Û°Ê¤À¿ë¡A¦ý¬O¦pªG±z¥Î MASM 5.0 ¨Ó²ÕĶ¡A«hµ²ºcÅéÄæ¦ì¦W­n¤£¬Û¦P¤~¯à¥¿½T²ÕĶ¡AÅãµM MASM 6.11 ¬OÁo©ú±o¦h¤F¡A¦ý¬°¤F¯à¥Î MASM 5.0 ²ÕĶ¡A©Ò¥H¤p¤ì°¸¨ú¤£¦P¦WºÙªºÄæ¦ì¡C

.286 °²«ü¥O

§Ú­Ìª¾¹D 80X86 ®a±Úªº CPU ³£¦³¦V¤U¬Û®eªº¯S©Ê¡A¤]´N¬O«á¤@¥Nªº CPU ¥i¥H°õ¦æ«e¤@¥N«ü¥O¶°¡A¦P®É¤S§ó¥[±j¤F©Î¦h¤F¤@¨Ç«ü¥O¡A¦b³o­Óµ{¦¡ùØ¡A¤p¤ì°¸¦bµ{¦¡²Ä 141 ¦æ¥Î¤F¤@­Ó shl bx,2 «ü¥O¡A¦b 8086/8088 «ü¥O¶°¨Ã¨S¦³³o¼Ëªº«ü¥O¡A8086/8088 ¨C¦¸¥u¯à¥ª²¾¤@­Ó¦ì¤¸¡A¦pªG­n¤@¨â­Ó©Î¨â­Ó¥H¤Wªº¸Ü¡A¥²¶·§â¥ª²¾¦¸¼Æ¥ý©ñ¤J CL ùØ¡A¦A¥ª²¾¡C¦ý¬O 80286 ¥H¤Wªº CPU ¬O¥i¥H¼g¦¨³o¼Ëªº¡A°²¦p¨S¦³«ü©w .286 ¨º²ÕĶ¾¹·|¨Ï¥Î 8086/8088 «ü¥O¶°¡A¬G·|²£¥Í¿ù»~¡A©Ò¥H¤p¤ì°¸¦bµ{¦¡¶}©l«ü©w¨Ï¥Î 80286 ªº«ü¥O¶°¡C

µ{¦¡²Ä 28 ¦æ¬O©w¸q¤@­Ó track ÅܼơA³o­ÓÅܼƨƹê¤W¬O¤@­Ó«Ü¤jªº°}¦C¡A¥¦¥H¥|­Ó¦ì¤¸²Õ¬°¤@³æ¦ì¡A¥Nªí¨C­Ó­µ­yªº°_©lºÏ°Ï½s¸¹¡A¨Ì¾Ú¬õ¥Ö®Ñ©Ò©w¸qªº­µ¼Ö¥úºÐ¡A¨C¤ù­µ¼Ö¥úºÐ³Ì¤j¥u¯à¦s©ñ 99 ­Ó­µ­y¡A¤]´N¬O 99 ­ººq¦±¡A¦]¦¹¤p¤ì°¸©w¸q¤F 100 ­Ó­µ­y©Ò»Ý¤§°_©lºÏ°Ï¡A¦@¦û 400 ­Ó¦ì¤¸²Õ¡C

µ{¦¡²Ä 32¡N33 ¦æ¤À¶}¨Ó¼gªº­ì¦]¬O¬°¤F¨Ï 163 ¨ì 172 ¦æªº AL2DEC °Æµ{¦¡«Ü¤è«Kªº§â­µ­yÁ`¼Æ¶ñ¤J³o­Ó¦r¦êùØ¡AµM«á¤@¦¸¥Ñ AH=9H/INT 21H ¦L¦b¿Ã¹õ¤W¡C²Ä 35 ¨ì²Ä 50 ¦æ¦@¦³¤T­Óµ²ºcÅé¡A¤À§O¬Oµ¹¨ú±o­µ¼Ö¥úºÐ¸ê®Æ¡N­µ­y¸ê®Æ¡Nºt«µ­µ¼Ö©Ò»Ýªº device driver request header ©Ò¥Î¡C¨ä¥Lªº³¡¥÷¨Ã¤£Ãø¤F¸Ñ¡A¤p¤ì°¸´N¤£ÂØ­z¤F¡C

«á°O

§Ú·Q³o­Óµ{¦¡ÁÙ¦³«Ü¤jªºÂX¥RªÅ¶¡¡A¨Ò¦p¥[¤W¼È°±¡N¸õ¨ì¤W/¤U¤@­º¦±¤l¡N½Õ¾ã­µ¶q¡N¶}±Ò/Ãö³¬¥úºÐ¾÷¦«½L¡NÅã¥Ü¥¿¦b¼u«µªº®É¶¡¡N°±¤î¼½­µµ¥µ¥¡A±z³£¥i¥H°Ñ¦Ò¤¤¤s¬üÄR¤§®qºëµØ°Ï¥úºÐÅX°Ê­ì©l»¡©ú¤å¥ó¹ê§@¥X¨Ó¡C


µù¤@¡G¥úºÐ¤ù¤Wªº¡y­µ­y¡z©M³nºÐ¤ù¤Wªº¡yºÏ­y¡z¤£¦P¡C¥úºÐ¤ù¤W­±¨Ã¨S¦³¹³³nºÐ¤ù¤@¼Ëªº¦P¤ß¶ê­y¹D¡A¦Ó¬O¤@­ÓÁ³§Î­y¡A©Ò¥H¥u¦³¤@­y¡A¼Ð·Çªº­µ¼Ö¥úºÐ¤W¦³¤@­ÓÁ³§Î­y¹D¡A¤W­±¦@¦³ 333000 ­ÓºÏ°Ï(sector)

¦^¨ì­º­¶¡A ¨ì²Ä¤G¤Q³¹¡A ¨ì²Ä¤G¤Q¤G³¹