CC65 is a mature cross-compiler of the C programming language for the 6502 processor. Some people have tried to use it (e.g. here, here, or here) and got discouraged by the quality of the generated code, often not understanding why the code generated was slow and big. This article is aiming to show that with a few changes in the coding style you can achieve both speed and size comparable to assembly language, while still having a majority of the benefits of working in a higher-level language. This article is based on CC65 version 2.18 (April 2020) and we may expect that in the future the compiler will handle more optimizations mentioned here automatically.
A 6502 emulator written in busybox ash. 6502.sh has a whopping 32k of RAM and 16k ROM in its default configuration, however this can be easily adjusted by editing machine.sh. It includes an interactive debugger with single-stepping, breakpoints (break on code, data access, JSR/RTS), and more. STDIO is directed to an ACIA compatible serial port at $8400 allowing for programs like BASIC to run.
The source for all your NES programming needs.