ESP (stack) question (using HLA)???



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!!!
push( ax );
mov( tesp, esp );
//stdout.put( "rstack = ", ( type uns16 rstack[ 0 ] ), nl );

....

mov( esp, tesp );
lea( esp, rstack );
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?

---John

.



Relevant Pages