¦b«e±¤@³¹´£¨ì¡A«e¨Ç®ÉÔ ( ¥Á°ê 100 ¦~«e«á ) n¥H²Õ¦X»y¨¥¼¶¼g Win64 µ{¦¡¡A¤´¬O¬Û·í³Â·Ðªº¨Æ¡A³o¬O¦]¬°·L³n¤½¥q²¾°£¤F ML64.EXE ªº°ª¯Å»yªk ( ³o¨Ç°ª¯Å«ü¥O¦³ INVOKE¡B.IF/.ELSEIF/.ELSE/.ENDIF¡B.WHILE/ENDW¡Kµ¥µ¥)¡A¨Ï ML64.EXE Åܦ¨´Ý¼o¡A¨Ã¥B¦Ü¤µ¤£¥´ºâ¥[¤J¡A¦]¦¹«e½ú̸չϥH¤£¦Pªº¤èªk«ì´_³o¨Ç°ª¯Å«ü¥O¡C¦³¨Ç¸Õ¹Ï¥H¥¨¶°«ü¥O¹ê²{³o¨Ç°ª¯Å«ü¥O¡A¨Ò¦p«X°êªº Vasily Sotnikov¡F¦³¨Ç«h¬O¥´³y¥t¤@Ó¬Û®e©ó ML64.EXE ªº²ÕĶ¾¹¡A¨Ò¦p Japheth¡C³o¨Ç¥ý¶i³£¦³¤£¿ùªº¦¨ÁZ¡A¥O¤H´L·q¡C
³o¤@³¹n¤¶²Ðªº¬O Japheth ©Ò¶}µoªº JWASM ²ÕĶ¾¹¡CJWASM °_·½©ó¥[®³¤jªº Watcom ¹q¸£¤½¥q¡A¦b¥Á°ê 77 ¦~®É¡AWatcom ´¿¸gµo°â»D¦W©ó¥@ªº Watcom C/C++ ²£«~¡C·Q·í¦~¡AWatcom ¤½¥q©Ò¶}µoªº³o®M Watcom C/C++ ½sĶ¾¹¯à°÷»P·L³n¡BÄ_Äõ ( Borland¡A³ÌµÛ¦Wªº²£«~¬O Turbo C/C++ ) ¤½¥q¶}µo¦æ C ½sĶ¾¹¤À®x¤®Â§¨Ã¤T¤À¤Ñ¤U¡C©Ò¥H»¡¡A³oÓ JWASM ¥i¬O¨t¥X¦Wªù¡A¨Ã«Dªxªx¤§½ú¡C·í¦~¡A¦b³o®M Watcom C/C++ ùØ¡A¤]¥]§t¤F¤@Ó²ÕĶ¾¹¡AºÙ¬° WASM ( WASM ¥þ¦W¬° Open Watcom Assembler )¡C¦Ó«á¥Ñ«e½ú Japheth ¥D¾É¶}µo¡A¨Ã§¹¦¨¤F 32 ¤Î 64 ¦ì¤¸ªº²ÕĶ¾¹¡A¦]¬°¥Ñ Japheth ¥D¾É¡A¬G«e±«a¤W¨ä¦W¦r¡AºÙ¬° JWASM¡CJWASM ¨ã¦³¥H¤Uªº¯S¦â¡G
¨ì¤F¦è¤¸ 2014 ¦~¤¸¤ë¡AJapheth ©ñ±ó¶}µo·sª©ªº JWASM ²ÕĶ¾¹¡A¦ý¬O¦b MASM32 ½×¾Â¤W¡A¦³¤@¸s¥H Habran ¬°ºªº¥ý¶i±µÄò Japheth ªº¤u§@¡AÄ~ÄòºûÅ@¨Ã¶}µo·sªº²ÕĶ¾¹¡A¨Ã±N¥¦§ï¦W¬° HJWASM¡A³Ì·sª©ªº HJWASM ¥i¥H¦b³oùؤU¸ü¡C¦ý¤p¤ì°¸ÁÙ¬O²ßºD¥Î JWASM 2.12 ª©¡A¥i¥H¦b SourceForge ¤U¸ü¡F¦Ó 2.11 ª©ªºì©l½X¤]¥i¥H¦b SourceForge ¤U¸ü¡C
¨ì¤F¦è¤¸ 2017 ¦~¤¤ë¡AHJWASM ³Q Github ¤½¥q±µ¦¬¡A¥Ñ Branislav Habus »P John Hankinson Ä~Äò§ï¨}¡A¨Ã§ó¦W¬° UASM¡C¦è¤¸ 2017 ¦~ 12 ¤ë¡A³Ì·sª©¥»¬O 2.46 ª©¡A¥i¥H¦b UASM ºô¯¸¤W¤U¸ü¡C©³¤U¤p¤ì°¸´N¥H UASM 2.46 ª©»¡©ú¦w¸Ë¤è¦¡¡A¦Ü©óª©ªº JWASM/HJWASM ªº¦w¸Ë¤è¦¡¤]¤j¦P¤p²§¡AŪªÌ¥i¥H¦Û¦æ¹Á¸Õ¡C
¶i¤J UASM ºô¯¸«á¡A¥i¥H¬Ý¨ì¤U±ªºµe±
UASM 2.46.5 (32bit) | 14/12/2017 | uasm246_x86.zip | 32bit Binary Package (Windows) |
UASM 2.46.5 (64bit) | 14/12/2017 | uasm246_x64.zip | 64bit Binary Package (Windows) |
UASM 2.46.5 (Linux 64bit) | 14/12/2017 | uasm246_linux64.zip | 64bit Linux Executable (GCC) |
UASM 2.46.5 (OSX Universal) | 14/12/2017 | uasm246_osx.zip | 64bit OSX Executable (GCC) |
¦pªG±zªº¨t²Î¬O 64 ¦ì¤¸ªº Windows ´N¤U¸ü uasm246_x64.zip¡C
¤U¸ü¦^¨Óªº uasm246_x64.zip ( 1004885 Ӧ줸²Õ ) «á¡A§â¥¦¸ÑÀ£ÁY¨ì¡uC:\UASM¡v¤l¥Ø¿ýùØ¡A´N¦w¸Ë§¹¦¨¤F¡C¦pªG¥H«án¸Ñ°£¦w¸Ë¡A§â¡uC:\UASM¡v¤l¥Ø¿ý³s¦P¨ä¤ºªº©Ò¦³ÀɮקR°£§Y¥i¡C°£¤F²ÕĶ¾¹¥~¡A¤]À³¸Ó§â³sµ²¾¹ ( LINK.EXE ) ¤Î¨ä©Ò»ÝÀÉ®× ( MSPDB80.DLL¡BMSOBJ80.DLL¡BMSPDBCORE.DLL¡BMSPDBSRV.EXE¡BCVTRES.EXE¡BLINK.EXE.CONFIG ) ©M¸ê·½½sĶ¾¹ ( RC.EXE ) ¤Î©Ò»ÝÀÉ®× ( RCDLL.DLL ) «þ¨©¨ì¡uC:\UASM¡v¤l¥Ø¿ýùØ¡C¦¹¥~¤]À³¸Ó«Ø¥ß¤@Ó¤l¥Ø¿ý¡A¡uC:\UASM\LIB¡v¡Aùر¬O GDI32.LIB¡BKERNEL32.LIB¡BUSER32.LIB µ¥¶×¤Jµ{¦¡®w¡C¨ì¦¹²ÕĶ¾¹¡B³sµ²¾¹»P¶×¤Jµ{¦¡®w³£¤w«Ø¸m§¹¦¨¡C¤WzÀɮסA¥i¦b¡u²Ä 0 ³¹²ÕĶ¾¹¡B³sµ²¾¹¡B¶×¤Jµ{¦¡®w¡v³B±o¨ì§ó¸Ô²Óªº¸ê®Æ¡C
³Ì¶Ë¸£µ¬ªºÁÙ¦³¤@Ó¡A¨º´N¬O¦U¦¡¦U¼Ëªº¥]§tÀÉ¡C©¯¦n³\¦h«e½úªº§V¤O¡A¦³³\¦h¥]§tÀɤw»s§@§¹¦¨¡A¥i¥H¨Ï¥Î¤F¡C¨Ò¦p Vasily Sotnikov »s§@ªº masm64.zip¡A¤U¸ü«á§â masm64.zip ùØ¡uinclude¡v¤l¥Ø¿ýªº¨âÓÀɮסGwin64.inc¡BResource.h ¸ÑÀ£ÁY¨ì¡uC:\UASM\INCLUDE¡v¤l¥Ø¿ýùØ¡C«eªÌ¦a¦ì»P MASM32 ùتº WINDOWS.INC ¬Û¦ü¡A¥u¬OÁÙ¤£¤ä´©¸U°ê½X¡F«áªÌ¬O¸ê·½½sĶ¾¹n¥Î¨ìªºÀɮסC
¤£¹L¤p¤ì°¸±ÀÂ˪º¥]§tÀɬO¥Ñ Japheth ©Ò»â¾Éªº¤p²Õ©Ò»s§@ªº¡AºÙ¬° WinInc 2.08/2.09¡C¦U¦ìŪªÌ¥i¥H¨ì UASM ªººô¯¸ ¤W¤U¸ü¡C®Ú¾Ú¸Óºô¯¸ªº¸ê®Æ¡AWinInc ¬O±Mªù¬° JWASM/HJWASM/UASM¡BMASM µ¥²ÕĶ¾¹©Ò¥´³yªº¡A¥]§t¤F©Ò¦³ Win32/64 API ©Ò»Ý«Å§i¤Î쫬¡C»P MASM32 ¤£¦Pªº¬O¡A¦b MASM32 ùتº WINDOWS.INC ¥]§t¤F©Ò¦³±`¼Æªº©w¸q¡A¦]¦¹Àɮ׫D±`¤j¡F¦ý¬O¦b WinInc ùØ¡A«o¬O¤Àªù§OÃþªº¦b¦UÓ¥]§tÀÉùØ¡A¥¦Ì¬O¥Ñ h2incx.exe Âà´«·L³nªº VC ©Ò´£¨Ñªº¥]§tÀÉ¡A*.H ©M *.INC¡A¥H 1¡G1 Âà´«¦Ó¨Óªº¡C°£¦¹¤§¥~¡AWinInc ¤]¤ä´©¸U°ê½X¡A³o¹ï¶}µo¦h°ê»y¨¥µ{¦¡¡A¬OÓ¦n®ø®§¡C§â WinInc208.zip ¤U¸ü¦^¨Ó«á¡A¥u»Ý§â¨ä¤ºªº Include ¤l¥Ø¿ý¾ãÓ¸ÑÀ£ÁY¨ì¡uC:\UASM¡v¡A´N¥i¥H¨Ï¥Î¤F¡C©³¤UªºÀɮסA´N¬O¤p¤ì°¸µwºÐ¤¤ªº¡uC:\UASM\¡v¥Ø¿ýùتº¤º®e¡G
96/11/08 ¤W¤È 08:19 38,904 cvtres.exe 106/12/02 ¤U¤È 11:37 134,162 History.txt 106/11/26 ¤U¤È 05:24 <DIR> Include 102/11/05 ¤W¤È 10:01 16,307 JWasm.chi 102/11/05 ¤W¤È 10:01 64,004 JWasm.chm 106/11/26 ¤W¤È 09:55 <DIR> Lib 102/12/19 ¤W¤È 10:01 21,145 License.txt 96/11/08 ¤W¤È 08:19 1,045,496 link.exe 95/06/05 ¤U¤È 06:02 268 link.exe.config 96/11/08 ¤W¤È 08:19 97,280 msobj80.dll 96/11/07 ¤W¤È 10:08 235,520 mspdb80.dll 96/11/07 ¤W¤È 10:08 396,800 mspdbcore.dll 96/11/07 ¤W¤È 10:08 132,096 mspdbsrv.exe 96/12/11 ¤U¤È 02:15 67,944 rc.exe 96/12/11 ¤U¤È 02:15 394,600 rcdll.dll 102/12/19 ¤W¤È 10:01 7,564 Readme.txt 101/09/25 ¤U¤È 12:43 6,144 res2inc.exe 106/12/19 ¤U¤È 10:47 <DIR> Samples 106/12/08 ¤W¤È 10:50 357,200 uasm246_ext.pdf 106/12/14 ¤W¤È 09:28 818,176 uasm64.exe 106/05/20 ¤U¤È 05:24 5,291 UasmTargets.zip 102/07/05 ¤W¤È 10:21 5,132 VS2010CustomBuildRule.zip
±µ¤U¨Ó¡An¥Î¤å®Ñ³B²z³nÅé»s§@ UASM.BAT¡A¨ä¤º®e¦p¤U¡G
1 2 3 4 |
SET INCLUDE=C:\UASM\INCLUDE;%INCLUDE%
SET LIB=C:\UASM\LIB;%LIB%
SET PATH=C:\UASM;%PATH%
SET LINK=/SUBSYSTEM:WINDOWS /DEBUG |
²Ä¤@¦æ¬O«ü©w¥]§tÀɦì¸m¡A²Ä¤G¦æ¬O«ü©w¶×¤Jµ{¦¡®w¦ì¸m¡A²Ä¤T¦æ«h³]©w°õ¦æÀɦì¸m¡A²Ä¥|¦æ«h¬O³]©w·L³n³sµ²¾¹ªº°Ñ¼Æ¡A/SUBSYSTEM:WINDOWS ªí¥Ü»s§@¥Xµøµ¡µ{¦¡¡A/DEBUG «h¬O«ü©w»s³y¥X PDB ÀɮסA°£¿ù¾¹¥i¥H¨Ï¥Î³oºØÀɮרÓÅã¥Ü¨Ï¥ÎªÌ©w¸qªº²Å¸¹¦WºÙ¡A¦Ó¤£¬O¥uÅã¥Ü¦ì§}¦Ó¤w¡C
±z¥i¥H¦b¡u©R¥O´£¥Ü¦r¤¸¡v¿é¤J¡uUASM64 -h¡v©Î¡uUASM64 -?¡v¡AUASM ·|Åã¥Ü¥X©Ò¦³°Ñ¼ÆªºÂ²³æ´yz¡A¤]¥i¥H¦b¶}±Ò¡uC:\UASM\JWasm.chm¡v»¡©úÀɾ\Ū¸Ô²Ó»¡©ú¡C¦b¦¹¤p¤ì°¸¶È²³æ¤¶²Ð³Ì«n¥B»P MASM ¤£¦Pªº³¡¥÷¡C¦¹¥~¡A³o¨Ç°Ñ¼Æ¤j¤p¼g¬O¦³°Ï§Oªº¡A¨Ò¦p¡u-win64¡v¬O¥¿½Tªº°Ñ¼Æ¡F¦ý¦pªG±z¿é¤J¡u-WIN64¡v¡A¨º»ò UASM ´NµLªk¥¿½T²ÕĶ¤F¡C¾¨ºÞ UASM ¥\¯à±j¤j¡A¦ý¬O¥¦µLªk²ÕĶ¦¨¥\«á¡Aª½±µ©I¥s³sµ²¾¹¡A¦]¦¹±o¦Û¦æ³sµ²¡A©Ò¥H¨S¦³¡u-link¡v³oӰѼơC
¨Ï¥Î¡u-Zi¡v°Ñ¼Æ¡A¥i¥H¦b©Ò«Ø¥ßªº¥ØªºÀɤ¤¡A¥[¤W¨Ï¥ÎªÌ¦b *.ASM ùةҨϥΪº²Å¸¹¸ê®Æ¡A³o²Å¸¹¸ê®Æ²Å¦X°£¿ùµ{¦¡ CodeView V4¡A«Ü¦h°£¿ùµ{¦¡³£¥i¨Ï¥Î¡A¹³ WinDbg¡BOllyDbg µ¥³£¥i¥H¡CUASM ©Ò«Ø¥ßªº OMF ©Î COFF ®æ¦¡ªº¥ØªºÀÉ¡A³£¥i¨Ï¥Î¡uZi¡v°Ñ¼Æ¡C¡uZi¡v«á±ÁÙ¥i¥H¿ï¾Ü¡A0¡ã3 ¥|ºØ¿ï¶µ¡C0 ªí¥Ü¥u¦³¥þ°ìÅܼƷ|³Q¼g¤J¥ØªºÀÉùØ¡F1 ªí¥Ü¥þ°ì©M°Ï°ìÅܼƳ£·|¼g¤J¥ØªºÀÉ¡F2 ªí¥Ü¥þ°ì©M°Ï°ìÅܼƥH¤Î¨Ï¥ÎªÌ©w¸qªº²Å¸¹³£·|¼g¤J¡A³o¬O¤º©wÈ¡F3 ªí¥Ü¥H EQU ©w¸qªº±`¼Æ¤]·|³Q¼g¤J¥ØªºÀÉ¡C
¨Ï¥Î³oӰѼơA·|¨Ï UASM »s³y¥X 64 ¦ì¤¸ COFF ®æ¦¡ªº¥ØªºÀÉ¡A¶i¤@¨B³sµ²«á´N¯à²£¥Í PE¡Ï ®æ¦¡ªº¥i°õ¦æÀÉ¡C´«¥y¸Ü»¡¡A¦pªGn»s³y¥X Win64 ¨t²Î¤¤ªº¥i°õ¦æÀÉ¡A´N¥²¶·¨Ï¥Î³oӰѼơC³oӰѼƷ|¦Û°Ê±Ò¥Î
.MODEL FLAT,FASTCALL OPTION WIN64:0
¡uOPTION WIN64:switches¡v³q±`¬O©ñ¦bì©l½Xªº«e±¡A¥Î¨Ó¶}±Ò¬Y¨Ç³]©w¡C³o¨Ç³]©w¥Ñ switches ¼Æȱ±¨î¡Aswitches ªº¨CӦ줸¦n¤ñ¤@Ó¶}Ãö¡A¥Î¨Ó¶}±Ò©ÎÃö³¬¬Y¨Ç³]©w¡C
¤j³¡¤Àªº±¡§Î¡A§ÚÌ¥un³]¬° 11¡A´N°÷¤F¡C¦pªG±z·Q¨Ï°Ï°ìÅܼƹï»ô¤@¸` ( paragraph )¡A¤~n³]¬° 15¡A¦ý¬O°Ï°ìÅܼƬO¤£¬O¥Ñ¤@Ó¸`¶}©l¡A¨Ã¤£¬O«Ü«n¡A¨Ã¥B¤@©wn¿í¦uªº¡C
¦¹«ü¥O¥u·|¼vÅT 64 ¦ì¤¸ªºµ{¦¡¡A³oÓ«ü¥O¬O¨M©w¬O§_Åý UASM ¦b¨ã¦³¡uFRAME¡vÄݩʪº°Æµ{¦¡¡A¦Û°Ê¥[¤W¡uprologues¡v©M¡uepilogues¡v¡Cprologues ¬O«ü¶i¤J°Æµ{¦¡®É¬°¤Fn¿í¦u Win64 ©I¥s¨ó©w¡A¥²¶·n¦h¥X¨Óªºµ{¦¡½X¡A¨Ò¦p¨Ï°ïÅ|¼W¥[´XӦ줸²Õµ¥¤u§@¡C¦Ó epilogues «h¬Oµ²§ô°Æµ{¦¡¡Aªð¦^¥Dµ{¦¡®É¡A¦h¥X¨Óªºµ{¦¡½X¡C¦pªG¨Ï¥Î¡uOPTION FRAME:AUTO¡v¡AUASM ´N·|¦Û°Ê¦b¨ã¦³¡uFRAME¡vÄݩʪº°Æµ{¦¡¡A¦Û°Ê¥[¤W¡uprologues¡v©M¡uepilogues¡v¡F¦pªG¬O¡uOPTION FRAME:NOAUTO¡v´N¤£·|¦Û°Ê¥[¤W¡A³o¬O¤º©wªº¿ï¶µ¡A«Øij¤£n¨Ï¥Î³oӿﶵ¡C
©³¤U¤p¤ì°¸¥´ºâ¼¶¼g¤@Ó¥i³Q JWASM ²ÕĶªº Win64 ²Õ¦X»y¨¥µ{¦¡¡A·íµM¡A¦¹µ{¦¡¬O³Ì²³æªº¡A¤]¬Oªì¾ÇªÌ¾Ç©Ò¦³»y¨¥²Ä¤@ӾDzߪº¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20 |
OPTION CASEMAP:NONE
OPTION WIN64:2
INCLUDE WINDOWS.INC
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
;*******************************************************************************
.CONST
szTitle BYTE '³Ì²³æªºµ{¦¡',0
szText BYTE '³o¬O¦b Windows 64 ¦ì¤¸§@·~¨t²Î¡A',0dh,0ah
BYTE '¥Î²Õ¦X»y¨¥¼gªºµ{¦¡¡C',0
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
main PROC
INVOKE MessageBox,0,ADDR szText,ADDR szTitle,MB_OKCANCEL
INVOKE ExitProcess,0
main ENDP
;*******************************************************************************
END main |
§â¤WzÀÉ®×¥H¡uHELLOW.ASM¡vªº¦WºÙ¡A¦s¤JµwºÐªº¡uE:\HOMEPAGE\SOURCE\WIN64\HELLOW\¡v¤l¥Ø¿ýùØ¡AµM«á¶}±Ò¡u©R¥O´£¥Ü¦r¤¸¡v¡A¨Ì·Ó¤U±¤èªk²ÕĶ»P³sµ² ( ¶À¦r¬O±zn¿é¤Jªº¡A¤£n§Ñ°O¨C¿é§¹¤@Ó«ü¥O«án«ö¡uEnter¡vÁä )¡G
Microsoft Windows [ª©¥» 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\wanker>jwasm [Enter] ¡÷°õ¦æ JWASM.BAT ( ¨£¦w±Æ JWASM ªºÀô¹Ò ) C:\Users\wanker>SET INCLUDE=C:\JWASM\INCLUDE; C:\Users\wanker>SET LIB=C:\JWASM\LIB; C:\Users\wanker>SET PATH=C:\JWASM;C:\ProgramData\Oracle\Java\javapath;C:\Windows \system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerSh ell\v1.0\ C:\Users\wanker>SET LINK=/SUBSYSTEM:WINDOWS /DEBUG C:\Users\wanker>E: E:\>cd E:\HomePage\SOURCE\WIN64 E:\HomePage\SOURCE\Win64>cd hellow [Enter] ¡÷¤Á´«¨ì hellow.asm ©Ò¦b¤l¥Ø¿ý E:\HomePage\SOURCE\Win64\HELLOW>jwasm -win64 -Zi hellow.asm [Enter] ¡÷²ÕĶ JWasm v2.12pre, Nov 27 2013, Masm-compatible assembler. Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. hellow.asm: 20 lines, 2 passes, 141 ms, 0 warnings, 0 errors E:\HomePage\SOURCE\Win64\HELLOW>link hellow.obj [Enter] ¡÷³sµ² Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /SUBSYSTEM:WINDOWS /DEBUG E:\HomePage\SOURCE\Win64\HELLOW> |
¨ì³oÓ¨BÆJ¡A±z¤w¸g±o¨ì HELLOW.EXE ¥i°õ¦æÀÉ¡A°õ¦æ«á¦p¥k¤W¹Ï¡C
¦b²ÕĶ¹Lµ{¤¤¡A©Ò¤Uªº«ü¥O¤¤¡A¦pªGnÀò±o 64 ¦ì¤¸ Windows ¨t²Îªºµ{¦¡¡A¡u-win64¡v¤£¯à¬Ù²¤¡F¦Ó¡u-Zi¡v«ü¥O¬O¬°¤F°£¿ù®É¡A¯àÅã¥Ü²Å¸¹¸ê®Æ¡A¦p¤£°£¿ù¥i¬Ù²¤¡C¦b¦¹¤p¤ì°¸¨Ï¥Î·L³nªº³sµ²µ{¦¡¡A¥i¥Ñ·L³n¡uWindows SDK for Windows Server 2008 and .NET Framework 3.5¡vªº¥úºÐ¼v¹³ÀÉùصѨú¥X¨Ó¡A¸Ô²Ó±¡§Î½Ð¾\Ū²Ä¹s³¹ªº»¡©ú¡C³sµ²®É¡A¦]¬°¦b JWASM.BAT ùؤw¸g³]©wÀô¹ÒÅܼơuLINK=/SUBSYSTEM:WINDOWS /DEBUG¡v¡A©Ò¥H¦b³sµ²®É¡A´N¤£»Ýn¦A¿é¤J¤@¦¸¡C¦pªGn»s§@ 32 ©Î 64 ¦ì¤¸ Windows ¨t²Îªºµ{¦¡¡A¡u/SUBSYSTEM:WINDOWS¡v¤£¯à¬Ù²¤¡F¦Ó¡u/DEBUG¡v«h¬O¨Ì¾Ú hellow.obj ªº¤º®e¡A»s§@ hellow.pdb¡A³oÓÀÉ®×¥i¨Ñ°£¿ù¾¹Åã¥Ü²Å¸¹¸ê®Æ¨Ï¥Î¡A¦pªG¤£»Ýn¡A¥i¬Ù²¤¡u/DEBUG¡v°Ñ¼Æ¡C
¬Ý¨£ HELLOW.ASM ªº²Ä 16¡B17 ¦æ¡AINVOKE ¤S¦^¨Ó¤F¡A¯u¬O°ª¿³¡I³o¤@¤Á³£nÂk¥\©ó«e½úªº§V¤O¡I¦b HELLOW.ASM ùتº²Ä 2 ¦æ¡A¡uOPTION WIN64:2¡v¬O©M¥H«e¦b Win32 ¤£¦Pªº¦a¤è¡C¦]¬° HELLOW.ASM ùØ¥u¦³¤@ӰƵ{¦¡¡A¦Ó¥B¨t²Î§â±±¨îÅv¥æµ¹ main ®É¡A¨S¦³°Ñ¼Æ¡A¦]¦¹¤£¶·§â¼È¦s°_¦s¤J°ïÅ|ùØ¡A©Ò¥H¡uOPTION WIN64:switch¡v¤¤¡Aswitch ªº¦ì¤¸ 0¡A³]¬° 0 §Y¥i¡C¦U¦ì¬Ý©x¡A±z·|µo²{¡A¥Î JWASM/HJWASM ¼¶¼g Win64 ²Õ¦X»y¨¥µ{¦¡¡A©M Win32 ´X¥G¬O¤@¼Ò¤@¼Ë¡C
©³¤U¨ÓÓ¸û¬°½ÆÂøªº Win64 µ{¦¡§a¡A¨º´N¬O¼g¤@Ӽзǵøµ¡¡Aµ{¦¡½X¦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 |
OPTION CASEMAP:NONE
OPTION WIN64:3
UNICODE EQU TRUE
INCLUDE WINDOWS.INC
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
;*************************************************************************************************************
.DATA
hInstance HINSTANCE ?
hwnd HWND ?
buffer DB 40h DUP (0)
;*************************************************************************************************************
.CONST
ClassName DW 53h,69h,6dh,70h,6ch,65h,57h,6eh,64h,43h,6ch,61h,73h,73h,0h ;SimpleWndClass
AppName DW 7d44h,5408h,8a9eh,8a00h,5f88h,597dh,73a9h,0ff01h,0h ;²Õ¦X»y¨¥«Ü¦nª±¡I
szFmt DW 60a8h,7684h,96fbh,8166h,5df2h,958bh,6a5fh,25h,75h,65e5h,25h ;±zªº¹q¸£¤w¶}¾÷%u¤é%
DW 75h,6642h,25h,75h,5206h,25h,75h,2eh,25h,75h,79d2h,0h ;u®É%u¤À%u.%u¬í
rect RECT <0,0,300,100>
;*************************************************************************************************************
.CODE
;-------------------------------------------------------------------------------------------------------------
;±q¶}¾÷¨ì°õ¦æHELLOW1¬°¤î¡A©Òªáªº®É¶¡°O¿ý¦bptString©Ò«üªº¦r¦êùØ¡Aªð¦^®É¡ARAX¡×ptString©Ò«üªº¦r¦êªø«×
get_time PROC ptString:LPSTR
LOCAL day:QWORD,hour:QWORD,minute:QWORD,sec:QWORD,msec:QWORD
call GetTickCount
xor rdx,rdx
mov r8,1000
div r8
mov msec,rdx ;²@¬í
mov r8,60
xor rdx,rdx
div r8
mov sec,rdx ;’
xor rdx,rdx
div r8
mov minute,rdx ;¤À
xor rdx,rdx
div r8
mov hour,rax ;¤p®É
xor rdx,rdx
mov r8,24
div r8
mov day,rdx ;¤é
INVOKE wsprintf,ptString,OFFSET szFmt,day,hour,minute,sec,msec
ret
get_time ENDP
;-------------------------------------------------------------------------------------------------------------
WndProc PROC hWnd:QWORD,uMsg:DWORD,wParam:QWORD,lParam:QWORD
LOCAL ps:PAINTSTRUCT
.IF uMsg==WM_PAINT
INVOKE BeginPaint,hWnd,ADDR ps
INVOKE get_time,OFFSET buffer
INVOKE DrawText,ps.hdc,OFFSET buffer,eax,OFFSET rect,DT_WORDBREAK
INVOKE EndPaint,hWnd,ADDR ps
.ELSEIF uMsg==WM_CLOSE
exit: INVOKE DestroyWindow,hWnd
.ELSEIF uMsg==WM_DESTROY
INVOKE PostQuitMessage,NULL
.ELSE
INVOKE DefWindowProc,rcx,edx,r8,r9
ret
.ENDIF
xor rax,rax
ret
WndProc ENDP
;-------------------------------------------------------------------------------------------------------------
main PROC
LOCAL wc:WNDCLASSEX
LOCAL msg:MSG
INVOKE GetModuleHandle,NULL
mov hInstance,rax
mov rdx,OFFSET ClassName
mov rcx,OFFSET WndProc
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc,rcx
mov wc.cbClsExtra,NULL
mov wc.cbWndExtra,NULL
mov wc.hInstance,rax
mov wc.lpszClassName,rdx
INVOKE GetStockObject,COLOR_BTNFACE
mov wc.hbrBackground,rax
mov wc.lpszMenuName,NULL
INVOKE LoadIcon,NULL,IDI_APPLICATION
mov wc.hIcon,rax
mov wc.hIconSm,rax
INVOKE LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,rax
INVOKE RegisterClassEx,ADDR wc
INVOKE CreateWindowEx,0,OFFSET ClassName,OFFSET AppName,WS_OVERLAPPEDWINDOW,350,600,300,\
100,0,0,hInstance,0
mov hwnd,rax
INVOKE ShowWindow,hwnd,SW_SHOWNORMAL
INVOKE UpdateWindow,hwnd
.WHILE TRUE
INVOKE GetMessage,ADDR msg,0,0,0
.BREAK .IF !eax
INVOKE TranslateMessage,ADDR msg
INVOKE DispatchMessage,ADDR msg
.ENDW
mov rax,msg.wParam
INVOKE ExitProcess,eax
main ENDP
;*************************************************************************************************************
END main |
²ÕĶªº¤èªk¦b©³¤U¡A¦Ó¥kÃä«h¬O°õ¦æ®Éªºµe±¡C
E:\HomePage\SOURCE\Win64\HELLOW>jwasm -win64 hellow1.asm [Enter] JWasm v2.12pre, Nov 27 2013, Masm-compatible assembler. Portions Copyright (c) 1992-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. hellow1.asm: 112 lines, 3 passes, 140 ms, 0 warnings, 0 errors E:\HomePage\SOURCE\Win64\HELLOW>link hellow1.obj [Enter] Microsoft (R) Incremental Linker Version 9.00.21022.08 Copyright (C) Microsoft Corporation. All rights reserved. /SUBSYSTEM:WINDOWS /DEBUG E:\HomePage\SOURCE\Win64\HELLOW> |
µ{¦¡ªº²Ä 2 ¦æ¡A¡uOPTION WIN64:3¡v¤¤¡A¡u3¡vªí¥Ü¤F²Ä 0¡B1 ¦ì¤¸§¡¬° 1¡A¦Ó²Ä 0 ¦ì¤¸¥NªíµÛ JWASM ²ÕĶ®É¡A·|¦Û°Ê§â°Æµ{¦¡©Ò¨Ï¥Îªº°Ñ¼Æ¼È¦s¾¹«O¦s¦b°ïÅ|ùØ¡C¦b HELLOW1 ùØ¡A¦³¨âӰƵ{¦¡¡A¤@¬O get_time¡A¥t¤@Ó¬Oµøµ¡¨ç¦¡¡AWndProc¡C¥Hµøµ¡¨ç¦¡¬°¨Ò¡A¦b¶i¤J WndProc «á¡A³Ì«e±ªº¥|¹D«ü¥O¬O¡G
00000001`400010c7 48894c2408 mov qword ptr [rsp+8],rcx 00000001`400010cc 4889542410 mov qword ptr [rsp+10h],rdx 00000001`400010d1 4c89442418 mov qword ptr [rsp+18h],r8 00000001`400010d6 4c894c2420 mov qword ptr [rsp+20h],r9
ÁöµM¦b HELLOW1.ASM ªºì©lµ{¦¡¤¤¨S¦³¼g¥X¨Ó¡A¦ý¬O±z¥i¥H¥Ñ Windbg ¸ü¤J HELLOW1.EXE Æ[¹î¡A±o¨ì½T»{¡C³o¥|¹D«ü¥O´N¬O¡uOPTION WIN64:switch¡v¤¤¡Aswitch ªº²Ä 0 ¦ì¤¸¬° 1 ®É¡AJWASM ²ÕĶ¦Û°Ê¥[¤W¥hªº¡C¦pªG¨Ï switch ªº²Ä 0 ¦ì¤¸¬° 0¡AJWASM ´N¤£·|¦Û¦æ¥[¤W³o¥|¹D«ü¥O¡A°£«D¦bì©lµ{¦¡¤¤¼g¤W¥h¡A§_«h¦b²Ä 54¡B57¡B60 ¦æ©I¥s WIN64 API ®É¡A¦]¬° hWnd ¨S¦³«ü©w¡A´N·|µo¥Í¿ù»~¡C¦P¼Ëªº¡Aget_time °Æµ{¦¡ªº²Ä¤@¹D«ü¥O¡A¤]¬O JWASM ¦Û¦æ¥[¤W¥hªº¡A
00000001`40001030 48894c2408 mov qword ptr [rsp+8],rcx
³o¬O¦]¬° get_time ¥u¦³¤@ӰѼơA©Ò¥H¥u¥[¤W¤@±ø«ü¥O¦Ó¤w¡C
±µ¤U¨Ó¡A²Ä 4 ¦æ¬O¡uUNICODE EQU TRUE¡v¡A³o¹D«ü¥O¬O«ü¥Ü JWASM ©Ò¼¶¼gªºµ{¦¡¦b©I¥s WIN64 API ®É¡A¬O©I¥s¼e¦r¤¸ª©ªº API¡C¨Æ¹ê¤W¡AWin32/64 API ¥]§t¨âºØª©¥»ªº API¡AANSI ª©»P UNICODE ª©¡C¨ºµ{¦¡©I¥s API ®É¡An«ç»ò§PÂ_©O¡H¨ä¹ê¦b¡uInclude\winuser.inc¡vùØ¡A¦³´X¦æ¹³¤U±ªº±Ôz
@DefProto WINUSERAPI, wsprintfA, c, , <:LPSTR, :LPSTR, :VARARG> @DefProto WINUSERAPI, wsprintfW, c, , <:LPWSTR, :LPWSTR, :VARARG> ifdef UNICODE wsprintf EQU <wsprintfW> else wsprintf EQU <wsprintfA>
©Ò¥H¥un¦bì©lµ{¦¡ªº«e±¡A©w¸q¡uUNICODE EQU TRUE¡v¡A´N¯à¨Ï¥Î¸U°ê½X¡A©I¥s Win API ®É¡A´N¬O©I¥s UNICODE ª©ªº API¡C¦pªG¨Ï¥Î¸U°ê½X¡A¨º»ò¤¤¤å¦r´N±o¥H¸U°ê½X½s½X¡C¦]¦¹ HELLOW1.ASM ªº²Ä 17¡ã20 ¦æªº¦r¦ê¡A¥þ¥H¸U°ê½X½s½X¡C¨ì¥Ø«e¬°¤î¡AJWASM ²ÕĶ¾¹¦ü¥GÁÙ¨SÅ¥»¡¤ä´©¸U°ê½X½s½Xªºì©lµ{¦¡¡A¦ý¬O³o¨Ã¤£¬O¤Ó¤jªº°ÝÃD¡C¤p¤ì°¸¤w¦b Win32 ²Õ¦X»y¨¥ªº²Ä 28 ³¹¼g¤F¤@Ó A2U µ{¦¡¡A¥i¥H§â ANSI/ASCII/Big 5 ½XÂà´«¦¨¸U°ê½X¡C
«e±´£¹L¡AWinInc ªº WINDOWS.INC §â Win32/64 ªº±`¼Æ¡BAPI 쫬µ¥©w¸q¤Àªù§OÃþªºÂkÃþ¡A·í©I¥s¬YÓ WIN32/64 API ®É¡A¯à¦Û°Ê¸ü¤J¡A©Ò¥H¥u»Ý¦b HELLOW1.ASM ¥]§t¤@Ó WINDOWS.INC ÀÉ®×´N¥i¥H¤F¡A¤£¥²¦A¼g¡uINCLUDE GDI32.INC¡v³o¼Ëªº±Ôz¡A«Ü¤è«K²¼ä¡A¨£ HELLOW1.ASM ªº²Ä 6 ¦æ¡C·íµM¨ä¥Lªº¶×¤Jµ{¦¡®wÁÙ¬O±o¤@Ó¤@Ó¥]§t¶i¨Ó¡AµLªk¬Ù²¤¡C
¦b ML64.EXE ªº»yªkùبS¦³¶i¤JÂI¡A©Ò¥Hì©lµ{¦¡ªº³Ì«á¤@¦æ¥u¯à¼g¡uEND¡v¦Ó¤w¡A¦Ó¦b©R¥O´£¥Ü¦r¤¸°õ¦æ ML64.EXE ®É¡A¥H¡u/entry:¡v°Ñ¼Æ«ü©w¶i¤JÂI¡C¦ý¬O JWASM ³Ì«á¤@¦æ¥i¥H¥Î¡uEND entry¡v«ü©w entry ¬°¶i¤JÂI¡A¸û¬°¶Kªñ MASM 6.x ªº»yªk¡A¨£ HELLOW1.ASM ªº 112 ¦æ¡C
¦b WIN64 ¨t²Î¤¤¡A«Ø¥ß¼Ð·Çµøµ¡ªº¤èªk»P WIN32 ¤@¼Ë¡Cº¥ýn©I¥s RegisterClassEx¡A«Ø¥ßµøµ¡Ãþ§O¡A¨£ HELLOW1.ASM ªº²Ä 76¡ã95 ¦æ¡C¦V§@·~µù¥Uµøµ¡Ãþ§O§¹¦¨«á¡A¦A¥H¦¹µøµ¡Ãþ§Oªº¦WºÙ¡A©I¥s CreateWindowEx «Ø¥ßµøµ¡¡AµM«áÅã¥Üµøµ¡¡C³Ì«á¶i¤JµL½aªº°T®§°j°é¤º¡A¥HÀò¨ú°T®§¡C
³B²z°T®§ªº¬Oµøµ¡¨ç¦¡¡A¦b HELLOW1.ASM µ{¦¡ùØ¡A¥¦¬O¤@ÓºÙ¬° WndProc ªº°Æµ{¦¡¡A¨£²Ä 51¡ã71 ¦æ¡Cµøµ¡¨ç¦¡¨Ã¤£»Ýn³B²z©Ò¦³ªº°T®§¡A¥u³B²zµ{¦¡n°µ©ÎªÌÃö¤ßªºªº°T®§¡A¤j³¡¤Àªº°T®§³£¥æ¥Ñ DefWindowProc ³B²z¡A¨£²Ä 66 ¦æ¡C¦ý¦³Â÷¶}¦ÓÃö³¬µ{¦¡ªº¨âÓ°T®§¡A¤j·§¬OµLªkÁקK¡A¤@©w±o³B²z¡C³o¨âÓ°T®§¬O WM_CLOSE ©M WM_DESTROY¡C¦]¦¹¡A¤@¯ë¦Ó¨¥¡Aµøµ¡¨ç¦¡ªø±o¹³¤U±ªº¼Ë¤l¡A±z¥i¥H§â¥¦·í§@¬Oµøµ¡¨ç¦¡ªº¼ËªO¡A¥Î¨ì®É¥Î½Æ»s¶K¤Wªº¤èªk¼¶¼g¡A«Ü¤è«K¡C
1 2 3 4
5 6 7 8
9 10 11 12 13
14 15 16 17 18
19 20 21 22 |
WndProc PROC hWnd:QWORD,uMsg:DWORD,wParam:QWORD,lParam:QWORD
.IF uMsg==WM_XXX
;³B²z WM_XXX ªºµ{¦¡½X
.ELSEIF uMsg==WM_YYY
;³B²z WM_YYY ªºµ{¦¡½X
... ... ...
.ELSEIF uMsg==WM_CLOSE
exit: INVOKE DestroyWindow,hWnd
.ELSEIF uMsg==WM_DESTROY
INVOKE PostQuitMessage,NULL
.ELSE
INVOKE DefWindowProc,rcx,edx,r8,r9
ret
.ENDIF
xor rax,rax
ret
WndProc ENDP |
µøµ¡¨ç¦¡ªº¥|ӰѼÆùØ¡A¥u¦³ uMsg ¬O 32 ¦ì¤¸ªø¡A¦b°ïÅ|¤¤¡A¤´µMn¦û¥Î 64 ¦ì¤¸ªº¤j¤p¡A¦ý¬O¸û°ª¦ì§}ªºÂù¦r²Õ¬O¨S¦³¥Î¨ìªº¡C¤W±ªº¼ËªO¡A¥²¶·°t¦X¡uOPTION WIN64:3¡v¡A¨Ï¦Û°Ê§â RCX¡BRDX¡BR8¡BR9 «O¦s¦b°ïÅ|ùØ¡A¨Ã¦Û°Ê¤À°t©I¥s°Æµ{¦¡®Éªº°ïÅ|®Ø¡C§_«h¡A¨ì©I¥s DestroyWindow¡BPostQuitMessage ®É¡A¥²²£¥Í¿ù»~¡A¦]¬°¦b°ïÅ|ùتº hWnd °Ñ¼Æ¬O¿ù»~ªº¸ê®Æ¡C
¦b x64 ²Õ¦X»y¨¥ùØ¡AµLªk§â 64 ¦ì¤¸¤j¤pªº¥ß§YȦs¤J 64 ¦ì¤¸ªøªº°O¾ÐÅéÅܼƤº¡F¥u¯à§â 32 ¦ì¤¸¤j¤pªº¥ß§YȦs¤J 64 ¦ì¤¸ªøªº°O¾ÐÅéÅܼÆùØ¡C¨Ò¦p©³¤Uªº¨Ò¤l¡G
x DQ ? ;x¬° 64 ¦ì¤¸ªøªºÅÜ¼Æ szStr DB "This is a dog.",0 mov x,4294967296 ;³o¬O¿ù»~ªº¥Îªk¡A¦]¬° 232¡×4294967296 mov x,4294967295 ;³o¬O¥¿½Tªº¥Îªk
¦b WIN64 ¨t²Î¤¤¡A¦ì§}¬O¥H 64 ¦ì¤¸ªø«×ªí¥Ü¡A§Y¨Ï¬O¸û°ªªº¦r²Õ©ÎÂù¦r²Õ¬O 0¡A¦ý¬O¤´¬O 64 ¦ì¤¸ªº¼ÆÈ¡A¦]¦¹¹³¤U±ªº»yªk¡A¤]¬O¤£¦Xªkªº¡G
mov x,OFFSET szStr
³o¬q¤é¤l¡A¤p¤ì°¸¨Ï¥Î JWASM ¥h²ÕĶ WIN64 µ{¦¡¡Aµoı¤ñ ML64 ¤è«K¦n¥Î±o¦h¡A¥¿§V¤O±´¯Á³oÓ²ÕĶ¾¹¡C§Ú·Q¤µ«á¡A¤j·§³£·|¨Ï¥Î³oÓ²ÕĶ¾¹¤F§a¡I