[Coco] OS9 C compiler
Bill Pierce
ooogalapasooo at aol.com
Sat May 6 19:43:38 EDT 2017
James, I was just making a quick example and not thinking through it LOL, but you're right. It's only needed at the point of use. I have to do this constantly in MShell when displaying any numeric value.
Bill Pierce
"Charlie stole the handle, and the train it won't stop going, no way to slow down!" - Ian Anderson - Jethro Tull
My Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Co-Contributor, Co-Editor for CocoPedia
http://www.cocopedia.com/wiki/index.php/Main_Page
E-Mail: ooogalapasooo at aol.com
-----Original Message-----
From: James Jones <jejones3141 at gmail.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Sat, May 6, 2017 6:47 pm
Subject: Re: [Coco] OS9 C compiler
YY is of no use in the code fragment there, because it, like XX, has typechar. When it's used in a wider context, it will be sign extended just asXX would be. The anding with 255 (might want to write it in hex to make themapping to bits more obvious) has to be done at the point of use, notassignment.Not taking advantage of the "as if" rule (and not having unsigned chartype) makes the 6809 C compiler generated code bigger and slower that itwould otherwise be.On Sat, May 6, 2017 at 9:26 AM, Bill Pierce via Coco <coco at maltedmedia.com>wrote:> Dave, it's my understanding that in MW OS9 C, "char" is ALWAYS signed. The> ONLY unsigned variable form in MW OS9 C is "unsigned", and most times to> keep from confusing the compiler, you need to declare it ( yy=(unsigned)xx).>> To get an unsigned char, you must:> char XX;> char YY;> XX=128;> YY=XX&255;>> This will make it read as signed. Also, any print or similar actions need> the same to get the proper response. i.e.> print("XX=\c",XX&255);>>>>>> Bill Pierce> "Charlie stole the handle, and the train it won't stop going, no way to> slow down!" - Ian Anderson - Jethro Tull>> My Music from the Tandy/Radio Shack Color Computer 2 & 3> https://sites.google.com/site/dabarnstudio/> Co-Contributor, Co-Editor for CocoPedia> http://www.cocopedia.com/wiki/index.php/Main_Page>> E-Mail: ooogalapasooo at aol.com>>>>>> -----Original Message-----> From: Dave Philipsen <dave at davebiz.com>> To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>> Sent: Sat, May 6, 2017 9:14 am> Subject: Re: [Coco] OS9 C compiler>> My next question is: does the OS9 compiler support unsigned char? I keep> getting errors related to this.DaveOn 5/6/2017 4:45 AM, James Jones wrote:>> cstart is the code that sets up things that C programs expect (zeroing or>> initializing file scope and static variables, setting up stdio for> standard> in/out/error, converting what the target OS uses for command line> arguments> into argc/argv), calls main, and then does whatever teardown C> programs> expect (e.g. closing standard input, output, error, for ANSI> calling> functions registered with atexit()) and exits the process, passing> the exit> code returned from main() or passed to exit() back to the> operating system> so the parent process can see how things turned out..>>> The important part here is that it calls main(). That's the reference that>> isn't resolved. Whoever wrote the code didn't include main(), which a>> complete C program has to have. Maybe whoever wrote the code intended it> to> be used as a library?>> On Fri, May 5, 2017 at 11:31 PM, Dave Philipsen> <dave at davebiz.com> wrote:>>> Any OS9 'C' gurus out there that could help> me with a problem?>>>> I'm compiling some code written by someone else and> my command line looks>> like this:>>>> cc1 csc.c -DOS9 -DX6809>>>> The> compiler proceeds through both passes, the optimizer and the assembler>>> but it chokes on the linker with this error:>>>> Unresolved references:>>> main cstart_a in /dd/lib/cstart.r>> linker> fatal: unresolved references>>>>>> Any clues?>>>>>> Dave>>>>>> -->> Coco> mailing list>> Coco at maltedmedia.com>> https://pairlist5.pair.net/> mailman/listinfo/coco>>-- Coco mailing listCoco at maltedmedia.comhttps://> pairlist5.pair.net/mailman/listinfo/coco>> --> Coco mailing list> Coco at maltedmedia.com> https://pairlist5.pair.net/mailman/listinfo/coco>-- Coco mailing listCoco at maltedmedia.comhttps://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list