[Coco] Compiler [was: CoCo Video Player]
John W. Linville
linville at tuxdriver.com
Mon Mar 21 16:04:54 EDT 2011
A while back, I was looking at retargeting the Bruce Evans C compiler
(bcc) to target the coco. I figured I'd start with RSDOS (or
possibly FLEX) targets, since those have less specific code generation
requirements than OS-9. But, I hoped to support (Nitr)OS-9 as well.
For those not familiar with it, the Bruce Evans compiler goes way back.
It was (or is?) used to build Linux-oriented boot loaders like LILO
and GRUB, and before that it was used in the Minix world. But what
makes it interesting is that it can also be built as a 6809 compiler.
At its heart it's a K&R compiler, but it does have an "ANSI" mode
that AFAICT is mostly just a function prototype convertor. There is
also a peephole optimizer as part of the codebase, but alas there
are no optimization rules for 6809 included.
The object file format actually is the same as the old Introl compiler,
a commercial offering that targetted FLEX and probably some embedded
systems and the like. So theorhetically those libraries could be used
with the compiler -- not a big motivator, but worth knowing. :-) I did
manage to find documentation for the Introl object format and convinced
myself that the format matched what the toolchain was producing.
When I was experimenting with it, it seemed to be generating reasonable
code. FWIW, I believe Chet Simpson had previously (years ago) said on
this list that he had used bcc for some coco work and that he was
pleased with its code generation. Chet also claimed to have done
some enhancements to bcc. I managed to find the sources he published,
but IIRC any changes from the original sources were minimal.
So anyway, I decided that there wasn't much point in keeping the
80x86 code generation in the codebase -- let the x86 bootloader
and ELKS folks worry about that! :-) So, I set-out to strip all
the non-6809-relevant bits from the code base. I also made a few
changes to the defaults (like setting the "ANSI" mode by default),
and I applied a few bug fixes (mostly related to building/running
on x86_64). I called the project 'bcc09' and put the results here:
In my work, I'm really only concerned with Linux. With that said,
I have no motivation to prevent running on other Unix-like OSes
(including OSX) or even Windows. I would just need someone else to
be interested enough to try that and to send patches to fix whatever
is broken. If you are interested, then let me know!
On Sun, Mar 20, 2011 at 02:19:09PM +1100, John Kent wrote:
> On the second video you talk about the possibility of working on
> compiler design.
> What did you have in mind there ?
> John K.
> On 17/03/2011 7:10 AM, John W. Linville wrote:
> >Ouch! Well as I said, it never quite performed like I would have
> >liked... :-)
> >You can see Allen's videos on YouTube:
> > http://www.youtube.com/watch?v=lFY-52qZzP8
> > http://www.youtube.com/watch?v=p3yY4mFLjDM
> >It's not HD by any means. :-) But still, I think it ain't all that
> >bad, considerin'...
> Coco mailing list
> Coco at maltedmedia.com
John W. Linville Someday the world will need a hero, and you
linville at tuxdriver.com might be all we have. Be ready.
More information about the Coco