What is wrong with the following instruction:
movb $0xF, (%ebx)
The answer states that %ebx cannot be used as an address register. I am new to assembly so can someone explain what this means?
If the instruction was movb $0xF, (%rbx) would that have been valid? Also what exactly is an address register? Lastly, does writing brackets around a register directly refer to the memory location the register is pointing to?
There's nothing wrong with
movb $0xf, (%ebx)1.Even in 64-bit mode it's fine per sè. Surely x32 programs won't mind using it and
r/e/bxcan be certainly used as a base register (in factbxis one of the few original registers that could act as a base in 16-bit mode).My advice is to find a better source for learning.
1 which is correctly assembled as
67 C6 03 0Fin 64-bit and 16-bit mode and without the address-size override byte (67) in 32-bit mode.