0

I'm trying to kind of write my own x64 Hello world program in FASM on Windows I tried to rewrite this version: How to write to the console in fasm?, to a x64 program like this:

format PE64

entry start

include 'win64a.inc'

section '.code' code readable executable
start:
    push hello
    call [printf]
    pop rcx

    push 0
    call [ExitProcess]

section '.rdata' data readable
    hello db 'Hello world!', 10, 0

section '.idata' import data readable writeable
    library kernel,'KERNEL32.DLL', \
        msvcrt,'msvcrt.dll'
    import kernel, ExitProcess,'ExitProcess'
    import msvcrt, printf, 'printf'  

Now the problem is that this compiles fine, but when it is executed it doesn't print anything to the console.

Why does this not work, is printf of msvcrt silently incompatible with x64? Have I overseen something?

Can someone tell me how to rewrite this for it to actually print "Hello world!"?

Community
  • 1
  • 1
S.Klumpers
  • 410
  • 3
  • 14

0 Answers0