¦b³\¦hµ{¦¡»y¨¥¤¤³£¦³°Æµ{¦¡ªºÆ[©À¡A¹³ BASIC¡BPascal¡BC/C++ µ¥µ¥¡C²Õ¦X»y¨¥¤]¤£¨Ò¥~¡A²Õ¦X»y¨¥¤¤ªº°Æµ{¦¡©I¥s¤è¦¡¬O¥Î CALL «ü¥O¡A¦Óªð¦^ì³B¬O¥Î RET «ü¥O( RETURNE ¤§ÁY¼g)¡C¦ý¦b³o¤@³¹¸Ì¡A§ÚÁÙ·Q¤¶²Ðµ{¦¡¬O¦p¦óªð¦^ì¦ì¸mÄ~Äò°õ¦æ¡A³o²o¯A¨ì¡y°ïÅ|¡zªºÆ[©À¡C
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 |
;***************************************
code segment
assume cs:code,ds:code
org 100h
;---------------------------------------
start: mov bl,2bh
;¥H¤U¤E¦æ¦L¥X BL ¤º¸û°ªªº 4 Ӧ줸¡A¨Ò¦p BL=2B «h¦b¿Ã¹õ¦L¥X¡y2¡z
mov cl,4 ;±N 4 ¦s©ó CL
mov dl,bl ;±N BL ¤§¤º®e¦s©ó DL ¤¤¥H¤è«K¦L¥X
shr dl,cl ;§â BL ¸û°ª¤§ 4 ¦ì¤¸Åܦ¨ DL ¤¤¸û§C¤§ 4 ¦ì¤¸
add dl,30h ;¥[¤W 30H
cmp dl,'9' ;¤ñ¸û¬Ý¬Ý¬O§_¶W¹L 39H
jbe ok_1 ;¨S¶W¹Lª½±µ¦L¥X
add dl,7 ;Y¶W¹L¦A¥[¤W 7
ok_1: mov ah,2
int 21h ;¦L¥X
;¥H¤U 8 ¦æ¦L¥X BL ¸û§Cªº 4 Ӧ줸¡A¨Ò¦p BL=2B «h¦b¿Ã¹õ¦L¥X¡yB¡z
mov dl,bl ;±N BL ¤§È¦s¤J DL
and dl,0fh ;¨ú±o DL ¤§¸û§Cªº 4 Ӧ줸
add dl,30h ;¥[¤W 30H
cmp dl,'9' ;¤ñ¸û¬Ý¬Ý¬O§_¶W¹L 9
jbe ok_2 ;¨S¶W¹Lª½±µ¦L¥X
add dl,7 ;Y¶W¹L¦A¥[¤W 7
ok_2: mov ah,2
int 21h ;¦L¥X
mov ax,4c00h;µ²§ôµ{¦¡
int 21h
;---------------------------------------
code ends
;***************************************
end start |
¥Õ¦â³¡¤À´N¬O«½Æªº³¡¤À¡A²{¦b§â¥L¿W¥ß¦¨¤@¬q°Æµ{¦¡¨Ã¨ú¦W¬° print¡A¦Ó¾ãÓµ{¦¡§ï¼g¦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 |
;***************************************
code segment
assume cs:code,ds:code
org 100h
;---------------------------------------
start: mov bl,2bh
;¥H¤U¥|¦æ¦L¥X BL ¤º¸û°ªªº 4 Ӧ줸¡A¨Ò¦p BL=2B «h¦b¿Ã¹õ¦L¥X¡y2¡z
mov cl,4 ;±N 4 ¦s©ó CL
mov dl,bl ;±N BL ¤§¤º®e¦s©ó DL ¤¤¥H¤è«K¦L¥X
shr dl,cl ;§â BL ¸û°ª¤§ 4 ¦ì¤¸Åܦ¨ DL ¤¤¸û§C¤§ 4 ¦ì¤¸
call print ;©I¥s print °Æµ{¦¡
;¥H¤U¤T¦æ¦L¥X BL ¸û§Cªº 4 Ӧ줸¡A¨Ò¦p BL=2B «h¦b¿Ã¹õ¦L¥X¡yB¡z
mov dl,bl ;±N BL ¤§È¦s¤J DL
and dl,0fh ;¨ú±o DL ¤§¸û§Cªº 4 Ӧ줸
call print ;©I¥s print °Æµ{¦¡
mov ax,4c00h;µ²§ôµ{¦¡
int 21h
;---------------------------------------
;print °Æµ{¦¡
;¿é¤J¡GDL-¥Ñ 0 ¨ì F ªº¤Q¤»¶i¦ì¼Æ
;¿é¥X¡G¦b¿Ã¹õ¤W¦L¥X DL ¤ºªº ASCII ½X
print proc near
add dl,30h ;¥[¤W 30H
cmp dl,'9' ;¤ñ¸û¬Ý¬Ý¬O§_¶W¹L 39H
jbe ok ;¨S¶W¹Lª½±µ¦L¥X
add dl,7 ;Y¶W¹L¦A¥[¤W 7
ok: mov ah,2
int 21h ;¦L¥X
ret
print endp
;----------------------------------------
code ends
;****************************************
end start
|
¥J²ÓÆ[¹î¬Ý¬Ý¡Aìµ{¦¡«½Æªº³¡¤À¤w¸gÅܦ¨ print °Æµ{¦¡¤F ( ²Ä 20¡ã31 ¦æ )¡An©I¥s°Æµ{¦¡®É¡A¥Î call «ü¥O¡Acall «á±´N±µµÛ°Æµ{¦¡¦WºÙ¡A´N¬O print¡A·N«ä´N¬Oµ{¦¡°õ¦æ¨ì¦¹·|¸õ¨ì°Æµ{¦¡¡Aprint¡A©Ò¦b¤§³BÄ~Äò°õ¦æ¡A¦Ó¤£¬O°õ¦æ¤U¤@¦æ¡C
¨Ó¬Ý¬Ý print °Æµ{¦¡ªº¼Ë¤l¡C¦b print °Æµ{¦¡¤¤³Ì«e±©M³Ì«á±¤À§O¦h¤F proc ©M endp ¨â¦æ¡C¦b²Õ¦X»y¨¥¤¤¡A«Å§i°Æµ{¦¡´N¬O¥Î proc ³oÓ°²«ü¥O¡A¥¦§i¶D²ÕĶ¾¹³o¨à¶}©l¦³Ó°Æµ{¦¡¡A¦Ó°Æµ{¦¡ªº¦WºÙ´N¦b«e±¡A¦Ó°Æµ{¦¡ªº¤º®e¤@ª½¨ì endp ¬°¤î¡Aendp ´N¬O§i¶D²ÕĶ¾¹³oӰƵ{¦¡µ²§ô¤F¡A¦]¦¹°Æµ{¦¡´N§¨¦b proc ©M endp ³o¨âÓ°²«ü¥O¤§¶¡¡C
proc «á±¦³Ó near¡A¥¦§i¶D²ÕĶ¾¹³oӰƵ{¦¡¬Oªñµ{©I¥s¡Aªñµ{©I¥s¬O»¡©I¥s°Æµ{¦¡ªºµ{¦¡ ( ¤]´N¬O¥Dµ{¦¡ ) ©M³Q©I¥sªÌ ( ´N¬O°Æµ{¦¡ ) ¬O¦b¦P¤@°Ï¬q¤º¡A¤]´N¬O»¡¨âªÌ³£¦b 64KB ¤º¡CÁÙ¦³¤@ºØ¥s»·µ{©I¥s¡A´N¬O³Q©I¥sªº°Æµ{¦¡¦b¥t¥~¤@ӰϬq¡A³o®É¥Î proc far ªí¥Ü¡C
¦n¤F¡A²{¦b°Æµ{¦¡¤º³¡¤w¤jP§¹¦¨¤F¡A³Ñ¤U¤@Ó·sªº 8088/8086 «ü¥O RET¡C¥Ñ¦r±¤W²q´ú§A¥i¯à¤w¸gª¾¹D¥¦¬O return ªºÂ²¼g¡A³oÓ«ü¥O¬O¥Î¨Óªð¦^ì©I¥s°Æµ{¦¡ªºµ{¦¡¤§¤U¤@¦æ¡A¨Ïµ{¦¡¯àÄ~Äò°õ¦æ¡C¥H¤Wzµ{¦¡¬°¨Ò¡A·í CPU °õ¦æ§¹ SHR DL,CL «á¡A´N°õ¦æ CALL PRINT¡A¦¹®É CPU ·|¸õ¨ì PRINT °Æµ{¦¡¤¤¶}©l°õ¦æ ADD DL,30H¡A¤@ª½¨ì¹J¨ì RET «ü¥O´N·|ªð¦^è¤~©I¥s³Bªº¤U¤@¦æÄ~Äò°õ¦æ¡A¦p¤U¹Ï¬õ¦â½bÀY©Ò¥Ü¡G
©Î³\§A·|°Ý¡Aendp ©M RET ³£¬Oµ²§ô°Æµ{¦¡¡A¬°¦ón¦³¨âÓ©O¡Hì¨Ó endp ¬O°²«ü¥O¡A¥¦¶È¶È«ü¥Ü²ÕĶ¾¹°Æµ{¦¡¨ì¦¹¬°¤î¤F¡F¦Ó RET ¬O 8086/8088 ªº«ü¥O¶°¡ACPU ¬Ý¨ì RET «ü¥O´N·|¸õ¨ìì¨Ó©I¥s¦a¤èªº¤U¤@¦æ¡C°£¤F¡y¯u¡z¡y°²¡z«ü¥Oªº®t§O¥~¡A¦³®É¤@ӰƵ{¦¡¥i¥H¦³¦n´XÓ¥X¤f¦^¨ì¥Dµ{¦¡¤¤¡A³o®É´N¦b¦U¥X¤f¥Î RET ¨Óªð¦^¥Dµ{¦¡¡C
°Æµ{¦¡¥i¥H²¤Æµ{¦¡³]p¡A¨C·í»Ýn¥Î¨ì°Æµ{¦¡®É¡A³£¥i¥H©I¥s¥¦¡A³oùز£¥Í¤F¤@Ó°ÝÃD¡A°Æµ{¦¡µ²§ô¤§«á¡ACPU ¦p¦óª¾¹Dnªð¦^¨º¤@Ó¦a¤èÄ~Äò°õ¦æ¡H³oÓ°ÝÃD¡A¹q¸£³]pªÌ¦¤w·Q¦n¤F¡Cì¨Óµ{¦¡¦b©I¥s°Æµ{¦¡®É¡A·|¥ý±N CALL ªº¤U¤@¦æ«ü¥O¦ì§}¦s¤J¤@Ó¯S§Oªº¦a¤è¡Aµ¥¨ì°Æµ{¦¡µ²§ô®É ( ¤]´N¬O°õ¦æ RET «ü¥O®É )¡ARET ·|¨ì³oÓ¦a¤è±N¸Ó¦ì§}¨ú¥X¡AµM«á¦A¸õ¨ì¸Ó¦ì§}Ä~Äò°õ¦æ¡A¦Ó³oÓÀx¦s¦ì§}ªº¦a¤è¥s¡y°ïÅ|¡z( stack )¡C
§A¥i¥H§â°ïÅ|·Q¹³¦¨À\ÆU¸Ì¡AªA°È¥Í°ï°_¨ÓªºÀ\½L¡C¨C¦¸ªA°È¥Í±NÀ\½L¬~°®²b´N±N½L¤l°ï¦b¤W±¡A¦pªG¬~¦n¤@ÓÀ\½L¡A¤S·|°ï¨ììÀ\½Lªº¤W±¡Aµ¥¨ìn¥Î®É´N¥Ñ³Ì¤W±ªºÀ\½L¶}©l®³¥X¨Ó¨Ï¥Î¡Cª`·N¡IÅ|°_¨ÓªºÀ\½L¦³¥ý¶i«á¥Xªº¯S©Ê¡A¥ç§Y¶V¥ý°ï°_¨ÓªºÀ\½L¡A¶V«á¥Î¨ì¡C¹q¸£¤¤ªº°ïÅ|¤]¨ã³oºØ¥ý¶i«á¥Xªº¯S©Ê¡A¨t²Îµ{¦¡·|µe¤À¤@¶ô°O¾ÐÅé§@¬°°ïÅ|¨Ï¥Î¡A¨Ã¥Î SS:SP ³o²Õ¼È¦s¾¹«ü¦V°ïÅ|¡C
¤@¶}©l®É°ïÅ|¦pªG¬OªÅªº¸Ü¡ASS:SP ´N«ü¦V³Ì°ª¦ì§}¡C¦b COM Àɤ¤¡A©Ò¦³°Ï¬q³£¦b 64K ¤º¡A©Ò¥H°ïÅ|ªº³Ì°ª¦ì§}¬° 0FFFFh¡A¦ý³Ì°ªªº¤@Ó¦r²Õ ( WORD¡A´N¬O¨âӦ줸²Õªºªø«×¡A©Ò¥H¦¹³B¡y³Ì°ªªº¤@Ó¦r²Õ¡z¬O¦û¥Î°O¾ÐÅé¦ì§} 0FFFFh ©M 0FFFEh ¨âӦ줸²Õ ) «O¯dµ¹¨t²Î¨Ï¥Î¡A©Ò¥H·í¤@¸ü¤J COM ÀɮɡASP ¤§È¬° 0FFFEh¡C±z¥i¥H¥Î DEBUG ¸ü¤J¥ô¦ó¤@Ó COM ¥i°õ¦æÀÉ¡AÆ[¹î SP ¤§È¡C
§Ú̫ܤ֨ϥΡymov ax,[sp]¡z³oºØ«ü¥O¨Ó¦s¨ú°ïÅ|¡A¤@¯ë§Ų́ϥΠPUSH ©M POP «ü¥O¨Ó¦s¨ú°ïÅ|¡C¥L̪º«ü¥O»yªk¬O¡G
PUSH ¼È¦s¾¹/°O¾ÐÅé POP ¼È¦s¾¹/°O¾ÐÅé
PUSH ¬O¥Î¨Ó§â«á±±µµÛªº¼È¦s¾¹©Î°O¾ÐÅ餺ªº¼ÆȦs¤J°ïÅ|¡A§ÚÌ¥i»¡¦¨¡y§â¼È¦s¾¹©Î°O¾ÐÅé±À¤J°ïÅ|¡z¡CPOP «h¬O¥Ñ°ïÅ|§â¼ÆȨú¦^¨Ã¦s¦b±µ¦b«á±ªº¼È¦s¾¹©Î°O¾ÐÅé¡C¨Ò¦p°õ¦æ¤U±¨âÓ«ü¥O
PUSH AX POP day
²Ä¤@Ó«ü¥O·|§â AX ¤§È¦s¤J°ïÅ|¡A²Ä¤GÓ«ü¥O·|¥Ñ°ïÅ|¤¤¨ú¥X¤@Ó¼ÆȦs¤J day ÅܼơA¥ç§Y day Åܦ¨ AX ¤§¼ÆÈ¡C
PUSH «ü¥Oªº°õ¦æ¹Lµ{¬O·í¦³¸ê®Æ¦s¤J°ïÅ|®É¡A³oµ§¸ê®Æ´N¦s¦b SP ©Ò«ü¦ì§}§ó§Cªº¤@Ó¦r²Õ©Ò¦b¦ì§}¡A¤]´N¬O 0FFFCh¡A¨Ã¥B¨Ï SP ¤§È´î 2¡AÅܦ¨ 0FFFCh¡A¦A«×¨Ï SP «ü¦V³Q¨Ï¥Îªº¦ì§}¡C¦pªG¤S¦³¸ê®Æ¦s¤J°ïÅ|®É¡A³oµ§¸ê®Æ«K¦s¦b 0FFFAh¡ASP Åܦ¨ 0FFFAh¡C( °ïÅ|¨C¦¸³£¥²¶·¦s¤J¤@Ó¦r²Õªºªø«×¡A¦r²Õªº^¤å¬° word¡A¤@Ó¦r²Õ¬Û·í©ó¨âӦ줸²Õ ( bytes )¡A§Y¤Q¤»Ó¦ì¤¸ ( bits ) )¡C©ÎªÌ§ó²³æªºÁ¿ªk¬O°õ¦æ PUSH «ü¥O®É¡ACPU ·|¨Ï SP ¼È¦s¾¹´î¥h 2¡AµM«á¦A§â«á±ªº¹Bºâ¤¸¦s¤J SP ©Ò«üªº°ïÅ|¦ì§}¡C
¤Ï¤§¡A°õ¦æ POP «ü¥O®É¡A¥ý§â SP ©Ò«üªº°ïÅ|¤º®e¨ú¥X¡A¦s¦b¹Bºâ¤¸¤¤¡A±µµÛ¨Ï SP ¥[ 2¡AÄÀ©ñ¥X¤@Ó¦r²Õ¥X¨Ó¡C¬°¤°»ò¬O¥[ 2 ©Î´î 2 ©O¡H³o¬O¦]¬°¨C¦¸±À¤J©Î¼u¥X°ïÅ|ªº¸ê®Æ³£¬O¤@Ó¦r²Õªº¸ê®Æ¡C( ¦³Ãö SS¡BSP ¼È¦s¾¹½Ð°Ñ¦Òªþ¿ý¤G )
CALL «ü¥O¬O¥Î¨Ó©I¥s°Æµ{¦¡ªº«ü¥O¡A»yªk¬O
CALL °Æµ{¦¡¦W
·í°õ¦æ CALL «ü¥O®É¡ACPU ·|§â CALL ¤U¤@¦æ©Ò¦b¦ì§}±À¤J°ïÅ|¡A³oÓ¦ì§}ºÙ¬°ªð¦^¦ì§}¡AµM«á§â CALL «á±°Æµ{¦¡©Ò¦b¦ì§}«þ¨©¨ì IP ¼È¦s¾¹ùØ¡A³o¼Ë CPU ´N·|¸õ¨ì°Æµ{¦¡¤¤°õ¦æ¤F¡C
RET «ü¥O¬O¦b°Æµ{¦¡¤¤ªð¦^¥Dµ{¦¡ªº«ü¥O¡A¨ä»yªk¬O¡G
RET n RETN n RETF n
n ¬O¦ì¤¸²Õ¼Æ¡A¦¹¦ì¤¸²Õ¼Æªí¥Ü¦Û°Æµ{¦¡ªð¦^®ÉÁÙn¦A¨Ï SP ¥[¤W´XӦ줸²Õ¡A±`¥Î©ó°ª¶¥»y¨¥©I¥s°Æµ{¦¡¡A¨£²Ä 31 ³¹¡C·í CPU °õ¦æ RET «ü¥O®É¡A·|¦Û SP ©Ò«ü°ïÅ|¦ì§}¨ú¥X¤@Ó¼ÆȨӡA¨Ã«þ¨©¨ì IP ¼È¦s¾¹¡A¦p¦¹¤@¨Óµ{¦¡«K·|¨ì¸õÅD¨ì¸Ó¼ÆÈ©Ò¥Nªíªº¦ì§}Ä~Äò°õ¦æ¡A±µµÛ CPU ÁÙ·|¨Ï SP ¥[¤W 2¡C°²¦p RET ¤§«á¨S¦³¹Bºâ¤¸¡An¡Aªº¸Ü¡ARET «ü¥O´Nºâµ²§ô¤F¡F¦pªGÁÙ¦³¹Bºâ¤¸ªº¸Ü¡ASP ÁÙn¦A¥[¤W n¡A¥ç§Y±Ë±ó°ïÅ|ùتºY¤z¸ê®Æ¡CRETN¡BRETF ¨£ PROC/ENDP °²«ü¥Oªº»¡©ú¡C
©³¤U¥Î DEBUG ¨ÓÆ[¹î§ï¼g«áªº¡y¦L¥X BL ¼È¦s¾¹¡zµ{¦¡°õ¦æ±¡§Î¡C¥ý±Nì©lµ{¦¡¦s¦¨ PNT_BL.ASM¡AµM«á¥Î CPL.BAT §å¦¸ÀɨӲÕĶ¡B³sµ²¡G(¶À¦â³¡¥÷¬O§A¥²¶·¿é¤Jªº¦r)
H:\HomePage\SOURCE>cpl pnt_bl [Enter]
H:\HomePage\SOURCE>..\masm50\masm pnt_bl;
Microsoft (R) Macro Assembler Version 5.00
Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved.
51578 + 418566 Bytes symbol space free
0 Warning Errors
0 Severe Errors
H:\HomePage\SOURCE>..\masm50\link pnt_bl;
Microsoft (R) Personal Computer Linker Version 2.40
Copyright (C) Microsoft Corp 1983, 1984, 1985. All rights reserved.
Warning: no stack segment
H:\HomePage\SOURCE>..\masm50\exe2bin pnt_bl pnt_bl.com
H:\HomePage\SOURCE>
¨ì¦¹¡A¤w¸g²ÕĶ¡B³sµ²¨ÃÂà´«¦¨ COM Àɦ¨¥\¤F¡A²{¦b¥Î DEBUG ¸ü¤J¬Ý¬Ý¡G( ¶À¦â³¡¥÷¬O§A¥²¶·¿é¤Jªº¦r )
H:\HomePage\SOURCE>..\masm50\debug pnt_bl.com [Enter] -u [Enter] 12A7:0100 B32B MOV BL,2B 12A7:0102 B104 MOV CL,04 12A7:0104 8AD3 MOV DL,BL 12A7:0106 D2EA SHR DL,CL 12A7:0108 E80D00 CALL 0118 ===>©I¥s°Æµ{¦¡³B 12A7:010B 8AD3 MOV DL,BL 12A7:010D 80E20F AND DL,0F 12A7:0110 E80500 CALL 0118 ===>©I¥s°Æµ{¦¡³B 12A7:0113 B8004C MOV AX,4C00 12A7:0116 CD21 INT 21 12A7:0118 80C230 ADD DL,30 12A7:011B 80FA39 CMP DL,39 12A7:011E 7603 JBE 0123 -g 106 [Enter] AX=0000 BX=002B CX=0004 DX=002B SP=FFFE BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=0106 NV UP EI PL NZ NA PO NC 12A7:0106 D2EA SHR DL,CL§ÚÌ°õ¦æ¦¹µ{¦¡¡A¤@ª½¨ì²Ä¤@¦¸©I¥s°Æµ{¦¡«eªº«ü¥O°±¤U¨Ó¡A¤]´N¬O¨ì SHR DL,CL °±¤U¨Ó¦nÅý§ÚÌÆ[¹îµ²ªG¡C¦A°õ¦æ¤@¦¸ t «ü¥O¡G
-t [Enter]
AX=0000 BX=002B CX=0004 DX=0002 SP=FFFE BP=0000 SI=0000 DI=0000
DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=0108 NV UP EI PL NZ AC PO CY
12A7:0108 E80D00 CALL 0118
²{¦b¥ýÆ[¹î°ïÅ|ªº¤º®e¡A¦A°õ¦æ CALL 0118 «ü¥O¡C¦]¬° SP ¬° FFFE¡A¬G¿é¤J¡yd SS:FFF0 L10¡zÆ[¹î³o 16 Ӧ줸²Õªº¸ê®Æ¡G
-d SS:FFF0 L10 [Enter] 12A7:FFF0 0F 06 15 1C 00 00 00 00-08 01 A7 12 0A 0C 00 00 ................ -t [Enter] ===>°õ¦æ CALL «ü¥O AX=0000 BX=002B CX=0004 DX=0002 SP=FFFC BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=0118 NV UP EI PL NZ AC PO CY 12A7:0118 80C230 ADD DL,30Æ[¹î°ïÅ|¤º®e¡A¨Ã¤ñ¸û¥Õ¦â³¡¤À¡C
-d SS:FFF0 L10 [Enter] 12A7:FFF0 0F 06 00 00 00 00 18 01-A7 12 0A 0C 0B 01 00 00§AÀ³¸Ó·|µo²{¡A¦b°õ¦æ CALL 0118 ¤§«e¡ASP=FFFE¡A¦Ó¦¹®É°ïÅ|¤¤¥u¦³¤@µ§¸ê®Æ¡A´N¬O 0000¡A³o¬O¨t²Î¨Ï¥Îªº¡C°õ¦æ CALL 0118 ¤§«á¡ASP=FFFC¡A°ïÅ|¤¤¦h¤F¤@µ§¸ê®Æ¡A010B¡A¦A¦^¨ì«e±¬Ý¬Ý CALL 0118 ¤§«áªº«ü¥O¬O MOV DL,BL¡A¨ä¦ì§}«ê¦n¤]¬O 010B¡C´«¥y¸Ü»¡ CALL «ü¥O·|±Nnªð¦^ªº¦ì§}(¾ï¦â)¡A¦s¤J°ïÅ|¤¤¡A¦A¸õ¨ì°Æµ{¦¡¦ì§}(¬õ¦â)Ä~Äò°õ¦æ¡C¦n¡A§Ú̬ݬݰƵ{¦¡ªº¤º®e¡A¦A³sÄò°lÂÜ¡G
-u 118 [Enter] 12A7:0118 80C230 ADD DL,30 12A7:011B 80FA39 CMP DL,39 12A7:011E 7603 JBE 0123 12A7:0120 80C207 ADD DL,07 12A7:0123 B402 MOV AH,02 12A7:0125 CD21 INT 21 12A7:0127 C3 RET 12A7:0128 0000 ADD [BX+SI],AL 12A7:012A 0000 ADD [BX+SI],AL -t [Enter] AX=0000 BX=002B CX=0004 DX=0032 SP=FFFC BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=011B NV UP EI PL NZ NA PO NC 12A7:011B 80FA39 CMP DL,39 -t [Enter] AX=0000 BX=002B CX=0004 DX=0032 SP=FFFC BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=011E NV UP EI NG NZ AC PE CY 12A7:011E 7603 JBE 0123 -t [Enter] AX=0000 BX=002B CX=0004 DX=0032 SP=FFFC BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=0123 NV UP EI NG NZ AC PE CY 12A7:0123 B402 MOV AH,02 -t [Enter] AX=0200 BX=002B CX=0004 DX=0032 SP=FFFC BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=0125 NV UP EI NG NZ AC PE CY 12A7:0125 CD21 INT 21³oÓ«ü¥O¬O DOS ªA°Èµ{¦¡¡AÀ³¸Ó¤£¦Ü©ó¦³¿ù»~¡A©Ò¥H¤@¯ë¦Ó¨¥¡A¤£¤©¥H°lÂÜ¡Aª½±µ¸õ¹L¡A¬G¥Î g ¡G
-g 127 [Enter] 2 ===>³o¬O DOS ªA°Èµ{¦¡©Ò¦L¥X¨Óªº¡AÁÙ°O±o AH=2/INT 21H §a¡H AX=0232 BX=002B CX=0004 DX=0032 SP=FFFC BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=0127 NV UP EI NG NZ AC PE CY 12A7:0127 C3 RET§ÚÌ¥ýÆ[¹î°ïÅ|°Ï°ì¡A¦A°õ¦æ RET «ü¥O¡C
-d SS:FFF0 L10 [Enter] 12A7:FFF0 0F 06 00 00 00 00 18 01-A7 12 0A 0C 0B 01 00 00 -t [Enter] AX=0232 BX=002B CX=0004 DX=0032 SP=FFFE BP=0000 SI=0000 DI=0000 DS=12A7 ES=12A7 SS=12A7 CS=12A7 IP=010B NV UP EI NG NZ AC PE CY 12A7:010B 8AD3 MOV DL,BL -d SS:FFF0 L10 [Enter] 12A7:FFF0 0F 06 00 00 00 00 00 00-18 01 A7 12 0A 0C 00 00°õ¦æ RET «ü¥O¤§«e¡A¦p§Ú̹w®Æªº¡ASP ©Ò«ü¤§³B¥¿¬O·íªì¦s¤Jªº±ýªð¦^¦ì§} ( ¥Õ¦â )¡C°õ¦æ¤§«á¡Aµ{¦¡¸õ¨ì¸Ó¦ì§}³B¡A¦Ó¤£¬OÄ~Äò°õ¦æ RET ¤§«áªº ADD [BX+SI],AL¡A¦P®É SP ¤§È¤]«ì´_¨ìì¥ý¥¼©I¥s°Æµ{¦¡ªºÈ ( 0FFFEh )¡C
¦n¤F¡A§Ú¤w¸g¤¶²Ð§¹°Æµ{¦¡»P°ïÅ|¤F¡A¤£ª¾§Aı±o¦p¦ó¡H·Ó¨Ò°µÓµ²½×¡A³o¤@³¹ùØ¡A¤p¤ì°¸¤¶²Ð¤F
PROC ¨Ã«D 80x86 «ü¥O¦Ó¬O°²«ü¥O¡A¥¦¬O¥Î¨Ó©w¸q°Æµ{¦¡¡A¥¦«ü¥X°Æµ{¦¡¥Ñ¦¹¶}©l¡A¥²¶·©M EDNP ·f°t¨Ï¥Î¡A§_«h²ÕĶ¾¹·|¥X¿ù¡C»yªk¬O¡G
¼Ð¸¹¦W proc [near/far] ;°Æµ{¦¡½X ret ¼Ð¸¹¦W endp
¼Ð¸¹¦W´N¬O³oӰƵ{¦¡ªº¦WºÙ¡A¨Ò¦p·í CPU °õ¦æ¨ì
CALL my_subroutine
«ü¥O®É¡A´N·|¸õ¨ì¦W¬° my_subroutne ªº°Æµ{¦¡°õ¦æ¡C
Y PROC «á±µ near ªí¥Ü°Æµ{¦¡»P¥Dµ{¦¡¦b¦P¤@°Ï¬q¤º¡AºÙ¬°ªñµ{©I¥s¡FY±µ far¡Aªí¥Ü°Æµ{¦¡»P¥Dµ{¦¡¦b¤£¦P°Ï¬q¤º¡AºÙ¬°»·µ{©I¥s¡CY¬Ù²¤ near ©M far¡A²ÕĶ¾¹¯à¦Û°Ê§PÂ_°Æµ{¦¡»P¥Dµ{¦¡¬O§_¦b¦P¤@°Ï¬q¤º¡Cªñµ{©I¥s©Î»·µ{©I¥s·|¼vÅTªð¦^¦ì§}ªº¤j¤p¡C«Ü©úÅ㪺¡Aªñµ{©I¥s¡A¥un§â¤U¤@«ü¥Oªº°¾²¾¦ì§}±À¤J°ïÅ|§Y¥i¦Ó°¾²¾¦ì§}¥u¦³¤@Ó¦r²Õªº¤j¤p¡F¦pªG¬O»·µ{©I¥s¡A´Nn§â°Ï¬q¦ì§}¤Î°¾²¾¦ì§}¡A¦@¨âÓ¦r²Õ±À¤J°ïÅ|¡C³o¤]¼vÅT¨ìªð¦^®Én¦Û°ïÅ|¨ú¥X¤@өΨâÓ¦r²Õ¡A¦]¦¹¤À§O¥Î RETN¡BRETF ¨Óªí¥Ü¡C¦ý¬O¦pªG¥Î RET¡A¤]¨SÃö«Y¡A²ÕĶ¾¹¤]¯à¦Û°Ê§PÂ_¡C