I am trying to re-learn assembly. I have been trying to find a tutorial for assembling a program using NASM on Windows, on a CPU with the x86_64 architecture. I have been unable to make any of the provided examples work.

I am asking to be provided:

  • A piece of code to assemble. The resulting program should output a message into the CLI.
  • CLI commands to make an object file and to do linkage of that into an executable file.

This should preferably be done using NASM, on Windows, on x86_64 architecture, but I’m at my wit’s end at this point, so I guess I will be fine with another assembler.

I intend to analyze the example and to use this as a starting point in my process of getting back into assembly.

  • Tomorrow_Farewell [any, they/them]@hexbear.netOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    28 days ago

    Sadly, this doesn’t work. When trying to link the object file, I get a bunch of errors:

    i386 architecture of input file `test.obj' is incompatible with i386:x86-64 output
    test.obj:test.asm:(.text+0x6): undefined reference to `_printf'
    undefined reference to `WinMain'
    collect2.exe: error: ld returned 1 exit status
    

    I currently do not have the time to debug this.