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!
If you want to move the contents of the stack pointer into another register, you need
mov ax, sp
i.e. you shouldn't in this case be using the square brackets, which mean "calculate an effective address". I use tasm, not nasm, so there may be some differences; sorry if I'm misinforming you.
If you want to move the thing in a memory location pointed to by sp into another register, then I don't think
mov ax, [sp] is valid.
I think you should consider just doing
pop ax
push ax
which I think should achieve the same result.
Hope that helps...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.