[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pascal header for MTLib?



 > > 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.
 
 I tend to count instructions instead of cycles. It is very common
 to see tax upon an ORCA function return, matched with pla for
 Toolbox calls. But, true, tax is quicker than pla and the Toolbox
 protocol also loses on the initial pha. I guess one
 case where they are about equal is if you pass parameters from
 one function to another ("foo(bar())"). The Toolbox convention
 can be very nice for the caller, though, in that it provides
 scratch space to work out the function result or other temporary
 storage. It some cases, it can optimize the stack/dp adjustment.
 I really like it for its consistency though. Like, I started
 asm with lots of Toolbox calls, and it is a pain to mix that
 past and present with C code.
 
 Also, if you want to mix your code with APW C or MPW IIGS Pascal
 or C, you must use Toolbox conventions. APW/MPW IIGS C "pascal"
 functions follow Toolbox conventions, and you can call them,
 unlike ORCA/C.  I suspect TML Pascal used Toolbox conventions too.
 
  > APW C...a much safer way
  
  True that it is safer, but it is generally larger (but faster I think).
  This issue receives some attention in the ORCA/C manual. Programs
  that require this safety are buggy and ORCA/C does provide runtime
  stack checking.

--
 -- jay.krell@cornell.edu