The cc65 compiler is a C compiler that builds programs for computers with a 6502 CPU, like the Apple II series and the Commodore 64. It runs on Windows and Linux. So it is actually called a cross-compiler because it runs on a different type of system than the type for which it builds programs.
Why would you want to write C programs for a 30 year old computer? If you're asking yourself that question then maybe this is the wrong article for you.
Setup Instructions for Windows
Setup Instructions for Fedora Linux
I have determined the optimal way to setup cc65 on Fedora. I would like to build a package for Fedora but that is another effort in itself. These instructions will provide package-like system integration for cc65.
The cc65 compiler is distributed in source form. But this is not a problem because it builds flawlessly on Fedora.
Fedora Step1: Install Dependencies
The following command not only installs the necessary tools to build the cc65 executable programs, it also installs all the tools to build the documentation.
sudo dnf install git gcc make linuxdoc-tools texinfo
Fedora Step 2: Create a Place for the Source Code
If you don't have a "git" directory, create it with the below commands. You don't need to create a ~/git/cc65 directory because that will be done automatically by git.
Fedora Step 3: Retrieve the Source Code
From the ~/src directory, enter the following command to download the cc65 code from github.com. A cc65 subdirectory will automatically be created.
git clone https://github.com/cc65/cc65.git
Fedora Step 4: Build the Compiler from Source
The build process works flawlessly on Fedora. Simply type:
Fedora Step 5: Build the Documentation
You will want to refer to the documentation. It will be quicker to access it
locally. Build it with this command:
Fedora Step 6: Install the Compiler
The below command installs the following:
- cc65 executables in /usr/local/bin
- cc65 documentation in info format in /usr/local/share/info. View it with the command: info /usr/local/share/info/index.info
- cc65 documentation in HTML format in /usr/local/share/doc/html/cc65.
sudo make install prefix=/usr/local
Fedora Step 7: Bookmark the Documentation
To be successful working with software development tools you need quick access to the documentation. I keep a very organized set of bookmarks in my browser so that I can quickly get answers to questions that come up during development. One can waste a lot of time looking for information if it is not readily available. So I suggest creating a bookmark in your browser for the following local file which is the starting point for the cc65 documentation in HTML format.
In Firefox you can press Ctrl-O to open a file. Enter the below path. Then bookmark it with Ctrl-D.
Fedora Step 8: Build a Program
Fedora Step 9: Run Your Program
Apple II Dev Links
All the information necessary to build programs for an Apple II is unfortunately not collected into one place. There are bits and pieces everywhere.
- 6502 CPU Instruction Set
- ProDOS Memory Map
- ProDOS Commands
- ProDOS API
- Built-in Machine Language Subroutines
- Monitor Commands