[Coco] [Color Computer] OS-9 Editor and NitrOS-9 Download

KnudsenMJ at aol.com KnudsenMJ at aol.com
Thu Dec 11 11:54:10 EST 2003


In a message dated 12/10/03 6:09:37 PM Eastern Standard Time, 
dbree at duo-county.com writes:

> It probably was.  It was probably just defined as a "char", since there
>  is no unsigned char in Coco C, and it was never changed.  Of course, it
>  was a bug to not mask off the MSB in the first place.

Right, but there's a catch here.  The usual way to fake "unsigned char" on 
the Coco is, given a char variable ch, is
    (ch & 127)      /* I have dozens of these in UME source code */
but in the Scred case you want the full 8 bits, so you have to first extend 
it to a 16-bit int and then mask out the upper byte, so you need something like
    (((int) ch) & 255)
to get the offset you will be adding to index the table.

In assembly, you just LDB ch and then CLRA before doing the coupled left 
shift by one to double the offsets --Mike K.



More information about the Coco mailing list