Of course there are several versions of K&R C compilers that emit z80
& 8080 asm, but my questioner seeks an ANSI-C compiler that can output
asm for his 8085.
Thxs,
Steve
It sounds like a joke. The only instruction code difference between 8080
and 8085 is that the 8085 have two additional instructions, RIM and SIM
(read and set interrupt mask).
So I see no advantage to get a compiler which make use of these two
instructions, which IMHO are very hardware dependant.
For CP/M compiler, plz visit my C-Compiler page at:
http://www.z80.eu/c-compiler.html
If you need a cross compiler (for DOS), may be you can modify Small-C
for that purpose, start with http://www.cpm.z80.de/small_c/smc88dos.zip
Regards
Peter
Hi Peter, I could have said that better. He has an 8085 single board
computer. He desires a small-c compiler that has its source code
written in ansi-c C syntax, so that he can compile its sources on his
linux system with GCC. All of the sources that I am familiar with are
written in K&R C syntax. AIUI, K&R syntax support has been dropped
for some time from most (all?) compilers.
tia,
Steve
In another terms, he needs a GCC backend, or I have misunderstanded the
question ?
Anyway, there's a *nix C x-compiler for Z-80:
I guess is feasible to work a 8080/5 backend, and IIRC is still
considered one of the best Z80 compiler (heck, can compile workable
binary for a ZX81/80...)
Best regards from Italy,
dott. Piergiorgio.
What I need are sources for a compiler that I could modify and compile
on *NIX/CYGWIN. With that executable in hand I could then cross
compile C to 8080 asm. I tried to cross compile some C to 8080 with
this http://www.cpm.z80.de/small_c/c80dos.zip
But it tries to link some CP/M libraries to the result. As I only have
simple single board computer with no CP/M this won't work. Then I
wanted to modify source code of c80dos.c and tried to compile it on
CYGWIN. It did not compile. So now I am asking, if somebody has an
compilable version of 8080 C compiler that I could take and modify.
I believe main problem is that Ron Cain's (c80dos.c) assumes pointers
are two byte wide, char is only one byte, original SmallC was self
compiling and therefore only used one dimensional arrays, no
structures .. This makes it difficult task to get c80dos.c compiled on
modern C compiler.
Hmm. I have lying around something called "Small C Compiler v C3.0R1.1"
by Chris Lewis that includes an 8080 flavor. I've just built in on my
NetBSD box, so I know it goes through GCC.
However, all the pointers to it I'm finding on the net are defunct. I'm
not sure where or when I picked it up.
--
roger ivie
ri...@ridgenet.net
Can you please try to compile simple C program with it if it really
parses well and outputs 8080 asm ? That could make my day :-)
On 2011-05-02, roman fulek <roman...@gmail.com> wrote:
Here's a pointer to the software that still works:
http://www.gtoal.com/compilers101/small_c/small-c/
Compiling this C code:
main()
{
return 1;
}
yields this assembly:
; Small C 8080;
; Coder (2.4,84/11/27)
; Front End (2.7,84/11/28)
extrn ?gchar,?gint,?pchar,?pint,?bool
extrn ?sxt
extrn ?or,?and,?xor
extrn ?eq,?ne,?gt,?le,?ge,?lt,?uge,?ult,?ugt,?ule
extrn ?asr,?asl
extrn ?sub,?neg,?com,?lneg,?mul,?div
extrn ?case
cseg
main:
lxi h,1
jmp ?1
?1:
ret
dseg
extrn etext
extrn edata
public main
--
roger ivie
ri...@ridgenet.net
'Chris Lewis' rung a bell..
http://www.cpm.z80.de/small_c/small-c.tar.gz
Steve
...<snip>...
compile C to 8080 asm. I tried to cross compile some C to 8080 with
this http://www.cpm.z80.de/small_c/c80dos.zip
But it tries to link some CP/M libraries to the result. As I only have
simple single board computer with no CP/M this won't work. Then I
wanted to modify source code of c80dos.c and tried to compile it on
CYGWIN. It did not compile. So now I am asking, if somebody has an
compilable version of 8080 C compiler that I could take and modify.
I believe main problem is that Ron Cain's (c80dos.c) assumes pointers
are two byte wide, char is only one byte, original SmallC was self
compiling and therefore only used one dimensional arrays, no
structures .. This makes it difficult task to get c80dos.c compiled on
modern C compiler.
...<end>...
What you have is the comp.unix cross-compiler for Small-C. The
Unix version makes less assumptions about the host compiler word
size, and has an allowance for host byte order. It still uses
many 'non-portable' constructs, but fortunately most compilers
resolve them in a similar fashion to Small-C, so you just have to
tolerate a lot of warnings. It is possible to eliminate
pointer-->int-->pointer conversions by editing in a suitable
set of macros and/or conversion-function calls, but that will
require some significant (but not impossible) level of effort.
You will still need to link any results with an appropriate
C-Arithmetic-and-Logic-Library (call.mac/rel/obj/lib). The 'CALL'
is not CP/M specific. If your programs use any of the usual
(Unix) StandardIO or other library functions, you will have to
create your own versions for a non-CP/M system. You will also
have to deal with the C-Run-Time-Start-Off module (or lack
there-of). That may mean no command-line arguments, re-direction,
or arguments for main() (no argc or argv[]).
Quot: "35K The code needs some modifications (just renaming some
functions) to work under Linux. The files extracted are dated 1989! It
does fail with a segmentation fault when trying to compile it, which
it's supposed to be able to do, so I can't guarantee it's 100%
stable."
As I read this I avoided it originally. But Roger proved that it still
works under NetBSD, so that I made those modifications, got the
segmentation falut and resolved it :-) It was just problem with args
processing. Now it works also under Linux/64 :-)
Thanks for reply. So my assumptions were right. Those old CP/M version
are probably dead. As this *NIX version now works, I may resolve those
pointer-->int-->pointer conversion warnings in the future. I believe I
can take C-Arithmetic-and-Logic-Library from another SmallC version
for 8080 with almost no modifications needed. Register allocation
should be the same.
Great!
I hope you will submit your version to www.cpm.z80.de
Steve
Yes, the Small-C 1.2 CALL should work un-modified. You might want
to start off by resorting the original Ron Cain technique of using
stdio.h to inject the CRTSO and CALL sources via an '#asm' section
into the front of the generated assembly code. Everything must be
compiled at once (via '#include' commands, for example), but you
initially only need an assembler (no cross librarian or linker).
Later on you can get the assembler, librarian, and linker in the
'SmallMac' package (on Gaby's site, among others) to compile and
run as cross-tools too. I have them running under DOS (WIN23 cmd
window) via the CWare PCC v1.2d compiler. PCC is a 16 bit integer
compiler, so I don't claim to have shaken out too many non-portable
constructs from the SmallMac sources. The SmallMac tools have a
common set of support routines that have to be compiled into a
library for your host system. Some of them may already be in your
C-compiler's library routines, and others (like 'getkey()') may have
to be faked or re-invented.
Note, that to get the SmallMac assembler to compile as a cross-tool,
you will first have to get the supporting 'cmit' tool running, with
the modification that it spits out it's tables as C-source or in
your host system's assembly source form. I can e-mail you my
modified cmit sources, if you are interested.