jim@felix.UUCP (02/09/87)
Although stacks do grow down on: DEC PDP-11 DEC VAX-11 Zilog Z-80 Zilog Z-8000 Intel 8080, 8085 MOS Technology 6502 Motorola 6800 Motorola 68000 NSC 320xx they do grow up on some machines Burroughs B-5x00 Burroughs B-6x00 Burroughs B-7x00 Basic/Four 8000 and some machines do not include any particular support for either direction IBM S/360 Having done a great deal of compiler and system code for the Basic/Four 8000 I found no particular disadvantage in having the stack grow up, in fact, on this thoroughly big-endian machine, it was most pleasant to have "up" mean "towards higher addresses". It also made the microcode/hardware for checking segment overflows simpler since everything only grew at the higher-addressed end. Jim Gilbert FileNet Corporation ...hplabs!felix!jim Newsgroups: comp.sys.minix Subject: Stack Growth Direction Expires: References: Sender: Reply-To: jim@felix.UUCP (Jim Gilbert) Followup-To: Distribution: world Organization: FileNet Corp., Costa Mesa, CA Keywords: Although stacks do grow down on: DEC PDP-11 DEC VAX-11 Zilog Z-80 Zilog Z-8000 Intel 8080, 8085 MOS Technology 6502 Motorola 6800 Motorola 68000 NSC 320xx they do grow up on some machines Burroughs B-5x00 Burroughs B-6x00 Burroughs B-7x00 Basic/Four 8000 and some machines do not include any particular support for either direction IBM S/360 Having done a great deal of compiler and system code for the Basic/Four 8000 I found no particular disadvantage in having the stack grow up, in fact, on this thoroughly big-endian machine, it was most pleasant to have "up" mean "towards higher addresses". It also made the microcode/hardware for checking segment overflows simpler since everything only grew at the higher-addressed end. Jim Gilbert FileNet Corporation ...hplabs!felix!jim
alexande@drivax.UUCP (02/10/87)
In article <384@dayton.UUCP> joe@dayton.UUCP (Joseph P. Larson) writes: >Pre-decrement of SP for a push makes the stack grow up... Wrong. I quote from the Intel iAPX 286 Programmer's Reference Manual, 1984, pages B-80 and B-84: POP ... The word on the top of iAPX 286 stack, addressed by SS:SP, replaces the previous contents of the memory, register, or segment register operand. The stack pointer SP is incremented by 2 to point to the new top of stack. PUSH ... The stack pointer SP is decremented by 2, and the operand is placed on the new top of stack, which is pointed to by SS:SP. Then, from the Motorola M68000 Programmer's Reference Manual, 4th ed., page 23: Stack growth from high to low memory is implemented with -(An) to push data on the stack, (An)+ to pull data from the stack. That's straight from the equine oral orifice. As the bumper sticker says (in another context), "Read The Book." -- Mark Alexander ...{hplabs,ucbvax!decvax}!decwrl!pyramid!amdahl!drivax!alexande "This then is my story. I have reread it. It has bits of marrow sticking to it, and blood, an
apratt@atari.UUCP (02/12/87)
in article <913@drivax.UUCP>, alexande@drivax.UUCP (Mark Alexander) says: > > In article <384@dayton.UUCP> joe@dayton.UUCP (Joseph P. Larson) writes: >>Pre-decrement of SP for a push makes the stack grow up... > > Wrong. > > [citations deleted] As one who has recently been burned by caustic net postings, I think I should interject some sympathy and understanding here. "Up" and "down," "high" and "low" mean different things to different people. When drawing a memory map on a page, do you put zero at the top or at the bottom? Which way is "up?" The direction which is "up" in your mind may be different from "up" in somebody else's. As long as we all understand (and I think we do) that stacks on the 808* and 680* use predecrement for "push" and and postincrement for "pop", the question of "up" and "down" is irrelevent. Alexander@drivax used one unambiguous phrase ("Pre-decrement") and one ambiguous one ("up") -- why not give him the benefit of the doubt? Maybe his mental structure has zero at the top of the page. Can we put this to rest now? Counter-flames to /dev/null, please. /----------------------------------------------\ | Opinions expressed above do not necessarily | -- Allan Pratt, Atari Corp. | reflect those of Atari Corp. or anyone else. | ...lll-lcc!atari!apratt \----------------------------------------------/
joe@dayton.UUCP (02/13/87)
In article <913@drivax.UUCP> alexande@drivax.UUCP (Mark Alexander) writes: >In article <384@dayton.UUCP> joe@dayton.UUCP (Joseph P. Larson) writes: >>Pre-decrement of SP for a push makes the stack grow up... > >Wrong. > >I quote from the Intel iAPX 286 Programmer's Reference Manual, 1984, >pages B-80 and B-84: > > POP ... The word on the top of iAPX 286 stack, addressed by > SS:SP, replaces the previous contents of the memory, register, > or segment register operand. The stack pointer SP is incremented > by 2 to point to the new top of stack. I continue to get mail, so I might as well continue to continue... Why is it called the "top of stack" if the stack grows down? Yes, the stack grows towards low memory. The entire problem is that of terminology. I wasn't wrong. No one else was either. I knew exactly what I was talking about even if no one else did. So quit with the mail!!!!! -- UUCP: rutgers!dayton!joe Dayton Hudson Department Store Company ATT : (612) 375-3537 Joe Larson/MIS 1060 (standard disclaimer...) 700 on the Mall Mpls, Mn. 55408