Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!wasatch!utah-gr!uplherc!sp7040!obie!wes From: wes@obie.UUCP (Barnacle Wes) Newsgroups: comp.lang.c Subject: Re: Argument Passing in C (Stacks) Summary: Addressing modes? We don't need no stinking addressing modes! Message-ID: <202@obie.UUCP> Date: 6 Oct 88 05:03:57 GMT References: <705.2339B3D8@stjhmc.fidonet.org> <699@wsccs.UUCP> Organization: the Well of Souls Lines: 41 In message <69210@sun.uucp> swilson%thetone@Sun.COM (Scott Wilson) writes: | Can someone explain to me what the difference is between a hardware stack | and a software stack? I worked on a C compiler project once where | one person said the target machine "doesn't even have a hardware stack." | I asked what the difference was between the target machine and, say, a | 68000. | The answer was the 68000 had a stack because it supported addressing modes | like "movl d7,@sp-" whereas the target machine required you to use two | instructions, first a move then an explicit decrement of the stack pointer. In article <699@wsccs.UUCP>, dharvey@wsccs.UUCP (David Harvey) replies: > It seems to me that any register based hardware with register indirect > mode and, post-increment and pre-decrement instructions will do the > trick for you. [...] But what about hardware without pre-decrement and post-increment addressing? The Univac 1100 and many derivatives of it, for example. Or the IBM 360 family? With the 360, you usually end up using a register for the stack pointer, and using macros like (forgive me if the syntax is wrong, it has been quite a few years since I wrote a BAL program :-) POP MACRO a MOV (R5),a ADD #4,R5 ENDM PUSH MACRO a SUB #4,R5 MOV a,(R5) ENDM The problem with these macros is that they are not atomic. I can't think of any straightforward reasons why this is a problem, but I'm sure it would cause problems somewhere, somehow. -- {hpda, uwmcsd1}!sp7040!obie!wes "How do you make the boat go when there's no wind?" -- Me --