[Coco] A Basic09 Query

Wayne Campbell asa.rand at gmail.com
Tue Aug 27 09:16:26 EDT 2019


I had to consult the cocopedia page I created years ago,
http://www.cocopedia.com/wiki/index.php/The_Structure_of_I-Code. There are
2 functions for square root and 2 functions for square. SQR  (token AB)
becomes SQRT (token AA) in packed i-code, and I assume that was just a
convenience so you could type 3 characters instead of 4. SQ has 2 tokens,
B2 for byte/integer calculations and B3 for real calculations.

This information was accumulated by much testing by writing code, packing
it, and decoding the packed i-code to get the tokens.

You are correct that the square functions are really overkill since it is a
simple multiplication. The square root functions, imo, are not so simple
and I can see why it was included.

Maybe someone here knows why they included so much in Basic09. As for PI, I
don't know why they would bother to calculate it when they could easily
just make it a constant value and save space. Basic09 is already as large
as a program can get and still run in a 64k space. I think Curtis may be
able to say whether it's a calculation or not.

Wayne

On Tue, Aug 27, 2019, 5:09 AM Bill Gunshannon <bill.gunshannon at hotmail.com>
wrote:

> On 8/26/19 6:02 PM, Wayne Campbell wrote:
> > PI isn't really a function. It's more of a defined constant.
>
> It's listed as a Function on the Reference Card.  And Basic09 is
> not the only language implementation I have seen to do this.  It
>   may only return the constant value,  but I would assume if it
> is implemented as a function it has the associated overhead.  Thus
> the reason for my question.
>
> >                                                              SQ and SQR
> > both compute the square root of a number. If I recall correctly, one
> > operates on REAL numbers, the other on INTEGER numbers, but I may be
> > misremembering there.
>
> The book lists both as taking "a numeric" and returning "a
> numeric".  Nothing about either being Integer or Real.  But,
> again, why?  Why have the overhead of a function call for a
> simple multiplication?
>
> I was hoping one of the former MicroWare denizens might
> remember why this was done in that manner.
>
> bill
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list