From 23e9a1160183815fd09b9a699b21f845ea291f7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=82=D0=B0=D1=81=20=D0=9C=D0=B8=D1=85=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2=20WindowsDesktop?= Date: Sat, 26 Dec 2020 11:49:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB?= =?UTF-8?q?=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 +++ main.asm | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .gitignore create mode 100644 main.asm diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50322ed --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vscode/tasks.json +main.obj +main.exe diff --git a/main.asm b/main.asm new file mode 100644 index 0000000..762e8b5 --- /dev/null +++ b/main.asm @@ -0,0 +1,34 @@ +global _main + extern _GetStdHandle@4 + extern _WriteFile@20 + extern _ExitProcess@4 + + section .text +_main: + ; DWORD bytes; + mov ebp, esp + sub esp, 4 + + ; hStdOut = GetstdHandle( STD_OUTPUT_HANDLE) + push -11 + call _GetStdHandle@4 + mov ebx, eax + + ; WriteFile( hstdOut, message, length(message), &bytes, 0); + push 0 + lea eax, [ebp-4] + push eax + push (message_end - message) + push message + push ebx + call _WriteFile@20 + + ; ExitProcess(0) + push 0 + call _ExitProcess@4 + + ; never here + hlt +message: + db 'Hello, World', 10 +message_end: \ No newline at end of file