CHIP-8: The birth of gaming
Tags: programming, gamedev
Published: 2023-04-10 03:57:52

## Intro

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/po8dt6pv5thm44hk4wjy.png)

When we think of video games, we start to look towards the past. I love retro games, as they have a simplicity to them. The many nights of playing Pac-Man on a CRT TV or Galaga in an arcade of most kids amusement areas, the classics are where it's at. However, because we usually talk about arcade style games when it comes to retro we tend to forget that we had even more classics in the 70s just as tech was beginning to form. Which is why today I'm gonna talk about one of the first virtual machines built for creating video games, the CHIP-8 programming language.

## CHIP-8 Breakdown and History

For simplicities sake I'll refer to CHIP-8 as C-8 through this blog. To start what is C-8, how does it work, and what was made with C-8? All of this will be answered, but lets start with what.

C-8 is a interpretive program language designed by Joseph Weisbecker in the mid 1970s. The original program was used on either COSMAC VIP or a Telmac 1800, to which both are 8-bit microcomputers. Its funny cause these computers are actually weaker than most graphing calculators to this day, and the first one was designed with a C-8 interface. C-8 was the backbone of some very famous games such as Pac-Man, Tetris, Space Invaders, and the GOAT Pong.


![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x6gnqbxsw2zjus1si1sd.jpg)
> Pac-man built on CHIP-8 SuperCHIP-8

C-8 was very simple. It rendered black and white pictures when it first began which acted as the playground for the game. Later in the 80s it was give limited color palettes, as well as some sound capabilities. The machine would output in upscaled 64x32 resolution, but would eventually scale higher with more updates. It was the big way to build games until around the mid 1980s when games began to evolve. It wasn't until the 1990s that C-8 was brought back from the dead, in the way of designing graphing calculators (as described above). This revitalized version was made easier to program with which sparked a boom in retro game development. Today C-8 is used for preservation as well as retro web browser versions of the games we played back in the day through emulation.

C-8 is a virtual machine build on past tech so I'll spare you the actual tech talk. I will however discuss it's input and the Opcode table, to which is the coding aspect of it.


![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p21cst7vd4etdbv3lmrh.jpg)

> Standard CHIP-8 inputs

Inputs are written on a standard keyboard using hex. These keys are interpreted from the ranges of 0 to F; with 8, 4, 6, and 2 being directional. The opcode table then interprets the key presses in 3 stages; first one skips the key press on specific ones, second does when specific keys aren't pressed, and the third saves it to a data register that is added to the stack.


![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ylx7snr9xjs6pku56f2y.jpg)
> Most of the Opcodes. Source: Cornell University

Opcodes are the operation codes executed when the stack is called. This is important to telling the program what to do. C-8 started out with 35 codes, but has expanded since the 1990s. Below this is a picture of some commands that are popular to use.

## Conclusion


![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dbe7tkkp3t50rdcucdoa.jpg)

C-8 has been a big player in how modern video games take shape. Most modern consoles have some sort of C-8 machine built in for developers to experiment with. It surprises me how much gaming in general was designed by one small computer program. I hope this blog gives you a small insight on C-8, and give you a small appreciation of the tech that goes into the jump between two paddles and a ball, and characters running over fields of green chasing some mythical beast.

References: 
https://en.wikipedia.org/wiki/CHIP-8
https://courses.ece.cornell.edu/ece5990/ECE5725_Fall2016_Projects/Lab_group_bcp39_rk534/cpu.html