I want to make WORD variable in little endian without manually converting it, for example:
SECTION .data
variable1: dw 2 ; <-- How to make 2 little-endian without manually writing db 0x02, 0x00?
Maybe NASM has builtin macro or you can suggest your one?
>Solution :
Something along these lines should work (link shows another approach)
MACRO M_swap16 operand
LOCAL result
result = (((operand and 0FFh) shl 8) or ((operand and 0FF00h) shr 8))
exitm %result
ENDM
Does TASM allow a macro to be used as an operand