Bitbanging Super Smash Bros.

[Kyle] and an a few of his classmates are wrapping up a microcontroller interfacing class at Purdue and thought it best to send in the results of their efforts. It’s a version of Super Smash Bros. made by just bitbanging pins on a microcontroller.

The hardware for the project is based around a Freescale 9S12c32, an updated version of the 30-year-old M68HC11 microcontroller. For the controls, the guys used a Playstation 2 joystick and buttons housed in an Altoids box, and the actual console is made out of strips of wood stapled together to look like a crate from Super Smash Bros.

There are nine playable characters: Pikachu, Captain Falcon, Yoshi, Donkey Kong, Mario, Luigi, Link, Kirby, and Fox. Despite these characters being only four pixels high, the game looks extremely playable (at least when two players don’t choose the same character). After the break is the video demo of Super Smash Bros: Bitbang edition, along with a gallery of pics showing the console and gameplay. All the code is up on GitHub for your perusal.

Im having a really hard time understanding what bitbanging really is. Everything I read never makes anything clear as to what or why. Anyone know of like a good resource or video to help explain it to me?

It’s commonly used in the sense of specialized versions of serial protocols like SPI or I2C, or when your hardware doesn’t have the built-in support for an interface. Like generating S/PDIF with a Propeller.

If you’ve read wiki on the subject and still don’t get it this explanation is for you.

To bitbang is to use software instead of hardware to do some form of communication. You may use it b/c your micro-controller(MCU) doesn’t have the hardware peripheral, you may be using that feature already or you may be to lazy to RTFM and find out how to use that feature.

Bitbanging is using software to manually set or check the pin(s) of the MCU or whatever you’re using. It usually refers to more complex endeavors like serial or in the case of this post VGA output.

I can give you more info on this subject if your still in the dark. Let me know.

Bitbanging is simply the name given to the technique of wiggling I/O pins in software.

The simplest example is probably a serial port. Usually you have a UART where you can simply write a byte to a register and the UART hardware takes care of start, stop and parity bits and all the bit timing. The UART will drive its output pin appropriately to send your byte.

‘Bitbanging’ in this case means you write your own loop in software to iterate through the bits in the byte and you set or clear the I/O pin according to each bit at the appropriate time. In the loop maybe there is a delay for the length of the bit cell, or maybe you can do it with an interrupt. Either way, all the work is done in software instead of dedicated hardware.

The reason it’s popular now is because micros are so fast they can emulate many ASIC functions in software just by wiggling the right pins at the right time, and you still have time for your application program too.