Something has got me confused in x86 assembly for a while, it\'s how/when can NASM infer the size of the operation, here\'s an example:
mov ebx, [eax]
mov [eax], 123456
This instruction would use immediate addressing for the source operand and indirect addressing for the destination operand i.e. place the decimal 123456 into the memory address stored in register eax, as you pointed out but the memory address to which eax points does not itself have to be 32 bits in size. NASM can not infer the size of the destination operand. The size of the pointer in register eax is 32 bits.
Surely if I wanted to put the 16 bit represtation of 123456 into eax I would do this: mov ax, 123456
Yes but here you are using immediate addressing for the source operand and register addressing for the destination operand. The assembler can infer the amount of data you wish to move from the size of the destination register (16 bits in the case of the ax register).
compile error
I think you meant assembly error :)