CC65 patches for Apple 1 and Replica 1

Discuss software for the Apple 1/replica 1

CC65 patches for Apple 1 and Replica 1

Postby resman » Jun Tue 13, 2006 4:09 pm

I've made some patches to the cc65 compiler suite to add support for the Apple 1 and Replica 1. The file: ...
is the directory structure of the cc65 source tree containing only the new files or files that have been modified. To apply, download the current stable source archive from and copy the patched files over the existing ones. I have submitted the files to for inclusion in the next release, but it would be nice to test it more. Two new targets are available to the compiler, apple1 and replica1. The difference lies in the memory map of the two computers. The Apple 1 has a disjoint 8K memory map whereas the Replica 1 has a nice contiguous 32K. The code generated by the compiler isn't really compact, so it would tend to overflow 8K. 32K fits nice. In order to compile the classic:

Code: Select all
#include <stdio.h>

int main(void)
        printf("Hello, world.\n");
        return (0);

one would type "cl65 -t replica1 hello.c" and get a binary called hello. Since I was the lucky one to get Vince's SE prototype, I send things over the USB/serial interface. I have included a utility program under util/apple1/bintomon.c that reads the binary file and spits out Woz monitor compatible text. Redirect the output to save to a file. The linker set the start address at $280 for both the Apple 1 and Replica 1. You can interact with your program through stdio, or you can use some very basic routines to read the keyboard and write to video. The file include/apple1.h has the function prototypes for these routines. The standard I/O library is very large so if you don't need it, use the simple routines. Both targets generate standard 6502 code. If you have a 65c02, you can get slightly more efficient code by including a " --cpu 65c02 " on the command line. Now, even if you aren't into C coding on the 6502, the cc65 suite has a pretty powerful assembler as well. Not quite as nifty as having a resident Replica 1 assembler, but its easier to write that giant Apple 1 masterpiece of coding you have always wanted to do.

Posts: 2
Joined: Jun Tue 13, 2006 3:45 pm
Location: Lake Tahoe

Postby lorddoomicus » Aug Sat 09, 2008 8:13 pm

I'm having problems compiling cc65 with the patches applied ...

I downloaded the sources for 2.11.0, un-tar'd it, compiled it. It compiled just find.

I untar'd it and typed the following:

cd cc65-2.11.0
cp make/gcc.mak Makefile

Like I said it worked just fine ...

Then I downloaded the cc65 patches for the replica I, and typed the following commands:

cd cc65-2.11.0-diff
tar -cf - . | ( cd ../cc65-2.11.0/ ; tar -xvf - )
cd ../cc65-2.11.0

and I get a bunch of complier messages scrolling by and it ends with:

cp apple2enh/apple2-280-192-6.tgi a2e.hi.tgi
for i in apple1 common runtime; do \
make SYS=apple1 -C $i || exit 1; \
../src/ar65/ar65 a apple1.lib $i/*.o;\
ca65: Invalid target name: `apple1'
make[3]: *** [crt0.o] Error 1
make[2]: *** [apple1lib] Error 1
make[1]: *** [all] Error 1
make: *** [libs] Error 2

I assume I did something wrong when applying the patches.

If it matters, I am running Mac OS X 10.5.4 on an MacBook and have the latest x-code tools installed.

Any clues?


- Derrik
Derrik Walker v2.0, RHCE
Posts: 32
Joined: Sep Thu 07, 2006 9:30 pm
Location: Mentor Ohio

Return to Software

Who is online

Users browsing this forum: No registered users and 1 guest