[Coco] [Color Computer] Cross development for 8 bits. Was: RELIC Is Coming...

James Diffendaffer jdiffendaffer at yahoo.com
Wed Feb 28 15:21:10 EST 2007


-boisy at boisypitre.com was heard saying:---------------------
Call me a cynic, but past efforts to get a true cross-compiler system
for the CoCo have always ended up yielding nothing. There was gcc,
sdcc, and now this. RELIC is running NOW under Linux and Mac OS X as
a cross compiler to CoCo/NitrOS-9 and is generating executables NOW.
My hope is that a lot of the talk about compilers that has been
generated on this list over the years will finally transform itself
into action, and interested parties will take RELIC to the next level.
--end quote-------------------------------------------------

Well Boisy, 
You are probably right.

I guess I shouldn't have taken a job as the IT manager for a small
company and spent a lot of long days building their IT department up
from scratch shortly after starting work on SDCC.

And I shouldn't have taken last year off to help with my mom's rehab
after her knee replacement surgery when she had complications and
again when she had a stroke.  Even though if I hadn't they would have
stuck her in a rest home instead of returning her to her home where
she has been since mid January.

Yes, I should have focused my time on writing a compiler for a
processor that isn't manufactured any longer, which almost nobody uses
for anything new and for a machine that was discontinued almost 20
years ago rather than spend the time on my real job or my family.  



Sarcasm aside... congratulations, that's a lot of work and I commend
you for it.  I hope work on your degree is going well.

My original goal was just to write some games that could be easily
ported from one 8 bit to the next and so far that has been more dream
than reality.  

When I first tried SDCC for the Z80 it crashed even on my simple code. 
Then I tried Z88dk which doesn't support floats and doesn't optimize
well on the front end.
The two 6502 compilers I looked at are almost opposites of each other.
 One has a good front end, lousy back end and is closed source.  The
other has an lousy front end, good back end, is open source but is
missing language features.
And there was no 6809 compiler which is why I started work on one.
(small C doesn't even handle multi-dimensional arrays)

So I wanted a compiler that targets multiple CPUs.  Something that
lets me switch compilers for different targets without completely
separate environments.  The only potential compilers I found at the
time were GCC and SDCC.  Given the crashing issue of SDCC the choice
was obvious.  However, after spending some time on GCC it was obvious
it would not be efficient for smaller CPUs unless they had built in
cache to handle the software pseudo registers.  It was also huge,
complex, requiring a lot of changes for each new target and required a
special environment where SDCC does not.  By this time SDCC's crashing
issue appeared to be solved so I chose to drop GCC and work on SDCC.
Actually, I found something called LCC(?) later but I've never looked
at it.  I hear one of he 6502 compilers was based on it.

I have SDCC close to the point of generating complete code (it doesn't
count if the code doesn't work) but there were a few things left to be
done or fixed.  It also isn't set up to generate position independent
code.  I wanted to add that as a compiler option and also wanted to
look at how the OS-9 compilers dealt with the user stack and DP usage
for some possible future enhancements that could be enabled with
command line options.

As things stand, I've already added support for the 6309 if defined to
compile that way.  But it's obvious that a lot of benchmarking will
need to be done to determine the best code size and speed.  I also
need to verify that all the instructions generated are actually legal
for the 6309.  I figured I'd just try passing the output to a 6309
assembler to see if it complained to figure out the last one and see
if it was still worth working on.  Now that I actually have a 6309 for
each of my machines it is a lot more interesting to me.  However, the
6309/6809 register model obviously didn't have optimal compiler code
generation in mind when it was designed.

I may look at building a cygwin version of the toolkit as I find time.
 It sounds very promising and I need some of the tools to continue
anyway no matter what compiler I use.  I do have an extra machine I
can switch into a Linux box though so we'll see.

I'm anxious to see how good the code your compiler produces is.
It would be interesting to see which front end optimizes better.  If
your compiler is based on a better front end then SDCC probably
wouldn't be the best choice, not for the CoCo anyway.  I can't say
I've been thrilled with the level of activity around improving SDCC
beyond fixing the crashes but there appears to be a new release in the
works so I may change my mind. 





More information about the Coco mailing list