The NES Toolchain Foundation
Now let’s take a look at the toolchain I’ll be using for NES development. For reference, I previously referenced nesdev.org’s programming guide for finding out what’s available. During my previous endeavor I looked at cc65’s compiler and was able to build it without much difficulty. However, from recollection, it didn’t perform anything in the way of optimizations, so that’s sounded a little suspect. What does provide optimizations out of the box? LLVM! So this goes along with by dual intent for this project, experimenting in game and compiler development.

Since 6502 isn’t supported as a part of mainline llvm, we’ll be using 2 repos based on llvm: llvm-mos and llvm-mos-sdk. At first I questioned the need for the SDK to experiment with, I thought I’d just be writing my own macros in support of accessing HW registers, but as I worked through my initial example I realized that there were some other features required that would take a non-trivial amount of effort to achieve (eg. linker ROM output). We’ll spend more time looking at this in the future.
The other thing I wanted to do for this cross compiler tool-chain is to make it more portable by “containerizing” the environment. We also want to avoid working within the container, so to the degree that is achievable, we want to run these commands from within each respective OS shell. To this end I’ve created a github repo with docker image instructions to make this easier.
I’ll be using a Mac Mini for this project because it’s where I’ve begun to work on my personal project.