³o¤@³¹¤p¤ì°¸¤£¥´ºâÄ~Äò±Ð¾Ç¤º®e¡A¦Ó¬O§Q¥Î«e±ªºÆ[©À¹ê§@¤@µ{¦¡¡AÆ[¹î°O¾ÐÅéùتº¤º®e¡A³o¼Ë°µ¦³¨âӥتº¡G¤@¬OÅýŪªÌ¹ï¯u¹ê¼Ò¦¡ ( real mode ) ¤Uªº°O¾ÐÅé¦ì§}¦³¸û²M·¡ªº»{ÃÑ¡A¦pªG¯àÆ[¹î§ó¦h°O¾ÐÅ餺®e¡A·íµM¯à»{Ãѱo§ó²M·¡¡F²Ä¤G¬O¡AÆ[¹î°O¾ÐÅ餺®e¥»¨´N¬O«Ü¦³½ìªº¨Æ±¡¡AÁ|Ó¨Ò¤l¡A¥´¹qª±®É¥D¨¤ªº¦å¥²©w¬O°O¿ý¦b¬YÓ°O¾ÐÅ餺¡A¦pªG¯à·Q¿ìªkÅý¦¹°O¾ÐÅé¼ÆȤ£·|´î¤Ö¡A¨º»ò¥D¨¤´N¬O¤£¦º¤§ÂߤF¡C
³oÓµ{¦¡¦WºÙ¬O¡uMEMDUMP.ASM¡v¡AMEM ¬O memory¡A°O¾ÐÅ骺²¼g¡ADUMP ¬O¶É¦Lªº·N«ä¡A¥ç§Y§â°O¾ÐÅ餺®e¦L¦b¿Ã¥ú¹õ¤W¡C¦¹µ{¦¡°õ¦æµe±¦p¤U¡G
«Ü©úÅ㪺¡A³oÓµe±¬O¼Ò¥é DEBUG ¥H¡uD¡v«ü¥OÆ[¹î°O¾ÐÅ餺®e©ÒÅã¥Üªºµe±¡C¤£¦Pªº¬O¡A¥¦¨C¦¸´N¥u¯àÅã¥Ü 100H Ӧ줸²Õªº°O¾ÐÅ餺®e¡A¨Ï¥ÎªÌ¥i¥H«ö¡uPage Up¡v¡B¡uPage Down¡vÁäÆ[¹î¡A¤]¥i¥H«ö¡uS¡v©Î¡uO¡vÁä§ó§ï°Ï¬q¦ì§}©Î°¾²¾¦ì§}¡C¦pªGnÂ÷¶}¦¹µ{¦¡¡A¨º»ò´N«ö¤U¡uEsc¡vÁä¡C
¦³¤F³oÓ¤u¨ãµ{¦¡¡A¥i¥HÆ[¹î¨ì DOS 1MB ªº©Ò¦³°O¾ÐÅ餺®e¡A©³¤UÁ|´XÓ¨Ò¤l¡AŪªÌ¥i¥H¸Õ¸Õ¬Ý§ó§ï°O¾ÐÅ骺°Ï¬q¦ì§}©M°¾²¾¦ì§}Æ[¹î¡G
·íµMÁÙ¦³³\¦h¸ê®Æ¡A¤£¦b³oùؤ@¤@¦CÁ|¡AŪªÌ¥i¥H¦Û¦æ¬d¾\ºô¸ô¤Wªº¸ê®Æ¡C
©³¤U¥ý¤¶²Ð¡uMEMDUMP¡v¨Ï¥Î¨ìªº´XÓ¤¤Â_ªA°Èµ{¦¡¡C
³oÓªA°È¤¤Â_¥i¥HÅýµ{¦¡±q±±¨î¥x±µ¦¬¦r¤¸¡A©ÎªÌ§â¦r¤¸¿é¥X¨ì±±¨î¥x¡A³oùةҿתº±±¨î¥x´N¬OÁä½L©Î¿Ã¹õ¡C¦Ü©ón¿é¤JÁÙ¬O¿é¥X¦r¤¸¡A½Ð¬Ý©³¤Uªº»¡©ú¡G
±±¨î¥xª½±µ¿é¤J¿é¥X ¿é¤J¡GAH¡×06H ¡@¡@¡@DL¡×0FFH¡A¿é¤J¦r¤¸¡FDL¡Ú0FFH¡A¿é¥X¦r¤¸¡ADL §Y¬°n¿é¥Xªº¦r¤¸ °õ¦æ¡GINT 21H ªð¦^¡GY¿é¥X¦r¤¸®É¡A¨S¦³¦^¶ÇÈ ¡@¡@¡@Y¿é¤J¦r¤¸®É ¡@¡@¡@¡@¡@Y ZR¡A¨Ï¥ÎªÌ¨S¦³¿é¤J¦r¤¸ ¡@¡@¡@¡@¡@Y NZ¡AAL¡×¨Ï¥ÎªÌ«ö¤UªºÁä©Ò¥Nªí¦r¤¸ªº ASCII ½X©Î±½´y½X
AH¡×06H/INT 21H DOS ªA°Èµ{¦¡¦³¨âºØ¨Ñ¥\¥Î¡A¤@¬O§â¦r¤¸¦L¦b¿Ã¹õ¤W¡A¥t¤@ºØ¬O¥ÑÁä½L¿é¤J¦r¤¸¡C¥ý»¡²Ä¤@ºØ¥\¥Î¡A§â¦r¤¸¦L¦b¿Ã¹õ¤W¡C³o®É§ân¦L¦b¿Ã¹õ¤Wªº¦r¤¸ ASCII ½X©ñ¨ì DL ùØ¡AAH ³]¬° 06H¡A©I¥s INT 21H §Y¥i¡C
²Ä¤GºØ¥\¯à¬O¥ÑÁä½L¿é¤J¦r¤¸¡A³o®ÉÔn¦b©I¥s INT 21H ¤§«e¡A§â DL ³]¬° 0FFH¡AAH ³]¬° 06H¡AµM«á©I¥s INT 21H¡C³o®ÉÔ¤£ºÞ¨Ï¥ÎªÌ¬O§_¤w¿é¤J¸ê®Æ¡ADOS ³£¤£·|°±¤U¨Óµ¥¨Ï¥ÎªÌ¿é¤J¡A¦Ó¬Oª½±µ°õ¦æ INT 21H ªº¤U¤@¦æ«ü¥O¡C·íµM³o®É·|²£¥Í¨âºØ±¡§Î¡G
¤]³\¦³¤H·|¦³ºÃ°Ý¡AAH¡×01H/INT 21H¡BAH¡×0/INT 16H ¤]³£¯à±qÁä½L¤W¿é¤J¦r¤¸¡A¨º»ò¦³¤°»ò¤£¦P¡A¬°¦ón¦³³o»ò¦h¬Ý°_¨Ó¹³¬O¤@¼ËªºªA°Èµ{¦¡©O¡H¨Æ¹ê¤W¡A¥¦ÌÁÙ¬O¦³¤@¨Ç®t²§ªº¡A¥Î©³¤Uªºªí¨Ó¤ñ¸û¥i¯à·|²M·¡¤@¨Ç¡G
ªA°Èµ{¦¡ | ¬O§_µ¥«Ý¿é¤J | ¬O§_¨ü Ctrl¡ÐC ¼vÅT | ¬O§_¦b¿Ã¹õ¤W¦^À³ | ¬O§_¨ú±o±½´y½X |
AH¡×00H/INT 16H | ¬O | §_ | §_ | ¬O |
AH¡×01H/INT 21H | ¬O | ¬O | ¬O | §_ |
AH¡×06H/INT 21H | §_ | §_ | §_ | ¦³¨î |
¥Ñ¤Wªí¡A¥i¥H¬Ý¥X¨Ó¡A©I¥s AH¡×00H/INT 16H ©Î AH¡×01H/INT 21H «á·|µ¥«Ý¨Ï¥ÎªÌ¿é¤J¦r¤¸¡A¦ý¬O AH¡×06H/INT 21H «o¤£µ¥«ÝÄ~Äò°õ¦æ¤U¤@¹D«ü¥O¡F·í¨Ï¥ÎªÌ«ö¤U Ctrl¡ÐC ®É ( DOS ªº Ctrl¡ÐC Áä¬OÅýµ{¦¡¤¤Â_¦Ó°±¤î°õ¦æ¡Aªð¦^ DOS ¨t²Î¡A¨Ã«D Windows ªº½Æ»s§Ö±¶Áä )¡AAH¡×00H/INT 16H¡BAH¡×06H/INT 21H ¤£¨ü¼vÅT¡A¦ý AH¡×01H/INT 21H ·|¸õ¥Xµ{¦¡¦^¨ì DOS¡C³o¨ÇÃþ¦üªºªA°Èµ{¦¡¤£¦P¤§³BÁÙ¦³¡G¬O§_·|§â¨Ï¥ÎªÌ«ö¤UªºÁäÅã¥Ü¦b¿Ã¹õ¤W¡A¬O§_¯à¨ú±o±½´y½Xµ¥µ¥¡Aµ{¦¡³]p®v¥i¨Ì»Ý¨D¤£¦P¨Ï¥Î¡C
INT 10H ¬O¥Ñ¿N¿ý¦b BIOS ªºµ{¦¡¡A±Mªù´£¨Ñ©I¥sÅã¥Ü¥d¥\¯àªºªA°Èµ{¦¡¡A¨Ã¤£¬O DOS ´£¨Ñªº¡C¦b²Ä¤Q¤T³¹´£¹L±m¦âÅã¥Ü¥dªº¿Ã¹õ¥i¤À¬°¤å¦r¼Ò¦¡»P¹Ï§Î¼Ò¦¡¨âºØ¡A³o¨âºØ¤S¦³³\¦h¤£¦Pªº¸ÑªR«×¡C¦b DOS ¶}¾÷®É¡A¹w³]ªº¼Ò¦¡¬O 80¡Ñ25 ¤Q¤»¦â¤å¦r¼Ò¦¡¡A·íµM¡Aµ{¦¡¥i¥H¨Ì»Ý¨D©I¥s AH¡×00H/INT 10H §ïÅÜÅã¥Ü¼Ò¦¡¡A¨Ï¥Î¤èªk¦p¤U¡G
³]©wÅã¥Ü¼Ò¦¡ ( display mode ) ¿é¤J¡GAH¡×00H ¡@¡@¡@AL¡×·Qn³]©wªºÅã¥Ü¼Ò¦¡ °õ¦æ¡GINT 10H ªð¦^¡GµL
¤Uªí¬O CGA ©Ò¯à¤ä´©ªºÅã¥Ü¼Ò¦¡¡C«á¨Ó¤S±À¥X¤F EGA¡BVGA µ¥§ó°ª¶¥ªºÅã¥Ü¥d¡A¥i¥H¨Ï¥ÎªºÅã¥Ü¼Ò¦¡´N§ó¦h¤F¡A¦A¨ì«á¨Ó³s DOS ¤]¤w²^¨O¡A¦]¦¹´N¨S¦³¦C¥X¨Ó¤F¡C
Åã¥Ü¼Ò¦¡ | ¤å¦r©Î¹Ï§Î | ¸ÑªR«× | ÃC¦â |
0H | ¤å¦r | 40¡Ñ25 | ¶Â¥Õ |
1H | ¤å¦r | 40¡Ñ25 | 16 ¦â |
2H | ¤å¦r | 80¡Ñ25 | ¶Â¥Õ |
3H | ¤å¦r | 80¡Ñ25 | 16 ¦â |
4H | ¹Ï§Î | 320¡Ñ200 | 4 ¦â |
5H | ¹Ï§Î | 320¡Ñ200 | 4 ¦â¦Ç¶¥ |
6H | ¹Ï§Î | 640¡Ñ200 | ¶Â¥Õ |
AH¡×00H/INT 10H Y¬O¦¨¥\°õ¦æ¡AÁÙ·|²M°£¿Ã¹õµe±¡A§Y¨Ï¨S¦³§ïÅÜÅã¥Ü¼Ò¦¡¡A¦]¦¹¥i¥H¥Î¦¹ BIOS ªA°Èµ{¦¡¥R·í²M°£¿Ã¹õªº¥\¯à ( BIOS ¨S¦³±Mªù´£¨Ñ³oÓ¥\¯à )¡C¦ý¬O¦pªG AL ªº³Ì°ª¦ì¤¸¬° 1 ®É¡A´N¤£·|²M°£µø°T°O¾ÐÅ骺¤º®e¡A¦]¦¹¦b§ïÅÜÅã¥Ü¼Ò¦¡®É¡A¿Ã¹õ¤WÁÙ·|¦³¤@¨Ç¸ê®Æ´Ý¦s¡C
ÁöµM¼ÐÃD¬O¼g¡u³]©w´å¼Ð§Îª¬¡v¡A¦ý¬O¤d¸U¤£n»~·|¦¹ªA°Èµ{¦¡¥i¥H§â´å¼ÐÅܦ¨¤T¨¤§Î¡B¶ê§Î¡B¬P§Î¡K¡K³o¨Ç§Îª¬¡A¥¦¥u¯à§â´å¼ÐÅܦ¨°ª«×¤£¦Pªº¯x§Î¦Ó¤w¡C©I¥s¤è¦¡¦p¤U¡G
³]©w¿Ã¹õ¤å¦r¼Ò¦¡ªº´å¼Ð§Îª¬ ¿é¤J¡GAH¡×01H ¡@¡@¡@CH¡×´å¼Ð¶}©lø¥Xªº¦ì¸m¤Î¬O§_Åã²{´å¼Ð ¡@¡@¡@CL¡×´å¼Ðµ²§ôø¥Xªº¦ì¸m °õ¦æ¡GINT 10H ªð¦^¡GµL
¦b CGA Åã¥Ü¥d¤W¡A¥i¥H§â´å¼Ð¬Ý¦¨¬O¤@Ó¯x§Î¡A¤À¦¨¤Kµ¥¤À¡A¥Ñ¤W¦Ó¤U¤À§O¬O 0¡B1¡B2¡K¡K7¡C¦ý¬O¦b DOS ¶}¾÷®É¡A¥u¦³³Ì©³¤U¨â³¡¤À¬°¹q¸£¥H¥Õ¦âø¥X¨Ó¡A¨Ã¤£Â_°{Ã{¡A¤]´N¬O´å¼Ð¶}©lø¥Xªº¦ì¸m¬O 6¡Aµ²§ôø¥Xªº¦ì¸m¬O 7¡C°²¦pn§â´å¼Ð³£¶ñº¡¡A¥i¥H¥Î¤U±ªºµ{¦¡¡G
mov ah,1 mov cx,0007 int 10h
CH ªº¦ì¤¸ 7¡AÀ³³]¬° 0¡F¦ì¤¸ 5¡B6 §¡¬° 0 ®É¡A´å¼Ð¥¿±`Åã¥Ü¡F¨ä¥L¼ÆȮɡA´å¼Ð®ø¥¢¡C¦ì¤¸ 0¡ã4 ªí¥Ü´å¼Ð¶}©lø¥X¦ì¸m¡CCL ¥u¥Î¦ì¤¸ 0¡ã4 ¨Óªí¥Ü´å¼Ðµ²§ôø¥X¦ì¸m¡A¦ì¤¸ 5¡ã7 À³³]¬° 0¡C
¦¹ªA°Èµ{¦¡ªº¥Îªk¬O¡G
³]©w´å¼Ð¦ì¸m ¿é¤J¡GAH¡×02H ¡@¡@¡@BH¡×Åã¥Ü¶ ¡@¡@¡@DH¡×¦C ( ³Ì¤W±¤@¦C¬O 0 ) ¡@¡@¡@DL¡×¦æ ( ³Ì¥ªÃä¤@¦æ¬O 0 ) °õ¦æ¡GINT 10H ªð¦^¡GµL
BH ¬OÅã¥Ü¶¸¹½X¡A¤°»ò¬OÅã¥Ü¶ ( display page ) ©O¡Hì¨Ó CGA Åã¥Ü¥d¦³ 16KB ªºµø°T°O¾ÐÅé¡A¦pªGÅã¥Ü¼Ò¦¡³]¬° 3¡A¤]´N¬O 80¡Ñ25 ªº¤å¦r¼Ò¦¡¡A¨º»ò©Ò»Ýªº°O¾ÐÅéªÅ¶¡¬O 82¡Ñ25¡Ñ2¡×4000 Ӧ줸²Õ ( ¬°¤°»ò³o¼Ëºâ¡A¥i°Ñ¦Ò²Ä¤Q¤T³¹µø°T°O¾ÐÅé )¡A¶È»Ý 4KB ¥ª¥k¡C©Ò¥H CGA §â³oÓ¼Ò¦¡¤À¦¨¥|ÓÅã¥Ü¶¡A½s¸¹¥Ñ¹s¨ì¤T¡C
¦b¤@¶}¾÷®É¡A¨t²Î±NÅã¥Ü¼Ò¦¡³]¬° 3¡AÅã¥Ü¦b¿Ã¹õ¤Wªº¬O²Ä¹s¸¹Åã¥Ü¶¡A¨ä¦ì§}¬O B8000:0000 ¶}©l¦Ü B800:0F9F ¬°¤î¡F¦Ó²Ä¤@¸¹Åã¥Ü¶¦ì§} B800:1000 ¶}©l¡A¨ì B800:1F9F¡F²Ä¤G¸¹Åã¥Ü¶¥Ñ¦ì§} B800:2000 ¶}©l¨ì B800:2F9F¡F²Ä¤T¸¹Åã¥Ü¶¥Ñ B800:3000 ¶}©l¦Ü B800:3F9F¡CÅã¥Ü¶©MÅã¥Ü¶¤§¶¡¦³¤@ÂIªÅ»Ø¡CÅã¥Ü¼Ò¦¡ 2 ªºÅã¥Ü¶¦ì§}¤Àªk»P¤W±¤@¼Ë¡A¦ýÅã¥Ü¼Ò¦¡ 0 »P 1¡AÅã¥Ü¶ªº°_©l¦ì§}¬O 0000¡B0800¡B1000¡B1800¡K¡K¡C
¬°¤°»òn³]pÅã¥Ü¶©O¡Hì¨Ó¬O¹q¸£¹Bºâ³t«×¤ñ¤Hªº¿é¤J§Ö±o¦h¤F¡Aµ{¦¡¥i¥H¦bµ¥«Ý¤H¿é¤Jªº®É¶¡ªº³o¤@Àþ¶¡ ( ¹ï¤H¦Ó¨¥¬O¤@Àþ¶¡¡A¦ý¹ï CPU ¦Ó¨¥«o¯à°õ¦æ¼Æ¦Ê¸U¦¸¬Æ¦Ü§ó¦h¦¸ªº¹Bºâ )¡A¥ý§â¤U¦¸nÅã¥Üªºµe±¹Bºâ¥X¨Ó¡A¶ñ¦b¤U¤@ÓÅã¥Ü¶¤W¡Cµ¥¤H¿é¤J¦n«á¡Aµ{¦¡´N¥i¥H¤Á´«Åã¥Ü¶¦Ó¸`¬Ù¹Bºâ®É¶¡¡A¿Ã¹õµe±¤]´N«Ü§Ö¯àÅã¥Ü¥X¨Ó¤F¡C
¤£¦PÅã¥Ü¼Ò¦¡¡AÅã¥Ü¶ªº¦h¹è¤]¤£¦P¡ABH ªº½d³ò¤]¤£¦P¡CÅã¥Ü¼Ò¦¡¬° 0 ©Î 1 ®É¡A¦³ 8 ÓÅã¥Ü¶¡A¬G BH ¬° 0 ¨ì 7 ªº¾ã¼Æ¡FÅã¥Ü¼Ò¦¡¬° 2 ©Î 3 ®É¡A¦³ 4 ÓÅã¥Ü¶¡A¬G BH ¬° 0 ¨ì 3 ªº¾ã¼Æ¡F¹Ï§Î¼Ò¦¡¡ABH ¥²¬° 0¡C
¿ï¾ÜÅã¥Ü¶ªº·N«ä¡A´N¬O±N¸ÓÅã¥Ü¶ªº¤º®eÅã¥Ü¦b¿Ã¹õ¤W¡AÁöµM MEMDUMP ¥Î¤£µÛ³oÓ BIOS ªA°Èµ{¦¡¡A¦ý¤p¤ì°¸ÁÙ¬O¶¶«K¤¶²Ð¨Ï¥Î¤èªk¦p¤U¡G
¿ï¾ÜÅã¥Ü¶ ¿é¤J¡GAH¡×05H ¡@¡@¡@AL¡×Åã¥Ü¶ °õ¦æ¡GINT 10H ªð¦^¡GµL
¦pªGÅã¥Ü¼Ò¦¡¬° 0 ©Î 1¡AAL ¥i¥H¬O 0 ¨ì 7¡F¦pªGÅã¥Ü¼Ò¦¡¬° 2 ©Î 3¡AAL ¥i¥H¬O 0 ¨ì 3¡C¦pªGÅã¥Ü¼Ò¦¡¬° 4¡B5¡B6¡AAL ¥u¯à¬O 0¡C
¨ä¤º®e¦p¤U¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
25 26 27 28
29 30 31 32
33 34 35 36
37 38 39 40
41 42 43 44
45 46 47 48
49 50 51 52
53 54 55 56
57 58 59 60
61 62 63 64
65 66 67 68
69 70 71 72
73 74 75 76
77 78 79 80
81 82 83 84
85 86 87 88
89 90 91 92
93 94 95 96
97 98 99 100
101 102 103 104
105 106 107 108
109 110 111 112
113 114 115 116
117 118 119 120
121 122 123 124
125 126 127 128
129 130 131 132
133 134 135 136
137 138 139 140
141 142 143 144
145 146 147 148
149 150 151 152
153 154 155 156
157 158 159 160
161 162 163 164
165 166 167 168
169 170 171 172
173 174 175 176
177 178 179 180
181 182 183 184
185 186 187 188
189 190 191 192
193 194 195 196
197 198 199 200
201 202 203 204
205 206 207 208
209 210 211 212
213 214 215 216
217 218 219 220
221 222 223 224
225 226 227 228
229 230 231 232
233 234 235 |
.MODEL SMALL,C
.386
;*******************************************************************************
.STACK
;*******************************************************************************
video SEGMENT PARA AT 0b800h ;video°Ï¬q³]¦bµø°T°O¾ÐÅé¤W
video ENDS
;*******************************************************************************
.DATA
dump_segment DW ? ;n¶É¦Lªº°O¾ÐÅé°Ï¬q¦ì§}
dump_offset DW 0 ;n¶É¦Lªº°O¾ÐÅé°¾²¾¦ì§}
prog_name DB " M E M O R Y D U M P"
field_name DB " Seg:Off 00 01 02 03 04 05 06 07-08 09 0A 0B 0C 0D ",
"0E 0F 01234567-89ABCDEF"
line DB 77 DUP (0c4h)
help_text DB "Esx=EXIT S=Change Segment O=Change Offset PgDn",
"/PgUp=Forward/Backward"
input_offset DB " Input offset address : "
input_segment DB "Input segment address : "
error_msg DB "Please input 0-9 or A-F. "
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
invisible_cursor PROC ;¨Ï´å¼Ð®ø¥¢¤£¨£
mov ah,1
mov cx,2000h ;CHªºbit 5,6¤À§O¬O1,0¡A¥iÅý´å¼Ð®ø¥¢
int 10h
ret
invisible_cursor ENDP
;-------------------------------------------------------------------------------
visible_cursor PROC ;Åã¥Ü´å¼Ð±q²Ä6³¡¤À¨ì²Ä7³¡¤À
mov ah,1
mov cx,607h ;CHªºnit 5,6§¡¬°0¡AÅã¥Ü´å¼Ð¡ACHªº0¡ã4
int 10h ;¦ì¤¸ªí¥Ü´å¼Ð¶}©l¬°6¡ACL¬°´å¼Ðµ²§ô¬°7
ret
visible_cursor ENDP
;-------------------------------------------------------------------------------
input PROC
LOCAL value:WORD
mov ah,2 ;³]©w´å¼Ð¦ì¸m
mov dh,22 ;¦b²Ä22¦C²Ä24¦æ
mov dl,SIZEOF input_offset
mov bh,0
int 10h
call visible_cursor ;«ì´_´å¼Ð¬°¥i¨£
mov cx,4 ;¤@Ó¦r²Õªº¤Q¤»¶i¦ì¼Æ¦³¥|¦ì
mov value,0 ;¨ÏvalueÂk¹s
.WHILE cx
mov ah,1 ;DOSªA°Èµ{¦¡¡AÁä½L¿é¤J¦r¤¸
int 21h ;AL¡×¿é¤J¦r¤¸ªºASCII½X
.IF (al>="0")&&(al<="9")
sub al,"0"
.ELSEIF (al>="A")&&(al<="F")
sub al,37h
.ELSEIF (al>="a")&&(al<="f")
sub al,57h
.ELSEIF al==0dh
.BREAK .IF 1
.ELSE
stc
.BREAK .IF 1
.ENDIF
shl value,4 ;value¡×value¡Ñ10H
cbw ;¨ÏAHÅܬ°0
add value,ax ;value¡×value¡ÏAX
dec cx
.ENDW
call invisible_cursor
mov ax,value
ret
input ENDP
;-------------------------------------------------------------------------------
;¦b¿Ã¹õ¤W¦L¥XDLªº¤Q¤»¶i¦ì¼ÆÈ
print_dl PROC
rol dl,4
call print_4_bits
rol dl,4
print_4_bits:: mov al,dl
and al,0fh
add al,30h
cmp al,39h
jbe ok
add al,7
ok: stosw
ret
print_dl ENDP
;-------------------------------------------------------------------------------
;¦b¿Ã¹õ¤W¦L¥XDX¤§¤Q¤»¶i¦ì¼ÆÈ
print_dx PROC
mov cx,4
next: rol dx,4
call print_4_bits
loop next
ret
print_dx ENDP
;-------------------------------------------------------------------------------
video_address PROC ;pºâ²ÄAX¦C²Ä¹s¦æ¦bµø°T°O¾ÐÅ餤ªº¦ì§}«á¦s©óDIªð¦^
mov cl,160 ;¨C¤@¦C¦³80Ó¦r¤¸¡A¨C¦r¤¸¦û¥Î¤@ÓASCII½X¤ÎÃC¦â
mul cl ;¦]¦¹¨C¤@¦C¦û¥Î160Ӧ줸²Õ
mov di,ax
ret
video_address ENDP
;-------------------------------------------------------------------------------
;¦b¿Ã¹õ²Ärw¦C¶É¦L¤@¦C¡A16Ӧ줸²Õªº°O¾ÐÅ餺®e¡A°£¦¹¤§¥~ÁٶɦL°O¾ÐÅé¦ì§}¡B»P¦¹16Ó
;¦ì¤¸²Õ¤º®e©Ò¥NªíªºASCII½X¡Cn¶É¦Lªº°O¾ÐÅé¦ì§}¦bsg:ofst
print_data PROC rw:WORD, sg:WORD, ofst:WORD
LOCAL counter:WORD
mov ax,rw
call video_address ;pºâ²Ärw¦C¦bµø°T°O¾ÐÅ骺°¾²¾¦ì§}
;¦L¥Xn¶É¦Lªº°O¾ÐÅé°Ï¬q¦ì§}»P°¾²¾¦ì§}
mov dx,sg ;¦L¥Xn¶É¦Lªº°Ï¬q¦ì§}
mov ah,0fh ;AH¡×0FHªí¥Ü«e´º¥Õ¦â¡AI´º¶Â¦â
call print_dx
mov al,":" ;¦L¥X¡u:¡v
stosw
mov dx,ofst ;¦L¥Xn¶É¦Lªº°¾²¾¦ì§}
mov ah,0fh
call print_dx
;¦L¥X¸Ó°O¾ÐÅé¦ì§}¶}©lªº16Ӧ줸²Õªº°O¾ÐÅ餺®e
mov counter,10h ;10H¬°16Ӧ줸²Õ
mov ah,0eh ;AH¡×0EHªí¥Ü«e´º¶À¦â¡AI´º¶Â¦â
mov fs,sg ;FS¡×n¶É¦Lªº°Ï¬q¦ì§}
mov bx,ofst ;BX¡×n¶É¦Lªº°¾²¾¦ì§}
nxt_by: .IF counter==8 ;¦pªG¤w³B²z8Ӧ줸²Õ®É¡A¤£¥ÎªÅ¥Õ
mov al,"-" ;¤À¹j¡A¦Ó¥Î¡u-¡v¤À¹j
.ELSE
mov al," "
.ENDIF
stosw
mov dl,fs:[bx] ;DL¡×±N¦L¦b¿Ã¹õ¤Wªº°O¾ÐÅ餺®e
inc bx
call print_dl
dec counter ;Àˬd¬O§_¤w¦L¥X16Ӧ줸²Õªº¸ê®Æ¤F
jnz nxt_by ;YNZ©|¥¼¦L§¹¡A¨ìnxt_by¦L¤U¤@Ӧ줸²Õ
mov eax,0e200e20h ;YZRu3¤w¦L§¹¡A¦L¥X¨âӪťդÀ¹jASCII°Ï°ì
stosd
;¦L¥X¤Wz16Ӧ줸²Õªº°O¾ÐÅ餺®e©Ò¥NªíªºASCII¦r¤¸
mov bx,ofst
mov counter,10h
mov ah,0bh
nxt_ch: .IF counter==8
mov al,"-"
stosw
.ENDIF
mov al,fs:[bx]
stosw
inc bx
dec counter
jnz nxt_ch
ret
print_data ENDP
;-------------------------------------------------------------------------------
;¦b²Ärw¦C¤¤¥HcolorªºÃC¦âÅã¥Ü¤@¦r¦ê¡A¦¹¦r¦ê¦ì§}¦bpstr³B¡Aªø«×¬°len¦ì¤¸²Õ
print_a_line PROC rw:WORD, pstr:WORD, len:WORD, color:BYTE
mov ax,rw ;pºâ²Ärw¦C²Ä¹s¦æ¦bµø°T°O
call video_address ;¾ÐÅ餤ªº¦ì§}¡A¨Ã¦s©óDIùØ
mov cx,len
mov ah,color
mov si,pstr
next: lodsb
stosw
loop next
ret
print_a_line ENDP
;-------------------------------------------------------------------------------
;print_screen¦L¥X¾ãӿùõ¸ê®Æ¡A¥]§tµ{¦¡¦WºÙ¡B¤À¹j½u¡B¨Ï¥Î»¡©ú¤Î256Ӧ줸²Õªº¸ê®Æ
;n¦L¥Xªº256Ӧ줸²Õ¸ê®Æ¦b°O¾ÐÅé¦ì§}ªºdump_s:dump_o³B¶}©lªº256Ӧ줸²Õ
print_screen PROC dump_s:WORD,dump_o:WORD
LOCAL row:WORD
;¦L¥Xµ{¦¡¦WºÙ¡BÄæ¦ì¡B¤À¹j½u
INVOKE print_a_line,0,OFFSET prog_name,SIZEOF prog_name,0fh
INVOKE print_a_line,2,OFFSET field_name,SIZEOF field_name,7
INVOKE print_a_line,3,OFFSET line,SIZEOF line,9
;¦L¥X16¦Cªº°O¾ÐÅ餺®e¡A¨C¦C16Ӧ줸²Õ
mov row,4
next_line: INVOKE print_data,row,dump_s,dump_o
add dump_o,10h
inc row
cmp row,20
jne next_line
;¦L¥X¤À¹j½u»P¨Ï¥Î»¡©ú
INVOKE print_a_line,row,OFFSET line,SIZEOF line,9
INVOKE print_a_line,21,OFFSET help_text,SIZEOF help_text,7
ret
print_screen ENDP
;-------------------------------------------------------------------------------
.STARTUP
mov ax,3 ;§â¿Ã¹õ³]¬°80¡Ñ25¤å¦r¼Ò¦¡
int 10h
mov dump_segment,es ;ªì©l¤Ædump_segment
mov ax,video ;§âES³]¬°µø°T°O¾ÐÅé¦ì§}
mov es,ax
call invisible_cursor;¨Ï´å¼Ð®ø¥¢
display: INVOKE print_screen,dump_segment,dump_offset
mov ah,6
mov dl,0ffh
int 21h ;±±¨î¥xª½±µ¿é¤J¿é¥X
jz display ;YZRªí¥Ü¨Ï¥ÎªÌ¥¼¿é¤J¡A¨ìdisplay³BÄ~Äò°õ¦æ
or al,al ;YNZªí¥Ü¤w¿é¤J¡C¨ì¤U¤@¦æÀˬdAL¬O§_¬°¹s
jnz gotten ;YAL¤£¬°¹sªí¥Ü¨Ï¥ÎªÌ«öªºÁ䦳ASCII½X
int 21h ;YAL¬°¹sªí¥Ü¨Ï¥ÎªÌ«öªºÁä¨S¦³ASCII½X
jmp short scan_code
gotten: .IF al==1bh ;Àˬd¬O§_«ö¤U¡uEsc¡vÁä
je exit
.ELSEIF al=="o"||al=="O" ;Àˬd¬O§_«ö¤U¡uo¡vÁä©Î¡uO¡vÁä
INVOKE print_a_line,22,OFFSET input_offset,SIZEOF input_offset,7
call input
jc error
and ax,0fff0h
mov dump_offset,ax
.ELSEIF al=="s"||al=="S" ;Àˬd¬O§_«ö¤U¡us¡vÁ䶡©Î¡uS¡vÁä
INVOKE print_a_line,22,OFFSET input_segment,SIZEOF input_segment,7
call input
jc error
mov dump_segment,ax
.ENDIF
INVOKE print_a_line,22,OFFSET prog_name,SIZEOF input_offset+4,7
jmp display
scan_code: cmp al,49h ;Àˬd¬O§_«ö¤U¡uPageUp¡vÁä
jne chk_pgdn_key
sub dump_offset,100h
jmp display
chk_pgdn_key: cmp al,51h ;Àˬd¬O§_«ö¤U¡uPageDown¡vÁä
jne display
add dump_offset,100h
jmp display
error: INVOKE print_a_line,22,OFFSET error_msg,SIZEOF error_msg,7
exit: call visible_cursor
mov ah,2
mov dx,1700h
mov bh,0
int 10h
.EXIT 0
;*******************************************************************************
END |
§â¤W±µ{¦¡½X¦s¤J¡uE:\DOS\MEMORY¡v¤l¥Ø¿ýùØ¡A¿é¤J¤U±«ü¥O²ÕĶ¤Î³sµ²¡G
C:\>e: [Enter] E:\>cd dos\second [Enter] E:\DOS\SECOND>ml memdump.asm [Enter] Microsoft (R) Macro Assembler Version 6.11 Copyright (C) Microsoft Corp 1981-1993. All rights reserved. Assembling: memdump.asm Microsoft (R) Segmented Executable Linker Version 5.31.009 Jul 13 1992 Copyright (C) Microsoft Corp 1984-1992. All rights reserved. Object Modules [.obj]: memdump.obj Run File [memdump.exe]: "memdump.exe" List File [nul.map]: NUL Libraries [.lib]: Definitions File [nul.def]: E:\DOS\SECOND>
§A¥i¥H¦Û¦æ°õ¦æ¬Ý¬Ý³oÓµ{¦¡¡C©³¤U¨Ó¸Ñ»¡ MEMDUMP.ASM¡C
MEMDUMP ·|Åã¥Ü 256 Ӧ줸²Õªº¸ê®Æ¡A¦A¥[¤W¼ÐÃD¦ì§}¡B¨Ï¥Î¤èªkµ¥¸ê®Æ¡A³£¦b¤@ӿùõ¤WÅã¥Ü¡A¥B¨Ï¥Î±m¦â¤å¦r¡A¦]¦¹³]©wÅã¥Ü¼Ò¦¡ 3¡A¥ç§Y 80¡Ñ25 ¤Q¤»¦â¤å¦r¼Ò¦¡¡C³o¬q³]©wÅã¥Ü¼Ò¦¡ªºµ{¦¡½XÀ³¸Ó¦bµ{¦¡¤@¶}©l´N°õ¦æ¡A¥¦ÁÙ¦³ÓÃB¥~ªº¦n³B¡A´N¬O¶¶±a¯à²M°£¿Ã¹õ¡C
¤W±ì©l½Xªº²Ä 188¡ã189 ¦æ¡A´N¬O³]©wÅã¥Ü¼Ò¦¡ 3¡A¦Ó²Ä 187 ¦æ´N¬Oµ{¦¡¶i¤JÂI¡C
MEMDUMP ¤£¬O§Q¥Î DOS ªA°Èµ{¦¡¦b¿Ã¹õ¤WÅã¥Ü¦r¤¸¡A¦Ó¬O§ânÅã¥Üªº¦r¤¸ª½±µ¶ñ¤Jµø°T°O¾ÐÅ餺¡C°Ñ¾\²Ä¤Q¤T³¹¡A¿Ã¹õ³Ì¤W±¬°²Ä¹s¦C¡A¨ä¤U¬°²Ä¤@¦C¡B²Ä¤G¦C¡K¡K²Ä 24 ¦C ( ¦C¬O¥Ñ¥ª¦Ó¥k )¡A¨C¦C 80 Ó¦r¤¸¡A¨CÓ¦r¤¸¶·¦û¥Î¨âӦ줸²Õ ( ¦ì§}¸û§C¦ì¤¸²Õ¦s©ñ¦r¤¸ªº ASCII ½X¡A¸û°ª¦ì§}ªº¦ì¤¸²Õ¬°«e´º¦â©MI´º¦â )¡C¦]¦¹¦b¿Ã¹õ¤W¡A²Ä Y ¦C²Ä X ¦æ ( ¤]´N¬O²Ä Y ¦C²Ä X Ó¦r¤¸ )¡A¦bµø°T°O¾ÐÅ餺ªº°¾²¾¦ì§}¥i¥Ñ¤U¦¡pºâ¡G
°¾²¾¦ì§}¡×160Y¡Ï2X
¤£¹L¤p¤ì°¸³]p MEMDUMP ³£¬O¥Ñ¨C¦Cªº²Ä¹sÓ¦r¤¸¶}©l¡A¦]¦¹¥u»Ý±N²Ä´X¦C¼¥H 160 §Y¥i±o°¾²¾¦ì§}¡C¤p¤ì°¸§â³o¬qµ{¦¡¼g¦¨°Æµ{¦¡ video_address ( ²Ä 97¡ã102 ¦æ )¡C
MEMDUMP ·|¨Ï¥Î¨ì¤Ó°Ï¬q¡A°£¤Fµ{¦¡½X°Ï¬q¡B°ïÅ|°Ï¬q¡B¸ê®Æ°Ï¬q³o¤TӰϬq¤§¥~¡AÁÙ·|¨Ï¥Î¨ìµø°T°O¾ÐÅé©Ò¦bªº°Ï¬q¡A¤p¤ì°¸¥Î ES °Ï¬q¼È¦s¾¹¨Ó«ü¦Vµø°T°O¾ÐÅé¦ì§} ( ²Ä 191¡ã192 ¦æ )¡C²z¥Ñ«Ü²³æ¡A¤p¤ì°¸§ânÅã¥Ü¦r¤¸ªº ASCII ½X©ñ¦b AL¡A«e´º¦â»PI´º¦â©ñ¦b AH ùØ¡AµM«á§Q¥Î x86 «ü¥O STOSW «Ü§Ö´N¯à§â AX ªº¤º®eª½±µ¶ñ¤J ES:DI ©Ò«ü¦ì§}ùØ ( ²Ä 84¡B129¡B146¡B161 ¦æ )¡C¦¹³B ES ¬Oµø°T°O¾ÐÅé°Ï¬q¦ì§}¡A§Y B800H¡ADI ¬O°¾²¾¦ì§}¡A¥i¥Ñ¤W±ªº¤½¦¡¡G160Y¡Ï2X ©Òpºâªºµ²ªG¡C
MEMDUMP °£¤F·|¨Ï¥Î«ez¥|ӰϬq¤§¥~¡AÁÙ·|¨Ï¥Î¥t¤@ӰϬq¡A³oӰϬq´N¬O¨Ï¥ÎªÌ·Qn¶É¦Lªº°O¾ÐÅé°Ï¬q¦ì§}¡A¤p¤ì°¸¥Î dump_segment °O¿ý¦¹°Ï¬qªº¦ì§}¡C·í MEMDUMP è¶}©l°õ¦æ®É¡A·|§â dump_segment «ü©w¬° ES ©Ò«ü°Ï¬q ( ²Ä 190 ¦æ¡A¨£µù¤@ )¡A¦¹®É ES ÁÙ¥¼«ü¦V B800 °Ï¬q¡A¦bµy«á¤~Åý ES «ü¦V B800¡C¦b³o¤§«á¡A¦pªG¨Ï¥ÎªÌקïn¶É¦Lªº°O¾ÐÅé°Ï¬q¦ì§} ( ´N¬O«ö¤U¡uS¡vÁä )¡Aµ{¦¡´N·|©I¥s input °Æµ{¦¡¡A«Ý¨Ï¥ÎªÌ¿é¤J§¹¦¨«á¡Adump_segment ´N·|Åܧó·s¿é¤Jªº¼ÆÈ¡C
n¶É¦Lªº°O¾ÐÅé°¾²¾¦ì§}¦s¦b dump_offset¡A¹w³]ȬO 0¡A¦P¼Ë¤]¯àק惡°¾²¾¦ì§}¡C¨Ï¥ÎªÌ¥u»Ý«ö¤U¡uO¡vÁä¡Aµ{¦¡´N·|©I¥s input °Æµ{¦¡¡A«Ý¨Ï¥ÎªÌ¿é¤J§¹¦¨«á¡Adump_offset ´N·|Åܧó·s¿é¤Jªº¼ÆÈ¡C
·íµ{¦¡n¶É¦L°O¾ÐÅ骺¤º®e®É¡A¥²¶·Åª¨ú dump_segment:dump_offset ¦ì§}ªº°O¾ÐÅ餺®e¡A¦ý CPU «ü¥O¤¤¤£¯à¥HÅܼƪ½±µ·í°µ°Ï¬q¦ì§}Ū¨ú°O¾ÐÅé¡A¹³©³¤Uªº»yªk¬O¿ù»~ªº¡G
mov bx,dump_offset mov dl,dump_segment:[bx] ¡ö¤£¯àª½±µ¥HÅÜ¼Æ·í°µ°Ï¬q¦ì§}Ū¨ú°O¾ÐÅé
¦Ó CS¡BDS¡BES¡BSS µ¥°Ï¬q¼È¦s¾¹³£¦U¦³¦Uªº¥Î³~¤F¡AÁöµM¤]¯à¦³¤èªk§â DS ©Î ES ÄË¥X¨Ó¨Ï¥Î¡A¦ý¬O«Ü³Â·Ð¡C©¯¦n 80386 ¤Î¨ä§ó°ª¶¥ªº CPU ÁÙ¦³¥t¥~¨âӰϬq¼È¦s¾¹¡GFS »P GS¡A¥i¨Ñ¨Ï¥Î¡C¤èªk¦p¤U¡G
mov fs,dump_segment mov bx,dump_offset mov dl,fs:[bx]
²Ä¤T¦æ«ü¥O´N¯à±j¢Åª¨ú FS ©Ò«üªº°Ï¬q¡A¦ÓŪ¨úªº°O¾ÐÅé°¾²¾¦ì§}¬O BX ©Ò«üªº¦ì§} ( ²Ä 130 ¦æ )¡C¹³³o¼ËŪ¨ú¬YÓ«ü©w°Ï¬q¼È¦s¾¹ªº¤è¦¡¡AºÙ¬°â¶V°Ï¬q¡C
¥t¥~ȱo¤@´£ªº¬O¡A¦pªG¥Î DEBUG ©Î SYMDEB °lÂܦ¹µ{¦¡¨ì³o¤@¶¥¬q®É¡A·|¨£¨ì©³¤Uªº¼Ë¤l¡G
20E6:00DA 64 DB 64 20E6:00DB 8A17 MOV DL,[BX]
¦Ó¤£¬O¡uMOV DL,FS:[BX]¡v¡A³o¬O¦]¬° DEBUG ©Î SYMDEB ¤£»{±o 80386 ·s¼Wªº«ü¥O¡A¦]¦¹Åã¥Ü¤£¥X¨Ó¥¿½Tªº¼Ë¤l¡A¦ý«o¤£§«®`¥¿±`°£¿ù©Î°lÂÜ¡A¤´¥i¦w¤ß¨Ï¥Î¡C
MEMDUMP.ASM ³Ì«nªº³¡¤À¡A¬O§â¼ÐÃD¡B¤À¹j½u¡B«öÁ仡©ú¤Î 256 Ӧ줸²Õªº¤º®eÅã¥Ü¦b¿Ã¹õ¤W¡A¤p¤ì°¸§â³o³¡¤Àªºµ{¦¡¡A»s§@¦¨°Æµ{¦¡¡AºÙ¬° print_screen¡C¦Ó print_screen ¦b³B²z¼ÐÃD¡B¤À¹j½u¡B«öÁ仡©úªº¤è¦¡»P³B²z 256 Ӧ줸²Õ¤º®e¤£¦P¡C«e¤TªÌ¬O¤£·|§ïÅܪº±`¼Æ¦r¦ê¡A¤p¤ì°¸¥Î print_a_line °Æµ{¦¡¡A¤@¦¸¤@Ó¦r¦êÅã¥Ü¦b¿Ã¹õ¤Wªº¤@¦CùØ¡C³Ì«á¤@Ó³B²z 256 Ӧ줸²Õªº¤º®e¡A·|ÀH°O¾ÐÅé¦ì¸m¤£¦P¦ÓÅܤơA¤p¤ì°¸¥Î print_data °Æµ{¦¡³B²z¡C
¦b¿Ã¹õ¤W¶É¦L©Ò¦³¸ê®Æ¤§«á¡A´N¬O³B²z¨Ï¥ÎªÌ«öÁ䪺µ{¦¡¡C³oùØ¡A¤p¤ì°¸¦³Ó·Qªk¡A·í¨Ï¥ÎªÌ¨S¦³«ö¤UÁä®É¡AMEMDUMP ¨Ã¤£·|¤@ª½¬\µ¥¨Ï¥ÎªÌ¿é¤J«öÁä¡A¦Ó¬Oª½±µ¸õ¹L¿é¤J«öÁä¡AµM«á·|¤£Â_¦a§â¦P¤@¦ì¸mªº°O¾ÐÅ餺®eÅã¥Ü¦b¿Ã¹õ¤W¡C³o¼Ë°µ¦³Ó¦n³B¡A¬Y¨Ç°O¾ÐÅ餺®e·|¤£Â_¦a³Q§@·~¨t²Î©Î BIOS §ó·s¡A¦p¦¹¤@¨Ó¡A¨Ï¥ÎªÌ´N¯à«Ü»´ÃP¦a¬Ý¨£³o¨Ç¸ê®Æ°ÊºAªºÅܤơC
¨Ò¦p¡AÁä½L½w½Ä°Ï´N¬O¤@Ó¨Ò¤l¡C§A¥i¥HÅý MEMDUMP Åã¥Ü 40:1A ³Bªº°O¾ÐÅ餺®e¡AµM«á«ö¤UÁä½L¤WªºÁä ( ³oÓÁ䤣¯à¬O¡uPgaeUp/PageDown¡v©Î¡uS¡v¡B¡uO¡v)¡A§A´N¯à¬Ý¨£ 40:1A ©M 40:1C ³B³o¨âÓ«ü¼ÐªºÅܤơA¤]¥i¥HÆ[¹î 40:1E¡ã40:3D ½w½Ä°Ï¤ºªºÅܤơC¥t¤@Ó¨Ò¤l¬O¦b 40:6C ªºÂù¦r²Õp¼Æ¾¹¡A¨C 55 ²@¬í·|¨Ï³oÓp¼Æ¾¹¼W¥[¤@¡C
¬°¤F¹F¨ì³oӥتº¡AMEMDUMP ¤£¥Î AH¡×00H/INT 16H¡BAH¡×01H/INT 21H ³B²zÁä½L¿é¤J¡A§ï¥Î AH¡×06H/INT 21H¡Cµ{¦¡½X¦b²Ä 194¡ã202 ¦æ¡A²Ä¤@¦¸©I¥s AH¡×06H/INT 21H «á¡A¦b²Ä 198 ¦æ·|¥ýÀˬd¨Ï¥ÎªÌ¬O§_«ö¤FÁä¡AY¨S¦³´N§âì¨Ón¶É¦Lªº°O¾ÐÅé¦AÅã¥Ü¤@¹M¡F¦pªG¨Ï¥ÎªÌ¤w«ö¤FÁä¡A«hÀˬd¦¹Áä¬O§_¦³ ASCII ½X¡A¦pªG AL ¬°¹s¡Aªí¥Ü¨S¦³ ASCII ½X¡A¨º»ò¨Ï¥ÎªÌ¥i¯à¬O«ö¤U¡uPage Up¡v©Î¡uPage Down¡vÁä¡F¦pªG AL ¤£¬°¹s´N¬O«öÁ䪺 ASCII ½X¡A©Î¬O¨S¦³ ASCII ½X«öÁ䪺±½´y½X¡C
¦b MEMDUMP ùئL¥X°Ï¬q¦ì§}ªº¤èªk¬O§â¥¦¦s¤J DX ùØ¡AµM«á©I¥s print_dx °Æµ{¦¡¡A¨£µ{¦¡²Ä 111¡ã113 ¦æ¡C¦Ó¦L¥X¬YÓ¦ì§}ªº°O¾ÐÅ餺®e«h¬O§â¥¦©ñ¦b DL ùØ¡A¦A©I¥s print_dl °Æµ{¦¡¡A¨£²Ä 130¡ã132 ¦æ¡C¦Ó³o¨âӰƵ{¦¡Ãþ¦ü¡A¥u¬O«eªÌ¶·¦L¥X¥|¦ìªº¤Q¤»¶i¦ì¼ÆÈ¡A«áªÌ¶È¶·¦L¥X¨â¦ì¡A³o¬qµ{¦¡¦b²Ä 78¡ã84 ¦æ¡C
¤p¤ì°¸§â³o¬qµ{¦¡¼g¦b print_dl ùØ¡A¬°¤F¸`¬Ùµ{¦¡½X¤j¤p¡Aprint_dx ¤£¥²¦A¼g¤@¦¸¥u¶·©I¥s print_dl ùتº³o¬qµ{¦¡§Y¥i¡CÁöµM¼Ð°O©M°Æµ{¦¡ªº¦WºÙ³£¬O¦ì§}¡A¦ý¼Ð°O¥u¦b³oӰƵ{¦¡¤º¡u¦³®Ä¡v¡A¨ä¥Lªº°Æµ{¦¡¬OµLªk¸õÅD¨ì¦¹¼Ð°O¡A¤]¤£¯à©I¥s¥t¤@ӰƵ{¦¡ªº¼Ð°O¡C¾¨ºÞ¦p¦¹¡AÁÙ¬O¦³¨âºØ¤èªk¥i¥H¹F¨ì¦¹¥Øªº¡G
²Ä¤@ºØ¤èªk¡G¦b¤@ӰƵ{¦¡¤¤¦A«Å§i¥t¤@ӰƵ{¦¡¡AÅܦ¨¹³¤U±ªºªº¼Ë¤l¡G
print_dl PROC rol dl,4 call print_4_bits rol dl,4 print_4_bits PROC mov al,dl and al,0fh add al,30h cmp al,39h jbe ok add al,7 ok: stosw ret print_4_bits ENDP print_dl ENDP
³o¼Ë¤]¯à¦b§Oªº¦a¤è¤¤¡A°õ¦æ¡ucall print_4_bits¡v«ü¥O¡C( ¦b°ª¶¥»y¨¥ùØ¡A°j°é¤º®MµÛ¥t¤@Ó°j°éºÙ§@±_ª¬°j°é¡A¦¹³B¤£ª¾¯à§_¥s±_ª¬°Æµ{¦¡¡H)
²Ä¤GºØ¤èªk¡G§â¼Ð°O³]¬°¡u¤½¦@¡vªº¡A¤èªk¬O¼Ð°Oµ²§À§ï¦¨¡u::¡v¹³¤U±ªº¼Ë¤l¡G
print_dl PROC rol dl,4 call print_4_bits rol dl,4 print_4_bits:: mov al,dl and al,0fh add al,30h cmp al,39h jbe ok add al,7 ok: stosw ret print_dl ENDP
³oºØ¥H¡u::¡vµ²§Àªº¼Ð°O¡A¥i¥H³Q¨ä¥L°Æµ{¦¡©I¥s¡A¤]¯à·í¦¨¨ä¥L°Æµ{¦¡¸õÅDªº¥Ø¼Ð¡C
¥»³¹´N¦b¦¹µ²§ô¡A¥»³¹¹ê§@¤F¤@Ó¸û¤jªºµ{¦¡¡A¤j¬ù¨â¦Ê¤T¤Q¦h¦æ¡A¦ý¤j³¡¤ÀªºÆ[©À«e±³£¤¶²Ð¹L¡AÀ³¸Ó¤£·|¤ÓÃø¡C·s¤¶²ÐªºÆ[©À¬O¤@Ó AH¡×06H/INT 21H DOS ªA°Èµ{¦¡¤Î¤@¨Ç¿Ã¹õ¾Þ§@¡C«eªÌµLªk¥Î DEBUG/SYMDEB °ÊºA°lÂÜ¡A¸û¤£¦n²z¸Ñ¡F«áªÌ¥i¥H¦b¿Ã¹õ¤Wª½±µ¨£¨ìµ²ªG¡AÀ³¸Ó¬O«Ü®e©öªº¡C
¥t¥~¤¶²Ð¤F¦p¦ó¨Ï¥Î 80386 ¤Î§ó°ª¶¥ªº CPU ©Ò´£¨Ñªº°Ï¬q¼È¦s¾¹ FS¡A·íµ{¦¡n¥Î¨ì¤Ó°Ï¬q®É¡AFS ´N¯à¬£¤W¥Î³õ¡A·íµMÁÙ¦³¤@Ó GS ¼È¦s¾¹¤]¯à«Ý©R¨Ï¥Î¡C