Re: ESP (stack) question (using HLA)???
- From: spamtrap@xxxxxxxxxx
- Date: Fri, 28 Oct 2005 01:17:31 +0000 (UTC)
spamtrap@xxxxxxxxxx wrote:
> I've tried to create my own (mini)stack using 'rstack' and pop & push
> from it by assigning the ESP register then pop & push and then assign
> ESP back to it's orinal value:
>
> Wdeg: uns16 := 0;
> rstack: uns16[ 2 ];
> tesp: uns32;
>
> ...
>
> mov( esp, tesp );
> lea( esp, rstack );
> //stdout.put( "esp = ", ( type uns32 esp ), nl ); This causes a stack
> error!!!
I've learned that it is safer to avoid type casting, when possible, in
these situations and it is also better to avoid the .put macro when
possible. Break it up like so:
stdout.puts( "esp = " );
stdout.puti32( esp );
stdout.newln();
> push( ax );
> mov( tesp, esp );
> //stdout.put( "rstack = ", ( type uns16 rstack[ 0 ] ), nl );
>
> ...
>
> mov( esp, tesp );
> lea( esp, rstack );
You need to adjust this down by two bytes because you PUSHed a 16-bit
value onto your self-made stack...this will allow the below POP to
access the correct location.
> pop( Wdeg );
> mov( tesp, esp );
> stdout.put( "Wdeg = ", ( type uns16 Wdeg ), nl );
>
>
> Unfortunately, this isn't working. The value assigned to Wdeg is 0 not
> 82 (the value I thought I had pushed). Any ideas?
>
Those are my ideas...
Nathan.
.
- References:
- ESP (stack) question (using HLA)???
- From: spamtrap
- ESP (stack) question (using HLA)???
- Prev by Date: Re: ESP (stack) question (using HLA)???
- Next by Date: Re: improve strlen
- Previous by thread: Re: ESP (stack) question (using HLA)???
- Next by thread: Re: ESP (stack) question (using HLA)???
- Index(es):
Relevant Pages
|