I have coded a lot in C on PC and would like to do some on the Atari as well. Are there any good compilers that let you set up projects similar to Visual Studio on PC and how fast is the compiled result compared to something coded in assembler. Ok I understand that it's not so easy to say since it all depends on the application and how good you code it, but let's say something like game logic or similar stuff that is not tight graphic loops. It had been good if it's possible with inline assembly so it's possible to make critical stuff in assembler.

Zamuel_a wrote:I have coded a lot in C on PC and would like to do some on the Atari as well. Are there any good compilers that let you set up projects similar to Visual Studio on PC and how fast is the compiled result compared to something coded in assembler. Ok I understand that it's not so easy to say since it all depends on the application and how good you code it, but let's say something like game logic or similar stuff that is not tight graphic loops. It had been good if it's possible with inline assembly so it's possible to make critical stuff in assembler.

I guess GCC and VBCC generates fairly efficient code. AHCC doesn't generate equally fast code afaik, but on the other hand it works really really well when developing natively since compile times are much shorter.

Zamuel_a wrote:I have coded a lot in C on PC and would like to do some on the Atari as well.

What are you going to make?

Zamuel_a wrote: Are there any good compilers that let you set up projects similar to Visual Studio on PC...

I've used Lattice C, PureC and gcc quite a lot the last 20 years, and have now landed on AHCC.

gcc produce efficient code but is very slow and eats huge amounts of memory. You would need atleast a TT with lots of memory, and either make or a GEM-based IDE like AGNUS to actually build something. You can use inline assembly in gcc. gcc is the only c++ compiler for TOS/MiNT.

PureC has a good, fast and efficient editor/IDE with a decent debugger (in TOS only). Produce less optimized code than gcc, but still quite good. Widely used, much commercial software was developed with PureC. No inline assembly, you must put assembler functions in separate files. *Very* fast compilation, PureC and AHCC are IMO the only realistic options if you're developing on a stock Atari.

Lattice C is comprehensible, and was widely used in the 90's. Still favoured by some, but I never really liked it. Compared to PureC it was slow and sluggish IMO. But it came with excellent documentation. I don't know anything about the quality of the produced binaries, sorry.

AHCC is actively developed. Quirky editor/IDE, but I'm beginning to like it. Loosely based on Sozobon X, binary compatible with PureC objects and linker, quite fast and fully open source. Solid and stable, but some bugs in the libraries. Good support from the author. Does not optimize code much, but OTOH it can produce binaries that works on both 020-060 and ColdFire. Inline assembly is supported, and you can access variables/structures declared in C directly from assembler.

VBCC is the new kid on the block. I'm not familiar with it. It comes from the Amiga world, Atari/TOS-support is relatively new. Actively developed.

gcc, AHCC and vbcc can produce native Coldfire binaries. AHCC can even produce binaries that runs on both 020-060 and Coldfire.

Forget about Sozobon C, Lazer C, Mark Williams C and a few other implementations from the stone age. They are not worth spending time on

There's more detailed information and some download links on Eero Tamminen's web site.

Zamuel_a wrote:...and how fast is the compiled result compared to something coded in assembler.

I guess that depends on the person that writes the assembler code For small, very specific pieces of code I'm sure a skilled assembler coder can beat any C compiler. But generally speaking a decent C compiler will beat any assembler coder once the code starts to grow.

Zamuel_a wrote:Ok I understand that it's not so easy to say since it all depends on the application and how good you code it, but let's say something like game logic or similar stuff that is not tight graphic loops. It had been good if it's possible with inline assembly so it's possible to make critical stuff in assembler.

If you're developing on an Atari, and you're developing games, I'd say PureC and AHCC both are good choices. PureC for it's very quick IDE and compiler, excellent help-system and good debugger. AHCC for almost equally quick IDE/compiler, better support for inline assembler and partial C99. Forget about gcc on real hardware, unless it's a CT60 or Firebee.

shoggoth wrote:I guess GCC and VBCC generates fairly efficient code. AHCC doesn't generate equally fast code afaik, but on the other hand it works really really well when developing natively since compile times are much shorter.

