Re: asm and nasm newbie
- From: "wolfgang kern" <nowhere@xxxxxxxxxxx>
- Date: Thu, 22 Sep 2005 10:27:33 +0000 (UTC)
Zhang Huan wrote:
| hi all:
Hi,
| want to get parameter from stack, i use "mov di, [sp+4]". while
| compiling error occurs "invalid effective address". what's wrong
[sp+4] is not available at all.
[esp+4] is a valid addressing form, but only as a 32-bit part.
so if you use 16 bit code you either can try:
mov di,[esp+4]
which most tools wont understand and cry, as this needs
a 67h prefix and a SIB-addressing mode in 16-bit code.
or make it a DB-code then:
;:use16 ;I assume to be 16-bit
67 8b 7c 24 04 mov di,[esp+4]
if used in true realmode (not VM86) then you can quietly
ignore the high-word of ESP, as it is zero then anyway.
for VM86 you better use 'the standard':
push bp
mov bp,sp
mov di,[bp+6] ;+2 as bp were pushed yet
....
pop bp
__
wolfgang
.
- Follow-Ups:
- Re: asm and nasm newbie
- From: Zhang Huan
- Re: asm and nasm newbie
- References:
- asm and nasm newbie
- From: Zhang Huan
- asm and nasm newbie
- Prev by Date: Re: Hex code and mnemonic
- Next by Date: Re: asm and nasm newbie
- Previous by thread: asm and nasm newbie
- Next by thread: Re: asm and nasm newbie
- Index(es):