mov reg16, [sp] doesn't work!!
-
Neptune
mov reg16, [sp] doesn't work!!
I can't figure this out. All I need to do is mov the contents of sp into a register, but nasm complains 'invalid effective address'. I've tried it with every single register combination, but it won't let me do it. Please help!
-
Khumba
RE:mov reg16, [sp] doesn't work!!
If you want to move the address SP points to into a register, use "mov reg16, sp". You can't use [sp], because x86 assembly removed that in order to have a plain [offset] addressing mode. So you'll have to load SP into another register (BX, BP, SI, or DI) and use that instead.
-
Khumba
RE:mov reg16, [sp] doesn't work!!
Actually, there's no [bp] mode either, only [bp+offset], but good compilers (like nasm) translate this to [bp+0].