And AHCC also has an IDE. Not exactly Eclipse, but very functional. The GUI is quirky, but very efficient when you're getting used to it. Very PureC-like in some aspects. E.g. the code you're working on is calling a function "foo(bar)", but you can't remember where that function is implemented. Just position the cursor somewhere on the function name and press Help, and you jump to the function implementation. Press Undo and you jump back to were you were working. Simple and brilliantly efficient.

It can also display a function call three, as well as a dependencies three. Very useful, especially when working with other people's code.

joska wrote:And AHCC also has an IDE. Not exactly Eclipse, but very functional. The GUI is quirky, but very efficient when you're getting used to it. Very PureC-like in some aspects. E.g. the code you're working on is calling a function "foo(bar)", but you can't remember where that function is implemented. Just position the cursor somewhere on the function name and press Help, and you jump to the function implementation. Press Undo and you jump back to were you were working. Simple and brilliantly efficient.

It can also display a function call three, as well as a dependencies three. Very useful, especially when working with other people's code.

AHCC has indeed some really nice features which makes life easier, but for some reason it doesn't have syntax highlighting, and I haven't found a way to switch to a more programmer friendly font. Maybe I've missed something.

You can't select fonts, but it does have limited syntax highlighting. I'm not a big fan of syntax highlighting myself but I see the value in it.

One thing I'm missing is the ability to fold code. Many editors can fold code between brackets and/or indendation levels, which I find very useful. Once you've got a working function, just fold it and the implementation is hidden from view.

But the nice thing about AHCC is that it's fully open source, so if I really miss these things I can do something about it myself.

AHCC's shell has one big drawback, it does not allow to launch the compiled executable. For users of MiNT this may be acceptable but for TOS users it is a pain the a**. You have to ompile, leave the shell, run the (probably crashing) exectuable and load the shell again.

I personally use the command line TTP version and edit my sources on the PC, the rest is done by Hatari.

Thanks for the information I have tried Pure C alittle in the past so maybe I should check it out again. I saw that you have to define a project file with all the sources you need to include. How do I add assembler sources? I guess just adding a .S file won't help. It need an external assembler I guess?

joska wrote:You can't select fonts, but it does have limited syntax highlighting. I'm not a big fan of syntax highlighting myself but I see the value in it.

One thing I'm missing is the ability to fold code. Many editors can fold code between brackets and/or indendation levels, which I find very useful. Once you've got a working function, just fold it and the implementation is hidden from view.

Henk has built AHCC for his own needs/ideas, and I respect that. It's a kick-ass project - but still, I'd like to have syntax hl and font selection, it really improves readability for me. It's what I'm used to.

But the nice thing about AHCC is that it's fully open source, so if I really miss these things I can do something about it myself.

Well, true, but I don't want to rewrite the GUI of GiMP just to be able to draw pictures, if you catch my drift. In this case it means => Qed.

Zamuel_a wrote:how do I call the assembler routines from within my C file? I would have to set the registers and all that stuff.

Take a look in the "demo_ass" folder in the PureC distribution. There's an example of how this works. This example shows parameter passing in registers. Which registers to use is explained in the PureC help-file.

You can also pass parameters on the stack if you define the function as "cdecl".

I use very little assembler, but I think AHCC is more clever than PureC in this area. First of all, in AHCC you can use inline assembly. Secondly, in AHCC you can access structs declared in C directly from assembler.

This is very interesting. Do you think you could write a more standalone post on this, for creating assembly sources both compatible with PureC,AHCC and gcc?It might be very helpful, and I think this little example without more indepth explanation will get lost inside this thread.

gcc produce efficient code but is very slow and eats huge amounts of memory. You would need atleast a TT with lots of memory, and either make or a GEM-based IDE like AGNUS to actually build something. You can use inline assembly in gcc. gcc is the only c++ compiler for TOS/MiNT.

PureC has a good, fast and efficient editor/IDE with a decent debugger (in TOS only). Produce less optimized code than gcc, but still quite good.

So, can you explain what you mean by, "gcc produce efficient code but is very slow and eats huge amounts of memory."? It seems that if it's efficient then it should run pretty fast on the ST, compared to less efficient code. Are you saying that the code is efficient but doesn't take into account the limited ram the ol' STs had?