DOS ªº¥i°õ¦æÀÉ¥]§t COM¡BEXE ©M BAT ¤TºØÀɮסCBAT ¬O§å¦¸ÀÉ¡A¤£¦b§ÚÌ°Q½×½d³ò¡FCOM Àɤñ¸û²³æ¡A«e´XÓµ{¦¡½d¨Ò³£¬O COM ÀÉ¡FEXE ÀÉ¥]§tªíÀY¡A¦]¦¹¤ñ¸û¤j¸ü¤J®É¤]¤ñ¸ûºC(¥i¯à¥uºC¼ÆÓ²@¬í§a¡H)¡A¸û¬°½ÆÂø¡CÁöµM EXE Àɸû½ÆÂø¡A¦ý¬O¸g²ÕĶ¡B³sµ²«áªºÀɮ׳£·|¥ýÅܦ¨ EXE ÀÉ¡AÁÙn°õ¦æÂà´«µ{¦¡( EXE2BIN.EXE )¤~¯àÂà´«¦¨ COM ÀÉ¡C¤£¹L¨Ã¤£¬O©Ò¦³ªº EXE Àɳ£¥i¥HÂà´«¦¨ COM ÀÉ¡C¦]¦¹²{¦b¥ý¨Ó¬Ý¬Ý COM ¥i°õ¦æÀɧa¡C
¨Ì·Ó¤£¦¨¤åªººD¨Ò¡A²Ä¤@Ó²³æªºµ{¦¡¡A¦ü¥G³£¬O¦b¿Ã¹õ¤W¨q¥X¤@¬q¤å¦r¡A¦]¦¹§Úªº²Ä¤@Óµ{¦¡¤]¬O¦p¦¹¡C©³¤U´N¬Oì©lÀɦCªí¡A³oµ{¦¡¤]¬OÅܦ¨ COM ÀÉ«á¦A°õ¦æªº¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16 |
;***************************************
code SEGMENT ;.code ¬q¶}©l¦ì§}
ASSUME cs:code,ds:code ;.°²³]µ{¦¡¬q¤Î¸ê®Æ¬q
ORG 100h ;.¥i§ï¦¨ *.COM ÀÉ
;---------------------------------------
start: jmp begin ;µ{¦¡¶i¤JÂI
mes DB 'Hi, I learn assembly.$';n¦L¥Xªº°T®§
begin: mov dx,OFFSET mes ;«ü¦V mes ªº¦ì§}
mov ah,9 ;©I¥sDOSªA°Èµ{¦¡¡AAH=9/INT 21H ªí¥Ü¦L¥X¦r¦ê
int 21h ;©I¥s DOS ªA°Èµ{¦¡
mov ax,4c00h ;«ü©wn©I¥sªºªA°È¸¹½X
int 21h ;©I¥s DOS ªA°Èµ{¦¡
;---------------------------------------
code ENDS ;code ¬qµ²§ô
;***************************************
END start ;¨Ï²ÕĶ¾¹ª¾¹Dµ{¦¡¶i¤JÂI |
±N¤Wzì©l½X¥Î¥ô¦ó¤@Ó¤å¦r½s¿è¾¹¡]¦pµ§°O¥»©Î UltraEdit 32 ©Î¨ä¥L¤å¦r½s¿è¾¹¡^¼g¦n¤§«á¡A¦s¦¨¯Â¤å¦rÀÉ¡A°²³]ÀɦW¬O EXAM01.ASM ( ·íµM§A¤]¥i¥H¨Ì°ª¿³¥ô·N¨úÀɦW¡A¦ý³sµ²®Én¥Î¦Û¤vªºÀɦW )¡C¦pªG§A¨Ï¥Î Win 9x/Me¡A½Ð¶}±Ò¡yMS-DOS ¼Ò¦¡¡z¡F¦pªG±z¨Ï¥Î XP/Vista/7¡A½Ð¶}±Ò¡y©R¥O´£¥Ü¦r¤¸¡z¡A²ÕĶªº¤èªk·|ÀH¤£¦Pª©¥»ªº²ÕĶ¾¹¤£¦P¡A¦]¦¹¿ï¾Ü¾A·íªº¤èªk²ÕĶ¡CÁöµM¬O³o¼Ë¡AÁÙ¬O«ØijŪªÌ¨Ì§Ç¬Ý¬Ý MASM 5.0 ¦p¦ó²ÕĶ¡A¦]¬°³o¬O³Ìì©lªº¤è¦¡¡C¥t¥~¡A°²¦p±z¤w¸g¦w¸Ë¦nµêÀÀ¾÷¾¹¡AMicrosoft Virtual PC 2007 SP1¡A¤]¤w¦bµêÀÀ¾÷¾¹¦w¸Ë¦n¤F DOS¡A¨º»ò¥i¥H°Ñ¾\ªþ¿ý¤Q¤@¡A¦bµêÀÀ¾÷¾¹¤¤²ÕĶ¡C
E:\HomePage\SOURCE>..\masm50\masm exam01; [Enter]
Microsoft (R) Macro Assembler Version 5.00
Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved.
51526 + 397850 Bytes symbol space free
0 Warning Errors
0 Severe Errors
¦¹³B¤p¤ì°¸ªº²Õ¦X»y¨¥²ÕĶµ{¦¡¤Îì©lÀɤ£¦b¦P¤@¥Ø¿ý¡A©Ò¥H¥²¶·«ü©w²ÕĶµ{¦¡©Ò¦b¥Ø¿ý¡A¦]¦¹«e±¦h¤F¡y..\masm50\¡z¡A´N¬O§i¶D DOS ²ÕĶµ{¦¡¦b¦ó³B¡A¦pªG§A§âì©lÀÉ¡B²ÕĶ¾¹¡B³sµ²¾¹¥þ³¡³£©ñ¦b¤@°_´N¤£¥Î¥´³o¨Ç¦r¤F¡C¦pªG¹q¸£Åã¥Ü 0 Warning Error »P 0 Severe Error ´N¬O§i¶D§A¤w²ÕĶ§¹¦¨¡A±µ¤U¨Ó§A±o³sµ²µ{¦¡®w¡]*.LIB¡^¡A¿é¤J¡y..\masm50\link exam01; ¡]¬°¦ón¥Î³sµ²¾¹³sµ²µ{¦¡®w¡A½Ð°Ñ¦Ò²Ä¤Q³¹¡^( LINK.EXE «áªº;¤]©MMASM.EXEªº·N¸q¬Û¦ü¡A¥i¦Û¤v¸Õ¸Õ )
E:\HomePage\SOURCE>..\masm50\link exam01; [Enter]
Microsoft (R) Personal Computer Linker Version 2.40
Copyright (C) Microsoft Corp 1983, 1984, 1985. All rights reserved.
Warning: no stack segment
³Ì«á·|¥X²{¤@Ó¨S¦³°ïÅ|°Ï¬q ( no stack segment ) ªºÄµ§i°T®§¡A¦³Ãö°ïÅ|¯d¨ì²Ä¤³¹¦A»¡©ú¡A¦¹³B§ÚÌ©¿²¤³o¶µÄµ§i°T®§¡C±µ¤U¨Ó§Ú̱N EXAM01.EXE ÀÉÅܦ¨ EXAM01.COM¡A¿é¤J¡y..\masm50\exe2bin exam01 exam01.com¡z
E:\HomePage\SOURCE>..\masm50\exe2bin exam01 exam01.com [Enter]
¨S¦³¥ô¦ó°T®§´N¥Nªí¦¨¥\¤F¡C±µ¤U¨Ó¡A¹ï¡y©R¥O´£¥Ü¦r¤¸¡z¿é¤J¡ydir¡z«ü¥O¡A¬Ý¬Ý§Ú̪ºÀɮצ³¨º¨Ç¡HµM«á¿é¤J¡yexam01¡z°õ¦æ¬Ý¬Ý¡G
E:\HomePage\SOURCE>dir [Enter] Volume in drive H is DATA_1 Volume Serial Number is 0330-08F6 Directory of E:\HomePage\SOURCE . <DIR> 02-02-02 21:31 . .. <DIR> 02-02-02 21:31 .. EXAM01 ASM 989 03-23-00 6:00 EXAM01.ASM EXAM01 OBJ 107 02-02-02 22:26 EXAM01.OBJ EXAM01 EXE 805 02-02-02 22:26 EXAM01.EXE EXAM01 COM 37 02-02-02 22:27 EXAM01.COM 5 file(s) 1,938 bytes 2 dir(s) 7,984.43 MB free E:\HomePage\SOURCE>exam01 [Enter] Hi, I learn assembly. E:\HomePage\SOURCE>
¦b³oӥؿý ( ¸ê®Æ§¨ ) ¸Ì¡AEXAM01.COM ´N¬O§Ú̳̫á±o¨ìªº°õ¦æÀÉ¡A·í§Ú̦b DOS ´£¥Ü¤U©Î Windows ªº¡y©R¥O´£¥Ü¦r¤¸¡z¤U¿é¤J¦¹°õ¦æÀÉÀɦW´N¥Nªí§ÚÌn°õ¦æ¦¹µ{¦¡¤F¡C§A¬Ý¡A§Ú̪º§V¤O²×©ó¦³¤F¥N»ù¡A¬O¤£¬O¨q¥X§ÚÌ©Ònªº¤å¦r¨Ó¡C
°²¦p±z¬O¦b XP ¨t²Î¤W¡A¨º»ò°õ¦æ exam01.com ®É¥i¯àµLªk¶¶§Q¦L¥X³o¬q¦r¨Ó¡A¥i¯à¬O¹ï INT 21H ªº¿é¥X¤£¤Ó¬Û®e¡A³o®É§A¥i¦bµêÀÀ¾÷¾¹¤U°õ¦æ¬Ý¬Ý¡A½Ð°Ñ¦Òªþ¿ý¤Q¤@¡C
¤Wzªº¹Lµ{¬O MASM.EXE ¬O§âì©lÀÉ ( ¤]´N¬O*.ASM ) ²ÕĶ¬°¥ØªºÀÉ *.OBJ¡A¦Ó³sµ²¾¹¬O§â¥ØªºÀÉ»Pµ{¦¡®w³sµ²°_¨Ó¡AÅܦ¨¥i°õ¦æªºÀÉ®× *.EXE¡Aµy«á§Ú¦A§@»¡©ú¡C³Ì«á¥i¥Î EXE2BIN ±N *.EXE ÀÉÂà´«¦¨ *.COM ÀÉ¡C¦ý¬O¨Ã«D¨C¦¸´N¯à¼g¥X¥¿½Tªºµ{¦¡¡A©Ò¥H¥²¶·°£¿ù¡Aµo²{¦³¿ù»~®É¤Wz¨BÆJ´N±o«½Æ¤@¦¸¡A«Ü¬O³Â·Ð¡A¦pªG¯à¿é¤J´XÓ¦r¨Ó¥N´À´N¦n¦h¤F¡A³o´N¬O§å¦¸Àɪº¦n³B¡A®e§Úµy«á¸ÑÄÀ¦p¦ó¼g§å¦¸ÀÉ¡C²{¦b¥ý¬Ý¬Ý MASM 6.11 ¦p¦ó²ÕĶ¡A¦A¨Ó¸ÑÄÀ¤Wzì©lÀÉ ( EXAM01.ASM ) ¨C¦æªº·N¸q¡C
¦]¬°¨C¦¸¼g¦nì©lÀÉ«á¡A³£n¥ý²ÕĶ¦A³sµ²µ{¦¡®w¡A«Ü¬O³Â·Ð¡A©Ò¥H MASM 6.0 ¥H«á¡A¤£¦A¨Ï¥Î MASM.EXE¡A¦Ó§ï¦¨ ML.EXE¡CML.EXE ¯à¦Û°Ê©I¥s³sµ²¾¹ ( LINK.EXE ) ³sµ²¡A©Ò¥H¥u»Ý¤U¤@¦¸©R¥O§Y¥i¡AÁö¬O¦p¦¹¡A¦ý¬O±zÁÙ±o±N³sµ²¾¹ªº¦ì¸m§i¶D ML.EXE ¤~¥i¥H¡A§_«h ML.EXE ·|©ê«è§ä¤£¨ì LINK.EXE ¥X²{¿ù»~¦Ó°±¤î¡C§ÚÌ¥i¥H¥Î DOS ªº PATH «ü¥O§i¶D ML.EXE¡ALINK.EXE ¦b¨º¤@ӥؿý¡A¦p¤U¡G
E:\HomePage\SOURCE>path E:\HomePage\masm611d;%path% [Enter]
E:\HomePage\SOURCE>
·í§ÚÌ°õ¦æ PATH «ü¥O«á¡A¥u»Ý°õ¦æ¤@¦¸¡ADOS ´N¯à°O¦í¡A©Ò¥H¦pªGì©lµ{¦¡²ÕĶµo²{¿ù»~¡Aקï¦n¥H«án¦A²ÕĶ®É¡A´N¤£¥Î¤U PATH ©R¥O¤F¡C¥u»Ý¦A¿é¤J¡yml /AT n²ÕĶªºÀɦW¡z§Y¥i¡C¦Ó¡y%path%¡z³oӰѼƬO«üקï PATH «ü¥Oªº¸ô®|¡C¸Ô²Ó±¡§Î½Ð¬Ýªþ¿ý¤T¤Îµù¤¡C
±µ¤U¨Ó´N°õ¦æ ML.EXE¡C¦]¬°¤p¤ì°¸·Q§âì©lµ{¦¡©M²ÕĶ¾¹¤À¶}¦b¤£¦P¥Ø¿ý¡A©Ò¥H¤p¤ì°¸´N¹³¤W¤@³¹ªº¦w±Æ¤è¦¡¡AML.EXE ¦b E:\HomePage\MASM611D ¦Ó EXAM01.ASM ¦b E:\HomePage\SOURCE ¥Ø¿ý¤º¡A¦Ó¥B¤p¤ì°¸¤]§Æ±æ²ÕĶ¦nªºµ{¦¡¯à©ñ¦b E:\HomePage\SOURCE ¤l¥Ø¿ý¤º¡A©Ò¥H¤p¤ì°¸¤Á´«¨ì E:\HomePage\SOURCE ¤l¥Ø¿ý¤º¡A³o¼Ë DOS ´N·|¦b E:\HomePage\SOURCE ¤¤¤u§@¡A§â²ÕĶ¦nªºÀɮצs©ñ©ó¦¹¤l¥Ø¿ýùØ¡C³Ì«á¤U¹F¡yml /AT n²ÕĶªºÀɦW¡z«ü¥O¡A³o¼Ë ML.EXE ´N¯à¨Ì¤p¤ì°¸ªº§Æ±æ°õ¦æ¡C¡yn²ÕĶªºÀɦW¡z¥²¶·¬O§¹¾ãªºÀɦW¡A¤]´N¬On¥]§t°ÆÀɦW¡A³o¬O ML.EXE ªº»yªk¤@©w±o¿í¦u¡C³Ì«áµ²ªG¦p¤U¡G
E:\HomePage\SOURCE>ml /AT exam01.asm [Enter]
Microsoft (R) Macro Assembler Version 6.11d
Copyright (C) Microsoft Corp 1981-1995. All rights reserved.
Assembling: exam01.asm
Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994
Copyright (C) Microsoft Corp 1984-1993. All rights reserved.
LINK : warning L4017: /r : unrecognized option name; option ignored
Object Modules [.obj]: /r exam01.obj/t
Run File [exam01.com]: "exam01.com"
List File [nul.map]: NUL
Libraries [.lib]:
Definitions File [nul.def]:
¦Ü©ó ML.EXE ªº°Ñ¼Æ¡y/AT¡z¬O§i¶D ML.EXE §ÚÌn»s§@¦¨ *.COM ÀÉ¡AML.EXE ·|¦Û°Ê¦aÂন EXAM01.COM ¦Ó¤£¶·¦A¥Î EXE2BIN ¤F¡Cnª`·N ML.EXE ªº°Ñ¼Æ¬O¦³¤j¤p¼gªº¤À§O¡A¡yAT¡zYÅܦ¨¡yat¡z¬O·|¥X¿ùªº¡C
¦pªG±zn¨Ï¥Î MASM 8.0 ª©©Î 9.0 ª©ªº²Õ¸q¾¹²ÕĶ exam01.asm¡A¤]¤£¬O¤£¥i¥H¡A¦ý¬O¦³´XÓ¨î¡Cº¥ý¡A8.0/9.0 ª©ªº ML.EXE ¥u¯à¦b Windows ¨t²Î¤¤°õ¦æ¡AµLªk¦b DOS §@·~¨t²Î¤¤°õ¦æ¡A¤]¤£¯à¦bµêÀÀ¾÷¾¹ªº DOS ùØ°õ¦æ¡A¤£¹L©Ò²£¥Íªºµ{¦¡ÁÙ¬O¯à¦b DOS ùØ°õ¦æ¡C²Ä¤G¡A8.0/9.0 ª©ªº ML.EXE ¥»¬O°t¦X Visual C++ ²ÕĶ VC ùؤº´Oªº²Õ¦X»y¨¥µ{¦¡½X¡A©Ò¥H¹w¥ý³]©w¬O¥Î¨Ó²ÕĶ 32 ¦ì¤¸ªº Windows µ{¦¡¡A¦pªGn²ÕĶ 16 ¦ì¤¸ªº DOS µ{¦¡¡A¥²¶·¥[¤W¡y/omf¡z°Ñ¼Æ¨Ï²ÕĶ©Ò±oªº¥ØªºÀɮ榡¬° Intel Object Module Format ®æ¦¡¡C²Ä¤T¡A©Ò¨Ï¥Îªº³sµ²¾¹¡A¥²¶·¬O¯à³sµ² OMF ®æ¦¡ªº¥ØªºÀɪº³sµ²¾¹¡A³Ì°ªª©¥»¬O 5.63 ª©¡A¤£n»P³sµ²¦¨ Windows µ{¦¡·d²V¤F¡C©³¤U¤p¤ì°¸°²³] 8.0 ª©ªº ML.EXE ¤Î 5.63 ª©ªº LINK.EXE ³£¦b¡yE:\HomePage\MASM8¡z¤l¥Ø¿ýùØ¡A¦Ó exam01.asm ¦b¡yE:\HomePage\SOURCE¡zùØ¡G
E:\HomePage\SOURCE>..\masm8\ml /omf /AT exam01.asm [Enter] Microsoft (R) Macro Assembler Version 8.00.50727.218 Copyright (C) Microsoft Corporation. All rights reserved. Assembling: exam01.asm E:\HomePage\SOURCE>..\masm8\link exam01 [Enter] Microsoft (R) Segmented Executable Linker Version 5.60.339 Dec 5 1994 Copyright (C) Microsoft Corp 1984-1993. All rights reserved. Run File [exam01.exe]: List File [nul.map]: Libraries [.lib]: Definitions File [nul.def]: LINK : warning L4021: no stack segment E:\HomePage\SOURCE>..\masm8\exe2bin exam01 exam01.com [Enter] E:\HomePage\SOURCE>
8.0/9.0 ª©ªº ML.EXE ¦ü¥G¤£¹³ 6.x ª©ªº ML.EXE ¯à¦Û°Ê°õ¦æ³sµ²¾¹¡A¦]¦¹¤£±o¤w¡A¥u¯à¤â°Ê°õ¦æ¡C
EXAM01.ASM ªº²Ä¤@¦æ¬O¡y;***************************************¡z¡A¤Z¬O¦b¡y;¡z¤§«áªº¤å¦r³£·|³Q²ÕĶ¾¹©¿²¤¡A¦]¦¹³Q¥Î¨Ó·íµù¸Ñ¡Cµ{¦¡³]p®vÀ³¾¨¶q¯d¤Uµù¸Ñ¡A¥H«K¤é«áקï¡Cµù¸Ñ³Ì¦n»¡©úºtºâªk¡B©Ò¥Îªºì²z¡BÅܼƩҥNªíªº·N¸q¡K¡K¡A¤£n¼g¤@¨ÇµL·N¸qªºµù¸Ñ¡A¨Ò¦p¤U±ªºµù¸Ñ¬O¨S¦³·N¸qªº¡C
;*************************************** ;³o¬Oµù¸Ñ
¦³®Éµù¸Ñ¤Óªø¡A¥²¶·¨Ï¥Î¦n´X¦æ¤å¦r®É¡A¥i¥H¥Î COMMENT ¨Ó·í¦¨µù¸Ñ¡ACOMMENT ªº»yªk¬O¡G
COMMENT ¤À¹j¸¹ µù¸Ñ¤å¦r ¤À¹j¸¹
¤À¹j¸¹¥i¥H¬O¥ô·N¦r¤¸¡A¦ý¬O¤£¥i¥H¥X²{¦bµù¸Ñ¤å¦r¤¤¡A°²¦p³o¼Ëªº¸Ü¡A²ÕĶ¾¹·|»{¬°µù¸Ñµ²§ô¤F¡A¦Óµo¥Í¿ù»~¡C
²Ä¤G¦æ¬O code segment¡A¨ä¤¤ segment ¬O²ÕĶ¾¹ªº°²«ü¥O¡C©Ò¿×°²«ü¥O¬O§i¶D²ÕĶ¾¹¦p¦ó²ÕĶ¡A¨Ã¤£¬O CPU ªº«ü¥O¶°¡C²Õ¦X»y¨¥ªº«ü¥O¤¤¡A¦³¨Ç¬O«ü¥Ü²ÕĶ¾¹¦p¦ó²ÕĶªº¡A§Y°²«ü¥O¡Q¦³¨Ç¬O 80X86 «ü¥O¡A³o¬O¨Ï CPU ¯u¥¿¹Bºâ©Î¤u§@ªº«ü¥O¡Csegment °²«ü¥O¬O§i¶D²ÕĶ¾¹¦³¤@ӰϬq ( segment ) ±q³o¨à¶}©l¤F¡Csegment ¤@©w·|»P ends ( end segment ªºÂ²¼g¡Aends ªº s ¬O«ü segment ) °t¹ï¡Aends ¤]¬O¤@Ó°²«ü¥O¡A¬O§i¶D²ÕĶ¾¹¡A³oӰϬq¨ì¦¹µ²§ô¤F¡C°Ï¬qªº¦WºÙ¥i¥ô·N¥Ñ^¤å¦r¥À¡B¼Æ¦r¤Î©³½u²Õ¦¨¡A¦¹³B§Ú±N¥¦¨ú¦W¬°¡ycode¡z°Ï¬q¡C¯u¹ê¼Ò¦¡©³¤U¡A¨CӰϬq¤£¥i¶W¹L 64K ¦ì¤¸²Õ¡C½Ð°Ñ¦Òµù¤G¦³Ãö°²«ü¥Oªº»¡©ú¡C
¦b²Õ¦X»y¨¥¤¤¡A¨C¤@¦æµ{¦¡½X©Î¨C¤@µ§¸ê®Æ³£¥²¶·¦b¬YӰϬq¤º¡A§_«h²ÕĶ®É²ÕĶ¾¹·|²£¥Í¿ù»~¡A§ó¤£n»¡°õ¦æ¤F¡C°Ï¬q¤jP¥i¤À¬°µ{¦¡½X°Ï¬q¡B¸ê®Æ°Ï¬q¤Î°ïÅ|°Ï¬q¡Aµ{¦¡½X°Ï¬q¬O¥Ñ³\¦h 80x86 «ü¥O²Õ¦¨¡A³o¨Ç«ü¥O§i¶D CPU ¸Ó¦p¦ó°Ê§@¡A¸Ó°µ¤°»ò¹Bºâ¡F¸ê®Æ°Ï¬q¬O CPU °Ê§@©Î¹Bºâ®É©Ò»Ýªº¸ê®Æ²Õ¦¨¡C¥H¥[ªk¬°¨Ò¡A¥[ªí¥Ü¹Bºâ¡A¦Ó³Q¥[¼Æ»P¥[¼Æªí¥Ü¸ê®Æ¡A¬Û¥[«á©Ò±oªº©M¤]¬O¸ê®Æ¡C¦b¯à°÷¥Ñ*.EXE ÀÉÂà´«¦¨ *.COM ªºµ{¦¡¡A¥¦ªºµ{¦¡¬q¤Î¸ê®Æ¬q¦b¦P¤@Ó¬q¤º¡A´«¥y¸Ü»¡µ{¦¡¬q»P¸ê®Æ¬q¦b 64K ¤º«Å|¦b¤@°_¡C
ªì¾ÇªÌ¥i¥H±N³o¨âÓ°²«ü¥Oµø¬°©T©w®æ¦¡¡A´N¦n¹³ HTML ¤¤ªº <HTML></HTML> ¤@¼Ë¡C²Õ¦X»y¨¥¤¤¡ACOM µ{¦¡ªºì©lÀɤ]¦³©T©w®æ¦¡¡A´N¬O¡G
°Ï¬q¦W segment assume cs:code,ds:code org 100h start: ;¦¹³B©ñµ{¦¡¤º®e °Ï¬q¦W ends end start·í¦³¸ê®Æ®É¡A¥i¥Î¤U±©T©w®æ¦¡¡G
code segment assume cs:code,ds:code org 100h start: jmp begin ;¦¹³B¦s©ñ¸ê®Æ begin: ;¦¹³B©ñµ{¦¡¤º®e code ends end start
¨ì¤F MASM 5.x ¥H«áªº²ÕĶ¾¹¡A¥i¥H¨Ï¥Î¸û²³æªº©w¸q¨Ó©w¸q°Ï¬q¡C¤èªk¬O¥Î¡y.code¡z©w¸qµ{¦¡½X°Ï¬q¡A¥Î¡y.data¡z©w¸q¸ê®Æ°Ï¬q¡A¤@ӰϬqªºµ²§ô´N¬O¥t¤@ӰϬqªº¶}©l¡A¦pªG¨ìì©lÀɳ̫á¡A´Nªí¥Ü³Ì«á¤@ӰϬq¤]µ²§ô¤F¡C¨Ò¦p COM µ{¦¡ªºì©lÀÉ¥i¥H¼g¦¨¡G
.code org 100h start: jmp begin ;¦¹³B¦s©ñ¸ê®Æ begin: ;¦¹³B©ñµ{¦¡¤º®e end start
²Ä¤T¦æ¬O
assume cs:code,ds:code
³o¤@¦æ¬O¹w¥ý±N CS ©M DS ¼È¦s¾¹³]¬° code °Ï¬q¡C¦b 8086 CPU ¤¤¦@¦³ 4 Ó 16 ¦ì¤¸ªº°Ï¬q¼È¦s¾¹¡A¤À§O¬O CS¡BDS¡BES¡BSS¡A²ßºD¤W¤À§O«ü¦Vµ{¦¡½X°Ï¬q¡B¸ê®Æ°Ï¬q¡BÃB¥~°Ï¬q¤Î°ïÅ|°Ï¬q¡C¡CÃö©ó8086¼È¦s¾¹¡A¸Ô²Ó±¡§Î½Ð°Ñ¦Ò³o¸Ì¡C
COM µ{¦¡ªºµ{¦¡½X¡B¸ê®Æ¬q¡BÃB¥~¬q¡B°ïÅ|¬q³£¦b¦P¤@°Ï¬q¤¤¡A¦]¦¹¦¹³B±N CS¡BDS ³£³]¬° code °Ï¬q¡C³]¦n¤§«áªº¥Î³B¬O¡A·ín¦s¨úÅܼƮɡA´N¤£¶·¦A«ü©w DS ¤F¡A§_«h¥i¯àn¥Îâ¶V°Ï¬q ( °Ñ¦Ò 24 ³¹¡@) ªº¤èªk¤F¡C
²Ä¥|¦æ¤¤¬O¡yorg 100h¡zªí¥Ü¦¹¦æ¥H«áªºµ{¦¡¥Ñ 100H ( ¥[¤W H ªí¥Ü 16 ¶i¦ì ) ³oÓ¦ì§}¶}©l¡CDOS ¥ÑºÏºÐ¸ü¤J COM µ{¦¡Àɮ׮ɡA·|¦Û°Ê§âµ{¦¡½X¤À°t¨ì¦ì§} 100H ¶}©l°õ¦æ¡A¦]¦¹¥²¶·¥[¤J³o¤@¦æ¡A§i¶D³sµ²¾¹µ{¦¡½Xn±q 100H ¶}©l³sµ²¡C
¤°»ò¬O¦ì§}©O¡H¹q¸£©Ò¯à±±¨îªº°O¾ÐÅé«Ü¤j¡A·í CPU n¦s¨ú°O¾ÐÅ餤ªº¸ê®Æ®É¡A¥²¶·nª¾¹D±o¦V¨º¤@Ó°O¾ÐÅén¸ê®Æ¤~¦æ¡C¦Ó°O¾ÐÅé¬O¦³½s¸¹ªº¡A¹q¸£¥H¤@Ӧ줸²Õ ( ¦ì¤¸²Õ¬O byte¡A§Y 8 ¦ì¤¸¡A¦ì¤¸¬O bit ) ¬°³æ¦ì°µ½s¸¹¡A³o½s¸¹´N¥s¦ì§}¡C¦b DOS ùØ¡A¥Î XXXX:YYYY ªí¥Ü¦ì§}¡A¨ä¤¤ XXXX ºÙ¬°°Ï¬q¦ì§} ( segment address )¡AYYYY ºÙ¬°°¾²¾¦ì§} ( offset address )¡A8086 ¤¤¨CӰϬq³Ì¤j¥i¥H¨ì 64KBytes ( 64KBytes¡×65536 Ӧ줸²Õ ) ¨C¤@ӰϬqªº°O¾ÐÅ骺½s¸¹¬O¥Ñ 0 ¸¹¨ì 65535 ¸¹¡A¦@¦³ 65536 Ó( 65536 °£¥H 1024 ±o 64¡A©Ò¥H¤@¯ë³£»¡¬O 64 KBytes)¡A³o 65536 Ó¦ì§}¡A¨C¤@Ó¦ì§}ªº®e¶q¤j¤p¥u¦³¤@Ӧ줸²Õ(byte)¡C´N¹³§ÚÌ®a®xªº¦a§}¤@¼Ë¡A¤¤µØ¸ô 263 ¸¹¡A³o¤¤µØ¸ô´N¹³¬O°Ï¬q¡AªùµP¸¹½X 263 ´N¹³¬O°¾²¾¦ì§}¡C·í CPU ¹Bºâ®É»Ýn¸ê®Æ¡A´N¥un§i¶D°O¾ÐÅé¡An¨ú¨º¤@Ó¦ì§}ªº¸ê®Æ¡A¹q¸£´N·|¨Ì¾ÚþӰϬq¡AþÓ°¾²¾¦ì§}¥h¦s¨ú¡A´N¤£·|§Ë¿ù¤F¡C
²Ä¤»¦æ¡Astart:¡A¬Oªí¥Ü¤@ӼаO¡A¤Z¬O¥H¡y:¡zµ²§Àªº¦r¦ê³£¬O¼Ð°O¡A¥Lªí¥Ü°O¾ÐÅ餤ªº¤@Ó¦ì§}¡A¸õÅD®É·|¥Î¨ì¡A¨Ò¦p jmp begin¡A´N¬Oªí¥ÜÅý CPU ¸õ¨ì begin: ¼Ð°O³BÄ~Äò°õ¦æ¡C¦b¸õÅD«ü¥O«á¡A¤£»Ý¥[¤W´U¸¹¡A©w¸q¼Ð°O®É¤~»Ýn¥Î¨ì´U¸¹¡C jmp ´N¬OµL±ø¥ó¸õÅD¡A´N¹³ BASIC ¤¤ªº GOTO ¤@¼Ë¡C
²Ä¤C¦æªº«ü¥O¬O db (define byte)¡A¨ä»yªk¬O¡G
ÅܼƦW db ¼ÆÈ ÅܼƦW byte ¼ÆÈ
MASM 6.x ¥H«á¤~¥i¥Î byte ©w¸q¦ì¤¸²Õ¡A¤£ºÞ¬O¡ydb¡z©Î¡ybyte¡z¡A³£¬O¤@Ó°²«ü¥O¡A¥¦¬O§i¶D²ÕĶ¾¹³o¨à¦³¤@¶ô°O¾ÐÅéªÅ¶¡«O¯d°_¨Óµ¹«e±ªºÅܼƦW¨Ï¥Î¡A¦Ó«O¯dªº¤j¤p¬O¤@Ӧ줸²Õ ( ¦ì¤¸²Õ^¤å¬O byte¡Aªø 8 Ӧ줸 )¡C¤@Ӧ줸²Õªº¤j¤p¥i¥Hªí¥Ü 0 ¨ì 255 ¦@ 256 ӼƦr ( 28¡×256)¡A©Ò¥H¦pªG±zªºÅܼƼÆȦb¦¹½d³ò¤º´N¥i¥H¥Î db ¨Óªí¥Ü¡C¦pªGn©w¸q¨âӦ줸²Õ¥i¥H¥Î
ÅܼƦW db ¼ÆÈ1¡A¼ÆÈ2
°²¦p¤@¶}©l¤£ª¾¹DÅܼƪº¼ÆÈ¡A¨º»ò¥i¥Î¡y?¡zªí¥Ü¡G
ÅܼƦW db ?
°£¤Fªí¥ÜÅܼƤ§¥~¡Adb ¤]¥i¥H©w¸qªº¬O¤@Ó^¤å¥y¤l ( ³N»yºÙ¬°¦r¦ê¡Astring )¡A´N¹³¦b³oÓ¨Ò¤lùتº²Ä¤C¦æ¡A¦ý¬°ÁקK²ÕĶ¾¹»~¸Ñ¬°¼Æ¦r¡A©Ò¥H¥Î¡y"¡z©Î¡y'¡z±N¥y¤l¬A°_¨Ó¡C°²¦p¥H¡ydb¡z©w¸q¤@Ó¦r¦êªº¸Ü¡A¨C¤@Ó^¤å¦r¥À·|¦û¥Î¤@Ӧ줸²Õ¡A¦Ó¤¤¤å¦r«h¦û¥Î¨âӦ줸²Õ¡C
MOV «ü¥Oªº»yªk¬O
MOV ¹Bºâ¤¸1,¹Bºâ¤¸2
MOV ¦b 80X86 ²Õ¦X»y¨¥¤¤¬Û·í©ó«ü©w©Î½á¤©¹Bºâ¤¸2ªº¼Æȵ¹¹Bºâ¤¸1¡AÃþ¦ü¨ä¥L°ª¶¥»y¨¥ªº¡y¡×¡z¤§·N¡C¨Ò¦p²Ä 9 ¦æªº
mov ah,9
´N¬O§â AH ³]¬° 9 ªº·N«ä¡C¤]¥i¥H§â¥¦·Q¦¨¬O±N«á±ªº¸ê®Æ²¾°Ê¡]move¡^¨ì«e±ªº¹Bºâ¤¸¤¤¡C¨º»ò¡AAH ¬O¤°»ò©O¡HAH ¬O¤@Ó 8 ¦ì¤¸¤j¤pªº¼È¦s¾¹¡C¼È¦s¾¹¥i¥H·Q¹³¦¨¬O¦b CPU ¤º³¡¤@¶ô¼È®ÉÀx¦s¸ê®Æªº°O¾ÐÅé¡A³o¨Ç°O¾ÐÅé¤j¤p¨Ã¤£¤j¡A¨CÓ¶È 8¡B16 ©Î 32 ¦ì¤¸ªø¡A¦ý¬O¹Bºâ³t«×«o¤ñ¦b°O¾ÐÅé§Ö±o¦h¡C¦b 8086/8088 CPU ¦³ 4 Ó 16 ¦ì¤¸³q¥Î¼È¦s¾¹¡A¨Ñ§@¥[´î¼°£µ¥¹Bºâ¤§¥Î¡A¤À§O¬O AX¡BBX¡BCX¡BDX¡A¦Ó¨CÓ³q¥Î¼È¦s¾¹¡A¤S¦U¤À¬°°ª¦ì¤¸©M§C¦ì¤¸ªº¨âÓ¡A¥H AX ¬°¨Ò¤S¤À¬° AH¡BAL¡AAH ªí¥Ü¸û°ªªº 8 ¦ì¤¸¡AAL ªí¥Ü¸û§Cªº 8 ¦ì¤¸¡A¦p¤U¹Ï©Ò¥Ü¡C
¤K¦ì¤¸ªº¼È¦s¾¹¡A´N¥u¯à¦s¤J 8 Ӧ줸ªº¤j¤p¡A¨CӦ줸¥i¯à¬O 0 ©Î¤@¡A©Ò¥H¥u¯àªí¥Ü 28 ӼơA¤]´N¬O 0¡ã255 ¤§¶¡¤£¦Pªº¼Æ¡C16 ¦ì¤¸ªº¼È¦s¾¹¡A«h¯àªí¥Ü 216 ӼơA¤]´N¬O 0¡ã65535 ¤§¶¡ªº¼Æ¡C
MOV «ü¥Oªº¨âÓ¹Bºâ¤¸¥²¶·ªø«×¬Û¦P¡A¦P¼Ë³£¬° 16 ¦ì¤¸©Î 8 ¦ì¤¸¡A¤£¥i¥H¹Bºâ¤¸1 ¬° 16 ¦ì¤¸¡A¦Ó¹Bºâ¤¸2 ¬° 8 ¦ì¤¸¡C¦Ó¥B³o¨âÓ¹Bºâ¤¸¥²¶·¦³¤@Ó¬O¼È¦s¾¹©Î±`¼Æ¼ÆÈ¡A¤£¥i¥H¨âÓ¹Bºâ¤¸¦P®É¬O°O¾ÐÅ餤ªº¸ê®Æ ( ¥ç§YÅÜ¼Æ )¡C
OFFSET ¬O±N¨ä«á¹Bºâ¤¸ªº°¾²¾¦ì§}pºâ¥X¨Ó¡CEXAM01.ASM ªº²Ä¤K¦æ¬O
begin: mov dx,offset mes
¨ä·N¸q´N¬O±N mes ©Ò¦b°¾²¾¦ì§}¶ñ¤J¨ì DX ¼È¦s¾¹¤¤¡Anª`·Nªº¬O¨Ã¤£¬O§â mes ªº¤º®e¦s¤J DX¡A¦Ó¬O§â°¾²¾¦ì§}·í¦¨¤@Ó¼ÆÈ¡A¦s¤J DX ùØ¡C¦pªG»¡°¾²¾¦ì§}´N¬OªùµP¸¹½X¡A¨º»ò¸Ó°¾²¾¦ì§}ªº¤º®e´N¬O§A®aùر©Ò¦íªº¤H¡C¨CӰϬq¶}©lªº¦ì§}³£¬O¥Ñ 0 ¶}©l¡A¦Óì©lµ{¦¡¤¤¨C¦æ©Ò¦û¥Îªº°O¾ÐÅé¦ì¤¸²Õ¦h¹è¤£ºÉ¬Û¦P¡AOFFSET ·|¥hpºâ¨C¦æµ{¦¡½X©Ò¦û¦ì¤¸²Õ¼Æ¡A´N¥i¥H¨D¥X¨Ó mes ©Ò¦b¦ì§}¡AµM«á¦A²¾¨ì DX ùØ¡COFFSET ³oÓ«ü¥O¡A¬O«ü¥Ü²ÕĶ¾¹¥hºâ¥X mes ©Ò¦bªº°¾²¾¦ì§}¡A¦]¦¹¬O°²«ü¥O¡C
²Ä¤Q¦æ int 21h¡Aint ªí¥Ü¤¤Â_¡A¦b²Õ¦X»y¨¥¤¤¡A¤¤Â_¬O¤@ªù¤j¾Ç°Ý¡A¦b¦¹³B§ÚÌ¥i¥H§â¤¤Â_·Q¦¨¬O¤@ºØ°Æµ{¦¡¡A°Æµ{¦¡¬OÀ°§ÚÌ°õ¦æ¤@¨Ç±`¥Îªº¤u§@¡Aµ¥§¹¦¨«á¡A¦A±N°õ¦æµ²ªG¶Ç¦^µ¹ì¨Óµ{¦¡Ä~Äò°õ¦æ¡C¦b¤@¯ëµ{¦¡¤¤¥i¯àn±`±`¦L¥X¤@¬q¤å¦r¡A¨Ò¦p´£¿ô§A¿é¤J©m¦W¡A©ÎªÌ¦L¥Xpºâªºµ²ªG¡A¦pªG¨C¦¸³£¼g¤@¬q¦L¥X¦r¦êªºµ{¦¡¡A¤£¬O«Ü¨S®Ä²v¶Ü¡H©Ò¥H§Ú̱`±`¬O§ân¦L¥Xªº¤å¦r°O¿ý©ó¬Y³B¡A¦A¶Çµ¹¤@¬q±Mªù¦L¥X¤å¦rªºµ{¦¡¡A³o¬qµ{¦¡´N¥s°Æµ{¦¡¡C¦¹³B¡A§ÚÌ©I¥s¤Q¤»¶i¦ìªº 21 ¸¹¤¤Â_¡A¦¹¤¤Â_¬O DOS ´£¨Ñªº¤]¥s DOS ªA°Èµ{¦¡¡C·í§Ú̶}¾÷¶i¤J DOS ®É¡ADOS ´N·|¦Û°Êªº±N¦¹¤¤Â_¤]¸ü¤J°O¾ÐÅ餤¡A²Õ¦X»y¨¥µ{¦¡±`§Q¥Î DOS ¤¤Â_³B²z³\¦hÁcÂøªº¨Æ¡A21h ¤¤Â_©Ò§@ªº¨Æ¡A³£¥Ñ AH ¤º®e¨M©w¡A·í AH=9 ¶i¤J 21h ¤¤¬q®Éªí¥Ün¦L¥X¤@¬q¤å¦r¡A¦Ó¦¹¤å¦rªº°_©l¦ì§}«K¥Ñ DX ¨M©w¡A¤@ª½¦L¨ì¡y$¡z¬°¤î¡C
DOS ©M BIOS ³£´£¨Ñ¤F³\¦h¤¤Â_ªA°Èµ{¦¡¡A¨C¤@Ó¤¤Â_³B²zªº¨Æ³£¤£¦P¡A¦]¦¹¼g²Õ¦X»y¨¥ªº¤H¤âÀY¤W³£À³¸Ón¦³¤@¥»¤¤Â_¦Cªí¡A¥H¨Ñ°Ñ¦Ò¡C
²Ä¤Q¤@¦æ¡B¤Q¤G¦æ¤]¬O°õ¦æ DOS ªA°Èµ{¦¡¡A¥Øªº¬Oµ²§ôµ{¦¡¡A¦b²Õ¦X»y¨¥¤¤µ²§ôµ{¦¡¦³¦n´XºØ¤è¦¡¡A³Ì±`¥Îªº´N¬O AH=4CH/INT 21H¡A¦Ó AL ¤ºªº¼ÆȬOªí¥Üµ²§ô®É¶Ç¦^µ¹ DOS ªº¿ù»~½X¡A¦pªG§A¼g¹L DOS ªº§å¦¸ÀÉ ( *.BAT ) ¥i¥H§Q¥Î¿ù»~½X¨Ó¿ï¾Ü¡C
¦b¦¹§A¤]¥i¥H¼g¦¨¹³¤U±ªº¼Ë¤l¡A¦ý¬On¦h¤@Ó byte¡C
mov ah,4ch mov al,0 int 21h¥t¥~¦b COM ÀÉùØ¡A¤]¥i¥H¨Ï¥Î int 20h ¨Óµ²§ôµ{¦¡¡C
²Ä¤Q¤»¦æ¡Aend ¤]¬O°²«ü¥O¡Aªí¥Üµ{¦¡µ²§ô¡Aend «á±ªº¼Ð°O¬O«üµ{¦¡¶i¤JÂI¡A¦ý¹ï COM ÀɦӨ¥¬OµL·N¸qªº¡A¼g¤£¼g³£¨SÃö«Y¡A¦]¬° COM Àɳ£¬O¥Ñ 100h ¶}©l°õ¦æ¡F¦ý¹ï EXE ÀɦӨ¥§A´N¥i¥H¨Ì»Ýn¦Ó¥[¥H³]©w¡Cend ¬O§i¶D²ÕĶ¾¹¡Aì©l½X¨ì¦¹¬°¤î¤F¡A¦A¤U±´N¨S¦³¤F¡A¥¦¨Ã¤£¬O§i¶D CPU ³oÓµ{¦¡µ²§ô¡A¦]¦¹ end ¤]¬O¤@Ó°²«ü¥O¡C¤]¦]¬° END ¤£¬O§i¶D CPU µ{¦¡µ²§ô¤F¡A©Ò¥H²Ä 11 ¦æ¨ì 12 ¦æªº¡ymov ax,4c00h/int 21h¡z¬O¤£¯à¬Ù²¤¡A§_«h·|·í¾÷¡C
..\masm50\masm %1; [Enter]
..\masm50\link %1; [Enter]
..\masm50\exe2bin %1 %1.com [Enter]
¤]¥i¥Hª½±µ¦b DOS ¼Ò¦¡²£¥Í CPL.BAT¡A¥ý¤Á´«¨ìì©lÀÉ©Ò¦b¥Ø¿ý¡A¦A¿é¤J¥H¤U¤å¦r¡G
E:\HomePage>cd source [Enter] E:\HomePage\SOURCE>copy con cpl.bat [Enter] ¡÷con ªí¥Ü±±¨î¥x ( ±±¨î¥x¥]§tÁä½L§Y¿Ã¹õ )¡A ..\masm50\masm %1; [Enter] ¡÷¤W¤@¦æªí¥Ü¥Ñ±±¨î¥x«þ¨©¤å¦r¨ì CPL.BAT ..\masm50\link %1; [Enter] ..\exe2bin %1 %1.com [Enter] ^Z [Enter](µù¥|) 1 file(s) copied E:\HomePage\SOURCE>dir [Enter] Volume in drive H is DATA_1 Volume Serial Number is 0330-08F6 Directory of E:\HomePage\SOURCE . <DIR> 02-02-02 21:31 . .. <DIR> 02-02-02 21:31 .. EXAM01 ASM 1,121 03-23-00 6:00 EXAM01.ASM CPL BAT 69 02-08-02 1:19 cpl.bat 2 file(s) 1,190 bytes 2 dir(s) 7,982.30 MB free
±z¥i¥H¬Ý¥X¨Ó¡A¨ä¹ê§å¦¸Àɪº¤º®e¡A§¹¥þ·Ó§ÚÌ©Ò¿é¤Jªº«ü¥O¥h°õ¦æªº¡A¨ä¤¤¥u¦³¥i¯à·|§ïÅܪº¦a¤è¥Î %1¡N%2 ¡K¡K¨Ó¥N´À¡A¨Æ¹ê¤W¡A %1¡N%2 ¡K¡K´N¦n¹³¬O¡yÅܼơz¤@¼Ë¡C
E:\HomePage\SOURCE>cpl exam01 [Enter] E:\HomePage\SOURCE>..\masm50\masm exam01; Microsoft (R) Macro Assembler Version 5.00 Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved. 51536 + 418608 Bytes symbol space free 0 Warning Errors 0 Severe Errors E:\HomePage\SOURCE>..\masm50\link exam01; Microsoft (R) Personal Computer Linker Version 2.40 Copyright (C) Microsoft Corp 1983, 1984, 1985. All rights reserved. Warning: no stack segment E:\HomePage\SOURCE>..\masm50\exe2bin exam01 exam01.com E:\HomePage\SOURCE> E:\HomePage\SOURCE>dir [Enter] Volume in drive H is DATA_1 Volume Serial Number is 0330-08F6 Directory of E:\HomePage\SOURCE . <DIR> 02-02-02 21:31 . .. <DIR> 02-02-02 21:31 .. EXAM01 ASM 1,121 03-23-00 6:00 EXAM01.ASM CPL BAT 69 02-08-02 1:19 cpl.bat EXAM01 OBJ 107 02-08-02 1:22 EXAM01.OBJ EXAM01 EXE 805 02-08-02 1:22 EXAM01.EXE EXAM01 COM 37 02-08-02 1:22 EXAM01.COM 5 file(s) 2,139 bytes 2 dir(s) 7,982.29 MB free E:\HomePage\SOURCE>exam01 [Enter] Hi, I learn assembly. E:\HomePage\SOURCE>
E:\HomePage\SOURCE>..\masm50\masm [Enter] Microsoft (R) Macro Assembler Version 5.00 Copyright (C) Microsoft Corp 1981-1985, 1987. All rights reserved. Source filename [.ASM]: exam01 [Enter] Object filename [exam01.OBJ]:[Enter] Source listing [NUL.LST]:[Enter] Cross-reference [NUL.CRF]:[Enter] 51544 + 418712 Bytes symbol space free 0 Warning Errors 0 Severe Errors¤W±ªº¨Ò¤l´N¬O¥u¦³«Ø¥ß¥ØªºÀɦӤw¡C±`±`¬°¤F¤è«K¡A´N¿é¤J¡yMASM ì©lÀɦW; [Enter]¡zªí¥Ü¥u«Ø¥ß¥ØªºÀɦӤw¡C
¦pªG±z¥u¿é¤J
E:\HomePage\SOURCE>..\masm50\masm exam01 [Enter]
¦Ó¨S¦³¿é¤J¡y;¡z¡A¨º»ò MASM ·|¸ß°Ý±z¥ØªºÀÉ¡B¦CªíÀÉ¡B¥æ¤¬°Ñ¦ÒÀɪºÀɦW¡C
¼Æ¦~«e¨ì²{¦b ( ¥Á°ê 98 ¦~¡A¤]´N¬O¦è¤¸ 2009 ¦~ ) ³\¦h¤H³£¨Ï¥Î Win XP §@·~¨t²Î¡A³o®É Windows ¨t²Î¤w¨Ï¥Î¤Q´X¦~¤F¡A¥¦¦³ 32 ¦ì¤¸©M 64 ¦ì¤¸ª©¥»¡A¥B»P DOS ®É¥N 16 ¦ì¤¸ªº¥i°õ¦æÀɮ榡¤£¦P¡A©Ò¥H²£¥Í¤èªk¤]¤£¬Û¦P¡C
µù¤T¡G100H ªº H ¬Oªí¥Ü³o 100 ¬O¤Q¤»¶i¦ì¼Æ¨Ã«D¤Q¶i¦ì¼Æ¡C¦pªG¼Æ¥Ø«á±¨S¦³¥ô¦ó^¤å¦r¡A´Nªí¥Ü¦¹¼Æ¬°¤Q¶i¦ì¡A¤Q¶i¦ì¤]¥i¥H¥Î D ªí¥Ü¡C¤K¶i¦ì©M¤G¶i¦ì¼Æ¤À§O¥Î¡yO¡z¡]^¤å¦rªº O ¡^©M¡yB¡zªí¥Ü¡C³o¨Ç^¤å¦r³£¬O¦b¼Æ¦r«á±¡A¤j¤p¼g¬Ò¥i¡C¦¹¥~¤Q¤»¶i¦ì¼Æ²Ä¤@Ó¦ì¼Æ¦pªG¬O^¤å¦r¡An¦b³Ì«e±ÃB¥~¥[¤W¤@Ó¹s¡A§_«h·|³Q·í¦¨ÅܼƦW©Î¼Ð°O¦W¡C¦pªG±z¤£¼ô±x¤Q¶i¦ì¡B¤G¶i¦ì ©M¤Q¤»¶i¦ìªº¸Ü¡A½Ð¥ß§Y°Ñ¦Òªþ¿ý¤@¡A¦b²Õ¦X»y¨¥¤¤±`±`n¥Î¨ì³o´XºØ¶i¦ìªk¡C
µù¥|¡G¡y^Z¡z³oÓ¦r¬Oª½±µ«ö¤U F6 ³oÓÁä¡A¤]¥i¥H¥ý«ö¦í Ctrl Á䤣©ñ¦A«ö¤U Z Áä¡C
µù¤¡G¸ô®|¡APATH¡A¬O¤@Ó DOS ¤º³¡«ü¥O¡A¥i°Ñ¦Òªþ¿ý¤Tªº»¡©ú¡C¨ä»yªk¬O
path ¸ô®|1;¸ô®|2;¸ô®|3......¦pªG¨Ï¥ÎªÌ¦b DOS ¼Ò¦¡¤U¿é¤J¦n¸ô®|«á¡A·í¨Ï¥ÎªÌ¿é¤J¤@Ó¥i°õ¦æÀÉ¡ADOS ¥ý¦b²{¦bªº¥Ø¿ý¤º´M§äÕY¨S¦³ªº¸Ü¡ADOS ·|¨Ì§Ç¨ì¸ô®|1¡B¸ô®|2 µ¥¸ô®|¥h´M§ä³oÓ¥i°õ¦æÀÉ¡C
©Ò¥H¦pªG§Ú̦b²ÕĶ«e¤U
E:\HomePage\SOURCE>path E:\HomePage\MASM50 [Enter]
³oÓ«ü¥O¡A¨º»ò²ÕĶ®É¡A¥u»Ý¿é¤J
E:\HomePage\SOURCE>masm exam01; [Enter]
´N¥i¥H¤F¡ADOS ·|¥ý¨ì E:\HomePage\SOURCE ³oÓ¤l¥Ø¿ý¥h§ä§ä¬Ý¡A¦³¨S¦³ MASM.EXE¡A¦pªG¨S¦³ªº¸Ü¡A´N·|¨ì path ©Ò«ü©wªº¥Ø¿ý¥h§ä MASM.EXE¡A¦pªG§ä¨ìªº¸Ü¡A´N°õ¦æ¥¦¡C©Ò¥H¥H«á´N¤£¥Î¦A¿é¤J¡y..\masm50\¡z¡A¦P¼Ë¦a³sµ²®É¤]¤£¥Î¦A¿é¤J¡y..\masm50\¡z³o´XÓ¦r¤F¡C
·í¸ô®|³]¥ß¦n¤§«á¡ADOS ·|±N¥¦¦s¦b°O¾ÐÅ骺¤@Ó¦a¤è¡A¦]¦¹°£«Dקï©ÎÃö¾÷¡A§_«h DOS ¬O¤£·|§Ñ°Oªº¡C¦pªG§Ú̳]¦n¤@Ó¸ô®|¡A¦Ó«á¤S·Q¦b¸ô®|¤W¦A¥[¤W¤@Ó¤l¥Ø¿ý¡A³o®É¥i¥Î¡y%path%¡z³oÓÅܼơA¡y%path%¡z¥Nªí«e¦¸¸ô®|¡C°²¦p±zn DOS ·j´M¨âÓ¥H¤Wªº¤l¥Ø¿ý¡A´N¥Î¡y;¡z±N¥¦¹j¶}¡C
±z¤]¥i¥H¦b DOS ´£¥Ü¤§¤U¿é¤J¡yset¡z«ü¥O¡AÀˬd¥Ø«e¤w¸g³]¦nªº¸ô®|¦³¨º¨Ç¡A¦ý¤d¸U¤£n¿é¤J¡yset path=¡z¡A¦p¦¹¤@¨Ó´N·|§â¸ô®|³]¬°ªÅªº¡A¥ç§Y²M°£©Ò¦³¸ô®|¤F¡C