[Coco] BASIC09 - unsigned INTEGERs?

Allen Huffman alsplace at pobox.com
Tue Feb 3 09:29:31 EST 2015


> On Feb 3, 2015, at 5:04 AM, Mark McDougall <msmcdoug at iinet.net.au> wrote:
> 
> I'm perhaps showing my ignorance here but I fail to see what the fuss is about. You have the *correct* answer in regs.X and regs.Y. Let's forget about printing for the moment, since that's a completely separate problem; the only issue is how BASIC09 is treating those quantities. You already know the problem - they're two 16-bit signed integers, and it seems you can't change that.
> 
> So what's the issue with, for example, assigning to a real and applying the maths to fix it? It seems everyone here wants to take a sledgehammer to crack a nut!?!

We already have three workarounds to do it. We're just trying to see if there is a "real" way to accomplish this. It's what we do :)

And -- due to one of the numbers will be negative, the normal maths don't work. That's what started this. One of the three workarounds proposed checks for that by doing something like

if b<0 then b=b+65536

...during the assign to the REAL.

We have several ways to make it work -- but we continue to look for a better way :)

		-- A



More information about the Coco mailing list