[Coco] Does DEF FNX for Basic only take one parameter?
Boisy G. Pitre
boisy at boisypitre.com
Wed Mar 31 09:45:34 EST 2004
John,
I was looking at the USRx entry point routines myself recently.
However, instead of just passing one parameter, I need to pass about 5
or 6. I found that USRx was just too limiting for what I needed, so I
just use wrote my assembly routine to live at $7000 and reserved some
parameter space in high RAM ($7100) where I POKE the parameter values.
I then do an EXEC &H7000 from BASIC and wait for the routine to finish.
When it does, it returns control to BASIC nicely.
I have found the explanation of DEFUSR/USR in the CoCo 3 BASIC book to
be a bit terse, and lacking specifics. For a better explanation, check
out the "Getting Started WIth EXTENDED Color BASIC" book that came with
most later CoCo 2s. Its explanation of DEFUSR/USR on pages 197-202 go
into much more detail.
As for passing a "parameter list", you could possibly pass the address
of an array using VARPTR. The array could have two, three or twenty
values and the assembly routine could go down the list of them. Still
a bit awkward, though.
Also, you need to call INTCNV in BASIC ROM from your assembly routine
in order to use the passed value into USRx(), as the number passed is
in BASIC's floating point format. INTCNV converts a BASIC number into
an integer and places it in reg D.
Again, the CoCo 2 book has much better information on the use of these
calls.
On Mar 30, 2004, at 11:08 PM, John Guin wrote:
> Hello all,
>
> I was working on a basic program to do something like:
> DEF FNX(A,B)= some function of A and B
>
> Basic gives a syntax error for this, but my Coco3 book says I can pass
> a
> parameter list to it.
>
> I'm assuming the book is wrong, and DEF FNx can only take one
> paramater, but
> does anyone know if that's right?
>
> Thanks,
> John
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
More information about the Coco
mailing list