shithub: scc

ref: c5e705ef14f8038a051f258fe741919f4988ef7d
dir: /README/

View raw version
This is the kcc compiler, a one very stupid non retargetable compiler
for z80. This compiler is intended to be very simple and suitable for
running in small machines (like MSX for example), and let almost part
of optimizations for the programmer.

After a lot of years seeing compilers for z80 I notice that it is very
hard for a C compiler generates a good code for a 8 bit processor like
z80, with a expensive indirect addressing mode, so the best solution
is to not try that compiler optimize the code and use C as a macro
macro assembler.

In order to get this last, we need a compiler that does exactly the
things we want to do. For example is a variable is register it MUST be
register and fails in other case. If a variable is automatic try to
realize operations directly with the stack (for example use ADD
A,(IX+4), instead of allocate the variable into register add and store
again in memory). So if you declare an automatic variable you are a
big bullshit or you need it for recursion (static variables are your
friends). 

This is the reason why I begin to develop this compiler, and I hope
it will be useful for you.