Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!asuvax!hrc!gtephx!campbellb From: campbellb@...!asuvax!gtephx (Brian Campbell) Newsgroups: comp.sys.apple2 Subject: Re: ML subroutines (passing parameters in ML) Summary: What about stack indexing? Message-ID: <1991Apr29.203359.250@...!asuvax!gtephx> Date: 29 Apr 91 20:33:59 GMT References: <3397@kluge.fiu.edu> <13845@ucrmath.ucr.edu> Organization: gte Lines: 16 In article <13845@ucrmath.ucr.edu>, rhyde@musial.ucr.edu (randy hyde) writes: > 4) Pass parameters on the stack. This is how most HLLs pass parameters. > It is slow, big, and accessing the parameters is inconvenient, > especially on processors like the 65816 which don't have a frame pointer > register. Nonetheless, there are some advantages to this technique: I thought that the 65816 had a stack addressing mode that allows one to "random" access values on the stack (which is not present on the 6502). It looks like this: (i,S) which I take to mean, access the word at offset i relative to the Stack pointer. So an immediate value of 0, means access the last word pushed, 2 means access the previous word pushed, etc. I've not had any experience with this mode -- but am I right or wrong? (Of course, it would access a byte with the m flag = 1). BTW, if all of this is true, in a assembly routine, to by-pass the JSL return address, would you typically use offsets of 3,5,7... to get word parameters n,n-1,n-2,... where n is the number of data words pushed?