Subject: Re: How does the asm interface to OF work? I need to enhance it
To: None <port-macppc@netbsd.org>
From: Derek Peschel <dpeschel@eskimo.com>
List: port-macppc
Date: 12/29/2001 05:37:17
On Fri, Dec 28, 2001 at 02:00:23PM -0600, Dave Huang wrote:

> I don't know much about OpenFirmware, and I don't know anything about
> the openfirmware() routine, but... :) Is openfirmware() limited to
> executing a single Forth word? Or can it execute a small routine? Seems
> like instead of just running find by itself, you could run a routine
> that would do the find, check to see if the result was 0, and if so,
> push a dummy value onto the stack. That way, you'd always have two items
> on the stack.

That would probably work.  Too bad I've run into a new problem -- I can't
seem to call DEPTH, which should be so simple (it just returns the current
stack depth) or DROP (which discards the top-of-stack).  openfirmware()
just returns -1.

I've tried writing OF_depth and OF_drop functions and I've tried using
OF_call_method.  No luck.  I wrote the OF_depth function three different
ways (is the depth the return from openfirmware() and should args.nreturns
be 0?  is the depth the return from openfirmware() and should args.nreturns
be 1?  is the depth placed inside an integer in args?)

OF_call_method takes an ihandle but I want to call a global word (not
associated with any device).  I used 0 but that might not work.

My FIND functions don't work either but I wanted to get DEPTH and DROP
working first.

And the local university library has short hours (it's between quarters)
so I can't go look at the standard until Monday.  Grr.  Maybe the public
library has it, though.

-- Derek