CppCon 2016: Jason Turner “Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17”

Channel:CppCon · Length:1:19:52 · Published:2016-09-24 · Views:264521

Watch on YouTube

Summary

Jason Turner's CppCon 2016 talk builds a simple Commodore 64 game using C++17, showing how constexpr and const let a modern compiler produce tight 6502 code. He walks through assembly output to show abstractions being optimized away.

Why HN recommends it

A perennial favorite, recommended as proof that expressive modern C++ can compile to efficient code even on tiny retro hardware.

there is a wonderful talk by Jason Turner about writing a simple Pong clone for the Commodore 64 in modern C++ — HN, 2016

C, C++, Rust, Go & systems languages · Compilers, interpreters & program analysis · Demoscene & retrocomputing

Subtitles (excerpt)

Good morning. Everyone having fun at the conference so far? So, as Rob said, I um have been doing things with 30 and 40y old computers for the fun of it. So, which brings us to today's plenary. We are going to make a simple Commodore 64 game in C++ 17. today. But before we get started, who all here regularly needs to program for desktop and server systems, ARM? You know, I'm assuming most people pro. Yeah. Okay, there we go. Um, PowerPoint just crashed. That's very strange. [Applause] All right. Yeah. Uh, it actually seems my computer just rebooted on me. So, just a moment. So, I'm going to actually fully reboot my computer now and uh without the HDMI cable plugged in and we'll continue the poll. So, the first question was who all has to program for regular computers? That's everyone basically, right? Who uh programs for microcontrollers? So, that's a I don't know 10% of people. So, does anyone here regularly have to program for 40y old 8-bit CPUs by any chance? 8bit CPUs, but not really. Uh, what are you programming for? AVR. Does AVR not do 16 bit math? You can't do 16 math. 16 bit emulated. Okay. So, um, today while we wait for my computer to reboot, we are, um, we're going to make this game in for the Commodore 64 and we're going to

On Hacker News

Absolutely. There was a fantastic talk at CppCon last year, using C++17 to program a game for the Commodore 64. Using standard C++ idioms, the optimizer was easily able to make it compile down to efficient machine code. [1] [VIDEO] — MereInterest, 2017-02
For those who haven't seen it, there is a wonderful talk by Jason Turner about writing a simple Pong clone for the Commodore 64 in modern C++: [VIDEO] — dmit, 2016-10
There's a great talk [1] in which C++17 features are used to build an efficient Pong clone on C64. As I recall, the author wound up writing an (obviously limited) x86-to-6502 translator to get around the lack of 6502 support. [1] [VIDEO] — 0xcde4c3db, 2023-02
Creativity flourishes with the right restrictions. In this case, the graphics and sound limitations. Also, just because you're targeting old platforms doesn't mean you need to use old platform's tools. Modern tools make it so much easier to develop on these old platforms, check out this talk about coding in C++17 for the Commodore 64 [VIDEO] — ciroduran, 2022-09
> Nor does it have any concern for the elegance of its design. It has a lot of inelegant facilities, which, when used under the hood, allow you to express your elegant abstractions. > Hence the common practice of using a small subset C++ and pretending it's just C with Extras. That's mostly failure to use C++. Since C++11, and especially with later updates to the standard, idiomatic C++ is very d… — einpoklum, 2022-05

Related videos