CPCWiki forum

General Category => Programming => Topic started by: sno0ks on 17:50, 22 July 18

Title: C compilers that run on the CPC?
Post by: sno0ks on 17:50, 22 July 18

I have used z88dk, but for pure s**ts and giggles I want to go full native. What was/is the best one out there and what's the best way of getting it?


Regards!
Title: Re: C compilers that run on the CPC?
Post by: GUNHED on 22:31, 22 July 18
Well, I would suggest the Small C compiler for CP/M Plus.  :)
Title: Re: C compilers that run on the CPC?
Post by: sno0ks on 23:22, 22 July 18

Thanks for the reply! I hadn't thought of using CP/M but unfortunately I can't seem to find download links to either CP/M for Amstrad or a binary of the Small C compiler that would run on it.


Are they somewhere so obvious I can't find them?
Title: Re: C compilers that run on the CPC?
Post by: asertus on 07:09, 23 July 18
Some of these may work,


http://www.z80.eu/c-compiler.html


For small tests I have used http://www.cpcwiki.eu/index.php/HiSoft_C , but I prefer compiling in a PC, easier to edit and faster to compile.
Title: Re: C compilers that run on the CPC?
Post by: HAL6128 on 07:10, 23 July 18
You will find the sources / discs at cpc-power.com.

HiSoft C (DOS and CP/M) and Arnor C (CP/M) are both (almost) ANSI C Compiler.
Title: Re: C compilers that run on the CPC?
Post by: AMSDOS on 08:26, 23 July 18
PhrozenC (http://www.cpc-power.com/index.php?page=detail&num=10206) is an interesting one to check out. It's basically a Small-C compiler, so would be somewhat limited, though PhrozenC comes on ROM or Disk, programs are written using Protext, PhrozenC compiles the code into Assembly (which can be compiled in MAXAM). PhrozenC also uses the Extra 64k (so 128kb is required), for storing the program to compile. Unsure if it's limited to what system it compiles to unlike Small-C which can compile AMSDOS,CP/M or FutureOS programs, PhrozenC is one of the more recent C Compilers made for CPC in 2010, comes with Manual and is Public Domain, it doesn't require CP/M to be running either. On a standard CPC it would seem to require a few ROMs to get the job done, for emulator like Winape, I'm sure editing the program in Windows and copy and paste the text file onto a DSK should work.
Title: Re: C compilers that run on the CPC?
Post by: sno0ks on 13:53, 23 July 18

Thanks everybody for all the very helpful replies, I think that gives me enough to chew on for the next while! I have Hisoft_C up and running so I'll take it from there, manual first.  :)






Title: Re: C compilers that run on the CPC?
Post by: Sykobee (Briggsy) on 14:38, 23 July 18
I presume the CP/M C compilers will generate 8080 code, rather than taking advantage of the additions in Z80?
Title: Re: C compilers that run on the CPC?
Post by: GUNHED on 14:26, 24 July 18
No, not Arnor C, not Small C and not Aztec C. They all make Z80 code. CP/M allows to use the full register set of the Z80, which can't be done for the native CPC OS. So I suggest to move to CP/M Plus which also provides 61 KB free RAM (in contrast to 42 KB under the native OS).
Title: Re: C compilers that run on the CPC?
Post by: AMSDOS on 02:11, 01 August 18
The original Small-C Compiler by Ron Cain was written to target 8080 systems, though at some stage it's been modified for z80 systems. Ron Cain's Small-C Compiler is also Public Domain, though the James Hendrix's versions are Shareware. A few years ago I was using Small-C along with Juergen Weber's Library which has Z80 code in it along with another similiar Library written earlier for Amstrad systems, to make some graphical demos. Downloading Small-C from an Amstrad based site should give you the right program, the Small-C page which is on the Wiki (http://www.cpcwiki.eu/index.php/Small_C) has links to some CP/M websites, which maybe the 8080 version. If in doubt just download ProzenC which is the modernised Small-C made to benefit what you can get out of the Amstrad with 128Kb, it's probably only limited for compiling CPC-OS programs through.
Powered by SMFPacks Menu Editor Mod