«e¤@³¹¤¶²Ð¤F°Æµ{¦¡¡Aª¾¹D¥¦¬O¤@¬q¥i¥H§¹¦¨¯S©w¥Øªºªºµ{¦¡¡CnÅý°Æµ{¦¡°õ¦æ®É¡A±o¥Ñ¥Dµ{¦¡©I¥s¥¦¡C·íµMn§¹¦¨¬Y¨Ç¯S©w¥Øªº¡A¥²©wn¥Ñ¥Dµ{¦¡¶Çµ¹°Æµ{¦¡¬Y¨Ç¸ê®Æ¡A³o¨Ç¸ê®Æ¤@¯ëºÙ¬°°Ñ¼Æ ( parameter )¡A¦Ó«á°Æµ{¦¡¸g¹L¹Bºâ¤~¯à§¹¦¨¡C¤W¤@³¹©Ò¤¶²Ðªºµ{¦¡¡A¬OÂǥѼȦs¾¹§@¬°°Ñ¼Æ§â¸ê®Æ¶Çµ¹°Æµ{¦¡ªº¡A¦ý¬O¼È¦s¾¹²¦³º¦³¼Æ¶qµ}¤Ö¡A¦³®É¤£°÷¨Ï¥Î¡C¦]¦¹¥»³¹¤¶²Ð¥t¤@ºØ¶Ç»¼°Ñ¼Æªº¤èªk¡AÂǥѰïÅ|§@¬°°Ñ¼Æ¶Ç»¼¸ê®Æ¡C
¨Ï¥Î°ïÅ|±N°Ñ¼Æ¶Çµ¹°Æµ{¦¡¡A¤´µMn¨Ï¥Î CALL «ü¥O©I¥s°Æµ{¦¡¡A¦ý¬O MASM 6.x ùØ·s¼W¤@Ó°²«ü¥O¡AINVOKE¡A¯à´î¤Öµ{¦¡³]p®v³\¦h·Ð¤Hªº¤u§@¡CµM¦Ó¨Ï¥Î INVOKE «ü¥O©I¥s°Æµ{¦¡¤§«e±o«Å§i°Æµ{¦¡ªºì«¬¡A³o¥i¥H¥Î PROTO °²«ü¥O¹F¦¨¥Øªº¡A¦]¦¹©³¤U¥ý¤¶²Ð PROTO °²«ü¥O¡C
«Å§i°Æµ{¦¡ì«¬ªº·N«ä¤jP¥i»{¬°¬O§i¶D²ÕĶ¾¹°Æµ{¦¡»Ýn´XӰѼơA³o¥i¥Î PROTO ¹F¦¨¡CPROTO °²«ü¥Oªº»yªk¬O¡G
label PROTO [distance][language-type][°Ñ¼Æ¦Cªí]
distance »P language-type ªº¥Îªk»P PROC ¤@¼Ë¡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¡C
distance ¥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¦b²Ä¤E³¹´£¨ì PROC/ENDP ®É¤]»¡¹L PROC ¤¤¦³¤@¿ï¶µ¬O»y¨¥Ãþ«¬¡A»P PROTO ªº»y¨¥Ãþ«¬·N¸q¬Û¦P¡A³£¬O¥Î¨Ó³]©w©I¥sºD¨Ò ( calling convention ) ªº¡C¦pªG¬Ù²¤ language-type¡A¥H .MODEL ³B©w¸qªº¬°·Ç¡C»y¨¥Ãþ«¬¥i¥H¦³ C¡BBASIC¡BFORTRAN¡BPASCAL¡BSYSCALL »P STDCALL ¤»ºØ¡A»P©I¥s®É°Ñ¼Æ±À¤J°ïÅ|ªº±¡§Î¦³Ãö¡C©³¤U¬O»y¨¥Ãþ«¬ªº¸ê®Æ¡G
»y¨¥Ãþ«¬ | STDCALL | SYSCALL | C | BASIC | FORTRAN | PASCAL |
¥ÑþӰѼƶ}©l±À¤J°ïÅ| | ¥k | ¥k | ¥k | ¥ª | ¥ª | ¥ª |
½Öt³d²M°£°ïÅ| | °Æµ{¦¡ | ¥Dµ{¦¡ | ¥Dµ{¦¡ | °Æµ{¦¡ | °Æµ{¦¡ | °Æµ{¦¡ |
¬O§_¤¹³\¤£©w°Ñ¼Æ | ¬O ( ¨£©³¤U ) | ¬O | ¬O | §_ | §_ | §_ |
קï°Æµ{¦¡¦WºÙ | ¥[¤J _ ¤Î @ | ¤£×§ï | ¥[¤J _ | §ï¦¨¤j¼g | §ï¦¨¤j¼g | §ï¦¨¤j¼g |
¥J²ÓÀˬd¤W±»y¨¥Ãþ«¬ªºªí®æ¡A§A´N·|µo²{¡A¨Æ¹ê¤W BASIC¡BFORTRAN¡BPASCAL ³o¤TºØ»y¨¥Ãþ«¬¨ä¹ê¬O¤@¼Ò¤@¼Ë¡C¦A¬Ý C »P SYSCALL ¦ü¥G¤]¤@¼Ë¡A¦ý¬OÁÙ¬O¦³®t§Oªº¡F²ÕĶ¾¹¤£·|¬° SYSCALL ¤¤ªº°Æµ{¦¡¦Wµ¥²Å¸¹²K¥[©³½u©Î¨ä¥L¦r¤¸¡A¦ý C ·|¡F³o´X¥G¤£·|¼vÅTµ{¦¡¹B§@¡A±N¥¦Ìǵø§@¬Ûµ¥¥ç¥¼¹Á¤£¥i¡CSTDCALL ¦b°Ñ¼ÆӼƤ£½T©w®É¡A¥ç§Y¨Ï¥Î VARARG ®É¬O¥Ñ¥Dµ{¦¡²M°£ªº°ïÅ|¡A¨ä¥L±¡§Î³£¥Ñ°Æµ{¦¡²M°£¡C
°Ñ¼Æ¦Cªí¬O¥Ñ³\¦h²Õªº°Ñ¼Æ»P¸ê®ÆÃþ«¬²Õ¦¨¡A¨C¤@²Õ³£¬O¡u°Ñ¼Æ:¸ê®ÆÃþ«¬¡v¡A¦Ü©ón¦h¤Ö²Õ«hµø°Æµ{¦¡ªº»Ýn¨M©w¡A¤]¥i¥H¤@²Õ³£¨S¦³¡C©³¤U¬O´XÓ¨Ò¤l¡G
addup PROTO NEAR C arg1:WORD, arg2:WORD, arg3:WORD myproc PROTO :WORD, :BYTE
PROTO ³Ì«nªº¥Øªº¬O§i¶D½sĶ¾¹°Ñ¼Æªº¼Æ¶q¡A°Ñ¼Æªº¦WºÙ¨Ã¨S¦³¤Ó¤j¥Î³~¡A¶È¶È¬O¬°¤F¥iŪ©Ê¡A¦]¦¹¥i¥H¬Ù²¤¡A©Ò¥H¤W±³Ì«á¤@¥y¤]¬O¥i¥Hªº¡C¦b¨Ï¥Î INVOKE ©I¥s°Æµ{¦¡«e¡A¤@©wn¥ý¥Î PROTO «Å§i°Æµ{¦¡ì«¬¡F¦ý¬O¦pªG¦b INVOKE ©I¥s°Æµ{¦¡«e¡A°Æµ{¦¡¤w¸g¥ý¥Ñ PROC/ENDP ©w¸q¹L¤F¡A¨º»ò PROTO «Å§i쫬´N¨S¦³¥²n¤F¥i¥H¬Ù²¤¤£¼g¡C
INVOKE ¯à«Ø¥ß¤@¨t¦Cªº PUSH «ü¥O¥H¤Î CALL «ü¥O¡CINVOKE ªº»yªk¦p¤U
INVOKE °Æµ{¦¡¦W,°Ñ¼Æ1,°Ñ¼Æ2¡K¡K
°Æµ{¦¡¦W¥i¥H¬O¼Ð°O©Î¬O¶¡±µ©w§}¡A°Ñ¼Æ1¡B°Ñ¼Æ2¡K¡K¤¤ªº¨CӰѼƳ£·|¥Ñ PUSH «ü¥O±À¤J°ïÅ|ùئӫá³Q°Æµ{¦¡©Ò¦s¨ú¡A¨º»ò·|¦³´XӰѼƱoµø PROC ©Î PROTO °²«ü¥O©Ò©w¸qªº°Ñ¼Æ¦Cªí¤¤ªº°Ñ¼ÆӼƨM©w¡C³oùتº°Ñ¼Æ1¡B°Ñ¼Æ2¡K¡K¥i¥H¨Ï¥Î¥ß§YÈ¡BÅܼơB¼È¦s¾¹¡BADDR ¹Bºâ¤l¡B¦ì§}¹Bºâ¦¡¡C
.MODEL¡BPROTO¡BPROC ³o¤TÓ°²«ü¥O³£¦³¤@ӿﶵ¡A»y¨¥Ãþ«¬ ( language type )¡A¥¦³W©w¤F¥Dµ{¦¡»P°Æµ{¦¡¤§¶¡ªº°Ñ¼Æ¨Ì·Ó¤°»ò¶¶§Ç¶Ç¹F¡B¤S¥Ñ½Öt³d²M°£°ïÅ|µ¥¸ê°T¡A³o¨Ç¸ê°TºÙ¬°¡u©I¥sºD¨Ò¡v( calling convention )¡F¤]¥i¥H»¡¡A©I¥sºD¨Ò¬O¥Ñ»y¨¥Ãþ«¬³]©wªº¡C
¤@¯ë¨Ó»¡¡A¦b¤@Óµ{¦¡ùØ·|©I¥s³\¦h°Æµ{¦¡¡A¦Ó³o¨Ç°Æµ{¦¡³£·|³]©w¦¨¬Û¦Pªº©I¥sºD¨Ò¡A¦]¦¹¦bµ{¦¡¤@¶}©l¥Ñ¡u.MODEL¡v³]©w¦n¡APROTO¡BPROC ³£¬Ù²¤»y¨¥Ãþ«¬¡A³o¼Ë¸û¬°³æ¯Â¥B¤è«K¡C¦pªG¡u.MODEL¡v¨S¦³³]©w»y¨¥Ãþ«¬¡A¨º»ò¦P¤@ӰƵ{¦¡¦b¡uPROTO¡v«Å§i®É»P¡uPROC¡v©w¸q®É³£n³]©w¬Û¦Pªº»y¨¥Ãþ«¬¡A¦ý¤£¦Pªº°Æµ{¦¡¥i¥H±Ä¥Î¤£¦Pªº»y¨¥Ãþ«¬¡A³o¼Ë´N¦³¸û¤jªº¼u©Ê¡C¤£¹Lnª`·Nªº¬O¡A¡uPROTO¡v»P¡uPROC¡v³£n³]©w¡A§_«h²ÕĶ¾¹·|²£¥Í¿ù»~°T®§¡F·íµM¦pªG¡uPROC¡v¦b¡uPROTO¡v¤§«e¡AÁÙ¬O¥i¥H¬Ù²¤¡uPROTO¡v¡C
¨Ò¦p¦³Ó°Æµ{¦¡ sum_of ¬°pºâ¤TÓ¾ã¼Æ¤§©M¡A©³¤U¬Oµ{¦¡¤ù¬q¡G
sum_of PROTO »y¨¥Ãþ«¬ :WORD,:WORD,:WORD ... INVOKE sum_of,num1,num2,num3 ... sum_of PROC »y¨¥Ãþ«¬ n1:WORD,n2:WORD,n3:WORD mov ax,n1 add ax,n2 add ax,n3 ret sum_of ENDP
¦]¬°¡usum_of PROC¡v¦b¡uINVOKE sum_of¡v¤§«á¡A¦]¦¹n¦b¡uINVOKE sum_of¡v¤§«e¥H PROTO «Å§i sum_of ªºì«¬¡A§_«h²ÕĶ¾¹µLªkª¾¹Dn¦p¦ó³B²z°Ñ¼Æ¡C¦pªG¬O¡usum_of PROC¡v¦b¡uINVOKE sum_of¡v¤§«e¡A´N¤£»Ýn¼g¡uPROTO¡v¤F¡A¦]¬°¡usum_of PROC¡v´N¤w¸g§i¶D²ÕĶ¾¹¦p¦ó³B²z°Ñ¼Æ¤F¡C©Ò¥H¤W±ªºµ{¦¡¥i¥H¼g¦¨¤U±¨º¼Ë¡G
sum_of PROC »y¨¥Ãþ«¬ n1:WORD,n2:WORD,n3:WORD mov ax,n1 add ax,n2 add ax,n3 ret sum_of ENDP ... INVOKE sum_of,num1,num2,num3 ...
©³¤U»¡©ú²ÕĶ¾¹¦p¦ó°Ñ¼Æ¡C¦pªG§â¤W±µ{¦¡¤ù¬q¤¤ªº¡u»y¨¥Ãþ«¬¡v¨Ì§ÇÅÜ§ó¬° STDCALL¡BSYSCALL¡BC¡BBASIC¡A²ÕĶì©lµ{¦¡«áªºµ²ªG¡A¦p¤Uªí¡G
ì©l½X | STDCALL | SYSCALL | C | BASIC |
INVOKE sum_of,num1,\ num2,num3 |
PUSH num3 PUSH num2 PUSH num1 CALL sum_of ... |
PUSH num3 PUSH num2 PUSH num1 CALL sum_of ADD SP,+06 ... |
PUSH num3 PUSH num2 PUSH num1 CALL sum_of ADD SP,+06 ... |
PUSH num1 PUSH num2 PUSH num3 CALL sum_of ... |
sum_of PROC »y¨¥Ãþ«¬\ n1:WORD,n2:WORD,n3:WORD mov ax,n1 add ax,n2 add ax,n3 ret sum_of ENDP |
PUSH BP MOV BP,SP MOV AX,[BP+04] ADD AX,[BP+06] ADD AX,[BP+08] POP BP RET 0006 |
PUSH BP MOV BP,SP MOV AX,[BP+04] ADD AX,[BP+06] ADD AX,[BP+08] POP BP RET |
PUSH BP MOV BP,SP MOV AX,[BP+04] ADD AX,[BP+06] ADD AX,[BP+08] POP BP RET |
PUSH BP MOV BP,SP MOV AX,[BP+08] ADD AX,[BP+06] ADD AX,[BP+04] POP BP RET 0006 |
²ÕĶ¾¹·|§â¡uINVOKE sum_of,num1,num2,num3¡v²ÕĶ¦¨¤@¨t¦Cªº PUSH »P CALL «ü¥O¡AY¬O¡u»y¨¥Ãþ«¬¡v¬° STDCALL¡A°Ñ·Ó¤W±ªí¤@»y¨¥Ãþ«¬ªº»¡©ú¡A³Ì¥kÃ䪺 num3 °Ñ¼Æ³Ì¥ý³Q±À¤J°ïÅ|¡AµM«á¨Ì§Ç¬O num2¡Bnum1¡A³Ì«á¬O CALL «ü¥O¡A©ó¬O´NÅܦ¨¤Wªí¤Gªº±¡§Î¡C¨£¤U¹Ï¹Ï¤@¡A³o¬O¶i¤J sum_of «á¡A°ïÅ|¦w±Æ±¡§Î¡A¥i¥H¨£¨ì BP¡Ï4 ¦ì§}ªº¦a¤è¬O num1¡ABP¡Ï6 ¬O num2¡K¡K¡A·í°Æµ{¦¡n¦s¨ú³o¨Ç°Ñ¼Æ®É¡A´N¬O¨ì³o¨Ç¦ì§}¥h¦s¨ú¡C
¤W¹Ï¹Ï¤G¬O°Æµ{¦¡µ²§ô®É¡A¥ý¥Ñ°ïÅ|¨ú¦^ì¨Óªº BP¡A¦¹®É°ïÅ|³»ºÝ¬Oªð¦^¦ì§}¡AµM«á°õ¦æ¡uRET 6¡v¡A¥Ñªð¦^¥Dµ{¦¡¨Ã±Ë±ó°ïÅ|¤W¤»Ó¦ì¤¸²Õªº¸ê®Æ¡A©ó¬O°ïÅ|¤ºªº±¡§Î´N©M¥¼¶i¤J sum_of «e¤@¼Ë¡C¥Ñ©ó¡uRET 6¡v¬O¦b°Æµ{¦¡ùØ°õ¦æªº¡A©Ò¥Hªí¤@ùØ»¡ STDCALL ¥Ñ°Æµ{¦¡²M°£°ïÅ|ùتº°Ñ¼Æ¡C
¦pªG»y¨¥Ãþ«¬§ï¦¨¡uC¡v¡A²ÕĶµ²ªG·|¦³¨Ç¤£¦P¡C¥ý»¡¬Û¦Pªº³¡¤À¡C¦b§â°Ñ¼Æ±À¤J°ïÅ|®É¡A¥Ñ¥k¦Ü¥ª¨Ì§Ç±À¤J°ïÅ|¡A¦]¦¹ num3 ¦b³Ì°ª¦ì§}¡Anum1 ¦b³Ì§C¦ì§}¡C°õ¦æ¡uCALL¡v®É¦A§âªð¦^¦ì§}±À¤J°ïÅ|¡A©ó¬O°ïÅ|¤¤ªº±¡§ÎÅܦ¨¤U¹Ï¥|¡C¶i¤J sum_of «á¡ABP¡Ï4 ¦ì§}ªº¦a¤è¬O num1¡ABP¡Ï6 ¬O num2¡K¡K¡A·í°Æµ{¦¡n¦s¨ú³o¨Ç°Ñ¼Æ®É¡A¤]¬O¨ì³o¨Ç¦ì§}¥h¦s¨ú¡C
¤W¹Ï¤¬O°Æµ{¦¡µ²§ô®É¡A¥ý¥Ñ°ïÅ|¨ú¦^ì¨Óªº BP¡A¦¹®É°ïÅ|³»ºÝ¬Oªð¦^¦ì§}¡AµM«á°õ¦æ¡uRET¡v¡Cµ{¦¡¥D±±Åv¦^¨ì¥Dµ{¦¡ùØ¡A³o®ÉÔ°ïÅ|³»ºÝ¬O num1 ªº¦ì§}¡C¦^¨ì¥Dµ{¦¡«áªº²Ä¤@Ó«ü¥O¬O¡uADD SP,6¡v¡A¨Ï±o SP ¼È¦s¾¹«·s«ü¦V¥¼©I¥s°Æµ{¦¡«eªº°ïÅ|³»¤F¡C¥Ñ©ó¬O¦b¥Dµ{¦¡¤¤²M°£°ïÅ|¤ºªº°Ñ¼Æ¡A¦]¦¹ªí¤@ùØ»¡ C ¥Ñ¥Dµ{¦¡²M°£°ïÅ|ùتº°Ñ¼Æ¡C
STDCALL »P C ¬O¸û¬°±`¥Îªº»y¨¥Ãþ«¬¡C·L³n©Ò¥X«~ªº Windows §@·~¨t²Î¦³ 16¦ì¤¸¡B32 ¦ì¤¸»P 64 ¦ì¤¸¤TºØ¡A¨ä¤¤ 32 ¦ì¤¸ªº§@·~¨t²Î¡A±q Windows 95/98/XP ¤D¦Ü¨ì Windows 7/8/10¡A©Ò¨Ï¥Î¨ìªº Win32 API ªº©I¥sºD¨Ò³£¬O STDCALL¡A©Ò¥H¼¶¼g Win32 µ{¦¡¤@©wn¤F¸Ñ STDCALL ¤~¦æ¡C¦Ü©ó C¡A¨º¤]¤£¥²¦h»¡¡Aªñ¤Q¦~¨Ó³Ì¬y¦æ¥B¾ú¤[¤£°Iªºµ{¦¡»y¨¥«D C »y¨¥²öÄÝ¡An¾Ç¦n C ¤]¤£¥i¤£ª¾ C ³oºØ©I¥sºD¨Ò¡C
¤p¤ì°¸·Q¥H¤@Ó¨Ò¤l¨Ó»¡©ú¦p¦ó¥Î STDCALL ©I¥sºD¨ÒÅý°ïÅ|¶Ç»¼°Ñ¼Æ¡C©³¤Uªº SEC.ASM µ{¦¡¬Opºâ¤¤p®É¥|¤Q¤K¤À¤Q¤C¬í¬Û·í©ó¦h¤Ö¬íÄÁ¡A³Ì«á¦b¿Ã¹õ¤W¦L¥X¦r¦ê¡G¡u05:48:17=20897seconds¡v¡Cì©lµ{¦¡¦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 |
;SEC§â5¤p®É48¤À17¬í´«ºâ¦¨¦@¦³´X¬íÄÁ
.MODEL TINY,STDCALL
.386
seconds PROTO :WORD,:WORD,:WORD,:WORD
;*******************************************************************************
.CODE
ORG 100h
;-------------------------------------------------------------------------------
;¥Dµ{¦¡
main PROC
jmp begin
hour DW 5
minute DW 48
second DW 17
string DB "05:48:17=00000seconds$"
begin: mov dx,OFFSET string
INVOKE seconds,hour,minute,second,OFFSET string+9
mov ah,9
int 21h
int 20h
main ENDP
;-------------------------------------------------------------------------------
;seconds´«ºâ®É¡B¤À¡B¬í¦@¦³´X¬íÄÁ
;°Ñ¼Æ¡Gn1¡Ð®É
;¡@¡@¡@n2¡Ð¤À
;¡@¡@¡@n3¡Ð¬í
;¡@¡@¡@address¡ÐÂà´««áªº¤Q¶i¦ì¦r¦ê
;¦^¶ÇÈ¡GAX¡Ð1¡A¦¨¥\µL¿ù»~
;¡@¡@¡@¡@¡@¡Ð0¡A¿ù»~
seconds PROC USES bx cx dx n1:WORD,n2:WORD,n3:WORD,address:WORD
LOCAL ten:WORD
LOCAL temp:WORD
mov ten,10
mov ax,n1
sub dx,dx
mov cx,3600
mul cx ;AX¡×3600¡Ñ¤p®É
mov temp,ax ;§âAX¼È®É¦s©ótempùØ¡A¦]¬°AX¦b°µMUL¹Bºâ·|¥ÎµÛ
mov ax,n2
sub dx,dx
mov cx,60
mul cx ;AX¡×60¡Ñ¤ÀÄÁ
add ax,n3 ;AX¡×60¡Ñ¤ÀÄÁ¡Ï¬íÄÁ
add ax,temp ;AX¡×¤w´«ºâ¦¨Á`¬í¼Æ
mov bx,address
add bx,4 ;BX¡×¤Q¶i¦ì¦r¦êªºÓ¦ì¼Æ¦ì§}
mov cx,5 ;¦@¦³¤¦ì¼Æ
next: sub dx,dx
div ten
add [bx],dl
dec bx
loop next
mov ax,1
ret
seconds ENDP
;*******************************************************************************
END main |
§â SEC.ASM ¦s¤J¡uMS-DOS 6.20¡vµêÀÀ¾÷¾¹¤¤ªº¡uE:\DOS\SECOND¡v¤l¥Ø¿ýùØ¡A²ÕĶ»PÁpµ²¹Lµ{»P©¹±`¤@¼Ë¡G
C:\>e: [Enter] E:\>cd dos\second [Enter] E:\DOS\SECOND>ml sec.asm [Enter] Microsoft (R) Macro Assembler Version 6.11 Copyright (C) Microsoft Corp 1981-1993. All rights reserved. Assembling: sec.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]: sec.obj/t Run File [sec.com]: "sec.com" List File [nul.map]: NUL Libraries [.lib]: Definitions File [nul.def]: E:\DOS\SECOND>sec [Enter] 05:48:17=20897seconds E:\DOS\SECOND>
¬Ý¨ì SEC ¦L¥X¡u05:48:17=20897seconds¡v¦r¦ê¡A´Nªí¥Ü SEC ¤w¸g°õ¦æ¦¨¥\¤F¡C©³¤U¤p¤ì°¸n½Íªº¬O©I¥s°Æµ{¦¡®É©Ò«Ø¥ßªº°ïÅ|®Ø ( stack frames )¡C
°ïÅ|®Ø¬O«ü¦b©I¥s°Æµ{¦¡®É¡A¦b°ïÅ|©Ò«Ø¥ßªº¤@¶ô°O¾ÐÅé¡A¥Ñ°ª¦ì§}¦V§C¦ì§}¡Aùر¦s©ñµÛ°Ñ¼Æ¡Bªð¦^¦ì§}¡Bì¨Óªº BP¡B°Ï°ìÅܼƥH¤În«O¦sªº¼È¦s¾¹µ¥¸ê®Æ¡Aµ¥ªð¦^¥Dµ{¦¡«á³o¨Ç¸ê®Æ³£·|³Q¾P·´¤£¯à¦A¦s¨ú¡C¤p¤ì°¸¦b«e±¤w¸g´£¹L¤F°Ñ¼Æ¡Bªð¦^¦ì§}¡Bì¨Óªº BP µ¥¸ê®Æªº¦w±Æ¤è¦¡¡A¤]½Í¹L¦p¦ó¾P·´¥¦Ì¡C²{¦b¤p¤ì°¸nÂÇµÛ SEC.COM µ{¦¡¡A¨Ó½Í½Ín«O¦sªº¼È¦s¾¹¥H¤Î°Ï°ìÅܼƦp¦ó°t¦X°Ñ¼Æ¡Bªð¦^¦ì§}¡Bì¨Óªº BP µ¥¸ê®Æ¡C
«e¤@³¹´£¨ì PROC ªº»yªk¬O
label PROC [distance][language-type][visibility][<prologuearg>][USES ¼È¦s¾¹¦Cªí][°Ñ¼Æ¦Cªí]
¨ä¤¤ªº¡uUSES ¼È¦s¾¹¦Cªí¡v·|³Q²ÕĶ¾¹²ÕĶ¦¨³\¦hÃþ¦ü¡uPUSH ¼È¦s¾¹¡vªº«ü¥O¡A§â¼È¦s¾¹¦Cªí¤ºªº¼È¦s¾¹¼È®É«O¦s¦b°ïÅ|ùØ¡F¦Ó¦bnªð¦^¥Dµ{¦¡®É¡Aº¥ý·|¥H¬Û¤Ïªº¶¶§Ç¦Û°ïÅ|¨ú¥X¼È®É¦s©ñªº¼È¦s¾¹ìÈ¡C³o·íµM¬O¦]¬°¼È¦s¾¹¼Æ¶q¤£¦h¡A¦ý¦b³\¦h¹Bºâ¹Lµ{³£n¥Î¨ì¡A¥¼¨¾¤î¯}Àò¼È¦s¾¹«nªº¸ê®Æ©Ò¥H PROC ¯S§O¥[¤J USES ¦b°ïÅ|ùØ«O¦s¼È¦s¾¹¡C½Ð°Ñ¦Ò¤Uªí¡G
ì©lµ{¦¡ | ²ÕĶ«áªºµ{¦¡ | |
¥Dµ{¦¡ | INVOKE seconds,hour,minute,second, ADDR string+9 |
PUSH 0111 PUSH [second] PUSH [minute] PUSH [hour] CALL _seconds@8 | °Æµ{¦¡ | seconds PROC USES bx cx dx n1:WORD, n2:WORD,n3:WORD, address:WORD LOCAL ten:WORD LOCAL temp:WORD .... ret seconds ENDP |
PUSH BP MOV BP,SP ADD SP,-04 PUSH BX PUSH CX PUSH DX .... POP DX POP CX POP BX MOV SP,BP POP BP RET 0008 |
¹ï·Ó¤Wªí¡A¥ý¬Ý¥Dµ{¦¡¡C¤@±ø INVOKE °²«ü¥O¡A´N³Q²ÕĶ¾¹²ÕĶ¦¨¥|Ó PUSH «ü¥O»P¤@Ó CALL «ü¥O¡C¦A¬Ý°Æµ{¦¡¡A¨â±ø LOCAL «ü¥O¡A³Q²ÕĶ¾¹²ÕĶ¦¨¤@±ø¡uADD SP,-04¡v¡F¤@±ø PROC °²«ü¥OÅܦ¨¥|±ø PUSH «ü¥O»P¤@±ø MOV «ü¥O¡Cªð¦^¥Dµ{¦¡®É¡A¤@±ø RET «ü¥OÅܦ¨ RET 8 «ü¥O¡A¦P®É²ÕĶ¾¹ÁÙ¦b RET 8 ¤§«eÃB¥~²K¥[¤F¥|±ø POP «ü¥O»P¤@±ø MOV «ü¥O¡C
©³¤U¤p¤ì°¸ºt¹¢¥H SYMDEB °lÂÜ SEC.COM¡A¨ÓÆ[¹î°ïÅ|®Øªº¦w±Æ¤è¦¡¡Cº¥ý¸ü¤J SEC.SYM ¤Î SEC.COM¡G
E:\DOS\HEX2DEC>c:\tools\mapsym sec [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>c:\tools\symdeb sec.sym sec.com [Enter] Microsoft (R) Symbolic Debug Utility Version 4.00 Copyright (C) Microsoft Corp 1984, 1985. All rights reserved. Processor is [80286] -t [Enter] ¡÷²Ä¤@Ó«ü¥O¬O¡uJMP begin¡v AX=0000 BX=0000 CX=0083 DX=0000 SP=FFFE BP=0000 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=011E NV UP EI PL NZ NA PO NC 20E1:011E BA0801 MOV DX,0108 -g 130 [Enter] ¡÷±µµÛ¦³¥|Ó PUSH «ü¥O¡A§â 0111¡Bsecond¡Bminute¡Bhour ±À¤J°ïÅ| AX=0000 BX=0000 CX=0083 DX=0108 SP=FFF6 BP=0000 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=0130 NV UP EI PL NZ NA PO NC 20E1:0130 E80600 CALL _seconds@8
¤p¤ì°¸ª½±µ¥Î¡ug 130¡v°õ¦æ¥|¦¸±À¤J°ïÅ|ªº«ü¥O¡A¤£¥Î³æ¨B°lÂÜ¡A¬Û«HŪªÌÀ³¸Ó«Ü¼ô±x PUSH «ü¥O¤F¡C±µ¤U¨Ó¬O¡ucall seconds¡v«ü¥O¡A¬°¤°»ò SYMDEB ·|§â°Æµ{¦¡¦WºÙ¼g¦¨¡u_seconds@8¡v¡H³o¬O²ÕĶ¾¹ªº³Ç§@¡C¦pªG»y¨¥Ãþ«¬¬° STDCALL ®É¡A²ÕĶ¾¹·|§â«Å§i¬° PUBLIC ªº²Å¸¹¦WºÙ¡A¦p°Æµ{¦¡¦WºÙ¡A×¹¢¦¨¡u_ì²Å¸¹¦W@n¡v¡An ¬O«ü°Ñ¼ÆÁ`¦@¦³¦h¤Ö¦ì¤¸²Õ¡C±µ着Ä~Äò¬Ý¤U¥h¡G
-t [Enter] ¡÷¶i¤J seconds °Æµ{¦¡ AX=0000 BX=0000 CX=0083 DX=0108 SP=FFF4 BP=0000 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=0139 NV UP EI PL NZ NA PO NC DGROUP:_seconds@8: 20E1:0139 55 PUSH BP -t [Enter] ¡÷¡A¦p¤W±seconds °Æµ{¦¡ªº²Ä¤@Ó«ü¥O¬O§â BP «O¦s¦b°ïÅ|¤W¡A°õ¦æ¥¦¡I AX=0000 BX=0000 CX=0083 DX=0108 SP=FFF2 BP=0000 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=013A NV UP EI PL NZ NA PO NC 20E1:013A 8BEC MOV BP,SP -t [Enter] ¡÷¤W±«ü¥O¬OÅý BP ªº°ò·Ç¬°²{¦b°ïÅ|³»ºÝ¦ì§}¡A¤]¬OÀx¦sì BP Ȫº¦ì§} AX=0000 BX=0000 CX=0083 DX=0108 SP=FFF2 BP=FFF2 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=013C NV UP EI PL NZ NA PO NC 20E1:013C 83C4FC ADD SP,-04 -t [Enter] ¡÷¤W±«ü¥O¡uADD SP,-4¡v¬OªÅ¥X¥|Ӧ줸²Õ¡A¦s©ñ¨âÓ°Ï°ìÅÜ¼Æ AX=0000 BX=0000 CX=0083 DX=0108 SP=FFEE BP=FFF2 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=013F NV UP EI NG NZ NA PE CY 20E1:013F 53 PUSH BX -g 142 [Enter] ¡÷±µµÛ¤TÓ PUSH «ü¥O¡A¤À§O§â BX¡BCX¡BDX ±À¤J°ïÅ|¡Aª½±µ°õ¦æ§¹¤£¤@¤@³æ¨B°lÂÜ AX=0000 BX=0000 CX=0083 DX=0108 SP=FFE8 BP=FFF2 SI=0000 DI=0000 DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=0142 NV UP EI NG NZ NA PE CY 20E1:0142 C746FE0A00 MOV Word Ptr [BP-02],000A SS:FFF0=7302
¥k¹ÏÅã¥Üªº¬O SEC.COM ©I¥s seconds ®É©Ò«Ø¥ßªº°ïÅ|®Ø¡C³z¹L¤W±ªº°lÂÜ¡A°ïÅ|®Ø«Ø¥ßªº¶¶§Ç¦p¤U¡G
¨ì¦¹°ïÅ|®Ø¤w¸g«Ø¥ß§¹¦¨¡A¶}©l¶i¤J°Æµ{¦¡¯u¥¿n§¹¦¨ªº¥Øªº¡GpºâÁ`¦@¦³´X¬íÄÁ¡C¤£¹L³o³¡¤À¤£¬O³o¤@³¹ªº«ÂI¡A¦]¦¹²¤¹L¤£»¡¡A¨£¤U±ªº«ü¥Oª½±µ°õ¦æ¡ug 17a¡v¡A¬Û«HŪªÌ¤]¯à°÷¬ÝÀ´pºâ¸g¹L¡Cµ¥pºâ§¹¦¨¡A´Nnªð¦^¥Dµ{¦¡¤F¡A©³¤U´N¬O¬Ý¬Ý³oÓ¹Lµ{¡C
-g 17a [Enter]
AX=0001 BX=0110 CX=0000 DX=0002 SP=FFE8 BP=FFF2 SI=0000 DI=0000
DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=017A NV UP EI PL NZ NA PO NC
20E1:017A 5A POP DX
º¥ý¬O«ì´_ USES «á©Ò¦C¥Xªº¼È¦s¾¹¤§ìÈ¡A³sÄò¤TÓ PUSH «ü¥O¡C¤p¤ì°¸¤]¤£¤@¤@³æ¨B°lÂÜ¡A¹³¤U±ª½±µ¿é¤J¡ug 17d¡v¡G
-g 17d [Enter]
AX=0001 BX=0000 CX=0083 DX=0108 SP=FFEE BP=FFF2 SI=0000 DI=0000
DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=017D NV UP EI PL NZ NA PO NC
20E1:017D 8BE5 MOV SP,BP
³o®ÉÔ SP «ü¦V°Ï°ìÅܼƩҦbªº³Ì§C¦ì§}¡A¤]´N¬Oì©lµ{¦¡¤¤³Ì«á¤@Ó°Ï°ìÅܼƪº¦ì§}¡C¦ý¦p¤µn±Ë±ó³o¨Ç°Ï°ìÅܼơA¦Ó BP ©Ò«ü¦ì§}«ê¦n´N¬O¤ñ°Ï°ìÅܼƳ̰ª¦ì§}¦A°ª¨âӦ줸²Õªº¦ì§}¡C²ÕĶ¾¹«Ü¥©§®ªº¥Î¤W±ªº¡uMOV SP,BP¡v«ü¥O¡A´N¯à§â°Ï°ìÅܼƥh°£¡C¥i¥H°Ñ¦Ò¥k¤W¹Ï¡A·|¤ñ¸û²M·¡¡C
-t [Enter]
AX=0001 BX=0000 CX=0083 DX=0108 SP=FFF2 BP=FFF2 SI=0000 DI=0000
DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=017F NV UP EI PL NZ NA PO NC
20E1:017F 5D POP BP
±µ¤U¨Ó¬O¥Ñ°ïÅ|³»ºÝ¤§ BP ìȼu¥X¨Ó«ì´_ BP ¼È¦s¾¹ì¥»ªº¸ê®Æ¡A¦p¤U±°õ¦æ¥¦¡G
-t [Enter]
AX=0001 BX=0000 CX=0083 DX=0108 SP=FFF4 BP=0000 SI=0000 DI=0000
DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=0180 NV UP EI PL NZ NA PO NC
20E1:0180 C20800 RET 0008
°Æµ{¦¡ªº³Ì«á¤@Ó«ü¥O¡ARET «ü¥O¡A¦ý¬O°£¤Fªð¦^¥Dµ{¦¡¥~¡AÁÙ±o±Ë±ó¥|ӰѼơA¨CӰѼƦ³¨âӦ줸²Õ¡A¦]¦¹n¥Î¡uRET 8¡v¡A¦Ó¤£¯à¥Î¡uRET¡v³o¼Ë³æ¯Â¡C
-t [Enter]
AX=0001 BX=0000 CX=0083 DX=0108 SP=FFFE BP=0000 SI=0000 DI=0000
DS=20E1 ES=20E1 SS=20E1 CS=20E1 IP=0133 NV UP EI PL NZ NA PO NC
20E1:0133 B409 MOV AH,09
°õ¦æ§¹¤W±ªº¡ut¡v«ü¥O«á¡A¬O¤£¬O SP ¼È¦s¾¹¤´«ü¦V©|¥¼°õ¦æ INVOKE «eªº°ïÅ|³»ºÝ¡A·N§Y¦ì§}¡uFFFE¡v¡C
80x86 ®a±Úªº¼ªk«ü¥O¦³¨âºØ¡AMUL »P IMUL¡A«eªÌ¬O¥Î¨ÓpºâµL¸¹¼Æ¡A«áªÌ«h¬O¥Î¨Ópºâ¦³¸¹¼Æªº¡C¦¹³B¶È¤¶²Ð MUL¡A¨ä»yªk¦p¤U¡G
MUL ¹Bºâ¤¸
MUL «á±±µµÛªº¹Bºâ¤¸¥i¥H¬O¤K¦ì¤¸¡B¤Q¤»¦ì¤¸¡B¤T¤Q¤G¦ì¤¸ªºÅܼƩμȦs¾¹¡A¤£¯à¬O¥ß§YÈ¡A¦Ó©Ò±oªº¼¿nªø«×¤À§O¬O¤Q¤»¦ì¤¸¡B¤T¤Q¤G¦ì¤¸¡B¤»¤Q¥|¦ì¤¸¡C·í«ü¥O MUL ©Ò±µ¹Bºâ¤¸¬°¤K¦ì¤¸®É¡A´Nªí¥Ü¦¹¹Bºâ¬O AL ¼¥H¦¹¤K¦ì¤¸ªº¹Bºâ¤¸¡A¦Ó©Ò±o¤§¼¿n¦s©ó AX ¼È¦s¾¹ùØ¡Aì¥ý AH¡BAL ¤§È·|®ø¥¢¡F·í MUL ©Ò±µªº¹Bºâ¤¸¬O¤Q¤»¦ì¤¸®É¡A´Nªí¥Ü¬O AX ¼¥H¦¹ 16 ¦ì¤¸ªº¹Bºâ¤¸¡A¦Ó©Ò±o¤§¼¿n¦s©ó DX:AX ¼È¦s¾¹ùØ¡Aì¥ý AX¡BDX ¤§È·|®ø¥¢¡F·í MUL ©Ò±µªº¹Bºâ¤¸¬O¤T¤Q¤G¦ì¤¸®É¡A´Nªí¥Ü¬O EAX ¼¥H¦¹¤T¤Q¤G¦ì¤¸ªº¹Bºâ¤¸¡A¦Ó©Ò±o¤§¼¿n¦s©ó EDX:EAX ¼È¦s¾¹ùØ¡Aì¥ý EAX¡BEDX ¤§È·|®ø¥¢¡C¾ã²z¦p¤Uªí¡G
¼ªk¤è¦¡ | ³Q¼¼Æ | ¼¼Æ | ¼¿n | ½d¨Ò¡]©³¤U¼ÆȬ°¤Q¤»¶i¦ì¡^ | |
¹Bºâ«e | ¹Bºâ«á | ||||
8 ¦ì¤¸ | AL | 8 ¦ì¤¸¼È¦s¾¹ ©ÎÅÜ¼Æ | AX | AX=0105 BX=0106 MUL BL | AX=001E BX=0106 |
16 ¦ì¤¸ | AX | 16 ¦ì¤¸¼È¦s¾¹ ©ÎÅÜ¼Æ | DX:AX | DX=FFFF AX=0200 BX=0106 MUL BX | DX=0002 AX=0C00 BX=0106 |
32 ¦ì¤¸ ¥u¯à¥Î©ó 386µ¥¯Å¥H¤W | EAX | 32 ¦ì¤¸¼È¦s¾¹ ©ÎÅÜ¼Æ | EDX:EAX | EDX=88887777 EAX=80000001 EBX=00000002 MUL EBX |
EDX=00000001 EAX=00000002 EBX=00000002 |
64 ¦ì¤¸ ¥u¯à¥Î©ó x64µ¥¯Å¥H¤W | RAX | 64 ¦ì¤¸¼È¦s¾¹ ©ÎÅÜ¼Æ | RDX:RAX | EDX=123456789ABCDEF0 RAX=8 RBX=8 MUL RBX | RDX=0 RAX=40 RBX=8 |
¤p¤ì°¸¨p¤U²q·Q¡A³o¼Ëªº¦w±ÆÁÙ¬O«Ü¦X²zªº¡C¥H§Ú̼ô±xªº¤Q¶i¦ì¼Æ¨Ó»¡¡A¨â¦ì¼Æ¼¨â¦ì¼Æ³Ì¤jȬO¥|¦ì¼Æ¡A¨Ò¦p 99¡Ñ99¡×9801¡C¦]¦¹¤K¦ì¤G¶i¦ì¼Æ¼¤K¦ì¤G¶i¦ì¼Æ©Ò±o¤§¼¿n¬°¤Q¤»¦ì¤G¶i¦ì¼Æ¡A²³æªº»¡¡A¤K¦ì¤G¶i¦ì¼Æ¡A¤£´N¤K¦ì¤¸ªº¼Æ¶Ü¡H¤Q¤»¦ì¤G¶i¦ì¼Æ¤£´N¬O¤Q¤»¦ì¤¸ªº¼Æ¶Ü¡H¦]¦¹ AL¡ÑBL ©Ò±oªº¼¿nn©ñ¦b¤Q¤»¦ì¤¸ªº¼È¦s¾¹ùØ¡C
¨Ò¦p¡A¦pªGnpºâ 9 ¼¥H 8¡A¥i¥H¥Î©³¤Uªº¤è¦¡¡G
mov al,9 mov bl,8 mul bl
³o¬O¦]¬° 9¡B8 ³£¤£¶W¹L 255 ( ÁÙ°O±o§a¡H¤K¦ì¤¸ªº¼È¦s¾¹©Î°O¾ÐÅé¼e«×¥i¥Hªí¥Ü 0 ¨ì 255 ½d³òªº¥¿¼Æ )¡A¦]¦¹³Q¼¼Æ¡B¼¼Æ³£¦s©ó¤K¦ì¤¸ªº¼È¦s¾¹ùØ¡A¦ý¬O¨Ì¾Ú 80x86 MUL »yªk¡A³Q¼¼Æ¥u¯à¥Î AL¡A©Ò¥H²Ä¤@¦æ¬°¡umov al,9¡v¡A¦Ü©ó¼¼Æ¡A8¡A¥i©ñ©ó¥ô¦ó¤@Ó¤K¦ì¤¸ªº¼È¦s¾¹¡A¦p AH¡BBL¡BBH¡K¡K³£¥i¥H¡A¤]¥i¥H©ñ¦b¥H DB ©Ò©w¸qªº¤K¦ì¤¸°O¾ÐÅéÅܼÆùØ¡A³Ì«á¦A¥H«ü¥O¡umul bl¡vpºâ¡A©Ò±o¼¿n·|¦b AX ¼È¦s¾¹ùØ¡AAX ·|Åܦ¨ 0048h¡ABL ¤´¬O 8¡C
²Ä¤E¡B¤Q¨â³¹´£¨ì¤F°Æµ{¦¡¡A¤]Á¿¤F¤@¤j°ï¡A¤p¤ì°¸¬ðµM·Q¨ì¡ADOS ªºªA°Èµ{¦¡ INT 20H ©Î INT 21H ¤]¹³¬O°Æµ{¦¡¤@¼Ë¡A¦ý¬O¥¦Ì¨Ã«D¨Ï¥Î°ïÅ|¶Ç»¼°Ñ¼Æ¡A¦Ó¬O§Q¥Î¼È¦s¾¹¡AµM«á©I¥s³o¨Ç°Æµ{¦¡À°§Ú̧¹¦¨¯S©wªº¤u§@¡A´N¹³¦b¥»³¹½d¨Òªº seconds °Æµ{¦¡¤@¼Ë¡C¦]¦¹±q³oÓ¨¤«×¨Ó¬Ý¡A§Ṳ́]¥i¥H§â DOS ªA°Èµ{¦¡¬Ý¦¨¬O¤@ºØ°Æµ{¦¡¡C
¥t¥~ÁÙ¦³¤@¨âÓ«ü¥O¡A¤]»P°Æµ{¦¡¦³Ãö¡A¥¦Ì¬O ENTER »P LEAVE¡C
ENTER «ü¥O¯à²¤Æ«Ø¥ß°ïÅ|®Øªº¤u§@¡A¥¦·|§¹¦¨¥H¤U¤T¥ó¨Æ±¡¡G①§â BP ±À¤J°ïÅ|¡F②§â SP ¤§È¦s¤J BP ùØ¡F③«O¯d°Ï°ìÅܼƪºªÅ¶¡¡C¾¨ºÞ¦p¦¹¡AENTER ¨Ã¤£·|§â°Ñ¼Æ§Yªð¦^¦ì§}±À¤J°ïÅ|¡A¤]¤£·|«O¦s¼È¦s¾¹ªº¸ê®Æ¡CENTER ªº»yªk¬O¡G
ENTER ¹Bºâ¤¸1,¹Bºâ¤¸2
¹Bºâ¤¸1¥Nªín¬°°Ï°ìÅܼƫO¯d¦h¤Ö¦ì¤¸²ÕªºªÅ¶¡¡A¨Ò¦p¤W±ªº some_of °Æµ{¦¡¨S¦³°Ï°ìÅܼơA¬G¥i¥Î¡uENTER 0,0¡v¡A³o¼Ë´N¬Û·í©ó¡G
push bp mov bp,sp
¦A¨Ò¦p«e±»¡ªº seconds ¦³¨âÓ°Ï°ìÅܼơA¦]¦¹¥i¥Î¡uENTER 4,0¡v¡Aµ¥®Ä©ó¤U±ªº«ü¥O¡G
push bp mov bp,sp sub sp,4
LEAVE «ü¥O¥Î¨Ó¾P·´³¡¤À°ïÅ|®Ø¡A¥¦»P ENTER ªº¹Lµ{«ê¦n¬Û¤Ï¡G①§â BP ¤§È¦s¤J SP ùØ¡F②¦Û°ïÅ|¼u¥X¤@¼ÆȨì BP¡CLEAVE ¨Ã¨S¦³°£¥h°Ï°ìÅܼƪº¥\¯à¡CLEAVE ªº»yªk¬O
LEAVE
¬Ý°_¨Ó¡A³oùؤ¶²Ðªº ENTER/LEAVE «ü¥O¥i¥H¥Î¤@±ø«ü¥O¥N´À¨â¤T±ø PUSH/POP/MOV «ü¥O¡A¦ü¥G«Ü¦³®Ä²v¡C¦ý¹ê»Ú±¡§Î¨Ã«D¦p¦¹¡ACPU ¦b°õ¦æ¹Bºâ¹Lµ{®Éªº®Ä²v¡A¤£¬O¶È¬Ý¦³´X¹D«ü¥O¦Ó¤w¡A¹ê»Ú¤W¥H»ÅºÍ 11 ¦Ó¨¥¡A ENTER ¥§¡°õ¦æ³t²v¤ñ PUSH/MOV/ADD Á`©MÁÙnºC¤W 7 Ӯɯߥª¥k¡ALEVEL ¤]ºC¤W 3 Ӯɯߥª¥k¡A¦]¦¹¤@¯ë²ÕĶ¾¹©Î½sĶ¾¹«Ü¤Ö¨Ï¥Î ENTER/LEVEL «ü¥O¡C
³o¤@³¹Á¿¤F³\¦h©I¥s°Æµ{¦¡º¾¸Hªº¹Lµ{¡A³o¨Ç³£¬O¬°¤F©I¥s¨ä¥L°ª¶¥»y¨¥©Ò¼¶¼gªº°Æµ{¦¡©Ò»Ýnªº¡C¦pªG¤£¯à§¹¥þÁA¸Ñ³o¨Ç¹Lµ{¡A¥u·Q²³æ¨Ï¥Î INVOKE »P PROC/ENDP ªº¸Ü¡A¥un¿í´`¤U±ì«h§Y¥i¡G
¦pªGÁÙ·Qª¾¹D§ó¦h¡A´Nn¤F¸Ñ°ïÅ|®Øªººc³y¡A©³¤U¬O´XÓ«ÂI¡G