Skip to content
0:00 / 0:00

#c++17#commodore64#constexpr

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

CppCon

189K subscribers • 94 videos on Hallway • Conference channel

YouTube
  • Recommended by 15 people: 13 on Hacker News, 1 on Lobsters and 1 in engineering communities.
  • A classic. People kept recommending it from 2016 to 2023.
  • Presented by Jason Turner, host of C++Weekly
  • Linked in the descriptioncppcon/cppcon2016
  • May be out of date. Uploaded 10 years ago, in an area where tools change fast.

Advanced. Deep dive for people who know the field.

264K views10 years ago15 recommendations

Systems programmingGame developmentC++Retro computingGame programming

Jason Turner demonstrates how to write a Commodore 64 game in modern C++17, leveraging compiler optimizations to produce efficient 6502 assembly.

CppCon.org — Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/cppcon/cppcon2016 — The Commodore 64 was released in 1982 and is the best selling computer model of all time. At 34 years old, even the most simple embedded processor today outperforms it. Join me on an exploration of how C++17 techniques can be utilized to write expressive, high performance, high level code for simple computers. Together we will create a game for this aging system. You'll leave the talk with a better understanding of what your compiler is capable of and be able to apply these ideas to create better code on modern systems. — Host of C++Weekly youtube.com/c/JasonTurner-lefticus, Co-host of CppCast cppcast.com, Co-creator and maintainer of the embedded scripting language for C++, ChaiScript chaiscript.com, and author and curator of the forkable coding standards document cppbestpractices.com. I'm available for contracting and onsite training. — Videos Filmed & Edited by Bash Films: BashFilms.com Work at Hudson River Trading (HRT): tinyurl.com/safxfctf

Why it's here

15 people recommend this, 1 disputes it

What people say. Highly recommended for showing how modern C++ abstractions and constexpr can compile down to extremely efficient retro-hardware machine code.

Moments people linked to

u/hak8orin r/embedded • Recommends

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

dbremneron Lobsters • Recommends

Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17 (2016)

dmiton Hacker News • Recommends

On “Twenty years later I wrote a Tetris again”

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++: link to this video

MereIntereston Hacker News • Recommends

On “C++ on Embedded Systems”

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 link to this video

voltagex_on Hacker News • Recommends

On “Ask HN: What's your favorite tech talk?”

Your second link reminded me of link (which definitely builds on some of Matt's work). link to this video - C++17 for the Commodore 64. Probable language warnings for my other suggestions: * Rescuing Prince of Persia from the Sands of Time link (was this talk ever given elsewhere?) * And You Shall Know Me By My Trail of Documentation - link * The History and Evolution of Computer Viruses - link

beached_whaleon Hacker News • Recommends

On “Epiphany-V: A 1024-core 64-bit RISC processor”

Check out the cppcon 2016 presentation by Jason Turner and watch how eager the compiler optimizes away code when const is enabled on values. Cool presentation too, and uses Godbolt's tool link to this video

sqeakyon Hacker News • Recommends

On “Add a const here, delete a const there”

…ror then most compilers (or at least GCC and Clang) will presume the code is compliant and make optimizations following what the standard allows. This potentially results in undefined behavior when that pointer you mentioned is used to modified a thing that ought to be const. Consider the amount of optimizations seen in the video from CppCon 2016: link to this video Jason Turner, the presenter, is writing code a few lines at a time and cross compiling for the Commodore 64. He shows his assembly at many steps of the way and shows how many functions are completely elided when const (and later constexpr) are used correctly. There are a ton of other good talks from CppCon 2016 including one about const and…

Nimelrianon Hacker News • Recommends

On “C++: Associative map containers with compile-time lookup”

Also highly recommended: Anything by Jason Turner and Ben Deane. Examples: - Ben Deane - Using Types Effectively 0 - Jason Turner - Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17 1 - Ben Deane & Jason Turner - constexpr ALL the Things! 2 0 link 1 link to this video 2 link

adev_on Hacker News • Recommends

On “ChaiScript – Easy to Use Scripting for C++”

For the note: ChaiScript is from Jason Turner. He also does CPPCast ( link ) and is a regular presenter at CPPCon ( link to this video ). Many of his videos / tutorials are worth a look if you are interested in C++.

inetknghton Hacker News • Recommends

On “Getting started with bare-metal assembly”

> And once You think you’ve run hw to its limits there are plentiful demos and examples around to blow your mind watching what people have been able to do with these machines (often in obscure ways). What blew my mind was using a modern C++ compiler to build optimized software for that old hardware. Here's an example with the Commodore 64 0. 0: link to this video

magicalhippoon Hacker News • Recommends

On “Comparison of C++17, Go, and Java for a next-generation sequencing tool”

> I was hoping someone could prove this, actually. Maybe this presentation by Jason Turner from CppCon 2016 can illustrate just what can be done in C++17. His target in the presentation is a C64, but I think it illustrates well just what you can do with the language, and hence what tools are available for writing fast code. link to this video edit: If you just want a quick fix, check out what a simple keyword does here: link to this video

dhsysusbsjsion Hacker News • Recommends

On “I translated a simple C program to x86_64 and it was slower”

This talk proves this point exactly: link to this video Watch from 27:00 where he talks about using const wherever possible so the compiler can optimise. It reduces a full function call to work out a colour in 3D space from thousands of instructions to one. After watching this and a few others particularly dynamic dispatch in Swift, I find myself adding as many hints as I can and applying the most restrictions / scoping possible. Final, const, Private etc. link Even though actually it can work this out in your module!

einpoklumon Hacker News • Recommends

On “Common libraries and data structures for C”

> 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 different from C - even if you're not using a lot of the standard library. I'll link to a talk already linked-to in another comment in this discussion: Rich code for tiny computers / Jason Turner, CppCon 2016 link to this video

ciroduranon Hacker News • Recommends

On “8bitworkshop”

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 link to this video

0xcde4c3dbon Hacker News • Recommends

On “I learned to program a C64 in basic and compiled C (2020) [video]”

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 link to this video

fredsanfordon Hacker News • Disputes

On “The cost of forsaking C”

Take a look at the useless features and bloat in this video. Modern C++ isn't what you think it is. link to this video