[Coco] OS9 HEX to DECIMAL conversion.

James Jones jejones3141 at gmail.com
Wed May 16 19:17:11 EDT 2018


That's a shame. The manual says that PRINT USING can output any (non-TYPE?)
data type with the hex format item, so I had hopes for VAL(), since it
returns a REAL.

So I guess the original poster will have to take the string with the hex
representation and convert it up to four bytes at a time, accumulating in a
REAL.

On Wed, May 16, 2018 at 1:41 PM, L. Curtis Boyle <curtisboyle at sasktel.net>
wrote:

> Your error is due to pushing beyond the signed 16 bit limits of the hex
> routines in BASIC09. It does work fine within 16 bit signed values (I put
> some screenshots of test source code, and a sample run, in the BASIC09
> section on Discord).
>
>
> > On May 16, 2018, at 12:19 PM, James Jones <jejones3141 at gmail.com> wrote:
> >
> > Tried it out. VAL("$61A80") gives an error 67, "illegal argument".
> > VAL("A80") prints as 2688., so VAL() returns a REAL, which I guess it has
> > to for consistency with other BASICs. Hex PRINT USING output claims to be
> > fine with printing a REAL, but perhaps the VAL() code for hex doesn't
> > handle values that won't fit in an INTEGER. (What's 61A80? 400000 in
> hex.)
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
>


More information about the Coco mailing list