開発環境 |
Microsoft Visual Studio Community 2019 |
実行環境 |
Microsoft Windows 10 Home (64bit) |
プロジェクトの作成
メニューから[ファイル]-[新規作成]-[プロジェクト]を選択。
プロジェクト テンプレート |
空のプロジェクト(C++) |
プロジェクト名 |
hello2019 |
asmファイルの追加
プロジェクトのディレクトリにhello2019.asmという空のファイルを作る。
メニューから[プロジェクト]-[既存の項目の追加]を選択。
.model flat, c
NULL equ 0
MB_OK equ 0
ExitProcess proto stdcall, :dword
MessageBoxA proto stdcall, :dword, :dword, :dword, :dword
.data
caption byte "ハロー", 0
text byte "hello, world", 0
.code
main proc
invoke MessageBoxA, NULL, addr text, addr caption, MB_OK
invoke ExitProcess, 0
main endp
end main
ビルドのカスタマイズ
ソリューション エクスプローラーのプロジェクト(hello2019)を右クリックし、[ビルドの依存関係]-[ビルドのカスタマイズ]を選択。
masm(.targets, .props)にチェックを付ける。
hello2019.asmを右クリックし、[プロパティ]を選択。
項目の種類 |
Microsoft Macro Assembler |
ビルド
ツールバーの項目を設定。
ソリューション構成 |
Release |
ソリューション プラットフォーム |
x86 |
メニューから[プロジェクト]-[プロパティ]を選択。
システム |
サブシステム |
Windows (/SUBSYSTEM:WINDOWS) |
最適化 |
リンク時のコード生成 |
(削除) |
- Microsoft Macro Assembler
Listing File |
List All Available Information |
はい (/Sa) |
|
Assembled Code Listing File |
$(IntDir)%(FileName) |
Advanced |
Use Safe Exception Handlers |
はい (/safeseh) |
メニューから[ビルド]-[ソリューションのビルド]を選択。(Ctrl+Shift+B)
hello2019.lst からの抜粋
.
.model flat, c
= 00000000 NULL equ 0
= 00000000 MB_OK equ 0
ExitProcess proto stdcall, :dword
MessageBoxA proto stdcall, :dword, :dword, :dword, :dword
00000000 .data
00000000 83 6E 83 8D 81 caption byte "ハロー", 0
5B 00
00000007 68 65 6C 6C 6F text byte "hello, world", 0
2C 20 77 6F 72
6C 64 00
00000000 .code
00000000 main proc
invoke MessageBoxA, NULL, addr text, addr caption, MB_OK
00000000 6A 00 * push +000000000h
00000002 68 00000000 R * push OFFSET caption
00000007 68 00000007 R * push OFFSET text
0000000C 6A 00 * push +000000000h
0000000E E8 00000000 E * call MessageBoxA
invoke ExitProcess, 0
00000013 6A 00 * push +000000000h
00000015 E8 00000000 E * call ExitProcess
0000001A main endp
end main
実行
メニューから[デバッグ]-[デバッグなしで開始]を選択。(Ctrl+F5)
最終更新:2020年10月17日 10:40