apple1 | ||
doc | ||
include | ||
py65 | ||
test | ||
vcs | ||
vic20 | ||
.gitignore | ||
a02.sh | ||
asm6502.c | ||
asm.c | ||
asm.h | ||
c02.bat | ||
c02.c | ||
c02.lang | ||
c02.ppj | ||
c02.sh | ||
clean02.bat | ||
clean02.sh | ||
common.c | ||
common.h | ||
cond.c | ||
cond.h | ||
dclrtn.c | ||
dclrtn.h | ||
expr.c | ||
expr.h | ||
files.c | ||
files.h | ||
include.c | ||
include.h | ||
label.c | ||
label.h | ||
Makefile | ||
parse.c | ||
parse.h | ||
README.md | ||
stmnt.c | ||
stmnt.h | ||
test.asm | ||
vars.c | ||
vars.h |
C02
C02 is a simple C-syntax language designed to generate highly optimized code for the 6502 microprocessor. The C02 specification is a highly specific subset of the C standard with some modifications and extensions
The compiler generates assembly language code, currently targeted to the DASM assembler.
See the top-level documentation for more information.
Building the Compiler
In Linux, use gcc and the Makefile.
In Windows use the Pelles C IDE and the file ./C02.ppj.
Compiling C02 programs
At a command line, cd into the appropriate directory, e.g. py65 or vic20.
Execute the c02 compiler from the parent directory using the c02 source file (without the .c02 extension) as an argument.
For example, to compile the program conds.c02, in the py65 directory, use the command
../c02 conds
in Linux, or
..\c02 conds
in Windows.
Some of the subdirectories contain a c02.bat file, which will compile the .c02 program, then run dasm to assemble the code. However, the path to dasm is hardcoded, so you will likely need to change it.
The file c02.sh provides the same functionality in Linux, but it may not be in a working state.