A C compiler that can compile for dragon 32?

A place to discuss everything Dragon related that doesn't fall into the other categories.
lukeoftheaura
Posts: 14
Joined: Sat Apr 29, 2017 7:13 pm

A C compiler that can compile for dragon 32?

Post by lukeoftheaura »

Hi,
is there a C compiler available (for linux preferably) that can compile for the dragon 32?

Thanks,
luke
User avatar
robcfg
Posts: 1530
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: A C compiler that can compile for dragon 32?

Post by robcfg »

Hi Luke!

Maybe gcc 6809 is what you're looking for.

Cheers,
Rob
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: A C compiler that can compile for dragon 32?

Post by Bosco »

Also, Pierre Sarrazin has developed a 6809-generating cross-compiler for a subset of the C language.

http://perso.b2b2c.ca/~sarrazip/dev/cmoc.html

The website says `The most significant difference between CMOC and a complete C compiler is the absence of longs and floats and of the const keyword.'

I'm not very knowledgable about such things but thought I'd post a link in case it was of interest? :)
User avatar
robcfg
Posts: 1530
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: A C compiler that can compile for dragon 32?

Post by robcfg »

Of course it's of interest!

I've tried a couple of times to compile gcc6809 without luck, so maybe this one will come in handy.

Thanks, mate!
lukeoftheaura
Posts: 14
Joined: Sat Apr 29, 2017 7:13 pm

Re: A C compiler that can compile for dragon 32?

Post by lukeoftheaura »

Bosco wrote:Also, Pierre Sarrazin has developed a 6809-generating cross-compiler for a subset of the C language.

http://perso.b2b2c.ca/~sarrazip/dev/cmoc.html

The website says `The most significant difference between CMOC and a complete C compiler is the absence of longs and floats and of the const keyword.'

I'm not very knowledgable about such things but thought I'd post a link in case it was of interest? :)
I'll certainly give this a look - compiling gcc6809 seems like a bit of a pain.I wonder if there's a graphics library?
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: A C compiler that can compile for dragon 32?

Post by Bosco »

I know CMOC supports inline assembly language. Handy I guess for sections of code which are speed critical.

I think Rick Adams wrote `Temple of Rom' using a mix of C and ASM?
lukeoftheaura
Posts: 14
Joined: Sat Apr 29, 2017 7:13 pm

Re: A C compiler that can compile for dragon 32?

Post by lukeoftheaura »

So far I've managed to write the classic "Hello world" program using CMOC and run it on xroar and I'm quite impressed, but I don't know how to then convert that so I can run it on real hardware (to cas or WAV). any ideas?
User avatar
Bosco
Posts: 333
Joined: Tue Mar 04, 2014 11:49 pm
Location: Nottingham, UK

Re: A C compiler that can compile for dragon 32?

Post by Bosco »

lukeoftheaura
Posts: 14
Joined: Sat Apr 29, 2017 7:13 pm

Re: A C compiler that can compile for dragon 32?

Post by lukeoftheaura »

I can't seem to make bin2cas work, there's probably an option I'm missing.
I have this program:

Code: Select all

#include <cmoc.h>
int main()
{
    printf("HELLO WORLD!\n");
    return 0;
}
I compile it using

Code: Select all

cmoc main.c
and when I open the bin with xroar, I get the expected output. Then, I run bin2cas to convert to a cas file, and cas2wav to convert to cas:

Code: Select all

./bin2cas.pl main.bin -omain.cas
./cas2wav main.cas main.wav
Then when I open the wav or the cas in xroar it seems to load the file but then nothing happens (it stays on the screen saying "F MAIN"), and I get the same response when I load it on my dragon 32.
User avatar
robcfg
Posts: 1530
Joined: Sat Apr 04, 2009 10:16 pm
Location: Stockholm, Sweden
Contact:

Re: A C compiler that can compile for dragon 32?

Post by robcfg »

Hi Luke,

Try my DrBinCas program which you can find here.

Tell me if you have any problem with it.
Post Reply