NASM Forum > Programming with NASM

Problem with x64 program

(1/1)

namespace:
Hello!

I'm beginner in nasm.
I have a x86 program:

--- Code: ---   
global main
extern printf

    section .data
fmt:  db "a=%e",10,0
a:    dq 0x1.1p+32

   section .text

main:
   push dword [a+4]
   push dword [a]
   push  dword fmt
   call printf
   add esp,12
   ret

--- End code ---

When I tried to compile on x64 NASM i have got a problem:

--- Code: ---prog.asm:11: error: instruction not supported in 64-bit mode
prog.asm:12: error: instruction not supported in 64-bit mode

--- End code ---

Does anyone know what I have to change in this program to compile on x64?

Frank Kotler:
Well, "push qword"... but you probably don't want to do that. They've changed the game! Take a look here:

http://www.vikaskumar.org/amd64/index.htm

Or the NASMX package might help you out...

I'm still running 32-bit hardware, so I can't help you much...

Best,
Frank

Keith Kanios:
Jeremy Gordon, the author of GoAsm, has a pretty decent summary of Writing 64-bit programs with emphasis on low-level details.

However, if you are merely trying to assemble/run a 32-bit program on 64-bit Windows, then use -f win32 instead of -f win64 and link accordingly.

Navigation

[0] Message Index

Go to full version