Vous êtes sur la page 1sur 7

Re: Free assembler for x8664bit processors

Re: Free assembler for x8664bit processors


Source: http://coding.derkeiler.com/Archive/Assembler/alt.lang.asm/200806/msg00018.html

From: "James Van Buskirk" <not_valid@xxxxxxxxxxx>


Date: Mon, 2 Jun 2008 17:56:52 0600
<pickett.aaron@xxxxxxxxx> wrote in message
news:2765e16aeb734fe8926ad1b255b1c424@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Where can i get a assembler for the x8664bit family? free?

********************************************************
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

Re: Free assembler for x8664bit processors


Buffer_End:
ALIGN 4
NumberOfBytesWritten dd ?
XDATA ENDS
END
C:\Asm\MASM\hello>ml64 c hello.asm
Microsoft (R) Macro Assembler (AMD64) Version 8.00.40310.39
Copyright (C) Microsoft Corporation. All rights reserved.
Assembling: hello.asm
C:\Asm\MASM\hello>link hello.obj /subsystem:console /defaultlib:kernel32.lib
/en
try:start
Microsoft (R) Incremental Linker Version 8.00.40310.39
Copyright (C) Microsoft Corporation. All rights reserved.

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

Re: Free assembler for x8664bit processors


xor ecx, ecx
call ExitProcess
C:\Asm\YASM\hello>yasm0.7.1win64 f x64 hello.asm
C:\Asm\YASM\hello>link hello.obj /subsystem:console /entry:_MAIN__
/defaultlib:k
ernel32
Microsoft (R) Incremental Linker Version 8.00.40310.39
Copyright (C) Microsoft Corporation. All rights reserved.

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

Re: Free assembler for x8664bit processors


Microsoft (R) Incremental Linker Version 8.00.40310.39
Copyright (C) Microsoft Corporation. All rights reserved.

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

Re: Free assembler for x8664bit processors


; File: hello.asm
; Public domain 2008 James Van Buskirk
; Assemble, link, and run sequence:
; POASM /AAMD64 hello
; polink /subsystem:CONSOLE /defaultlib:kernel32.lib hello.obj
; hello
..MODEL Flat,FASTCALL
;.CORE ; Not clear why this doesn't work
STD_OUTPUT_HANDLE EQU 11
nNumberOfBytesToWrite EQU Buffer_End Buffer
..text SEGMENT PARA FLAT READ EXECUTE "CODE"
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 FLAT READ WRITE "DATA"
Buffer db "Hello, world!", 0dh, 0ah
Buffer_End:
ALIGN 4
NumberOfBytesWritten dd ?
..xdata ENDS
END start
C:\Asm\POASM\hello>POASM /AAMD64 hello
C:\Asm\POASM\hello>polink /subsystem:CONSOLE /defaultlib:kernel32.lib
hello.obj
C:\Asm\POASM\hello>hello
Hello, world!
********************************************************
GAS can be found many places, e.g.
http://sourceforge.net/projects/mingww64/
http://www.equation.com

Re: Free assembler for x8664bit processors

Re: Free assembler for x8664bit processors


C:\Asm\GAS\hello>type hello.s
.data
.align 32
nNumberOfBytesWritten:
.long 0
Buffer:
.ascii "Hello, world!\n"
# nNumberOfBytesToWrite = 15
.ascii "\0"
.text
..globl _MAIN__
_MAIN__:
subq $40, %rsp
movl $11, %ecx
call _GetStdHandle
movq %rax, %rcx
leaq Buffer(%rip), %rdx
# movl nNumberOfBytesToWrite, %r8d
movl $15, %r8d
leaq nNumberOfBytesWritten(%rip), %r9
xorl %eax, %eax
movq %rax, 32(%rsp)
call _WriteFile
xorl %ecx, %ecx
call _ExitProcess
C:\Asm\GAS\hello>as hello.s ohello.o
C:\Asm\GAS\hello>ld hello.o lkernel32 o hello.exe
C:\Asm\GAS\hello>hello
Hello, world!
********************************************************
FASM http://flatassembler.net/
C:\Asm\FASM\hello>type hello.asm
format MS64 coff
extrn GetStdHandle
extrn ExitProcess
extrn WriteFile
STD_OUTPUT_HANDLE = 11
section 'CODE' code readable executable align 16
align 16
public _main
_main:
sub rsp, 40
mov ecx, STD_OUTPUT_HANDLE
call GetStdHandle
Re: Free assembler for x8664bit processors

Re: Free assembler for x8664bit processors


mov rcx, rax
mov rdx, Buffer
mov r8d, nNumberOfBytesToWrite
mov r9, lpNumberOfCharsWritten
mov qword[rsp+32], 0
call WriteFile
xor ecx, ecx
call ExitProcess
section 'DATA' data readable writeable align 16
Buffer db 'Hello, world!', 0dh, 0ah
nNumberOfBytesToWrite = $Buffer
align 4
lpNumberOfCharsWritten dd ?
C:\Asm\FASM\hello>fasm hello.asm
flat assembler version 1.67.18 (1276893 kilobytes memory)
3 passes, 381 bytes.
C:\Asm\FASM\hello>link hello.obj /entry:_main /subsystem:console
/defaultlib:ker
nel32.lib
Microsoft (R) Incremental Linker Version 8.00.40310.39
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Asm\FASM\hello>hello
Hello, world!

write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D85, &


6.0134700243160014d154/),(/'x'/)); end

Re: Free assembler for x8664bit processors

Vous aimerez peut-être aussi