[Coco] More optimizations for the CMOC compiler

Kip Koon computerdoc at sc.rr.com
Mon Aug 10 06:38:28 EDT 2015


Hi Pierre,
I thought I would let you know that I compiled nobasic.c and autostart.c successfully!  Whoo-Hoo!  I have created nobasic.dsk and autostart.dsk image files and will be trying them out on my Coco2 and Coco3 shortly.  I looked at the source code and I must say that I realized how much more about C that I don't know than I thought.  Calling C functions from assembly language is a mystery to me as is mixing C and assembler code.  I remember using for() {} before, but I have almost completely forgotten the whole syntax from my C++ days.  I truly need a C Tutorial or a book on learning C that teaches not only the syntax, commands and functions, but also various algorithms obvious and not so obvious from somewhere.  Learning various concepts of how to combine C commands and functions is my ultimate goal to learning C.  For me, it is not enough to learn the commands and functions, but also how to wield them as well.  Any ideas?
I am already reading a book called "Microcontroller Technology: 68HC11 and 68HC12".  I've bought a few chips that I plan on using some time in the future.  Seeing your compiler reminded me how much I need to learn C from that perspective as well.  The THRSIM11 68HC11 simulator has a built-in C cross-compiler so I don't need software so much as how to effectively program in C for the Motorola MC68HC11 chip in all of its glory.  I know 6800 Assembly Language though it has been more than a few years since I have used it until recently that is.  Albeit an older microcontroller, the 68HC11 is binary compatible with the 6800 so most of the assembly language mnemonics are familiar to me, but like C, C++ or any other programming language, I need to know how to wield the 68HC11 mnemonics into useful routines, subroutines and ultimately write whole programs in an efficient manner.  That's some of the things I'm currently working on I thought I would share with you to give you some idea what I'm into.  There a lot more, but I'm stop for now.  Well, I will let you go.  :)  Keep up the good work on the development of CMOC.  Take care my friend.

Kip Koon
computerdoc at sc.rr.com
http://www.cocopedia.com/wiki/index.php/Kip_Koon



> -----Original Message-----
> From: Coco [mailto:coco-bounces at maltedmedia.com] On Behalf Of Pierre Sarrazin
> Sent: Sunday, August 09, 2015 2:25 PM
> To: CoCoList for Color Computer Enthusiasts
> Subject: Re: [Coco] More optimizations for the CMOC compiler
> 
> Hi Kip,
> 
> Dixit Kip Koon (2015-08-09 00:34):
> > Hi Pierre,
> > I just tried to compile CMOC and received the following messages.
> >
> > main.cc: In function ‘Byte getcharifavail()’:
> > main.cc:91:57: error: ‘select’ was not declared in this scope
> >   if (select(STDIN_FILENO + 1, &readset, NULL, NULL, NULL) <= 0)
> >
> > What am I doing wrong?  I'm running Cygwin x64.
> 
> An #include statement is missing to declare select() on a Cygwin system.  At the top of src/usim-0.91-cmoc/main.cc, you could try
> changing this:
> 
> #if defined(__unix) || (defined(__APPLE__) && defined(TARGET_OS_MAC)) #include <unistd.h> #endif
> 
> to just #include <unistd.h>. If that doesn't work, try adding #include <sys/select.h>.
> 
> If that still does not compile, replace the contents of getcharifavail() with "return 0;", as a workaround, because you don't need USim
> anyway: it's just there to run CMOC's self-tests.
> 
> > If there are any specific tests you would like me to do as you further
> > develop your C Cross-Computer, just let me know.  I would like be a
> > tester for CMOC.
> 
> For starters, you can help me support Cygwin. That will be useful to those who are not in a position to run CMOC under GNU/Linux.
> (Please tell me which alternative above worked for you: I'll integrate it in the next version.)
> 
> Aside from that, just have fun writing C programs for the CoCo, and report any bugs or usability issues to me, and I'll be glad to check
> them out.
> 
> My hope is that CMOC will help more people publish practical programs for the CoCo, like games, utilities, etc. That will be the true
> measure of CMOC's usefulness.
> 
> > You may have to "hold my hand" as I learn the language so I can do the
> > tests like you wish though.  Thanks for writing this compiler.
> > I'm sure I will enjoy using it once I get over the learning curve.
> > :)  Take care my friend.
> 
> You're welcome!
> 
> By the way, I've already published CMOC 0.1.12, after receiving bug reports from a user:
> 
>     http://sarrazip.com/dev/cmoc.html
> 
> --
> Pierre Sarrazin <sarrazip @ sarrazip . com>
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco



More information about the Coco mailing list