10 Years
Discussion Span
Last Post by retsigir

Sorry for a late reply, I just recently joined. NASM 64-bit support was introduced by Keith Kanios, and revised by H. Peter Anvin. Just about all the recent versions you get are fully 64 bit compliant with the exception of the MS/DOS build (afair).

The 64 bit general purpose registers have been given the designation r?x for example, rax, rbx, rcx and so on. The extended registers begin with r[8-15] then are followed with an optional size designation for byte and dword sized variables. Examples include R8B, R9D, and R15. Here are a few simple mov instructions for you to get the idea:

; Set several registers to the value of __BITS__ internal definition
mov RAX, %[__BITS__] ; Move QWORD value into RAX
mov R8B, %[__BITS__] ; Move BYTE value into R8
mov R9D, %[__BITS__] ; Move DWORD value into R9
mov R15, %[__BITS__] ; Move QWORD value into R15

If you want more information, like how to handle relative and absolute displacement (not that hard since NASM supports a32, abs, r32, and rel) I suggest you check out the NASM latest release of the NASM documentation.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.