「ASM/vprint」の編集履歴(バックアップ)一覧はこちら
ASM/vprint - (2020/10/21 (水) 11:40:59) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
|開発環境|Microsoft Visual Studio Community 2019|
|実行環境|Microsoft Windows 10 Home (64bit)|
|プロジェクト テンプレート|空のプロジェクト(C++)|
|プロジェクト名|vprint|
#table_zebra(t,#fee,#eef)
**asmファイルの追加
vprint.asm
#highlight(asm){{
.model flat, c
NULL equ 0
STD_OUTPUT_HANDLE equ -11
ExitProcess proto stdcall :dword
GetStdHandle proto stdcall :dword
WriteConsoleA proto stdcall :dword, :ptr, :dword, :ptr, :ptr
wvsprintfA proto stdcall :ptr, :ptr, :ptr
debug proto c :ptr, :vararg
.data
fmt1 byte '0x%X (%d)', 0ah, 0
fmt2 byte '%s %d %c', 0ah, 0
msg byte 'hello', 0
.data?
hConsole dword ?
.code
start proc
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConsole, eax
invoke debug, addr fmt1, 123, 456
invoke debug, addr fmt2, addr msg, 42, '%'
invoke ExitProcess, 0
ret
start endp
debug proc fmt:ptr, va:vararg
local written:dword
local buf[1024]:byte
invoke wvsprintfA, addr buf, fmt, addr va
mov edx, eax ; len
invoke WriteConsoleA, hConsole, addr buf, edx, addr written, NULL
ret
debug endp
end start
}}
**ビルド
・リンカー
|システム|サブシステム|コンソール (/SUBSYSTEM:CONSOLE)|
#table_zebra(t,#fee,#eef)
**実行
&image(startup.png)
|開発環境|Microsoft Visual Studio Community 2019|
|実行環境|Microsoft Windows 10 Home (64bit)|
|プロジェクト テンプレート|空のプロジェクト(C++)|
|プロジェクト名|vprint|
#table_zebra(t,#fee,#eef)
**asmファイルの追加
vprint.asm
#highlight(asm){{
.model flat, c
NULL equ 0
STD_OUTPUT_HANDLE equ -11
ExitProcess proto stdcall :dword
GetStdHandle proto stdcall :dword
WriteConsoleA proto stdcall :dword, :ptr, :dword, :ptr, :ptr
wvsprintfA proto stdcall :ptr, :ptr, :ptr
debug proto c :ptr, :vararg
.data
fmt1 byte '0x%X (%d)', 0ah, 0
fmt2 byte '%s %d %c', 0ah, 0
msg byte 'hello', 0
.data?
hConsole dword ?
.code
start proc
invoke GetStdHandle, STD_OUTPUT_HANDLE
mov hConsole, eax
invoke debug, addr fmt1, 123, 456
invoke debug, addr fmt2, addr msg, 42, '%'
invoke ExitProcess, 0
ret
start endp
debug proc fmt:ptr, va:vararg
local written:dword
local buf[1024]:byte
invoke wvsprintfA, addr buf, fmt, addr va
mov edx, eax ; len
invoke WriteConsoleA, hConsole, addr buf, edx, addr written, NULL
ret
debug endp
end start
}}
**ビルド
・リンカー
|システム|サブシステム|コンソール (/SUBSYSTEM:CONSOLE)|
#table_zebra(t,#fee,#eef)
**実行
&image(vprint.png)