開発環境 Microsoft Visual Studio Community 2017
実行環境 Microsoft Windows 10 Home (64bit)

参考

  • 任意のディレクトリを用意する(例 C:\Projects\masm64\hello64c)

hello64c.asm
comment *
	hello64c.asm for ML64
 
ml64 /c /Fl hello64c.asm
link /entry:start /subsystem:windows hello64c
*
 
extern ExitProcess: proc
extern MessageBoxA: proc
 
includelib kernel32.lib
includelib user32.lib
 
.const
caption db "hello64",0
message db "hello, world",0
 
.code
start proc
	sub rsp, 28h
	mov rcx, 0
	lea rdx, message
	lea r8, caption
	mov r9, 0
	call MessageBoxA
	mov ecx, eax
	call ExitProcess
start endp
 
end
 

dev.bat
path %path%;"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\Hostx64\x64"
set lib="C:\Program Files (x86)\Windows Kits\10\Lib\10.0.16299.0\um\x64"
cmd
 

  • dev.batを実行し、アセンブル・リンクを行う。


hello64c.lst
Microsoft (R) Macro Assembler (x64) Version 14.11.25547.0   11/03/17 09:58:49
hello64c.asm						     Page 1 - 1
 
 
				comment *
					hello64c.asm for ML64
 
				ml64 /c /Fl hello64c.asm
				link /entry:start /subsystem:windows hello64c
				*
 
				extern ExitProcess: proc
				extern MessageBoxA: proc
 
				includelib kernel32.lib
				includelib user32.lib
 
 00000000			.const
 00000000 68 65 6C 6C 6F	caption db "hello64",0
	   36 34 00
 00000008 68 65 6C 6C 6F	message db "hello, world",0
	   2C 20 77 6F 72
	   6C 64 00
 
 00000000			.code
 00000000			start proc
 00000000  48/ 83 EC 28			sub rsp, 28h
 00000004  48/ C7 C1			mov rcx, 0
	   00000000
 0000000B  48/ 8D 15			lea rdx, message
	   00000008 R
 00000012  4C/ 8D 05			lea r8, caption
	   00000000 R
 00000019  49/ C7 C1			mov r9, 0
	   00000000
 00000020  E8 00000000 E		call MessageBoxA
 00000025  8B C8			mov ecx, eax
 00000027  E8 00000000 E		call ExitProcess
 0000002C			start endp
 
				end
 
 
Microsoft (R) Macro Assembler (x64) Version 14.11.25547.0   11/03/17 09:58:49
hello64c.asm						     Symbols 2 - 1
 
 
 
 
Segments:
 
                N a m e                  Length   Align   Class
 
CONST  . . . . . . . . . . . . .	 00000015 16	  'CONST'	 ReadOnly
 
 
Procedures, parameters, and locals:
 
                N a m e                 Type     Value    Attr
 
start  . . . . . . . . . . . . .	P 	 00000000 _TEXT	Length= 0000002C Public
 
 
Symbols:
 
                N a m e                 Type     Value    Attr
 
ExitProcess  . . . . . . . . . .	L 	 00000000 External
MessageBoxA  . . . . . . . . . .	L 	 00000000 External
caption  . . . . . . . . . . . .	Byte	 00000000 CONST	
message  . . . . . . . . . . . .	Byte	 00000008 CONST	
 
	   0 Warnings
	   0 Errors
 
最終更新:2017年11月07日 21:04
添付ファイル