[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Pascal header for MTLib?
- Subject: Re: Pascal header for MTLib?
- From: dempson@actrix.gen.nz (David Empson)
- Date: Sun, 9 Oct 1994 21:14:49 GMT
- Newsgroups: comp.sys.apple2
- Organization: Actrix Information Exchange
- References: <36uta8$ska@detroit.freenet.org> <36vii9$66@blackice.winternet.com> <370u05$ij7@tuba.cit.cornell.edu>
In article <370u05$ij7@tuba.cit.cornell.edu>,
Jay Krell <jmk3@crux4.cit.cornell.edu> wrote:
>
> But Really, the IIGS lacks a standard parameter passing protocol.
> Mike says the compiler writers initially hammered out as standard
> what ORCA/Pascal does, which was promptly violated by APW C and I
> think TML Pascal, and later violated by MPW IIGS Pascal.
That is quite surprising. MPW IIgs Pascal uses the toolbox calling
conventions for its own functions (with one odd extension for
returning strings, something that ORCA/Pascal cannot do at all).
APW C is certainly different to the others (the calling function pulls
the parameters off the stack after the called function has returned,
which _I_ think is a much safer way of handling things, especially
with calls like printf). It returns values in a similar manner to
ORCA/C and Pascal (in the registers).
I'm not sure what TML Pascal used - I don't think I ever looked at the
calling conventions.
> ORCA/C and Modula-2 don't follow it by default, but have the option
> of fitting in.
ORCA/Modula-2 has its own oddball way of doing everything. Off the
top of my head, I think it is similar to the toolbox calling conventions.
> Of course, from asm it is confusing to have one (well, really
> more, but I'm only counting e1/0000) protocol for the system
> and one to interface with compiler generated code, so I've always
> favored the Toolbox protocol as standard, but Mike and Jawaid and
> others insist it is quicker to not push result space.
Definitely. At the very least, you save having to pull the results
into registers after returning. It may complicate the exit code
slightly to return the result in registers, but a simple TAY/TYA pair
gets around that.
--
David Empson
dempson@actrix.gen.nz
Snail mail: P.O. Box 27-103, Wellington, New Zealand