Posts tagged c
Optimizing C array lookups for the 6502
- 17 March 2019
Most of the platforms in the IDE that are powerful enough to support a C compiler are Z80-based. The Z80 isn’t the easiest target for C, but at least it has a lot of registers.
While the 6502 only has three 8-bit registers, the 6502 has strengths the Z80 doesn’t, as we’ll see here.
Let’s compare the two dominant C compilers for these CPUs.
We’ll compile a function with the CC65 C compiler for the 6502, and then with the SDCC
(Small Device C Compiler) for the Z80.
We’ll call the function getValue()
: