I made a NES emulator in 15 minutes

Channel:Bisqwit · Length:15:04 · Published:2011-12-05 · Views:389475

Watch on YouTube

Summary

Bisqwit writes a NES emulator in C++ in about 15 minutes of tool-assisted, sped-up coding, narrated with captions. It shows an accurate emulator built with a compile-time generated 6502 instruction table. Part 2 covers compiling and running it.

Why HN recommends it

HN programmers admire it as a clean, clever demonstration of emulator design and as the standout of a favorite programming YouTuber.

Here's a very clean and clever NES emulator in C++ by Bisqwit of TAS fame — HN, 2015

C, C++, Rust, Go & systems languages · Software practice, open source & careers · Demoscene & retrocomputing

Subtitles (excerpt)

Konnichiwa! I am Bisqwit. In this video I create a NES emulator from scratch. The process of creating an emulator is highly technical, and I cannot possibly go over every detail, but I will try to explain some of the more interesting parts. The CPU in NES has 2 kilobytes of RAM, three general-purpose registers, a 8-bit stack pointer, and a 16-bit program counter that points to the current instruction to be executed. The purpose of an union is to provide different views to the same data. Nearly all registers in the NES contain bit-fields that are smaller than a byte. This RegBit object provides a portable way to access those bitfields. I learned it from byuu. My emulator architecture is synchronous. It means that every component runs off the same clock.processes the screen rendering in real For instance, every time the CPU executes one clock cycle, the PPU executes three. Each component only does the things they should do on those clock cycles. This approach has a number of benefits. For instance, it makes it easy to provide TAS functionality. It also makes the overall emulator design a lot simpler than otherwise. Emulation accuracy also comes as a side effect. The downside is that the emulator requires a beefier computer to run.

On Hacker News

Agreed. My favourite programming YouTuber by a long stretch. If anyone is unfamiliar with him and wants to watch some of the "classics" I'd recommend these: His "cracking videogame passwords" series: [LINK] Creating a Doom-style 3D engine in C: [LINK] Creating a Rogue-like game in C++11: [LINK] Creating a PIC16 emulator and NES music player: [LINK] Creating a NES emulator: [VIDEO] Creating a DOS … — petercooper, 2019-01
Those who enjoy this might also enjoy "Creating a NES emulator in C++11" [0] [1] [2] while not short in bytes of code(space) there is a nice video series short in minutes(time). Bisqwit takes you on a 30 minute tool assisted coding journey of making an NES emulator and also provides a 15 minute followup Q&A video explaining different aspects. [0] [VIDEO] [1] [LINK] [2] [LINK] — molticrystal, 2022-10
[LINK] is by far my favorite and I've spent many hours watching him. He does things like create a Doom-style engine from scratch: [LINK] .. create a NES emulator: [VIDEO] .. work back from a C++17 example to show why new C++ standards are needed: [LINK] .. and even building a Tetris clone in GW-BASIC: [LINK] .. Right now, he's doing a series on cracking 80s videogame passwords: [LINK] Sirajology … — petercooper, 2016-10
Here's a very clean and clever NES emulator in C++ by Bisqwit of TAS fame: [VIDEO] He presents the code in the style of a tool assisted run, typing it in in high speed. I never saw templates used like that to create the unrolled CPU dispatcher — atesti, 2015-03
[LINK] record high quality videos at many programming conferences each year and then share the recordings on YouTube. So much to enjoy here, especially if you're open source leaning, like most of the events they do. O'Reilly puts up lots of good stuff at [LINK] although the webinar recording quality leaves a lot to be desired. A real random set of tech topics though and often something worth watc… — petercooper, 2014-04

Related videos