Ch 09¡@°Æµ{¦¡¡]¤@¡^

³o¤@³¹­n¤¶²Ð°Æµ{¦¡¡C°Æµ{¦¡­^¤å¥s subroutine¡A¤¤¤å¤SºÙ¤lµ{¦¡¡A¤j³°«hºÙ¬°¤lµ{§Ç¡A¥¦©w¸q¬°¡u¤@­Ó¤j«¬µ{¦¡ªº¬Y¤@³¡¥÷¡A¨Ã¥B§¹¦¨¯S©w¤u§@ªºµ{¦¡¡v¡C

³o¼ËÁ¿¦ü¥G«Ü¼Ò½k¡A¤p¤ì°¸Á|­Ó¨Ò¤l¡C¨Ò¦p­n¼g¤@­Ó¯à°÷§â¤Q¤»¶i¦ìÂà´«¦¨¤Q¶i¦ìªºµ{¦¡¡A¨ä¬yµ{¥i¤À¤T¨BÆJ¡G①¿é¤J¤Q¤»¶i¦ì¼Æ¡B②­pºâ¡B③¦L¥Xµ²ªG¡C¤p¤ì°¸ªº·Qªk¬O²Ä①¨BÅý¨Ï¥ÎªÌ¿é¤J¤Q¤»¶i¦ì¼Æ¡A´N¬O¤@­Ó§¹¾ãªº¥\¯à¡A¥i¥H¿W¥ß¥X¨Ó§Î¦¨¤@­Ó°Æµ{¦¡¡A¥i©R¦W¬°¡uinput¡v¡A¥i°Ñ¾\²Ä¤»³¹¡C

²Ä②¨B­pºâ¬O«ü­n­pºâ¥X¯à¦L¦b¿Ã¥ú¹õ¤Wªº¦r¦ê¡AÃþ¦ü¡uXXXXH¡×DDDDD¡vªº¦r¦ê¡AXXXX ¬O¨Ï¥ÎªÌ¿é¤Jªº¤Q¤»¶i¦ì¼Æ­È¡A¸g¹L­pºâ«á±o¨ì¨C¤@¦ì³£¬O ASCII ½X¡A¨ä½d³ò¦b 30H¡ã39H ©Î 41H¡ã46H ( §Y 0¡ã9 ©Î A¡ãF ) ¤§¶¡¡A¨ä©Ò¥Nªíªº¥|­Ó¦r¤¸§Î¦¨ªº¦r¦ê¡FDDDDD ¬O¤Q¶i¦ì¼Æ¦r¡A¨C¤@¦ì³£¬O ASCII ½X 30H¡ã39H ²Õ¦¨ªº¦r¦ê¡C

¦]¦¹²Ä②¨B¥i¤À¬°¨â³¡¤À¡A¤À§O¬O¡u¤Q¤»¶i¦ì¼Æ­ÈÅܦ¨¤Q¤»¶i¦ì¼Æ¦r¦r¦ê¡v¤Î¡u§â¤Q¤»¶i¦ì¼Æ­ÈÅܦ¨¤Q¶i¦ì¼Æ¦r¦r¦ê¡v¡A³o¨â³¡¤À¤]¥iµø¬°¯S©wªº¤u§@¡A¬G¤]¥i¥H¤À§O¿W¥ß¬°°Æµ{¦¡¡C³o¨â­Ó°Æµ{¦¡¤À§O¬O¡uhexadecimal¡v¡B¡udecimal¡v¡A«eªÌ¥i¥H°Ñ¾\²Ä¤­³¹¡A«áªÌ¥i°Ñ¾\²Ä¤C³¹¡C

²Ä③¨B¶È¬O¦b¿Ã¥ú¹õ¤W¦L¥X¦r¦ê¡A¥i¥H©I¥s AH¡×9/INT 21H §¹¦¨¡C

°õ¦æ HEX2HDEC µ{¦¡«á¡Aµ{¦¡­º¥ý·|§â±±¨îÅv¥æµ¹ input °Æµ{¦¡¥h°õ¦æ¡A³o¼Ëªº¹Lµ{ºÙ¬°¡u©I¥s¡v( call )¡C³Q©I¥sªºµ{¦¡´N¬O°Æµ{¦¡¡A©I¥s°Æµ{¦¡ªºµ{¦¡ºÙ¬°¥Dµ{¦¡ ( main program ) ¡Cµ¥°Æµ{¦¡§¹¦¨¤u§@«á¦A§â¸ê®Æ¶Ç¦^µ¹¥Dµ{¦¡¡A¦¹¸ê®ÆºÙ¬°¦^¶Ç­È¡A¨Ã±N±±¨îÅv¥æ¦^µ¹¥Dµ{¦¡¡CµM«á¦A¥Ñ¥Dµ{¦¡©I¥s hexadecimal §â¨Ï¥ÎªÌ¿é¤Jªº¼Æ­ÈÅܦ¨¦r¦ê¡A§¹¦¨«á¦Aªð¦^¥Dµ{¦¡¡C¦Ó«á¥Dµ{¦¡¦A©I¥s decimal °Æµ{¦¡¡Aµ¥°Æµ{¦¡ªð¦^«á´N§âµ²ªG¦L¦b¿Ã¥ú¹õ¤W¡Aµ²§ô¦¹µ{¦¡¡C

°Æµ{¦¡ªð¦^¥Dµ{¦¡®É¡A¤£¤@©w¦³¦^¶Ç­È¡A§¹¥þµø»Ý­n¨M©w¡C¨Ì¾Ú°Æµ{¦¡µ²§ô®É¡A¦³¨S¦³¶Ç¦^¦^¶Ç­Èµ¹¥Dµ{¦¡¡A¥i§â°Æµ{¦¡¤À¦¨¨âºØ¡G①¦³¦^¶Ç­Èªº°Æµ{¦¡ºÙ¬°¨ç¼Æ ( function¡A¥çºÙ¨ç¦¡ )¡B②¨S¦³¦^¶Ç­Èªº°Æµ{¦¡ºÙ¬°µ{§Ç ( procedure )¡C


»P°Æµ{¦¡¬ÛÃöªº«ü¥O


PROC »P ENDP °²«ü¥O

PROC »P ENDP ³o¨â­Ó°²«ü¥O¥²¶·¦¨¹ï¥X²{ªº¡APROC ¬O«Å§i¬Y­Ó°Æµ{¦¡©ó¦¹³B¶}©l¡AENDP «h¬O«Å§i³o­Ó°Æµ{¦¡©ó¦¹³Bµ²§ô¡CPROC »P ENDP ªº»yªk¬O

label  PROC  [distance][language-type][visibility][<prologuearg>][USES ¼È¦s¾¹¦Cªí][°Ñ¼Æ¦Cªí]
       °Æµ{¦¡¤º®e
label  ENDP

¤W­±ªº©ñ¦b PROC »P ENDP ¤§«eªº label ´N¬O°Æµ{¦¡ªº¦WºÙ¡A¨âªÌ¥²¶·¤@­P¡C¡ulabel PROC¡v¥Nªí¦WºÙ¬°¡ulabel¡vªº°Æµ{¦¡¡A¥Ñ³o­Ó¦ì§}¶}©l¡F¡ulabel ENDP¡vªí¥Ü¦¹°Æµ{¦¡¨ì ENDP µ²§ô¡C¦]¦¹¥i¥H§â°Æµ{¦¡¬Ý°µ¤@¶ô§¨¦b PROC »P ENDP ¤§¶¡ªº°Ï°ì¡A³o¶ô°Ï°ì¥i¥H¬O x86 «ü¥O¶°¡B°²«ü¥O¤ÎÅܼơB¼È¦s¾¹©Ò²Õ¦¨ªºµ{¦¡½X¡C

PROC ¤§«á±µµÛ³\¦h¥i¿ï¾ÜªºÄÝ©Ê ( ÄÝ©Ê¥]§t distance¡Blanguage-type¡Bvisibility ¥H¤Î <prologuearg>)¡B¼È¦s¾¹¦Cªí»P°Ñ¼Æ¦Cªí¡A³o¨Ç³£¥i¥H¬Ù²¤¡A²{¦b¤¶²Ð¤ñ¸û­«­nªº distance¡C

distance ¥i¥H¬O NEAR ©Î¬O FAR¡A¤À§Oªí¥Ü°Æµ{¦¡¬Oªñµ{ÁÙ¬O»·µ{¡Cªñµ{ªº·N«ä¬O«ü°Æµ{¦¡»P¥Dµ{¦¡¦b¦P¤@°Ï¬q¤º¡F»·µ{«h¬O¦b¤£¦P°Ï¬q¡Cdistance ¥i¥H¬Ù²¤¡A¦pªG¬Ù²¤´N¥Ñµ{¦¡¶}©lªº .MODEL ¨M©w¡C¦pªG .MODEL «ü©wªº°O¾ÐÅé¼Ò¦¡¬O TINY¡BSMALL¡BCOMPACT ©Î FLAT¡A¨º»ò°Æµ{¦¡¬Oªñµ{ªº¡F¦pªG¬O MEDIUM¡BLARGE ©Î HUGE¡A¨º»ò´N¬O»·µ{¡C¦pªG¬O 80386 µ¥¯Å©Î§ó°ªµ¥¯Åªº CPU¡A¥i¥H¥Î 16 ©Î 32 ¦ì¤¸°Ï¬q¡Adistance ÁÙ¥i¥H¨Ï¥Î NEAR16¡BNEAR32¡BFAR16 ©Î FAR32¡C

language-type ¬O»y¨¥Ãþ«¬ªº·N«ä¡A¦³ C¡BBASIC¡BFORTRAN¡BPASCAL¡BSYSCALL »P STDCALL ¤»ºØ¡A³o¨Ç»y¨¥Ãþ«¬©M©I¥s®É°Ñ¼Æ¦Cªí¦³Ãö¡A¤]´N¬O»¡¡A»y¨¥Ãþ«¬¬O¥Î¨Ó³]©w©I¥s¨ó©w ( calling convention ) ¡Aµ¥¤U¤@³¹¦A»¡©ú¡C

visibility ¬O«ü¯à§_Åý¨ä¥Lµ{¦¡¤]¥i¥H©I¥s¡A¥i¥H¬O PRIVATE¡BPUBLIC ©M EXPORT¡CPRIVATE ªí¥Ü¥u¦³¦¹¥Dµ{¦¡¥i¥H©I¥s³o­Ó°Æµ{¦¡¡FPUBLIC ªí¥Ü¹ï©Ò¦³ªºµ{¦¡³£¥i¥H©I¥s¡FEXPORT ªí¥Ü°£¤F¨ã¦³ PUBLIC ªº¯S©Ê¥~¡AÁÙ·|Åý LINK.EXE §â°Æµ{¦¡¦WºÙ¼g¦b¾É¥Xªí¤¤¡A·í¼¶¼g DLL ªº®É­Ô¦p­n±N¬Y­Ó¨ç¼Æ¾É¥X®É¥i¥H³o¼Ë¨Ï¥Î¡C¦pªG¬Ù²¤ visibility¡A¹w³]­È¬O PUBLIC¡C

ENDP °²«ü¥O¬Oªí©ú°Æµ{¦¡¨ì¦¹µ²§ô¡A³o­Ó¡©ªí©ú¡ª¬Oµ¹²ÕĶ¾¹©Î¬O¤HÃþ¬Ýªº¡ACPU ¨Ã¤£·|°õ¦æªð¦^¨ì¥Dµ{¦¡¡A¦]¦¹¦b ENDP ¤§«eÁÙ¬O­n¥Î x86 «ü¥O¡ARET¡A¤~¯à¯u¥¿°õ¦æªð¦^¦Ü¥Dµ{¦¡¡C


x86 «ü¥O¡GCALL

CALL ¬O©I¥s°Æµ{¦¡ªº«ü¥O¡A»yªk¦p¤U¡G

CALL    ¼Ð°O
CALL    ÅܼÆ
CALL    [¼È¦s¾¹]

²Ä¤@­Ó¨Ò¤l¬O³Ì±`¥Îªº¡A¦¹³Bªº¼Ð°O´N¬O°Æµ{¦¡ªº¦WºÙ¡A³q±`¬O¥H°²«ü¥O PROC «Å§i¡C²Ä¤G¡B¤T­Ó¨Ò¤l¨Ï CALL ÅܱoÆF¬¡±o¦h¡A¥ç§Y CALL ©I¥sªº°Æµ{¦¡¦ì§}¥i¥H¬O¦s¦bÅܼƩμȦs¾¹ùتº¦ì§}¡A©Ò¥H¬O¥i¥HÅܰʪº¡A³o¬O«Ü°ª¶¥ªº¥Îªk¥H«á¦A»¡§a¡C

CALL ¦³¨âºØ§Î¦¡¡G①ªñµ{©I¥s»P②»·µ{©I¥s¡A«eªÌ¬O©Ò©I¥sªº°Æµ{¦¡»P¥Dµ{¦¡¦b¦P¤@°Ï¬q¡A¤Ï¤§¡A¦b¤£¦P°Ï¬qªº©I¥sºÙ¬°»·µ{©I¥s¡C¥¦­Ìªº¾÷±ñ½X¨Ã¤£¬Û¦P¡A¦ý¬O¦b ASM ­ì©l½X¤¤³£¥Î CALL¡C¦pªG¬O³o¼Ë¡A¨º²ÕĶ¾¹¬O«ç»òª¾¹Dªñµ{ÁÙ¬O»·µ{©O¡H¨ä¹ê¤£Ãø¡A²ÕĶ¾¹¬O¥Ñ³Q©I¥sªº°Æµ{¦¡©Ò¦b¦ì¸m¡A´Nª¾¹D¬O§_¦b¦P¤@°Ï¬q¡A¦]¦Ó¯à²ÕĶ¦¨¨º¤@ºØ¾÷±ñ½X¡C

·í CPU °õ¦æ¨ì CALL ®É¡ACALL ·|§â¤U¤@±ø«ü¥Oªº¦ì§}Àx¦s°_¨Ó¡A³o­Ó¦ì§}ºÙ¬°ªð¦^¦ì§}¡AµM«á¦A§â±±¨îÅvÂಾ¨ì°Æµ{¦¡ªº°_©l¦ì§}¤W¡A¨ä¹ê´N¬O§â°Æµ{¦¡°_©l¦ì§}«þ¨©¨ì CS:IP¡A´N³oÂI¦Ó¨¥¦³¨Ç¹³ JMP «ü¥O¡A¥u¬O CALL ¦h¤FÀx¦sªð¦^¦ì§}ªº°Ê§@¡C°ÝÃD¬O CALL §âªð¦^¦ì§}Àx¦s¦b­þùØ©O¡Hµª®×¬O¦b°ïÅ|ùØ¡C

¦pªG¬Oªñµ{©I¥s¡ACALL ¥u·|§â¤U¤@±ø«ü¥Oªº°¾²¾¦ì§}±À¤J°ïÅ|¡F¦pªG¬O»·µ{©I¥s¡A´N·|¨Ì§Ç§â°Ï¬q¦ì§}¤Î°¾²¾¦ì§}±À¤J°ïÅ|¡A¦]¦¹¦b°ïÅ|ùØ¡A°Ï¬q¦ì§}Àx¦s¦b¸û°ª¦ì§}¡A°¾²¾¦ì§}¦b¸û§C¦ì§}¡C


x86 «ü¥O¡GRET

RET ¬O returen ªº·N«ä¡A¥ç§Y±q°Æµ{¦¡ªð¦^¦Ü¥Dµ{¦¡¡Aºë½Tªº»¡¬Oªð¦^¦Ü CALL ¤U¤@±ø«ü¥Oªº¦ì§}¡CRET ªº»yªk¬O

RET
RET     n

²Ä¤@ºØ±¡§Îªº RET ¨S¦³¹Bºâ¤¸¡A¥¦·|§âÀx¦s¦b°ïÅ|ùتºªð¦^¦ì§}¨ú¥X¨Ó¡A«þ¨©¨ì CS:IP ùØ¡A³o¼Ë CPU ªº±±¨îÅv´N·|°õ¦æ¥Dµ{¦¡¤¤ CALL ªº¤U¤@±ø«ü¥O¤F¡C¦Ü©ó¥u­n¨ú¥X°¾²¾¦ì§}ÁÙ¬O­n¨ú¥X°Ï¬q¦ì§}¤Î°¾²¾¦ì§}¡A«h­nµøªñµ{©I¥sÁÙ¬O»·µ{©I¥s¡C¤W¥y¸Üªº·N«ä¬O RET »P CALL ¤@¼Ë¡AÁöµM¤À¬°ªñµ{»P»·µ{¨âºØ¡A¦b²Õ¦X»y¨¥­ì©lµ{¦¡ùؤ´³£¨Ï¥Î RET¡A¦ý¥¦­Ìªº¾÷±ñ½X¤£¦P¡C¦b DEBUG ©Î SYMDEB ùØ¡A¦pªG¬Oªð¦^»·µ{ªº¥Dµ{¦¡¡A·|¥H RETF ªí¥Ü¡C

²Ä¤GºØ±¡§Î¬O RET °£¤F¨ú¦^ªð¦^¦ì§}¥~¡AÁÙ·|¦b°ïÅ|ùر˱ó n ­Ó¦ì¤¸²Õªº¸ê®Æ¡C

¥Dµ{¦¡»P°Æµ{¦¡ªºÃö«Y¦p¥k¹Ï©Ò¥Ü¡A¦V¥kªº¶À¦â½bÀY¥Nªí©I¥s¡A¦V¥ªªº½bÀY¥Nªíªð¦^¡C¦Ó PROC/ENDP ¬Oªí©ú¦¹°Ï¶ô¬°°Æµ{¦¡ªº°²«ü¥O¡A¨Ã«D CPU ¯u¥¿ªº«ü¥O¡A¨S¦³¹ê»Ú°Ê§@¡C


HEX2DEC.ASM ­ì©l½X

©³¤U¤p¤ì°¸´N§â³o­Óµ{¦¡¡AHEX2DEC.ASM¡A¦C¥X¨Ó¡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
;Åý¨Ï¥ÎªÌ¿é¤J¤@­Ó¦r²Õªø«×ªº¤Q¤»¶i¦ì¼Æ¡A§â¥¦Åܦ¨¤Q¶i¦ì¼Æ¡AµM«á¦L¥X¨Ó
.MODEL  TINY
.386
;*********************************************************************
.CODE  
ORG     100h
;---------------------------------------------------------------------
;¥Dµ{¦¡
main    PROC
        mov     ah,9
        mov     dx,OFFSET prompt
        int     21h             ;¦L¥X´£¥Ü¦r¦ê
        call    input           ;©I¥sÅý¨Ï¥ÎªÌ¿é¤J¤Q¤»¶i¦ì¼Æªº°Æµ{¦¡
.IF carry?
;¦pªG¦^¶Ç­È¬°CY¡Aªí¥Ü¨Ï¥ÎªÌ¿é¤J¿ù»~¡A¦L¥X¿ù»~°T®§«áÂ÷¶}µ{¦¡
        mov     dx,OFFSET error
.ELSE
;¦pªG¦^¶Ç­È¬°NC¡Aªí¥Ü¨Ï¥ÎªÌ¿é¤J¥¿½T
        mov     value,ax        ;§â¦^¶Ç­È¦s¤JvalueùØ
        mov     bx,OFFSET answer+2
        call    hexadecimal     ;§âvalueÅܦ¨¤Q¤»¶i¦ì¼Æ¦r¦r¦ê
        mov     bx,OFFSET answer+8
        mov     ax,value
        call    decimal         ;§âvalueÅܦ¨¤Q¶i¦ì¼Æ¦r¦r¦ê
        mov     dx,OFFSET answer
.ENDIF
        mov     ah,9
        int     21h
        int     20h
main    ENDP
;---------------------------------------------------------------------
value   dw      ?
prompt  db      "Input a hexadecimal number :$"
answer  db      0dh,0ah,"0000H=",5 DUP ("0"),"$"
error   db      0dh,0ah,"Please input 0~9 or A~F.$"
;---------------------------------------------------------------------
;Åý¨Ï¥ÎªÌ¿é¤J¤@­Ó¤Q¤»¶i¦ì¼Æ­È¡AµM«á¦¹¼Æ­È¦s©óAXùØ
;°Ñ¼Æ¡GµL
;¦^¶Ç­È¡G¨Ï¥ÎªÌ¿é¤J¥¿½Tªº¼Æ­È¡AAX¡Ð¤Q¤»¶i¦ì¼Æ­È
;¡@¡@¡@¡@¨Ï¥ÎªÌ¿é¤J¿ù»~ªº¼Æ­È¡A¶i¦ìºX¼Ð³Q³]©w
input   PROC
        LOCAL   hex:WORD
        mov     cx,4            ;¤@­Ó¦r²Õªº¤Q¤»¶i¦ì¼Æ¦³¥|¦ì
        mov     hex,0
.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
    .ELSE
        stc
.BREAK .IF 1
    .ENDIF
        shl     hex,4           ;hex¡×hex¡Ñ10H
        cbw                     ;¨ÏAHÅܬ°0
        add     hex,ax          ;hex¡×hex¡ÏAX
        dec     cx
.ENDW
        mov     ax,hex
        ret
input   ENDP
;---------------------------------------------------------------------
;§âAX¤ºªº¼Æ­È¥H¤Q¤»¶i¦ìªº¤è¦¡¡A©ñ¦bBX©Ò«üªº¦ì§}
;°Ñ¼Æ¡GAX¡Ð­nÂà´«ªº¤Q¤»¶i¦ì¼Æ
;¡@¡@¡@BX¡Ð¦s©ñÂà´««áªº¤Q¤»¶i¦ì¼Æ¦rªºASCII¦r¦ê
;¦^¶Ç­È¡GµL
hexadecimal     PROC
        mov     cx,4
next:   rol     ax,4
        mov     dl,al
        and     dl,0fh
.IF dl>0ah
        add     dl,7
.ENDIF
        add     [bx],dl
        inc     bx
        loop    next
        ret
hexadecimal     ENDP
;---------------------------------------------------------------------
;§âAX¤ºªº¼Æ­ÈÂà´«¦¨¤Q¶i¦ìªºªü©Ô§B¼Æ¦r¡A©ñ¦bBX©Ò«ü¦ì§}ùØ
;°Ñ¼Æ¡GAX¡Ð­nÂà´«ªº¤Q¤»¶i¦ì¼Æ
;¡@¡@¡@BX¡Ð¦s©ñÂà´««áªºªü©Ô§B¼Æ¦rªºASCII¦r¦ê
;¦^¶Ç­È¡GµL
decimal PROC
        LOCAL   ten:WORD
        mov     ten,10
        mov     cx,5
        add     bx,4
.WHILE cx
        xor     dx,dx
        div     ten
        add     [bx],dl
.BREAK .IF ax==0
        dec     bx
        dec     cx
.ENDW
        ret
decimal ENDP
;*********************************************************************
END     main

²ÕĶ¡B³sµ²¤èªk¸ò¥H«e¤@¼Ë¡A°²³] HEX2DEC.ASM ¦b¡uE:\DOS\HEX2DEC¡v¤l¥Ø¿ýùØ¡A°õ¦æ¡uMS-DOS 6.20¡vµêÀÀ¾÷¾¹«á¡G

C:\>e: [Enter]

E:\>cd \dos\hex2dec [Enter]

E:\DOS\HEX2DEC>ml /Zf /Fm hex2dec.asm [Enter]
Microsoft (R) Macro Assembler Version 6.11
Copyright (C) Microsoft Corp 1981-1993.  All rights reserved.

 Assembling: hex2dec.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]: hex2dec.obj/t
Run File [hex2dec.com]: "hex2dec.com"
List File [nul.map]: "hex2dec.map" /m
Libraries [.lib]:
Definitions File [nul.def]:

E:\DOS\HEX2DEC>c:\tools\mapsym hex2dec [Enter]
Microsoft (R) Symbol File Generator  Version 4.00
Copyright (C) Microsoft Corp 1984, 1985.  All rights reserved.

	Program entry point at 0000:0100

E:\DOS\HEX2DEC>hex2dec [Enter] ¡÷°õ¦æ HEX2DEC.COM ¸Õ¸Õ¬Ýµ²ªG¦p¦ó
Input a hexadecimal number :ffff ¡÷ÀH«K¿é¤J¤@­Ó¤Q¤»¶i¦ì¼Æ¡A¤£¶·«ö Enter Áä
FFFFH=65535
E:\DOS\HEX2DEC>

¨ä¥L¸Ñ»¡

¤p¤ì°¸¤wÁ¿§¹¦³Ãö¥»³¹ªº¥D­n¸Ñ»¡¡A³Ñ¤Uªº¬O¤@¨Ç²Ó¸`¡G

HEX2DEC.ASM ªºµ²ºc

HEX2DEC.ASM ¶È¦³¤@­Ó°Ï¬q¡A¦Ó³o­Ó°Ï¬qùØ­±¦³¥|­Ó¥H PROC/ENDP «Å§iªº°Æµ{¦¡¡C²Ä 9¡ã30 ¦æ¡A¬OºÙ¬°¡umain¡vªº°Æµ{¦¡¡A¥¦¬Oµ{¦¡ªº¶i¤JÂI¡C·í DOS °õ¦æ HEX2DEC.COM ®É¡ADOS ·|±N±±¨îÅv¥æµ¹ main °Æµ{¦¡¡A°õ¦æ§¹ HEX2DEC.COM «á¤S¬O±q main ªð¦^¨t²ÎùØ¡C±q³o­ÓÆ[ÂI¨Ó¬Ý¡Amain ¥i¥H¬Ý¦¨¬O DOS ªº°Æµ{¦¡¡C¦ý¬O¥¦¤S·|©I¥s¨ä¥L¤T­Ó°Æµ{¦¡¡A¬G¬Û¹ï©ó¨ä¥L°Æµ{¦¡¡Amain ¥i»¡¬O¥Dµ{¦¡¡C¦]¦¹¡umain ªº¦a¦ì«ÜÀǬN¡A¬O¥Dµ{¦¡¤]¬O°Æµ{¦¡¡Aµø¹ï¶H¦Ó©w¡C¡v

HEX2DEC ùØ¡A³Q main ©I¥sªºªº¤T­Ó°Æµ{¦¡¬O input¡Bhexadecimal¡Bdecimal¡A¨ä­ì²z³£¬O«e´X³¹¤¶²Ð¹Lªºµ{¦¡¡A¦]¦¹ÁöµM HEX2DEC ¦³¤@¦Ê¦h¦æ¡A«o¤£Ãø¡C

¦b main ¤§«á¡A¬O¤@¶ô¦s©ñ¸ê®Æªº¦a¤è¡C§A·|µo²{¤p¤ì°¸¥Î

;---------------------------------------------------------------------

¨Ó¤À¹j°Æµ{¦¡¡A³o¼Ë°µ¬O¬°¤F¸û®e©ö¾\Ū¡C¦b¦s©ñ¸ê®Æ¤§«á¡A¬O input °Æµ{¦¡¡A§A¯à¨£¨ì¡A¤p¤ì°¸¦b°Æµ{¦¡¤§«e¼g¤F´X¦æµù¸Ñ¡A§i¶D¦Û¤v³o­Ó°Æµ{¦¡ªº¥\¯à¡B°Ñ¼Æ¡B¦^¶Ç­Èµ¥µ¥­«­n¸ê°T¡C¨Æ¹ê¤W¡A¨C­Ó°Æµ{¦¡³£À³¸Ó³o¼Ë°µ¡A§_«h®É¤é¤@¤[¡A§Y«K¬O§A¦Û¤v¼¶¼gªºµ{¦¡¤]·|§Ñ¤F³oµ{¦¡¬O·F¹Àªº¡C

input °Æµ{¦¡¬OÅý¨Ï¥ÎªÌ¿é¤J¤@­Ó¦r²Õ¤j¤pªº¼Æ­È¡A¤£»Ý­n±q¥Dµ{¦¡¤¤Àò±o¸ê®Æ¬GµL¶·°Ñ¼Æ¡A¦ý­n±N¨Ï¥ÎªÌ¿é¤Jªºµ²ªG¶Ç¦^µ¹¥Dµ{¦¡¡AÁÙ±o¦Ò¼{¨Ï¥ÎªÌ¬O§_«ö¤U¤£¸Ó«ö¤Uªº«öÁä¡A¨Ò¦p¤Q¤»¶i¦ì´N¤£·|¦³ G¡BH¡K¡Kµ¥¦r¤¸¡C¤p¤ì°¸¬O³o¼Ë³]­pªº¡G­Y¨Ï¥ÎªÌ¿é¤J¥¿½T¡A´N±N¶i¦ìºX¼Ð²M°£¡AAX ¤º¬°¿é¤Jªº¼Æ­È¡A§Y¦^¶Ç­È¡F­Y¨Ï¥ÎªÌ¿é¤J¿ù»~¡A´N³]©w¶i¦ìºX¼Ð¡C

±q input °Æµ{¦¡ªð¦^ main «á¡AÀˬd¶i¦ìºX¼Ð¡A¦pªG³]©w¡AÅãµM¨Ï¥ÎªÌ¿é¤J¿ù»~¡A¦L¥X¿ù»~ªº­ì¦]«áµ²§ôµ{¦¡¡F¦pªG²M°£¡A¥ý§â input ªº¦^¶Ç­È¦s¤J value ùØ¡A¦A©I¥s hexadecimal ¥h­pºâ¤Q¤»¶i¦ì¦r¦ê¡C

hexadecimal ©Ò»Ý­nªº¸ê®Æ¦³¨â­Ó¡A¤@¬O¼Æ­È¡A¤G¬OÂà´««áªº¤Q¤»¶i¦ì¦r¦ê­n¶ñ¦b­þ¤@¦ì§}¡A¤p¤ì°¸¤À§O±N¥¦­Ì¦s¦b AX »P BX ¼È¦s¾¹ùØ¡C´«¥y¸Ü»¡¡A¥H³o¨â­Ó¼È¦s¾¹§@¬°°Ñ¼Æ¡A§â³o¨âµ§¸ê®Æ¶Çµ¹ hexadecimal ¥h­pºâ¥X¤Q¤»¶i¦ì¦r¦ê¨Ó¡Chexadecimal ¨S¦³¦^¶Ç­È¡A¦]¬°¥ô¦ó AX ³£¯àÅܦ¨¤Q¤»¶i¦ì¦r¦ê¡A³o¬O²@µLºÃ°Ýªº¡C

¥Ñ hexadecimal ªð¦^«á¡Amain ¤S¦A³]©w decimal ©Ò»Ýªº¨â­Ó°Ñ¼Æ¡G¼Æ­È»P¸Ó¼Æ­ÈÂà´««áªº¤Q¶i¦ì¦r¦ê­n¶ñ¤Jªº¦ì§}¡AµM«á©I¥s decimal¡C§¹¦¨«áªð¦^ main¡A¦L¥X¦r¦ê¨Ó¡Aµ{¦¡µ²§ô¡C

¦r¦ê»P¼Æ­È

¦b¤W­±²ÕĶ»P³sµ²«á¡A¤p¤ì°¸°õ¦æ HEX2DEC.COM ¸Õ¸Õ¬Ý¡A³Ì«á¦L¥X¨Óªº¬O¡uFFFFH=65535¡v³o¼ËªºªF¦è¡A­nª¾¹D³o¬O¦r¦ê¡A¨Ã«D¼Æ­È¡C¦b°O¾ÐÅ餤¥¦¬O¤@³s¦êªº ASCII ¦r¤¸¡A¦pªG¥Î DEBUG ©Î SYMDEB ¸ü¤J HEX2DEC.COM °õ¦æ§¹¥h¬Ý¡Aanswer ¦r¦ê¦b 014B ³B ( ¥Õ¦â¦r )¡A§A·|¬Ý¨£¡G

1D89:0140  6C 20 6E 75 6D 62 65 72-20 3A 24 0D 0A 46 46 46   l number :$..FFF
1D89:0150  46 48 3D 36 35 35 33 35-24 0D 0A 50 6C 65 61 73   FH=65535$..Pleas

·íµM¡A¤Q¤»¶i¦ìªº 46 ´N¥Nªí­^¤å¦r¥Àªº¡uF¡v¡B¤Q¤»¶i¦ìªº 3D ´N¥Nªí¼Æ¾Ç²Å¸¹¡u=¡v¡K¡K¡C¦]¦¹¡uhexadecimal¡v¡B¡udecimal¡v³o¨â­Ó°Æµ{¦¡¨ä¹ê´N¬O­pºâ value ¤ºªº¼Æ­È¡A¥H¬Û¹ïÀ³ªº ASCII ¦r¤¸¶ñ¤J answer ¦r¦ê¡Aªð¦^ main «á³Ì«á¦A¥Ñµ{¦¡²Ä 27¡ã28 ¦æ¦L¦b¿Ã¥ú¹õ¤W¡C

¦¹¥~¦bµ{¦¡²Ä 34¡B35 ¦æªº¨â­Ó¦r¦ê°_ÀY³£¬O 0DH¡B0AH¡A³o¨â­Ó¦r¤¸·f°t¦b¤@°_«K¦¨¬°´«¦æ²Å¸¹¡A¥H«K¸ò¤W¤@¦æ¤À¶}¡A¤è«K¾\Ū¡C¤@­Ó·L¤£¨¬¹Dªº¤p§Þ¥©¡C

¶Â½c§@·~ªº°Æµ{¦¡

®Ú¾Ú¥¿­×¤j¾Ç±Ð±Â§õ¬K¶¯³Õ¤hªº±Ð§÷¡A°Æµ{¦¡¦³´X­Ó¥Øªº¡G

  1. ¥i¥H¨Ïµ{¦¡§ó²¤Æ¡A¦]¬°§â­«ÂЪºµ{¦¡¼Ò²Õ¤Æ¡C
  2. ¼W¥[µ{¦¡¥iŪ©Ê¡C
  3. ´£°ªµ{¦¡ºûÅ@©Ê¡C
  4. ¸`¬Ùµ{¦¡©Ò¦û¥Îªº°O¾ÐÅéªÅ¶¡¡C
  5. ¸`¬Ù­«Âм¶¼gµ{¦¡ªº®É¶¡¡C

¬°¤F¹F¦¨²Ä 2¡B3 ¶µ¥Øªº¡A°Æµ{¦¡³Ì¦n¥u¯à±µ¦¬¥Dµ{¦¡¶Ç¨Óªº¸ê®Æ¡A°Æµ{¦¡®Ú¾Ú³o¨Ç¸ê®Æ¹Bºâ©Î¹F¦¨¬Y¶µ¥\¯à¡AµM«á§â±o¨ìµ²ªG¶Ç¦^µ¹¥Dµ{¦¡¡C¥Ñ¥Dµ{¦¡¶Çµ¹°Æµ{¦¡ªº¸ê®ÆºÙ¬°¡u°Ñ¼Æ¡v¡A¥Ñ°Æµ{¦¡ªð¦^¥Dµ{¦¡®É¶Çµ¹¥Dµ{¦¡ªºµ²ªGºÙ¬°¡u¦^¶Ç­È¡v¡C¦b³o°Æµ{¦¡¹B§@ªº¹Lµ{¤¤¡A¤£¦s¨ú¤]¤£­×§ï¥Dµ{¦¡¤¤ªº¸ê®Æ¡C³o¼Ë´N¨Ï±o¥Dµ{¦¡»P°Æµ{¦¡ªºÃö«Y¶È¦³°Ñ¼Æ»P¦^¶Ç­È¡A¦ÓµL¨ä¥L¥ô¦óÃöÁp¡C

¦pªG¦³³\¦h¹ÎÅé¡B­Ó¤H¶}µo¦U¦¡¦U¼Ëªº°Æµ{¦¡¨Ñµ¹¨ä¥Lµ{¦¡·R¦nªÌ¨Ï¥Î¡A¦Ó¨Ï¥Îªº¤H´N¯à±Mª`©ó¥»¨­µ{¦¡ªº°ÝÃD¡A¤£¥²­«·s¦A³Ð³y¬Û¦P¥\¯àªºµ{¦¡½X¡A¤]¤£¥²¾á¤ß³o¨Ç°Æµ{¦¡¦p¦ó¹B§@¡A°Z¤£§¹¬ü¤è«K¶Ü¡H³o´N¬O¤p¤ì°¸©Ò»¡ªº¡A°Æµ{¦¡³Ì°ª¹Ò¬É´N¬O¡u¶Â½c§@·~¡v¡C

·íµM¡A°Æµ{¦¡¦b¹B§@®É¡A¥²©w¤]¦³¹Bºâ®É©Ò»Ýªº¸ê®Æ¡A³o¨Ç¸ê®ÆÀ³¸Ó¼È®É«O¦s¦b¬Y¨ÇÅܼÆùØ¡A¨Ã¥BÀ³¸Ó«Ê³¬°_¨Ó¡A¥u¦³°Æµ{¦¡¯à°÷¦s¨ú¡A¥Dµ{¦¡µLªk¦s¨ú¡A¹³³oºØ¥u¦³¦b°Æµ{¦¡ùدà¦s¨úªºÅܼƺ٬°¡u§½³¡Åܼơv©Î¡u°Ï°ìÅܼơv( local variable )¡A¦pªG¬O¦b¥Dµ{¦¡©Î°Æµ{¦¡³£¯à¦s¨úªºÅܼƺ٬°¡u¥þ°ìÅܼơv( global variable )¡C

¦b²Õ¦X»y¨¥ùØ¡A¥þ°ìÅܼƤ@¯ë³£©ñ¦b¸ê®Æ°Ï¬qùØ¡A¥H DB¡BDW¡BDD «Å§i¡A¨Ò¦p HEX2DEC.ASM ùتº value¡B prompt¡Banswer¡Berror ³£¬O¥þ°ìÅܼơG

value   dw      ?
prompt  db      "Input a hexadecimal number :$"
answer  db      0dh,0ah,"0000H=",5 DUP ("0"),"$"
error   db      0dh,0ah,"Please input 0~9 or A~F.$"


°Ï°ìÅܼÆ

¦b²Õ¦X»y¨¥ùØ¡A«Å§i°Ï°ìÅܼƥ²¶·¥Î LOCAL °²«ü¥O¡ALOCAL ¥²¶·ºò±µµÛ¦b PROC ¤§«á¡A¨âªÌ¤£¯à¤À¶}¡CLOCAL ªº»yªk¬O¡G

LOCAL   ÅܼƦW[¦¸¼Æ]:¸ê®ÆÃþ«¬

¦pªG¦¹Åܼƥu¦³¤@­Ó¤¸¯À¡A¥ç§Y¤£¬O°}¦C ( array ) ªº¸Ü¡A¦¸¼Æ¥i¥H¬Ù²¤¡C¸ê®ÆÃþ«¬¥²¶·¬O BYTE¡BWORD¡BDWORD¡BQWORD µ¥µ¥¡C¥t¥~¦³¤@ÂI¤Q¤À­«­n¡ALOCAL µLªk³]©w°Ï°ìÅܼƪºªì©l­È¡A¥²¶·¥Ñ°Æµ{¦¡¤¤¦Û¦æ³]©w¡C³\¦h¿ù»~ªº²£¥Í¡A´N¬O¨S¦³³]©wªì©l­È¡C

©³¤U¬O´X­Ó°Ï°ìÅܼƪº¥¿½T¨Ò¤l¡G

prime   PROC
        LOCAL   var1:WORD
        LOCAL   var2[20h]:BYTE
        LOCAL   var3:DWORD,var4[2]:BYTE

³Ì«á¡A³Ñ¤U¤@­Ó°ÝÃD¤F¡A°Ï°ìÅܼƦb°O¾ÐÅ骺­þ¤@¦ì§}©O¡H©³¤U§Ú­Ì¸Õ¸Õ¬Ý°lÂÜ HEX2DEC.COM µ{¦¡´N·|ª¾¹Dµª®×¤F¡C

¥Î SYMDEB °lÂÜ HEX2DEC.COM

¬°¤FÆ[¹î°Ï°ìÅܼƦb­þ¨à¡A¥Î SYMDEB °lÂÜ HEX2DEC.COM ¬Ý¬Ý¡G

E:\DOS\HEX2DEC>c:\tools\symdeb hex2dec.sym hex2dec.com [Enter]
Microsoft (R) Symbolic Debug Utility  Version 4.00
Copyright (C) Microsoft Corp 1984, 1985.  All rights reserved.

Processor is [80286]
-u [Enter]
DGROUP:main:
1551:0100 B409           MOV	AH,09
1551:0102 BA2E01         MOV	DX,012E
1551:0105 CD21           INT	21
1551:0107 E86A00         CALL	input
1551:010A 7305           JNB	main+11 (0111)
1551:010C BA5901         MOV	DX,0159
1551:010F EB15           JMP	main+26 (0126)
-r [Enter]
AX=0000  BX=0000  CX=0104  DX=0000  SP=FFFE  BP=0000  SI=0000  DI=0000  
DS=1551  ES=1551  SS=1551  CS=1551  IP=0100   NV UP EI PL NZ NA PO NC 
DGROUP:main:
1551:0100 B409           MOV	AH,09

¶i¤J SYMDEB «á¥ýÆ[¹î¼È¦s¾¹¡A¥ý«á¤U¡uu¡v»P¡ur¡v«ü¥O¡A¦p¤W­±¡A¤@¤Á¥¿±`¡Aª½±µ°õ¦æ¨ì¶i¤J input ùØ¡A¦p¤U­±¤U¹F¡ug input¡v«ü¥O

-g input [Enter]
Input a hexadecimal number :AX=0924  BX=0000  CX=0104  DX=012E  SP=FFFC  BP=0000  SI=0000  DI=0000  
DS=1551  ES=1551  SS=1551  CS=1551  IP=0174   NV UP EI PL NZ NA PO NC 
DGROUP:input:
1551:0174 55             PUSH	BP

¤@¶}©lÁÙ«Ü¥¿±`¡A¦p¤W­±©Ò¥Ü¦L¥X¥Õ¦âªº¦r¦ê¡A¨º¥»¨Ó´N¬O HEX2DEC.COM ­nÅý¨Ï¥ÎªÌ¿é¤J¤Q¤»¶i¦ì¼Æªº´£¥Ü¦r¦ê¡F¦ý¬O¶i¤J input °Æµ{¦¡«áªº²Ä¤@­Ó«ü¥O³ºµM¤£¬O§Ú­Ì¦b HEX2DEC.ASM ùØ©Ò¼¶¼gªº«ü¥O¡A¦Ó¬O¡uPUSH BP¡v«ü¥O¡A³o¬O«ç»ò¤@¦^¨Æ¡H¥ý¤Ï²ÕĶ¬Ý¬Ý input °Æµ{¦¡¡A¦p¤U­±¡A¤U¹F¡uu input 187¡v¡G

-u input 187 [Enter]
DGROUP:input:
1551:0174 55             PUSH   BP
1551:0175 8BEC           MOV    BP,SP
1551:0177 83C4FE         ADD    SP,-02
1551:017A B90400         MOV    CX,0004
1551:017D C746FE0000     MOV    Word Ptr [BP-02],0000
1551:0182 EB34           JMP    input+44 (01B8)
1551:0184 B401           MOV    AH,01
1551:0186 CD21           INT    21

¥J²ÓÆ[¹î¤W­±ªº input °Æµ{¦¡«e´X¦æ«ü¥O¡Aµo²{±q¦ì§} 017A «áªº«ü¥O¤~¬O§Ú­Ì­ì©lµ{¦¡¤º©Ò¼¶¼gªº¡A²HÂŦâ¦rªº³¡¤À¨Ã«D§Ú­Ì©Ò¼¶¼gªº¡A¦Ó¬O²ÕĶ¾¹©Ò²K¥[ªº¡C¹ï·Ó­ì©lµ{¦¡³o­Ó½d³ò¤º¡A«ê¦n¤]¬O§Ú­Ì¼¶¼g°Ï°ìÅܼƪº¦ì¸m ( §Y¡uLOCAL hex:WORD¡v)¡A²ö«D³o¤T¦æ²HÂŦâ¦rªº«ü¥O©M°Ï°ìÅܼƦ³Ãö¡H¦A¬Ý¨ì¦ì§} 017D ³B¡A³oùØ­ì©lµ{¦¡¬O¼gµÛ¡umov hex,0¡v¡A«Ü©úÅã¡A°Ï°ìÅÜ¼Æ hex ´N¦b¦ì§}¡uBP-02¡v³B¡C

°Æµ{¦¡§t¦³°Ï°ìÅܼÆ

BP ¼È¦s¾¹¬O base pointer ªº·N«ä¡A¬O³]©w¦b°ïÅ|ùتº¤@­Ó°ò·Ç¦ì§}ªº¼È¦s¾¹¡AµM«á¥H¦¹°ò·Ç¦ì§}¥[©Î´î´X­Ó¦ì¤¸²Õ¡A¤S¥i¥H«ü¦V¨ä¥L¦ì§}¡C°Ñ¦Ò¤W­±¹Ï¤@¡A³o¬O¤@¶i¤J input °Æµ{¦¡®É°ïÅ|ªº±¡§Î¡ASP ©Ò«üªº°O¾ÐÅé¦ì§}¦s©ñµÛ¬Oªð¦^¦ì§}¡A010A¡Cinput ªº²Ä¤@­Ó«ü¥O¬O§â BP ¤§­È±À¤J°ïÅ|¡A¦¹Á|¦b©ó§â BP ¤§­È«O¦s°_¨Ó¡Aµ¥ªð¦^¥Dµ{¦¡«e¤@Àþ¶¡¦A¥Ñ°ïÅ|¨ú¦^¦¹¼Æ­È¡C¨ä­ì¦]¬O¦b input °Æµ{¦¡¤¤¡A¦s¨ú°Ï°ìÅܼƳ£¬O§â BP ·í¦¨°ò·Ç¡A¦]¦¹ BP ¤§­È·|§ïÅÜ¡CBP ­ì¬°¹s¡A·í BP ¤§­È¦s¤J°ïÅ|«áªº±¡§Î¦p¤W¹Ï¤G¡C

±µ¤U¨Óªº«ü¥O¬OÅý BP «ü¦V°ïÅ|³»ºÝªº¦ì§}¡A¥ç§Y¨Ï BP µ¥©ó SP¡A¦b¾ã­Ó°Æµ{¦¡¤§¤¤ BP ¤§­È¤£ÅÜ¡A¦p¤W¹Ï¤T¡C±µ¤U¨Óªº«ü¥O¬OÅý SP ´î¤Ö¤G¡A³o­Ó«ü¥O´N·|¨Ï°ïÅ|³»ºÝ¦A·s¼W¤@­Ó¦r²Õªº¸ê®Æ¡A¦¹¦r²Õ´N¬O°Ï°ìÅܼƩҦb¡A¦Ó¦¹¦r²Õªº¦ì§}¤ñ BP ©Ò«ü¦ì§}¤Ö¤G¡A¦]¦¹¦¹°Ï°ìÅܼƴN¥H¡uBP-2¡vªí¥Ü¡C¥i¯à·|¦³¤H°Ý¬°¦ó¤£¥Î SP §@¬°¦s¨ú°Ï°ìÅܼƪº°ò·Ç©O¡H³o¬O¦]¬°¦b°Æµ{¦¡¤¤¤]¥i¯à·|©I¥s¨ä¥L°Æµ{¦¡¡ASP ¤§­È¬O·|§ïÅܪº¡C

°²¦p¦³¨â­Ó§¡¬°¦r²Õªº°Ï°ìÅܼơA¦b°ïÅ|ùØ´N±o·s¼W¨âµ§¦r²Õªº¸ê®Æ¡A¨º»ò¹Ï¤T¨ì¹Ï¥|ªº«ü¥O´N·|Åܦ¨¡uADD SP,-4¡v¤F¡C¥Ñ¦¹¥i±À½×¡A¦pªG¦b°Æµ{¦¡¤¤¨Ï¥Î°Ï°ìÅܼơA²ÕĶ¾¹·|¥H BP «ü¦Vªð¦^¦ì§}§C¨â­Ó¦ì¤¸²Õªº¦a¤è§@¬°°ò·Ç¡AµM«á¥H BP ´î¤Ö´X­Ó¦ì¤¸²Õªº¤è¦¡«ü¦V¦U­Ó°Ï°ìÅܼơA³o¼Ë´N¯à¥H¡u[BP-n]¡vªº¤è¦¡¦s¨ú°Ï°ìÅܼƤF¡C

°Æµ{¦¡ input ±µ¤U¨Óªºµ{¦¡´N¤£»¡©ú¤F¡A§Ú­Ì¨Ó¬Ý¬Ý¦p¦óµ²§ô°Æµ{¦¡¡A¿é¤J¡uu 1b7¡v¤Ï²ÕĶ input °Æµ{¦¡³Ì«á´X­Ó«ü¥O¡G

-u 1b7 [Enter]
1551:01B7 49             DEC    CX
1551:01B8 0BC9           OR     CX,CX
1551:01BA 75C8           JNZ    input+10 (0184)
1551:01BC 8B46FE         MOV    AX,[BP-02]
1551:01BF 8BE5           MOV    SP,BP
1551:01C1 5D             POP    BP
1551:01C2 C3             RET
DGROUP:hexadecimal:

¤W­±²HÂŦâ¦rªº³¡¤À¬O²ÕĶ¾¹¦Û¦æ¥[¤W¥hªº¡A¦b 01BC ³Bªº¡uMOV AX,[BP-02]¡v¬O§â°Ï°ìÅܼƪº­È²¾¤J AX¡A¦¹­È¬°¦^¶Ç­È¡CµM«á­n°µªº¤u§@´N¬O³B²z¦n°ïÅ|¡Aªð¦^¥Dµ{¦¡¡A¨£¤U¹Ï¤­¡C

¤£½× SP ¬°¦ó¡A±µ¤U¨Óªº«ü¥O¬O¡uMOV SP,BP¡v³£·|Åý SP °£¥h°Ï°ìÅܼơA«ü¦VÀx¦s­ì¨Ó BP ¤§­È±o¦ì§}¡A¦p¤W¹Ï¤»¡C±µµÛªº«ü¥O¬O¡uPOP BP¡v¡A¥Ñ°ïÅ|«ì´_ BP ­ì­È¡A¦p¤W¹Ï¤C¡F°õ¦æ§¹¦¹«ü¥O«á¡ASP ´N«ü¦Vªð¦^¦ì§}ªº°O¾ÐÅé³B¡C³Ì«á°õ¦æ RET «ü¥O¡Aªð¦^¥Dµ{¦¡¡ASP ¤S«ì´_¦¨«ü¦VÁÙ¥¼¶i¤J¥Dµ{¦¡®Éªº¦ì§}¡C¦Ü¦¹¡A´N§¹¾ãªº°õ¦æ§¹°Æµ{¦¡¤F¡C


µ²»y

³o¤@³¹¨ì³o¨àµ²§ô¡A¦ý¦³Ãö°Æµ{¦¡ªºª¾ÃÑÁÙ¦³³\¦h¶Èµyµy´£¹L¡A¥²¶·²`¤J¬ã¨s¡A¤U¤@³¹¦A»¡¤@³¡¥÷§a¡I