[Coco] A Basic09 Query
Bill Gunshannon
bill.gunshannon at hotmail.com
Tue Aug 27 10:21:54 EDT 2019
On 8/27/19 9:16 AM, Wayne Campbell wrote:
> 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.
I didn't mean to mention the square root because it is complex
and a function makes sense. I just misread and thought it was
two SQUARE Functions rather than two SQUARE ROOT Functions.
Sorry about that. I just wondered what the rationale was for the others.
>
> 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.
I doubt they actually calculate. The function probably only
contains:
Function Pi:
begin
Pi := 3.14159265;
end;
But, as simple as that is it would include the underlying complexity
of a function call.
> 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.
I doubt it is.
As for SQ, wouldn't a PowrOf function have been a better answer?
bill
More information about the Coco
mailing list