²³©Ò¬Òª¾¡A¹q¸£¬O¥Î¨Ó³B²z¸ê®Æªº¡A§Ú̱N³\¦h¸ê®Æ¿é¤J¹q¸£¡AµM«á¸g¥Ñ¹q¸£¤¤ CPU ªº±j¤j¹Bºâ¥\¯à¡AÀò±o§ÚÌ©Ònªºµ²ªG¡CµM¦Ó¦b¹q¸£¤u§@®É¡A¦³®É¤´µM·|¦³³\¦h«nªº¸ê®Æ¥²¶·¥ß§Y±µ¦¬³B²z¡A§_«h·|³y¦¨¸ê®Æªº¿ò¥¢¡A¨Ò¦p¡A¹q¸£¥¿¤u§@®É¡A¨Ï¥ÎªÌ¬ðµM«ö¤UÁä½L¤Wªº«öÁä¡A³o®É¹q¸£±oÀu¥ý³B²z¨Ï¥ÎªÌªº«öÁä¡A§_«h¸ê®Æ´N¬y¥¢¤F¡C
¤@¯ë¹q¸£½u¸ô³]p¤§ªì´N·|¦Ò¼{³oÓ°ÝÃD¡A¤jP¥i¥H¥Î¨âºØ¤è¦¡¸Ñ¨M³oÓ°ÝÃD¡C²Ä¤@ºØ¬O§Þ¥©¬O±Ä¥Î½ü¸ß ( polling ) ªº¤è¦¡¡A¹q¸£¨C¹j¤@¬q®É¶¡¬d¸ß¦UÓ©PÃä³]³Æ¬O§_¦³¸ê®Æ¡A°²¦p¨Ï¥Î³oºØ¤è¦¡ªº¸Ü¡A©PÃä³]³Æ¤]»Ýn³]p¤@ÓÃB¥~ªº½w½Ä°Ï¡A§â¸ê®Æ¦s¦b¸Ó³B¡Aµ¥¹q¸£¬d¸ß®É¦A¥æ¥Ñ¹q¸£¨ú¥X³B²z¡C²Ä¤GºØ§Þ¥©¬O¤¤Â_¡A·í¹q¸£ªº©PÃä³]³Æ¦³¸ê®Æ²£¥Í®É¡A©PÃä³]³Æ·|³qª¾ CPU¡A¦Ó CPU ·|¥ýÀÁ¤U¥Ø«eªº¤u§@¨Ã§â·í®Éªºª¬ºA¦s°_¨Ó¡AµM«á³B²z³o¨Ç¸ê®Æ¡A«Ý³B²z§¹¦¨«á¡A¦AÄ~Äò³Q¥´Â_ªº¤u§@¡CIBM PC ¤Î¨ä¬Û®e¹q¸£±Ä¨ú¤¤Â_ªº¤è¦¡³B²z¬ð¦p¨ä¨Óªº¸ê®Æ¡C¨Æ¹ê¤W¡A¦b¤é±`¥Í¬¡¤¤¡A¤]¦³«Ü¦h³o¼Ëªº¨Ò¤l¡C¨Ò¦p¦b¦Y¶º®É¡A¬ðµM¹q¸Ü¹aÁnÅT°_¡A§ÚÌ´N·|¥ý©ñ¤U¸_¤l¡A±µÅ¥¹q¸Ü¡Aµ¥³q¸Ü§¹²¦«á¡A¦AÄ~Äò¦Y¶º¡C±µÅ¥¹q¸Ü³oӰʧ@¡A«K¹³¬O¤¤Â_¤@¯ë¡C
¦b IBM PC ¤Î¨ä¬Û®e¹q¸£¯à³B²z 256 Ó¤¤Â_¡A±q²Ä¹s¸¹¨ì 0FFH¡C³o¨Ç¤¤Â_³B²z¨Ó¦Û¦UºØ¤£¦Pªº©PÃä³]³Æ©ÎªÌ¬O¨Ó¦Û³nÅ骺n¨D¡A¦b IBM PC ¤Î¨ä¬Û®e¹q¸£ªº¤¤Â_¥i¤À¬°¨âºØ¡G
¤£ºÞ¬O³nÅ餤Â_©ÎµwÅ餤Â_¡A¥¦Ì¥»¨¨ä¹ê³£¬O¤@ÓÓªºµ{¦¡¡AºÙ¬°¤¤Â_ªA°Èµ{¦¡ ( interrupt service routine¡AISR )¡A¥Î¨Ó³B²z¯S©wªº¥\¥Î¡A¨º»ò CPU ¬O¦p¦ó±oª¾¦UÓ¤¤Â_ªA°Èµ{¦¡¦b¨º¤@Ó¦ì§}¡A¦nÅý CPU ¦b³B²z¤¤Â_®É¸õÅD¦Ü¸Ó¦ì§}©O¡Hì¨Ó¨C¦¸¤@¶}¾÷®É¡ABIOS¡BDOS ©Î¨ä¥LÅX°Êµ{¦¡µ¥¡A·|¦b°O¾ÐÅé¦ì§} 0000:0000 ¨ì 0000:03FF ( ¥H 16 ¶i¦ìªí¥Ü ) ¤§¶¡ªº 1KB ùØ¡A³]©w¤¤Â_¦V¶qªí ( interrupt vector table )¡A©³¤U¬O¤p¤ì°¸¹q¸£¥H MS¡ÐDOS ¶}¾÷«á¡A¥Î SYMDEB Æ[¹î 0000:0000 ³Bªº°O¾ÐÅ餺®e¡G
-d 0:0 L30 0000:0000 57 92 19 00 F4 06 70 00-16 00 E7 0D F4 06 70 00 W...t.p...g.t.p. 0000:0010 F4 06 70 00 54 FF 00 F0-BF 00 00 F0 67 00 00 F0 t.p.T..p?..pg..p 0000:0020 3C 00 E7 0D 45 00 E7 0D-57 00 E7 0D 6F 00 E7 0D <.g.E.g.W.g.o.g. -
¤£¦Pªº¹q¸£¡A¦] BIOS¡BDOS ª©¥»©M¸ü¤JÅX°Êµ{¦¡¤£¦P¡A¦b³o 1KB ªº¤¤Â_¦V¶qªíùتº¤º®e¤£ºÉ¬Û¦P¡A¤£¹L¥un¬O IBM PC ¤Î¨ä¬Û®e¹q¸£ªº¤¤Â_¦V¶qªí¥²¦s©ó 0000:03FF ³B¦Ó¥B¨CÓ¤¤Â_³£¬O¥Î¤@ÓÂù¦r²Õ ( §Y¨âÓ¦r²Õ©Î¥|Ӧ줸²Õ ) ¨Óªí¥Ü¡G
¡@¡@²Ä¹s¸¹¤¤Â_§Y¥Ñ 0000:0000 ¨ì 0000:0003¡A¨ä¤º®e¬° 0019:9257¡A
¡@¡@INT 1 ¥Ñ 0000:0004 ¨ì 0000:0007¡A¨ä¤º®e¬° 0070:06F4¡A
¡@¡@INT 2 ¥Ñ 0000:0008 ¨ì 0000:000C¡A¨ä¤º®e¬° 0DE7:0016¡A
¡@¡@¡K¡K¡A
¦b¤¤Â_¦V¶qªí¤¤¡A¦]¬°¨C¤@Ó¤¤Â_³£»Ýn¥|Ӧ줸²ÕªºªÅ¶¡¡A¦]¦¹§ÚÌ«Ü®e©ö§ä¨ì²Ä n ¸¹¤¤Â_ ( INT n ) ¬O¦b°O¾ÐÅ餤ªº¨º¤@Ó¦ì§}¡G
INT n ¦b¦ì§} 0000:(4n) ³B
¨C¤@¤¤Â_ªºÂù¦r²Õ¤¤¡A¸û°ª¦ì§}ªº¦r²Õ¬Oªí¥Ü¸Ó¤¤Â_ªº°Ï¬q¦ì§}¡A§C¦ì§}ªí¥Ü°¾²¾¦ì§}¡A³o¨Ç¦ì§}¬Oµo¥Í¤¤Â_«á¡ACPU ·|¸g¥Ñ¤@Óªøµ{©I¥s¦Ó¨ì¸Ó¦ì§}Ä~Äò°õ¦æ¡C°²¦pn¦AÁ¿±o§ó¸Ô²Ó¨Ç¡A·íµo¥Í²Ä n ¸¹¤¤Â_®É¡AINT n «ü¥O·|¨Ï CPU ¨Ì§Ç°õ¦æ¤U±°Ê§@¡G
¥Ñ¤W±¬Ý¨Ó¡A¨ä¹ê INT «ü¥O¸ò CALL «ü¥O«Ü¬Û¹³¡A©Ò¤£¦Pªº¬O INT «ü¥O·|§âºX¼Ð¼È¦s¾¹±À¤J°ïÅ|¡A¨Ã¥B·|²M°£¤¤Â_ºX¼Ð¤Î³´¨ÀºX¼Ð ( ¸T¤î¨ä¥L¤¤Â_µo¥Í¤]¸T¤î³æ¨B°lÂÜ )¡A¦ý¬O CALL ¤£·|§âºX¼Ð¼È¦s¾¹±À¤J°ïÅ|¡A¤]¤£·|²M°£¤¤Â_ºX¼Ð¤Î³´¨ÀºX¼Ð¡C¦b¤¤Â_ªA°Èµ{¦¡¤§¤¤¡A¸Ó°µ¨º¨Ç¥²nªº¨Æ©O¡Hº¥ý¬On«ì´_¤¹³\¨ä¥L¤¤Â_µo¥Í¡Aì¦]¬O¨t²Îp®É¾¹·|©I¥s INT 8H¡A¦]¦¹¤£»°ºò«ì´_¥i¥H¶}±Ò¤¤Â_·|³y¦¨p®É¤£·Ç½T¡A¬Æ¦Ü¤Þ°_·í¾÷¡C²Ä¤G¬O¥Î PUSHA «ü¥O¦b°ïÅ|¤¤«O¦s¦U¼È¦s¾¹¤§¼ÆÈ¡A¥H«K¤¤Â_ªA°Èµ{¦¡µ²§ôªð¦^ìµ{¦¡®É¡A¤´«O¦³ì¨Óªºª¬ºA¡A·íµM¤F¡A¦pªG¬Y¨Ç¼È¦s¾¹¬O¥²¶··í§@ªð¦^ȨÑìµ{¦¡°Ñ¦Òªº¼È¦s¾¹¤S¥t·í§O½×¤F¡C²Ä¤T¬O§Y±Nªð¦^ìµ{¦¡®É¡A¥Î POPA «ü¥O¦Û°ïÅ|¨ú¦^¦U¼È¦s¾¹¤§È¡A¦P®Énª`·N¡A¤¤Â_ªA°Èµ{¦¡µLªk§âºX¼Ð·í¦¨ªð¦^ȶǦ^µ¹ì¨Óªºµ{¦¡¡C
¦Ó¦Û¤¤Â_ªð¦^ìµ{¦¡®É¡A´N¥²¶·¦Û°ïÅ|¨ú¦^ìµ{¦¡ªº¤U¤@«ü¥O¦ì§}¡A¦P®ÉÁÙn¦b°ïÅ|¨ú¦^ºX¼Ð¼È¦s¾¹¡A¦]¦¹¤¤Â_µ²§ô®É¤£¥Î RET «ü¥O¦Ó§ï¥Î IRET «ü¥O¡CIRET «ü¥O¨Ï CPU °õ¦æ¤U±¨â¥ó¨Æ¡G
©³¤U¤p¤ì°¸Á|¤@Ó¥i¯à¬O¨t²Î¤¤³Ì²³æªº¤¤Â_¡AINT 1CH¡A¨Ó»¡©ú INT¡BIRET ªº¹Lµ{¡CINT 1CH ¨ä¹ê¬O¤@ӪŪº¤¤Â_¡A¥¦´N¥u¦³¤@Ó«ü¥O IRET¡A¥ç§Yµo¥Í¦¹¤¤Â_«á¡A¥ß§Yªð¦^¡CINT 1CH ¨ä¹ê¬O³Q INT 8H ©Ò©I¥sªº¤@Ó¤¤Â_¡A¥¦¬O¹w¯dµ¹±`¾nµ{¦¡¨Ï¥Î¡CINT 1CH ªºµ{¦¡¦ì§}¥i¦b¤¤Â_¦V¶qªí 0000:0070 ³B§ä¨ì ( 1CH*4=70H )¡A§Ú̥ΠSYMDEB Æ[¹î¨Ã°µ¹êÅç¡A©³¤U¶À¦âªº¤å¦r¬O¤p¤ì°¸¿é¤Jªº«ü¥O¡A¥Õ¦âªºÂù¦r²Õ´N¬O INT 1CH µ{¦¡ªº¦ì§}¡G
-d 0:70 L10 [Enter] ¡÷Àˬd INT 1CH ¦ì§} 0000:0070 53 FF 00 F0 A4 F0 00 F0-22 05 00 00 E6 2F 00 C0 S..p$p.p"...f/.@ -u f000:ff53 [Enter]¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡@¡÷¬Ý¬Ý INT 1CH ªºµ{¦¡½X F000:FF53 CF IRET¡@¡@¡@¡@¡@¡÷INT 1CH ªºµ{¦¡½X´N¥u¦³¤@±ø¡AIRET F000:FF54 E933EA JMP E98A F000:FF57 0000 ADD [BX+SI],AL F000:FF59 284329 SUB [BP+DI+29],AL F000:FF5C 3230 XOR DH,[BX+SI] F000:FF5E 3030 XOR [BX+SI],DH F000:FF60 41 INC CX F000:FF61 4D DEC BP -a [Enter]¡@¡@¡@¡@¡@¡÷½s¼g¤@µ{¦¡¡A¶È°õ¦æ INT 1CH 1F4C:0100 int 1c [Enter] 1F4C:0102 [Enter] -rip 100 [Enter]¡@¡÷³]©w IP ¼È¦s¾¹¤§È -r [Enter]¡@¡@¡@¡@¡@¡÷¥ýÆ[¹î¦U¼È¦s¾¹¤§È AX=0000 BX=0000 CX=0000 DX=0000 SP=DFA3 BP=0000 SI=0000 DI=0000 DS=1F4C ES=1F4C SS=1F4C CS=1F4C IP=0100 NV UP EI PL NZ NA PO NC 1F4C:0100 CD1C INT 1C -t [Enter]¡@¡@¡@¡@¡@¡÷°lÂܸӵ{¦¡¡A¤w¶i¤J INT 1CH ùر¤F AX=0000 BX=0000 CX=0000 DX=0000 SP=DF9D BP=0000 SI=0000 DI=0000 DS=1F4C ES=1F4C SS=1F4C CS=F000 IP=FF53 NV UP DI PL NZ NA PO NC F000:FF53 CF IRET -d ss:df9d L20 [Enter]¡@¡÷Æ[¹î°ïÅ| 1F4C:DF90 00 00 00 00 00 00 00 00-00 00 00 00 00 02 01 4C ...............L 1F4C:DFA0 1F 02 F2 00 00 00 00 00-00 00 00 00 00 00 00 00 ..r............. -t [Enter] AX=0000 BX=0000 CX=0000 DX=0000 SP=DFA3 BP=0000 SI=0000 DI=0000 DS=1F4C ES=1F4C SS=1F4C CS=1F4C IP=0100 NV UP EI PL NZ NA PO NC 1F4C:0102 8ED8 MOV DS,AX -
¦b¤W±ªº¹êÅçùØ¡A·í°õ¦æ INT 1C «á¡AºX¼Ð¼È¦s¾¹¡BINT 1C ¤U¤@¦ì§} ( ªð¦^¦ì§}¤§ CS:IP ) ³£·|³Q±À¤J°ïÅ|¡A³o¤@ÂI¥i¥H¸g¥ÑÆ[¹î°ïÅ|ùتº±¡§Î±oª¾ ( ÂŦâ¬OºX¼Ð¼È¦s¾¹¡A¾¥ºñ¦â³¡¥÷¬Oªð¦^¦ì§}¡AºX¼Ð¼È¦s¾¹ªºÈ¬O F202H¡A½Ð°Ñ¦Ò µù¤@ )¡A°£¦¹¤§¥~¡AINT «ü¥O¤]·|§âºX¼Ð¼È¦s¾¹ªº¤¤Â_ºX¼Ð³]¬° DI ( ¬õ¦â³¡¥÷ )¡C¤@¶i¤J INT 1C «á¡Aµ{¦¡¦ì§}Åܦ¨¦s©ó¤¤Â_¦V¶qªíªº¦ì§}¤F ( ¥Õ¦â³¡¥÷ )¡AINT 1C ¤°»ò¨Æ¤]¨S°µ´Nµ²§ô¤¤Â_¡A©Ò¥H¥u¦³¤@±ø«ü¥O IRET¡A¦A«×°lÂÜ¡Aµo²{ªGµM¤S¦^¨ì 1F4C:0102 ³B¡A¦P®É«ì´_ºX¼Ð¼È¦s¾¹¦¨¬°¶i¤J¤¤Â_«eªºª¬ªp¡C
¬°¤°»ònק襤Â_¦V¶qªí©O¡H¦]¬° IBM ¤Î·L³n¨Ã¨S¦³¨Ï¥Î©Ò¦³ªº¤¤Â_¡A´«¥y¸Ü»¡¡A¤´¦³³\¦h¤¤Â_¬O¥¼¨Ï¥Îªº¡A¥i¥H¨Ñ¨Ï¥ÎªÌ©Î¨ä¥L¼t°Ó¨Ï¥Î¡A¨Ò¦p INT 33H ²{¦b³Q¤½»{¬O¨Ï¥Î·Æ¹«ªºªA°Èµ{¦¡¡C°£¦¹¤§¥~¡AÁÙ¦³¨âÓ²z¥Ñ¡A¤@Ó¬O IBM ©Î·L³n´£¨Ñªº¤¤Â_¤£¦n¥Î¡A·Qק復¡F©Î¬O¬°¤F¼¶¼g±`¾nµ{¦¡ ( TSR¡Aterminate and stay resident )¡C·Qק襤Â_¦V¶qªí¡A¦³¨âºØ¤èªk¡A²Ä¤@ºØ¬O¨Ï¥Î DOS ´£¨Ñªº¤¤Â_ªA°Èµ{¦¡¡F²Ä¤GºØ¤èªk¬Oª½±µ×§ï 0000:0000 ¨ì 0000:03FF ³Bªº°O¾ÐÅé¡C
¥ý»¡²Ä¤@ºØ¤èªk¡AMS¡ÐDOS ªº¤¤Â_ªA°Èµ{¦¡ INT 21H ´£¨Ñ¤F¨âÓ¥\¯à¡A¤@ӥΨӨú±o¬Y¤¤Â_¦ì§} ( ¥Î AH=35H/INT 21H )¡A¤@ӥΨӳ]©w¬Y¤¤Â_¦ì§} ( ¥Î AH=25H/INT 21H )¡C¤p¤ì°¸¾ã²z¦p¤Uªí¡G
¨ú±o¤¤Â_¦ì§} | ³]©w¤¤Â_¦ì§} |
AL=±ý¨ú±o¦ì§}ªº¤¤Â_½s¸¹ AH=35H °õ¦æ INT 21H ªð¦^«á¡G ES:BX=¤¤Â_¦ì§} |
AL=±ý³]©w¦ì§}ªº¤¤Â_½s¸¹ AH=25H DS:DX=·sªº¤¤Â_µ{¦¡¦ì§} °õ¦æ INT 21H ªð¦^«á¡GµL |
«e±¤w¸g´£¹L¡A¨C¤@Ó¤¤Â_µ{¦¡ªº¦ì§}³£°O¿ý¦b°O¾ÐÅé 0000:03FF ¦ì§}³B¡A¦Ó¨C¤@Ó¤¤Â_µ{¦¡ªº¦ì§}³£¦û¾Ú¤@ÓÂù¦r²Õ¡A¦]¦¹«Ü®e©ö´N¯àpºâ¥X¸Ó¤¤Â_¦ì§}¡A¶i¦Óק復¡A¤èªkÁöµM²³æ¡A¦ý¬O«o±o¤p¤ß¡C°²¦p±znקï INT 9H ¤¤Â_¦ì§}¡A¥i¤£¯à³o¼Ë°µ¡G
mov es,0 ;¹w¥ý¨Ï¥Î .386 ¤~¥iª½±µ§ó§ï ES mov word ptr es:[24h],offset new_int9h ;³]©w·sªº INT 9H °¾²¾¦ì§} mov word ptr es:[26h],seg new_int9h ;³]©w·sªº INT 9H °Ï¬q¦ì§}
ì¦]¬O¡A¨Æ¹ê¤W¡A¦³¨Ç¤¤Â_¬OµwÅé¦Û¦æ²£¥Í¡A¦pªG·í¤W±×§ï¤¤Â_¦ì§}ªºµ{¦¡¤w°õ¦æ§¹²Ä¤GÓ mov «ü¥O¡A¦ý²Ä¤TÓ mov «ü¥O©|¥¼°õ¦æ®É¡A¨Ï¥ÎªÌè¦n«ö¤U¬Y¤@Áä¡A³o®É«K·|µo¥Í INT 9H¡A¦ý¬O³o®Éªº¤¤Â_¦V¶qªíªº INT 9H ªº¦ì§}¨ä¹ê¬O¿ùªº¡A¨t²Î«K·|·í¾÷¡C¦]¦¹§ï¦¨¤U±ªº¼Ë¤l¡G
mov es,0 cli ;¸T¤î¤¤Â_ mov word ptr es:[24h],offset new_int9h mov word ptr es:[26h],seg new_int9h sti ;¥i¥Hµo¥Í¤¤Â_
¤W±ªº°µªk¥i¥H¾A¥Î¦b¤j³¡¤Àªº±¡§Î¤U¡A¦ý¬O CLI «ü¥OµLªk¸T¤î NMI ªºµo¥Í¡A¦]¦¹¥i¯àÁÙ¬O·|²£¥Í·í¾÷ªº¦MÀI¡A¥¿½Tªºµ{¦¡À³¸Ó¬O¹³¤U±ªºµ{¦¡¡G
new_key dw offset new_int9h,seg new_int9h ¡K¡K mov es,0 mov di,24h mov si,offset new_key cld cli movsd sti
¤W±ªºµ{¦¡§â·sªº INT 9H ªº°¾²¾¦ì§}©M°Ï¬q¦ì§}³]©w¦¨¤@Ó¨â¦r²Õªº°}¦C¡AµM«á¥H MOVSD «ü¥O°µ·h²¾¡AMOVSD ¶È¬°¤@Ó«ü¥O¡A§Y¨Ï¬O NMI ¤]µLªk¦b«ü¥O¥¿°õ¦æ©|¥¼§¹¦¨®Éµo¥Í¡A³o¼Ë´N¥iÁקK¤¤Â_ªº¤zÂZ¤F¡C¤£¹L¬°¤F¬Ù«opºâ¤¤Â_ªA°Èµ{¦¡¦b¤¤Â_¦V¶qªíªº¦ì§}¡A¤j³¡¤Àªº±¡§ÎÁÙ¬O¥Î AH=25H/INT 21H ¨Óק襤Â_¦V¶qªí¡C
«e¤@³¹´¿´£¨ì·í CPU °µ°£ªk¹Bºâ¡A¦pªGµo¥Í°£¥H¹s©Î¬O°Ó¼Æ¤Ó¤j¡A·|²£¥ÍµL·N¸q©Î·¸¦ì¿ù»~¡ACPU ·|¦Û°Ê¤Þµo INT 0¡A¦b¿Ã¹õ¤W¦L¥X¡yDivide overflow¡z¡AµM«á²×¤îµ{¦¡¡C³oºØ³B²z¿ù»~ªº¤èªk¨Ã¤£§¹µ½¡A§A·Q°²¨Ï¯µ®Ñ¤p©j¤w¿é¤J³\¦h¸ê®Æ¡A¨Ã°µ¹Bºâ¡A¸U¤@¦³¤@µ§¸ê®Æµo¥Í°£¥H¹sªº¿ù»~¡A¦Ó¦o¨S¦³¨Æ¥ýÀx¦s¡Aµ²ªGµ{¦¡´Nµ²§ô¤F¡A¦o©Ò¿é¤Jªº¸ê®Æ¤£´Nªw´ö¤F¶Ü¡H¦pªG¦³³o¼Ë¤£³B²z INT 0 ªº°Ó·~³nÅé¡A·Q¥²¨S¤H·|¥h¶R¡C¥»³¹«e±¤w¸g¤¶²Ð¤F¤@¨Ç¤¤Â_ªº·§©À¡A¦pªG¹ï INT 0 ¤F¸Ñ ( °Ñ¦Òµù¤G )¡A´N¥i¥H°µÂ²³æªº×§ï¡C
©³¤Uªºµ{¦¡¡ANEW_INT0.ASM¡A¬O¹ï INT 0 °µÂ²³æªº×§ï¡C³oÓµ{¦¡°µ¤TÓ 8 ¦ì¤¸ªº°£ªk¹Bºâ¡G4096¡Ò0¡B4096¡Ò10¡B4096¡Ò32¡A«Ü©úÅ㪺²Ä¤@Ó¬O°£¥H¹s¡Aµ²ªG¬°µL·N¸q¡A²Ä¤GÓ°£ªkªº°Ó¼Æ¶W¹L 255¡AÅãµM·|³y¦¨·¸¦ì¡C°²¦p INT 0 ¤£´¿×§ï¡A¨º°µ§¹²Ä¤@Ó°£ªk«á¡ANEW_INT0 «K·|²×¤î¨Ãªð¦^ DOS¡C¦ý¬O¦b NEW_INT0.ASM ¤¤¡A¤p¤ì°¸×§ï¤F INT 0¡A¦]¦¹°£¥H¹s¶È·|¦L¥X¡yDivide by Zero!¡z¦r¦ê¡Aµ{¦¡ÁÙ¯àÄ~Äò°õ¦æ¤U¥h¡A¦Ó¥B·¸¦ì¤]¤£¬O°ÝÃD¡ANEW_INT0.ASM ¤´¯àºâ¥X¥¿½Tªº°Ó¼Æ©M¾l¼Æ¡A¨Ã¥B¦L¥X¨Ó¡C½Ð¬Ý°õ¦æªºµ²ªG¡G
E:\HomePage\SOURCE>new_int0 [Enter]
4096/0=Divide by Zero!
4096/10=409...6
4096/32=128
E:\HomePage\SOURCE>
§¹¾ãªº NEW_INT0.ASM ì©l½X¦p¤U¡A§â¥¦¦s¦¨ NEW_INT0.ASM¡A¸g²ÕĶ¡B³sµ²¨ÃÂà´«¦¨ NEW_INT0.COM ¥i°õ¦æÀÉ¡C
;·sªº INT 0¡Ð¦¹µ{¦¡¥i¥HÀˬd°£¥H¹sªº¿ù»~¡A¦Ó¤£·|²×¤îµ{¦¡ page ,132 ;*********************************************************** .386 code segment use16 assume cs:code,ds:code org 100h ;----------------------------------------------------------- start: jmp begin old_int0 dw ?,? message db 'Divide by Zero!' n dw 1000h ;1000h=4096d d1 db 0 d2 db 10 d3 db 20h buffer db 30h dup (' ') message_len equ offset n-offset message ;----------------------------------------------------------- new_int0 proc near sti mov bx,sp add word ptr ss:[bx],div_len mov bx,0ffffh iret new_int0 endp ;----------------------------------------------------------- hex2dec proc near ;§âEDX¤º©Ò¦sªº¤Q¤»¶i¦ì¦³¸¹¼ÆÅܦ¨¤Q¶i¦ì¦³¸¹¼Æ¡A¦s©óDI©Ò«üªº¦ì§} jmp short h2d0 tmp db 10 dup (' ') h2d0: test edx,80000000h ;Àˬd¬O§_¬°t¼Æ jz h2d1 mov al,'-' ;Y¬°t¼Æ¡A«h¨ú¨ä2ªº¸É¼Æ¡A¨Ã neg edx ;©óDI©Ò«ü¦ì§}¦s¤Jt¸¹ stosb h2d1: push di mov ebx,10 ;¨ÏEDX¨C¦¸°£¥H10¡A©Ò±oªº¾l¼Æ mov eax,edx ;¤À§O¬°¤Q¶i¦ìªºÓ¦ì¼Æ¡B¤Q¦ì¼Æ¡B mov di,offset tmp+9 ;¦Ê¦ì¼Æ¡K¡K¡A§â³o¨Ç¾l¼Æ¼È®É¦s©ó mov cx,bx ;tmp¦r¦ê¤¤(¥Ñ°ª¦ì§}¶}©l¦s) h2d2: sub edx,edx div ebx add dl,'0' mov [di],dl or eax,eax jz h2d3 dec di loop h2d2 h2d3: mov si,di ;§âtmp¦r¦ê¤¤ªº¨C¤@¦ì¼Æ¡A¦s¤J pop di ;DI©Ò«ü¦ì§} sub bx,cx mov cx,bx inc cx rep movsb ret hex2dec endp ;----------------------------------------------------------- division proc near sub bh,bh ;¨ÏBX°ª¦ì¤¸²Õ¬°¹s¡A¦]¬°°£¼Æ¶È¥Î BL push ax ;©I¥shex2dec®É¡AAX¡BBX§¡·|³Q¯}Ãa¡A push bx ;¬G¥ýÀx¦s©ó°ïÅ|ùØ sub edx,edx mov dx,ax call hex2dec ;pºâ³Q°£¼Æ¤§¤Q¶i¦ìASCII¦r¤¸ mov al,'/' stosb pop dx push dx call hex2dec ;pºâ°£¼Æ¤§¤Q¶i¦ìASCII¦r¤¸ mov al,'=' stosb pop bx pop ax or bl,bl jz divi2 ;Àˬd¬O§_°£¥H¹s¡AY¬O«h¸õ¦Üdivsi2 push bx addr_d: div bl addr_n: cmp bx,0ffffh ;Àˬd¬O§_°Ó¼Æ¤Ó¤j¡AµLªk©ñ¨ìAL¼È¦s¾¹ pop bx ;¡AY¤Ó¤j«h°£ªk·¸¦ì¡A¸õÅD¦Üdivi3³B²z je divi3 div_len equ offset addr_n-offset addr_d mov dl,al divi0: push ax call hex2dec ;pºâ°Ó¼Æªº¤Q¶i¦ìASCII¦r¤¸ pop ax or ah,ah jz divi1 mov dl,ah mov ax,2e2eh stosw stosb call hex2dec ;pºâ¾l¼Æªº¤Q¶i¦ìASCII¦r¤¸ divi1: mov ax,0a0dh stosw mov al,'$' stosb mov dx,offset buffer mov ah,9 int 21h ret divi2: mov si,offset message mov cx,message_len ;°£¥H¹s¡A«h¦L¥X¡yDivide by Zero!¡z rep movsb jmp divi1 divi3: sub cx,cx ;°£ªk·¸¦ì¡A«h§ï¥Î³sÄò´îªk¥N´À°£ªk mov bh,0 ;BX=°£¼Æ¡AAX=³Q°£¼Æ divi4: cmp ax,bx ;pºâ§¹«á¡ACX=°Ó¼Æ¡AAL=¾l¼Æ jbe divi5 ;Y³sÄò´îªk´î¦ÜAX¤ñ°£¼Æ¤p¡Aªí¥Ü°£ªk¤w§¹¦¨ sub ax,bx ;¡A°£ªk§¹¦¨«á¸õÅD¦Üdivi5¡A§_«hÄ~Äò´î¥h°£¼Æ inc cx jmp divi4 divi5: mov dx,cx mov ah,al ;¦]8¦ì¤¸ªºDIV«ü¥O¡A©Ò±o¾l¼Æ¦bAH¡A¬G§â jmp divi0 ;AH³]¬°AL¡A¦A¸õÅD¦Üdivi0 division endp ;----------------------------------------------------------- begin: push es mov ax,3500h ;Àx¦sªº INT 0 ¦ì§} int 21h mov old_int0,bx mov [old_int0+2],es mov dx,offset new_int0 mov ax,2500h int 21h pop es mov ax,n mov bl,d1 mov di,offset buffer call division ;pºâ 100h/0 mov ax,n mov bl,d2 mov di,offset buffer call division ;pºâ 1000h/10=409d...6 mov ax,n mov bl,d3 mov di,offset buffer call division ;pºâ 1000h/20h=128d push ds mov dx,word ptr old_int0 mov ds,word ptr [old_int0+2] mov ax,2500h ;«ì´_ì¨Óªº INT 0 int 21h pop ds mov ax,4c00h ;µ²§ôµ{¦¡ int 21h ;----------------------------------------------------------- code ends ;*********************************************************** end start
NEW_INT0.ASM ³Ì¥Dnªº¦a¤è¦b©ó new_int0 °Æµ{¦¡¡AÁöµM³oӰƵ{¦¡¶È¶È¤¦æ¡A¥¦«o§ïÅܤF°£ªk¿ù»~´N²×¤îµ{¦¡ªº¤£§¹¬ü¤§³B¡C³o¤¦æ«ü¥O°µ¤T¥ó¨Æ¡A²Ä¤@¬O¥i«·s¤¹³\¤¤Â_µo¥Í¡C²Ä¤G¥ó¨Æ¬O§ïÅܦb°ïÅ|ùØ¡Aªð¦^ìµ{¦¡ªº¦ì§}¡C«e±´£¹L¡A·í°õ¦æ INT «ü¥O®É¡A·|¨Ì§Ç§âºX¼Ð¼È¦s¾¹¡Bµo¥Í¤¤Â_®É¤U¤@Ó«ü¥Oªº¦ì§}¦s¤J°ïÅ|¡A¥H«OÃÒ±q¤¤Â_µ{¦¡ªð¦^®É¡A¯à§ä¨ììµ{¦¡µo¥Í¤¤Â_®Éªº¦a¤èÄ~Äò°õ¦æ¡C¦ý¬O¡A¹ï©ó INT 0 ³oÓ¤¤Â_«Ü©_©Ç¡A³oÓ¤¤Â_¬Oµo¥Í¦b°£¥H¹s©Î°£ªk·¸¦ì®É¡A¦pªG DIV «ü¥O°£¥H¹s©Î°Ó¼Æ¤Ó¤j¦Ó·¸¦ì¡ACPU ¨Ã¤£¬O§â DIV ¤U¤@«ü¥Oªº¦ì§}±À¤J°ïÅ|¡A¤Ï¦Ó¬O§â DIV «ü¥O©Ò¦b¦ì§}±À¤J°ïÅ|¡C¬°¤°»ò·|³o¼Ë¡H³o¤@ÂI¤p¤ì°¸¤]¤£²M·¡¡A¦p¦³«e½ú°ª¤H¡A¯à´£¨Ñ·N¨£«h·P¿E¤£ºÉ¡C
DIV «ü¥Oªº¦ì§}¬O¥Ñ CS:IP ©Ò²Õ¦¨¡ACPU ¥ý§âºX¼Ð¼È¦s¾¹¤Î CS ¼È¦s¾¹¨Ì§Ç±À¤J°ïÅ|¡A¦A§â IP ±À¤J°ïÅ|¡CSP ¼È¦s¾¹¥ý¬O«ü¦V°ïÅ|³»ºÝ¡A¨C±À¤J¤@µ§¦r²Õªø«×ªº¸ê®Æ¨ì°ïÅ|¡ASP ¼È¦s¾¹«K´î¤Ö 2¡A¦]¦¹§ÚÌnק諸´N¬O SP ©Ò«üªº¦ì§}¡A¦Ü©ón§ï¦¨¦h¤Ö©O¡H³o©M DIV ªº°£¼Æ¦³Ãö¡A°£¼Æ¥i¥H¬O¼È¦s¾¹©Î¬O°O¾ÐÅéÅܼơA¦ý¬O¥¦Ì©Ò²Õ¦¨ªº¾÷±ñ½Xªø«×¤£¦P¡A¦]¦¹¤p¤ì°¸¥Î div_len ¨Óªí¥Ü DIV «ü¥O©Ò¦û¾÷±ñ½Xªø«×¡A¥un§â SS:SP ©Ò«ü¦ì§}¤º¤§¼ÆÈ¥[¤W div_len ¤§È¡A´N¬O DIV «ü¥O¤U¤@¦ì§}¡C¦Ü©ó div_len ¥i¥H¥Ñ DIV ¤U¤@«ü¥O¦ì§}´î¥h DIV «ü¥O¦ì§}¦Ó±o¨ì¡A¨£ division °Æµ{¦¡¤¤ªºµ{¦¡¤ù¬q¡G
or bl,bl jz divi2 ;Àˬd¬O§_°£¥H¹s¡AY¬O«h¸õ¦Üdivsi2 push bx addr_d: div bl addr_n: cmp bx,0ffffh ;Àˬd¬O§_°Ó¼Æ¤Ó¤j¡AµLªk©ñ¨ìAL¼È¦s¾¹ pop bx ;¡AY¤Ó¤j«h°£ªk·¸¦ì¡A¸õÅD¦Üdivi3³B²z je divi3 div_len equ offset addr_n-offset addr_d
¦b·sªº INT 0H ¤¤Â_¤¤©Ò§@ªº²Ä¤T¥ó¨Æ±¡¬O¦pªGµo¥Í·¸¦ì®É¡A§â BX ³]¬° 0FFFFH °µ¬°ªð¦^È¡Aìµ{¦¡¥unÀˬd BX ¬O§_¬° 0FFFFH ´Nª¾¹D¬O§_µo¥Í·¸¦ì¡C·íµM¤F¡A¦pªG·|¶i¤J INT 0 ªºµ{¦¡¡AÅãµM´N·|²£¥Í·¸¦ì¡A©Ò¥H¦b INT 0 µ{¦¡ùØ¡A¤£»ÝnÀˬd¡C¦Ü©ó°£¥H¹sªº±¡§Î«h¦b addr_d: ¼Ð°O¤W¤T¦æªº«ü¥O¡A¡yOR BL,BL¡z¡A¥hÀˬd°£¼Æ¬O§_¬°¹s¡C¾ã²z¤@¤U§a¡INEW_INT0.ASM ¹ï©ó°£¥H¹sªº¿ù»~¡A¬O¨Æ¥ýÀˬd°£¼Æ¬O§_¬°¹s¡F¦Ó¹ï©ó°£ªk·¸¦ìªº±¡§Î¡A¬Oקï INT 0 ¤¤Â_¡A¨Ï¥¦¯à¹Bºâ¡CŪªÌÀ³¸Ónª¾¹D¡A¦b¼Æ¾Ç¬O¤W¨S¦³¤°»ò·¸¦ìªº¨Æµo¥Í¡A¦]¦¹¤°»ò°£ªk·¸¦ì¨ä¹ê¬O¥i¥Hºâ¥Xµª®×¨Óªº¡C
µù¤@¡G¦b¶i¤J INT 1CH ¤§«e¡A¥Ñ SYMDEB Æ[¹î¦UºX¼Ð¬O NV UP EI PL NZ NA PO NC¡A·¸¦ìºX¼Ð¬° NV ¬G NF=0¡B¤è¦VºX¼Ð¬° UP ¬G DF=0¡B¤¤Â_ºX¼Ð¬° EI ¬G IF=1¡B²Å¸¹ºX¼Ð¬° PL ¬G SF=0¡B¹sºX¼Ð¬° NZ ¬G ZF=0¡B»²§U¶i¦ìºX¼Ð¬° NA ¬G AF=0¡B¦P¦ìºX¼Ð¬° PO ¬G PF=0¡B¶i¦ìºX¼Ð¬° NC ¬G CF=0¡A¹ï·ÓºX¼Ð¼È¦s¾¹ªº¦UÄæ¦ì¡A½Ð¬Ý¤U¹Ï¡G
µù¤G¡G¨Æ¹ê¤W¡AµwÅ餤Â_¥i¤À¬°¨âºØ¡A¤@ºØ¬O¤º³¡¤¤Â_¡A¥t¤@ºØ¬O¥~³¡¤¤Â_¡C¤º³¡¤¤Â_¬O«ü¥Ñ CPU ¦Û¦æ²£¥Íªº¤¤Â_¡A¨Ò¦p°£¥H¹s©Î°£ªk·¸¦ì¡B°£¿ùµ{¦¡¤¤ªº³æ¨B°lÂܩΰõ¦æ¨ì¤¤Â_ÂI¡C¥~³¡¤¤Â_«h¬O¨ä¥Lªº©PÃä³]³Æ²£¥Íªº°T¸¹¡A³qª¾ CPU µo¥Íªº¤¤Â_¡A¥~³¡¤¤Â_¤S¥i¦A²Ó¤À¬°¥i¾B¸n¤¤Â_ ( maskable interrupt ) ©M¤£¥i¾B¸n¤¤Â_ ( non-maskable interrupt¡ANMI ) ¨âºØ¡C¥i¾B¸n¤¤Â_¬O«ü¥i¥H³Q CPU «ü¥O¸T¤î©Î¤¹³\ªº¤¤Â_¡A·íµo¥Í¥i¾B¸n¤¤Â_®É¡ACPU ·|¥ýÀˬdºX¼Ð¼È¦s¾¹¤¤ªº¤¤Â_ºX¼Ð ( IF )¡A·í¤¤Â_ºX¼Ð¬° 1 ®É¡ACPU ¥i±µ¨ü¥~¨Óªº¤¤Â_°T¸¹¡F¤Ï¤§¡AY¤¤Â_ºX¼Ð¬° 0 ®É«h¤£±µ¨ü¤¤Â_n¨D¡C8086 «ü¥O¶°ùر¦³Ó«ü¥O STI ¥i¥H³]©w¤¤Â_ºX¼ÐÅܬ° 1¡A¤¹³\¥i¾B¸n¤¤Â_°õ¦æ¤¤Â_ªA°Èµ{¦¡¡F¥t¤@Ó«ü¥O¡ACLI ¥i¥H²M°£¤¤Â_ºX¼ÐÅܬ° 0¡A¤£¤¹³\¥i¾B¸n¤¤Â_°õ¦æ¤¤Â_ªA°Èµ{¦¡¡C
¤£¥i¾B¸n¤¤Â_ ( NMI ) «h¬OµLªk³Q CPU «ü¥O¸T¤î©Î¤¹³\ªº¤¤Â_¡A¥ç§Y¥unµo¥Í¤F NMI¡A¤£ºÞ¤¤Â_ºX¼Ð¬O§_³]©w©Î²M°£¡A¤¤Â_³£·|³Q CPU °õ¦æ¡C¥u¦³ÄY«ªº¿ù»~µo¥Í®É¤~·|²£¥Í NMI¡A¨Ò¦p 8087 ¿ù»~¡B°O¾ÐÅ骺¦P¦ì¤¸¿ù»~ ( parity error )¡BI/O ³q¹D¿ù»~¡A³o¨Ç¿ù»~µo¥Í®É¡AY¤£³B²z ( ¨ä¹ê¤j³¡¤Àªº³B²z¤è¦¡¤]¥u¯à°eפF )¡A©Ò±oªº¸ê®Æ¤]¬O¿ù»~ªº¡A§Y¨Ï CPU ¯à³B¨Ò³o¨Ç¸ê®Æ¡A©Ò±oµ²ªG¤]¬OµL·N¸qªº¡C
©³¤U¤p¤ì°¸¹ïµwÅ餤Â_°µ¤@²³æ´yz¡C
INT 00H¡G³o¬O CPU µo¥Xªº¤º³¡¤¤Â_¡AºÙ¬°°£ªk¿ù»~ ( divide error )¡A·íµo¥Í°£¥H¹s©Î°£ªk·¸¦ì®É¡A·|²£¥Í¦¹¤¤Â_¡C®Ú¾Ú Ralf Brown's Interrupt List ´yz¡A²£¥Í¦¹¤¤Â_®É¡ACPU ¨Ã¤£¬O§â DIV ªº¤U¤@«ü¥O¦ì§}±À¤J°ïÅ|¡A¦Ó¬O§â DIV «ü¥O©Ò¦b¦ì§}±À¤J°ïÅ|¡A³o¤@ÂI»P¨ä¥L¤¤Â_¤£¦P¡C
INT 01H¡G³oÓ¤¤Â_¬O CPU ¦Û¨µo¥Xªº¤º³¡¤¤Â_¡AºÙ¬°³æ¨B°lÂܤ¤Â_ ( single-step interrupt )¡C·íºX¼Ð¼È¦s¾¹ªº³´¨ÀºX¼Ð³]©w®É¡A¨C°õ¦æ¤@Ó«ü¥O«K·|µo¥Í INT 1H¡A¦pªGµ{¦¡¨Æ¥ý¼¶¼g¦n INT 1H ªº¤¤Â_ªA°Èµ{¦¡¡A´N¥i¥H§â°õ¦æ¸Ó«ü¥O«á¼È¦s¾¹¤º®eÅã¥Ü©ó¿Ã¹õ¤W¡C
INT 02H¡G¦b IBM PC ùتº 256 Ó¤¤Â_ùØ¡A¥u¦³ INT 2 ¬O NMI¡A¥u¦³·í«ÜÄY«ªº¿ù»~µo¥Í¡A¨Ò¦p 8087 ¿ù»~¡B°O¾ÐÅ骺¦P¦ì¤¸¿ù»~ ( parity error )¡BI/O ³q¹D¿ù»~¡A´N·|²£¥Í INT 2 ¤£¥i¾B¸n¤¤Â_¡C
INT 03H¡G³oÓ¤¤Â_¬O CPU ¦Û¨µo¥Xªº¤º³¡¤¤Â_¡AºÙ¬°¤¤Â_ÂI¤¤Â_ ( breat-point interrupt )¡A±`¥Î©ó°£¿ùµ{¦¡°£¿ù¡C¦b°£¿ùµ{¦¡¤¤¤U¤¤Â_ÂI ( breakpoint ) ªº·N«ä¡A¨ä¹ê´N¬O§â¸Ó¦ì§}ªº«ü¥O§ï¦¨ INT 3H¡C¨Ò¦p¥Î DEBUG ¸ü¤J²Ä¤@³¹ªº exam01.com µ{¦¡°£¿ù¡G
-u 100 123 [Enter] 10F7:0100 EB17 JMP 0119 10F7:0102 90 NOP 10F7:0103 48 DEC AX 10F7:0104 692C2049 IMUL BP,[SI],4920 10F7:0108 206C65 AND [SI+65],CH 10F7:010B 61 POPA 10F7:010C 726E JB 017C 10F7:010E 206173 AND [BX+DI+73],AH 10F7:0111 7365 JNB 0178 10F7:0113 6D INSW 10F7:0114 626C79 BOUND BP,[SI+79] 10F7:0117 2E24BA AND AL,BA 10F7:011A 0301 ADD AX,CS:[BX+DI] 10F7:011C B409 MOV AH,09 10F7:011E CD21 INT 21 10F7:0120 B8004C MOV AX,4C00 10F7:0123 CD21 INT 21 -g 120 [Enter]¡@¡@¡÷¦b¦ì§} 0120 ³]¥ß¤¤Â_ÂI¡ADEBUG °õ¦æ¨ì¦¹·|³Q¥´Â_ Hi, I learn assembly. AX=0924 BX=0000 CX=0025 DX=0103 SP=FFFE BP=0000 SI=0000 DI=0000 DS=10F7 ES=10F7 SS=10F7 CS=10F7 IP=0120 NV UP EI PL NZ NA PO NC 10F7:0120 B8004C MOV AX,4C00
·íµ{¦¡³]p®v¦b DEBUG ¤¤¤U¡yg 120¡z³o¹D«ü¥O®É¡A¨ä¹ê DEBUG ´N¬O§â¦b 0120 ¦ì§}³Bªº«ü¥O§ï¦¨ INT 3H¡A³o¼Ë DEBUG °õ¦æ¨ì 0120 ¦ì§}³B´N·|²£¥Í INT 3H¡Aº¸«á INT 3H ¦A§â¼È¦s¾¹ªºª¬ºA¦L¦b¿Ã¹õ¤W¡C·íµM¨Æ«á DEBUG ¥²¶·n¯à«ì´_즨ì¨Óªºµ{¦¡½X¡A¦Ó¥B·í¨Ï¥ÎªÌ¥H¡yu¡z«ü¥OÆ[¹îµ{¦¡½X®É¤]¤£¯àÅã¥Ü¥X INT 3H ¨Ó¡C
INT 04H¡G³oÓ¤¤Â_¬O CPU µo¥Íªº¤º³¡¤¤Â_¡AºÙ¬° INTO ·¸¦ì¤¤Â_ ( INTO detected overflow )¡C·í CPU ¹Bºâ®Éµo¥Í¤F·¸¦ì¡A¦pªG¦¹¨è¦A°õ¦æ INTO «ü¥O¡A´N·|²£¥Í INT 4H¡A³oÓ¤¤Â_·|²×¤îì¨Óªºµ{¦¡¨Ãªð¦^§@·~¨t²Î¡C¦pªG¹Bºâ«á¡ACPU ¤£µo¥Í·¸¦ì¡A¦pªG¦¹®É¦A°õ¦æ INTO «ü¥O¡A«h¤£²£¥Í INT 4H¡ACPU ·|Ä~Äò°õ¦æ INTO ªº¤U¤@¹D«ü¥O¡C
INT 05H¡G¥H 8086/8088 ©Ò»s¦¨ªº IBM PC ùØ¡A³oÓ¤¤Â_¬O¤@¥~³¡¤¤Â_¡AºÙ¬°¿Ã¹õ¶É¦L ( print screen )¡A·í¨Ï¥ÎªÌ«ö¤UÁä½L¤Wªº¡yPrint Screen¡zÁä®É¡A¦Lªí¾÷·|§â¿Ã¹õ¤Wªº¤º®e¦L¦b¿Ã¹õ¤W¡C¦ý¨ì¤F 80286 ®É¥N³oÓ¤¤Â_Åܦ¨ CPU ¤º³¡¤¤Â_¡AºÙ¬° BOUND ½d³ò¿ù»~ ( BOUND range exceeded )¡ABOUND ¬O 80186 CPU ¥H«á©Ò·s¼Wªº«ü¥O¡A¨ä»yªk¬O¡G
BOUND «ü¥O¬OÄÝ©ó 80x86 «ü¥O¶°ªº¤@Ó¡A¤£¹L«Ü¤Ö¥Î¨ì¡A¥¦ªº¥Øªº¥Î¨ÓÀˬdÃä¬É¡A¨ä»yªk¦p¤U¡G
BOUND ¼È¦s¾¹¡A¦ì§}
Y¼È¦s¾¹¬° 16 ¦ì¤¸ªº¡A¥B¥ý§â¦ì§}»P¤ñ¸Ó¦ì§}¦h 2 ªº¨âÓ¦ì§}¶ñ¤J¦³¸¹¼Æ ( ¤pªº¦³¸¹¼Æ¦b°O¾ÐÅé¦ì§}§C³B )¡A«h BOUND ·|¤ñ¸û¼È¦s¾¹»P³o¨âÓ¦³¸¹¼Æ¤§È¡AY¼È¦s¾¹¤§¼ÆȦb³o¨âÓ¦³¸¹¼Æ¤§¶¡¡A«h¤£²£¥Í INT 5¡A§_«h²£¥Í INT 5¡C¨Ò¦p¡G
mov word ptr [200h],0fffah ;[0200]¡×¡Ð6 mov word ptr [202h],1 ;[0202]¡×1 mov ax,0fffeh ;AX¡×¡Ð2 bound ax,[200h] ;
Y AX ¦b 0FFFAH¡ã1 ¤§¶¡«h¤£²£¥Í INT 5¡F§_«h·|²£¥Í INT 5¡C¥H¦¹¨Ò¦Ó¨¥¡A¤£²£¥Í INT 5¡CY¼È¦s¾¹¬° 32 ¦ì¤¸¡A«h¤ñ¸û¼È¦s¾¹¬O§_¦b [ ¦ì§} ] »P [ ¦ì§}¡Ï4 ] ¤§½d³ò¤º¡AY¦b¸Ó½d³ò¤º«h¤£µo¥Í²Ä 5 ¸¹¤¤Â_¡F§_«hµo¥Í²Ä 5 ¸¹¤¤Â_¡C
INT 06H¡G³o¬O CPU ²£¥Íªº¤º³¡¤¤Â_¡A¬O«ü CPU ¹J¨ì¤£»{±oªº«ü¥O ( invalid opcode )¡A·íµo¥Í³oºØ¨Æ±¡®É¡A´N·|²£¥Í INT 6¡C¤j³¡¤Àªº±¡§Î¬O¦b¯u¹ê¼Ò¦¡¤U¡A°õ¦æ«OÅ@¼Ò¦¡ªº«ü¥O¡C
INT 07H¡G³o¬O CPU ²£¥Íªº¤º³¡¤¤Â_¡AºÙ¬°¦@¦P³B²z¾¹¤£¦s¦b ( processor extension not available )¡A©Ò¿×ªº¦@¦P³B²z¾¹´N¬O 80x87¡C³oÓ¤¤Â_¬Oµo¥Í¦b·í 80x86 ¹J¨ì 80x87 ªº«ü¥O¡A¦ý¬O 80x87 «o¤£¦s¦b®Éµo¥Í¡C¤£¹L¨ì¤F 80486 ¥H«á¡A´X¥G©Ò¦³ªº CPU ³£¤w¤º§t¤F¦@¦P³B²z¾¹¤F¡A©Ò¥H³oÓ¤¤Â_¤j·§¤£·|µo¥Í¤F¡C
INT 08H¡G³oÓ¤¤Â_¬O¥Ñ IBM PC ùتº¤@ÓºÙ¬° 8253 p®É¾¹µo¥X¨Óªº¥~³¡¤¤Â_¡A¦¹´¹¤ù¨C¬í¹ï CPU µo¥X 18.2 ¦¸ªº INT 8¡A´«¥y¸Ü»¡¡A8253 ·|Åý CPU ¨C¬í°õ¦æ INT 8 18.2 ¦¸¡C©Ò¥H§O¥H¬°±z¨S¦³«ö«öÁä¡A¤]¨SÅý¹q¸£¹Bºâ¡A¹q¸£´N¶¢µÛ¨S¨Æ°µ¡A¨ä¹ê¥un±z¶}±Ò¹q¸£¡A¹q¸£¤º³¡¨ä¹ê¬O«D±`¦£¸Lªº¤u§@µÛ¡A¦Ü¤Ö¨C¬íÄÁ´Nnµo¥Í 18.2 ¦¸ªº²Ä¤K¸¹¤¤Â_¡C¦³Ãö 8253 p®É¾¹§ó¸Ô²Óªº±¡§Î½Ð°Ñ¦Ò²Ä¤G¤Q¤E³¹¡C
INT 09H¡G³o¬OÁä½L¤¤Â_¡A¨C·í¨Ï¥ÎªÌ«ö¤U¤@Áä©ÎÃP¶}¤@Áä®É¡A´N·|µo¥Í INT 9¡A³qª¾ CPU §â¨Ï¥ÎªÌ«ö¤Uªº«öÁäÂà´«¦¨ ASCII ½X¥H¤Î±½´y½X¡AµM«áÀx¦s©ó 40:1E ¨ì 40:3D ³o 32 ¦ì¤¸²Õªº°O¾ÐÅ餺¡A³o¬q°O¾ÐÅéºÙ¬°Áä½L½w½Ä°Ï¡Aµ¥¨ìÀ³¥Îµ{¦¡°õ¦æ AH=0/INT 16H ®É¡A¤~§â¨Ï¥ÎªÌ«ö¤U«öÁ䪺 ASCII ½X»P±½´y½X¨ú¥X¡A¶Çµ¹À³¥Îµ{¦¡³B²z¡C
INT 0AH¡G¡H
INT 0BH¡G·í COM2 ©Î COM4 ( COM2¡BCOM4 ¬O§Ç¦C°ð ( serial port )¡A¦´Áªº·Æ¹«¡B¼Æ¾Ú¾÷³£¬O±µ¦b§Ç¦C°ð¤W± )±µ¦¬©Î¶Ç°e¸ê®Æ®É¡A²£¥Í INT 0BH ¥~³¡ªºµwÅ餤Â_¡C¦b 286 µ¥¯Å¥H¤Wªº¹q¸£¡A¦p¦b«OÅ@¼Ò¦¡®É¡A©Ò¿ï¾Ü°Ï¬q¤£¦s¦b®Éµo¥X INT 0BH ¤º³¡¤¤Â_¡C
INT 0CH¡G·í COM1 ©Î COM3 §Ç¦C°ð±µ¦¬©Î¶Ç°e¸ê®Æ®É¡A²£¥Í INT 0CH ¥~³¡ªºµwÅ餤Â_¡C
INT 0DH¡G³o¬O¦Lªí¾÷ µo¥Xªº¥~³¡¤¤Â_¡A¤@¯ë¦Lªí¾÷¬O±µ¦b¨Ã¦C°ð ( LPT2 ) ¤W¡A·í¦Lªí¾÷·Ç³Æ¦n¥i¥H±µ¦¬¸ê®Æ®É¡A·|µo¥X¦¹¤¤Â_¡C
INT 0EH¡G8086/8088 CPU ªº¹q¸£ùØ¡AINT 0EH ¬O³nºÐ±±¨î¾¹µo¥Xªº¥~³¡¤¤Â_¡C¦b 286 µ¥¯Å¥H¤Wªº¹q¸£¡A¦b«OÅ@¼Ò¦¡¤¤¦s¨úµêÀÀ°O¾ÐÅé®Éµo¥X INT 0EH¡C
INT 0FH¡G³o¬O¦Lªí¾÷ µo¥Xªº¥~³¡¤¤Â_¡A¤@¯ë¦Lªí¾÷¬O±µ¦b¨Ã¦C°ð ( LPT1 ) ¤W¡A·í¦Lªí¾÷·Ç³Æ¦n¥i¥H±µ¦¬¸ê®Æ®É¡A·|µo¥X¦¹¤¤Â_¡C