I'm running Windows7 64 bit. I tried to turn the following two programs into .exe files with al.exe and I got the following error message.
C:\nasm>al filename.obj /target:exe /out:filename.exe /main:entry point
Microsoft (R) Assembly Linker version 9.0.30729.1
Copyright (C) Microsoft Corporation. All rights reserved.
ALINK: error AL1047: Error importing file 'path\filename' -- An
attempt was made to load a program with an incorrect format.
Here is the code.
global _main
extern GetStdHandle
extern WriteFile
extern ExitProcess
section .text
_main:
mov rcx, -11
call GetStdHandle
mov rcx, rax
mov rdx, message
mov r8, (message_end - message)
mov r9, BytesWritten
mov qword [rsp+8*4], 0
call WriteFile
mov rcx, 0
call ExitProcess
;variables
BytesWritten: dq 0
message: db "Hello world"
message_end:
and here is the other one.
global _start
extern _MessageBoxA@16
extern _ExitProcess@4
section code use32 class=code
_start:
push dword 0
push dword title
push dword banner
push dword 0
call _MessageBoxA@16
push dword 0
call _ExitProcess@4
section data use32 class=data
banner: db 'Hello, world!', 0
title: db 'Hello', 0
Solutions anyone?