[Coco] BASIC09 - unsigned INTEGERs?

Allen Huffman alsplace at pobox.com
Wed Feb 4 09:48:25 EST 2015


> On Feb 4, 2015, at 4:08 AM, Mark McDougall <msmcdoug at iinet.net.au> wrote:

>> if b<0 then b=b+65536
>> 
>> ...during the assign to the REAL.
> 
> And for my money, this is the 'proper' way to do it...

Unless ... there's an even better way to do it someone hasn't thought of yet :) I wouldn't have expected there to be three ways to accomplish something I first thought was un-doable.

>> We have several ways to make it work -- but we continue to look for a
>> better way :)
> 
> What's you definition of 'better'? Less CPU cycles? Less RAM usage? Because I think the above will be hard to beat... and you're certainly not going to get there with string functions!

Yes to both.  I recently posted a multi-part series on word wrap routines in BASIC on my www.subethasoftware.com site. I wrote one, then someone sent in another, then someone sent in another, etc. I ended up with a chart showing which one used the less CPU time, which one used the less code space, and which one used the less variable/string memory. If you were in a 4K programming contest, CPU might be the least of your worries.

> As I said... sledgehammers and nut cracking...

Exactly :) I mean, why do we bother learning math? It's already been solved. It's a great brane exercise and it's fun.

		-- A


More information about the Coco mailing list