Created
September 24, 2016 11:50
-
-
Save ncatlin/b839012c3a364deaec08d6af401fe7b0 to your computer and use it in GitHub Desktop.
hello world assembly code used for graph layout illustration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _main | |
extern _GetStdHandle@4 | |
extern _WriteFile@20 | |
extern _ExitProcess@4 | |
section .text | |
_main: | |
; DWORD bytes; | |
mov ebp, esp | |
sub esp, 4 | |
jmp stuff | |
writestd: | |
; 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 | |
ret | |
stuff: | |
call writestd | |
call writestd | |
; ExitProcess(0) | |
push 0 | |
call _ExitProcess@4 | |
; never here | |
hlt | |
message: | |
db 'Hello, World', 10 | |
message_end: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment