On Tue, 20 Feb 2007 01:24:45 +0200, Giorgos Keramidas
<ke******@ceid. upatras.grwrote :
(sorry for the delay, I overlooked this in my new drafts folder)
On Mon, 29 Jan 2007 00:03:33 GMT,
Dave Thompson <da************ *@worldnet.att. netwrote:
Stacks in general almost, but the stack used for 'hardware'
(ISA) calls -- and as noted elsethread, in block-frame
languages including C it is usually convenient to put locals
and params/args together with calls -- JSR and RTS use
R6=(U?)SP growing downward. It is possible to cobble together
your own calling sequence not using -(R6), but significantly
more tedious for IME&O zero benefit.
And even for other (non-call) stacks, downward push *--r and
pop *r++ allow you to peek at the top (single) element more
cheaply than the upward counterparts. FW(L?)IW.
Hmmm, isn't a downward stack implemented with:
push: *--r = rvalue;
pop: return *r++;
Yes.
more or less equivalent with an upward growing stack which uses:
push: *++r = rvalue;
pop: return *r--;
Those aren't addressing modes on PDP-11. You can use
MOV psh, (r)+ ; dst mode 2r ;; *r++ = psh
MOV -(r), pop ; src mode 4r ;; pop = *--r
; or something else like ADD -(r), dst
but then 'peeking' at TOS element is -2(r) mode 6r which requires an
extra word not (r) mode 1r which does not and is sufficient on
downward, hence my 'more cheaply'.
or am I missing something fundamental about downward growing stacks?
I wouldn't call it fundamental, but the -11 architecture does have a
slight bias favoring downward as I described, in addition to its
(forced) use for the hardware functions (JSR, intr/trap) I described.
- David.Thompson1 at worldnet.att.ne t