Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!caen!uflorida!reef.cis.ufl.edu!scroll From: scroll@reef.cis.ufl.edu (Steve Croll) Newsgroups: comp.sys.amiga.programmer Subject: Re: 68K Assembly language question (stack frames) Message-ID: <27097@uflorida.cis.ufl.EDU> Date: 23 Feb 91 05:50:55 GMT References: Sender: news@uflorida.cis.ufl.EDU Distribution: comp Organization: UF CIS Dept. Lines: 31 In article dlbres14@pc.usl.edu (Brumley David M) writes: >Ok, my question has to do with the lines: > > MOVE.W 8(A6),D0 * Get parameter 1 to D0 > CMP.W 10(A6),D0 * Test against parameter 2 > >I simply don't understand how 8(A6) references parameter 1 and 10(A6) >references parameter 2 when param1 was pushed onto the stack before >param2! The references are backwards. Assuming a7 contained $4000 before the parameters where pushed, the following stack frame exists immediately after the link instruction. $4000 $3FFE ; parameter 1, reference with 10(a6) $3FFC ; parameter 2, reference with 8(a6) $3FF8 $3FF4 ; 'old' a6 $3FF0 a7 contains $3FF0, a6 contains $3FF4 Note: if your are interfacing C with assembly, parameters are generally pushed in REVERSE order. For example, when the call to function foo(x,y,z) is made, z is pushed on the stack first, y is pushed on next, and finally z is pushed on the stack. -- -- Steve Croll (internet: scroll@reef.cis.ufl.edu home: 904-373-8389)