Close

C-coding on a 65c02

A project log for PZ1 6502 laptop

I am building a laptop with a W65C02, lots of memory, SID-sound, decent graphics and a filesystem.

adamklotblixtadam.klotblixt 03/29/2024 at 05:220 Comments

During the wekend I managed to configure both cc65 and llvm-mos to emit code that runs on my own scheduler. Since doing a fair bit of C-code under Fuzix I was curious to see what assembler code the different compilers produced, and to benchmark them.

I started by writing a 16-bit fixed-point mandelbrot that produced the famous shape in ascii on my desktop pc. Then I followed the official porting guides for cc65 and llvm-mos. I was pleasantly surprised at how easy it is to get started, both projects have very clear guides!

When I finally got everything going, the visual "timing" said that llvm-mos is roughly twice as fast as cc65 for this particular program. The assembler code also looks more pleasing to me. The fact that cc65 lacks floating point is a big failure in my opinion. So, if I ever want to write C-code for the 65c02, llvm-mos will be the way to go.

Discussions