C Programming with Oscar64 on the Commodore 64

477

In his latest video, Wouter Bovelander, known as The Highlander71, explores Oscar64 C programming on the Commodore 64. He previously used the CC65 compiler but wanted to test Oscar64 this time. The compiler, created by Dr. Mortal Wombat, powers several fast-paced C64 games. These games prove C can be efficient on the Commodore 64.

He sets up Oscar64 in VS Code and runs its built-in tutorial programs. One example displays a DOS-style custom character set.

Working with Memory and Character Sets

Bovelander explains how Oscar64 loads custom character sets into RAM hidden under the ROM. Then, he demonstrates bank switching to give the VIC-II access to new characters.

He switches out the KERNAL and BASIC ROMs, copies the character set to RAM, and switches ROMs back in afterward. This process allows the CPU and VIC-II to share access without conflicts.

Understanding the Memory Trampoline

The main focus is the memory trampoline. This small assembly routine prevents crashes when interrupts occur while ROM is switched out.

It intercepts the interrupt, restores the ROM configuration, runs the original interrupt handler, and switches memory back to its previous state. This keeps the program stable during heavy memory changes.

Deep Technical Breakdown

Bovelander examines Oscar64’s source code and explains stack behavior, interrupt vectors, and register handling. Then, he shows why saving and restoring registers is critical.

He also reviews the IRQ and NMI handler hooks, pointing out how they work only when ROM is out. His added code comments are now part of Oscar64’s GitHub main branch.

Why It’s Worth Watching

This video blends compiler setup, system programming, and debugging. It’s a must-watch for anyone working with C or assembly on the Commodore 64.

If you want a clear, hands-on example of Oscar64 C programming, this breakdown delivers.

Subscribe
Notify of
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments