[ax]
is not a valid 16-bit addressing mode. Change it to mov ebx, [bx]
and you could do it. The ebx
determines the size of the operation, so you wouldn't need to say dword
. In 32-bit mode, [bx]
is unlikely to be a "useful" address, but it's "valid" code. In 32-bit mode, mov al, [eax]
, mov ax, [eax]
and mov eax, [eax]
are all valid, and the sizes are determined by the size of the destination register, but you might want to say "byte", "word", or "dword" for clarity. In this(!) case, the sizes do not have to match.
FWIW, it is possible to use 32-bit instructions - and 32-bit addressing modes - in 16-bit code. The entire address needs to be within the segment limit - usually 64k - but mov eax, [eax + ecx * 4]
is valid code. Nasm (or other "competent" assembler) will generate the required "operand size override prefix" and "address size override prefix" (0x66 and 0x67).
Don't be afraid to try these things... although it may not be clear WHY Nasm is refusing, and if Nasm DOES accept it that doesn't mean it will do what you intend...