MSG 00018
MSG 00018
MSG 00018
********************************************************
ml64.exe can be found in many of Microsoft's SDKs.
C:\Asm\MASM\hello>type hello.asm
; File: hello.asm
; Public domain 2008 James Van Buskirk
EXTRN GetStdHandle: PROC
EXTRN WriteFile: PROC
EXTRN ExitProcess: PROC
STD_OUTPUT_HANDLE EQU 11
nNumberOfBytesToWrite EQU Buffer_End Buffer
TEXT SEGMENT PARA READ EXECUTE "CODE"
PUBLIC start
start:
sub rsp, 40
mov rcx, STD_OUTPUT_HANDLE
call GetStdHandle
mov rcx, rax
mov rdx, OFFSET Buffer
mov r8d, nNumberOfBytesToWrite
mov r9, OFFSET NumberOfBytesWritten
xor eax, eax
mov [rsp+32], rax
call WriteFile
xor ecx, ecx
call ExitProcess
TEXT ENDS
XDATA SEGMENT PARA READ WRITE "DATA"
Buffer db "Hello, world!", 0dh, 0ah
Re: Free assembler for x8664bit processors
C:\Asm\MASM\hello>hello
Hello, world!
********************************************************
YASM http://www.tortall.net/projects/yasm/
C:\Asm\YASM\hello>type hello.asm
extern GetStdHandle
extern WriteFile
extern ExitProcess
[SECTION .data]
align 32
NumberOfBytesWritten:
dd 0
Buffer:
db 'Hello, world!', 0dh, 0ah
nNumberOfBytesToWrite EQU $Buffer
[SECTION .text]
global _MAIN__
_MAIN__:
sub rsp, 40
mov ecx, 11
call GetStdHandle
mov rcx, rax
mov rdx, Buffer
mov r8d, nNumberOfBytesToWrite
mov r9, NumberOfBytesWritten
xor eax, eax
mov [rsp+32], rax
call WriteFile
Re: Free assembler for x8664bit processors
C:\Asm\YASM\hello>hello
Hello, world!
********************************************************
NASM http://nasm.sourceforge.net/
C:\Asm\NASM\hello>type hello.asm
extern GetStdHandle
extern WriteFile
extern ExitProcess
[SECTION .data]
align 32
nNumberOfBytesWritten:
dd 0
Buffer:
db 'Hello, world!', 0dh, 0ah
nNumberOfBytesToWrite EQU $Buffer
[SECTION .text]
global _MAIN__
_MAIN__:
sub rsp, 40
mov ecx, 11
call GetStdHandle
mov rcx, rax
mov rdx, Buffer
mov r8d, nNumberOfBytesToWrite
mov r9, nNumberOfBytesWritten
xor eax, eax
mov [rsp+32], rax
call WriteFile
xor ecx, ecx
call ExitProcess
C:\Asm\NASM\hello>nasm f win64 hello.asm
C:\Asm\NASM\hello>link hello.obj /subsystem:console /entry:_MAIN__
/defaultlib:k
ernel32.lib
Re: Free assembler for x8664bit processors
C:\Asm\NASM\hello>hello
Hello, world!
********************************************************
GoAsm http://www.jorgon.freeserve.co.uk/
C:\Asm\GoAsm\hello>type hello.asm
DATA SECTION
ALIGN 16
nNumberOfBytesWritten DD 0
Buffer DB 'Hello, world!', 0DH, 0AH
Buffer_end:
nNumberOfBytesToWrite EQU Buffer_endBuffer
CODE SECTION
START:
SUB rsp, 40
MOV ecx, 11
CALL GetStdHandle
MOV rcx, rax
MOV rdx, OFFSET Buffer
MOV r8d, nNumberOfBytesToWrite
MOV r9, OFFSET nNumberOfBytesWritten
XOR eax, eax
MOV [rsp+32], rax
CALL WriteFile
XOR ecx, ecx
CALL ExitProcess
C:\Asm\GoAsm\hello>GoAsm /x64 hello.asm
GoAsm.Exe Version 0.56.4d Copyright Jeremy Gordon 2001/8 JG@xxxxxxxxxxx
Output file: hello.obj
C:\Asm\GoAsm\hello>golink /console hello.obj kernel32.dll
GoLink.Exe Version 0.26.9d Copyright Jeremy Gordon 2002/8JG@xxxxxxxxxxx
Output file: hello.exe
Format: X64 size: 2,048 bytes
C:\Asm\GoAsm\hello>hello
Hello, world!
********************************************************
POASM http://www.smorgasbordet.com/pellesc/
C:\Asm\POASM\hello>type hello.asm
Re: Free assembler for x8664bit processors
C:\Asm\FASM\hello>hello
Hello, world!