[Coco] VARPTR and floating point representation

Robert Gault robert.gault at att.net
Sat Mar 24 09:55:51 EDT 2012


Aaron Banerjee wrote:
>
> I was about to google this one, (I seem to have misplaced my color BASIC and
> Extended Color BASIC books) but thought the reference I'd find on Google was in
> all probability written by someone on this list (who would probably know it off
> the top of their head).
>
> Regarding the VARPTR command, what is the format that it has for "numbers?" I
> still have an old code snippet for strings (e.g. first byte length, etc). Is the
> number an IEEE 754 float? Thanks.
> - Aaron
>

The format depends on the type of variable.
Numeric - points to 5 byte floating point
  byte1 exponent, byte2-5 mantissa
  byte2 bit7 (0-7) = 0 number negative, = 1 number positive

String - points to 5 byte descriptor
  byte1 - length
  bytes 2&5 - reserved
  bytes 3&4 - address if 1st character

Array - description in "Going Ahead with ECB" short and not very clear.



More information about the Coco mailing list