[A83] Re: push - pop
[Prev][Next][Index][Thread]
[A83] Re: push - pop
> > Can somebody explain in the highest detail what push
> > and pop EXACTLY do? There are a couple of registers
> > but there's only ONE stack pointer... I don't get it??
>=20
> That's exactly the same mistake I made. btw, I think it's=20
because of
> AsmGuru that explains it a bit akward (sorry James...)
I don't think it to be a fault of AsmGuru, regardless
its style. :) When I was starting assembly on my PC,
first I had the same belief about the stack. Looking
back, I cannot blame the book I learnt it from
(a classic of Ag=E1rdi G=E1bor, many-many thanks to him),
it was just a natural step during the transition
from the basic-pascal era to the world of assembly.
You have to forget about the human way of thinking
when coding in assembly, and somehow this "saving
and recalling the registers"-thing might also
cause some confusion. (BTW the book actually gave
the exact explanation of these instructions much
later than the first time the programs used them.)
One little comment on Patrick Davidson's letter,
just to avoid sending this in two separate parts:
The top of the stack is at the end of the 64k,
and SP is DECREASED by PUSH and INCREASED by POP.
And if you want to jump back two levels without
losing the contents of any of the registers,
you can use INC SP \ INC SP \ RET as well
(but this is slower than a POP xx \ RET)
PG
References: