Replying to a message of Jasen Betts to DARRYL GREGORASH:
DG>> That means nothing can ever be written onto the bottom of
DG>> the stack, ye has always struck me as rather odd..
JB> no since different sized things can go onto the stack...
Forget about the calls and ints.. when you decrement the stack pointer, then
write to the stack, nothing can be written onto the bottom of the stack.
Period. OTOH, if you write first, then decrement, you have problems with
stack overflow, unless you are using a counter somewhere to keep track of the
number of items in the buffer (whether that is a queue or a stack, it does
not matter).
JB> it also menas SP can be initialised to 0 and the first push
JB> will write to bytes FFFF & FFFE
Are you really sure of that? I'm not going to check, but more likely it will
trigger a stack exception; it certainly will in 32-bit mode.
Besides, most people are not in the habit of allocating a 64K stack.. *and*
such segment wrap may or may not happen on anything but an 8088 or 286.. I
don't recall if segment wrap is a feature of the 386+ 16-bit mode.. in any
event, IMO it is shoddy programming practice to rely on something like that.
--- FleetStreet 1.21 NR
---------------
* Origin: BIG BANG Burger Bar: Regina SK Canada (1:140/86)
|