Tetris On An Oscilloscope, The Software Way

When we talk about video games on an oscilloscope, you’d be pardoned for assuming the project involved an analog CRT scope in X-Y mode, with vector graphics for something like Asteroids or BattleZone. Alas, this oscilloscope Tetris (Russian language, English translation) isn’t that at all — but that doesn’t make it any less cool.

If you’re interested in recreating [iliasam]’s build, it’ll probably help to be a retro-oscilloscope collector. The target instrument here is a Tektronix TDS5400, a scope from that awkward time when everything was going digital, but CRTs were still cheaper and better than LCDs. It’s based on a Motorola 68EC040 processor, sports a boatload of discrete ICs on its main PCB, and runs VxWorks for its OS. Tek also provided a 3.5″ floppy drive on this model, to save traces and the like, as well as a debug port, which required [iliasam] to build a custom UART adapter.

All these tools ended up being the keys to the kingdom, but getting the scope to run arbitrary code was still a long and arduous process, with a lot of trial and error. It’s a good story, but the gist is that after dumping the firmware onto the floppy and disassembling it in Ghidra, [iliasam] was able to identify the functions used to draw graphics primitives on the CRT, as well as the functions to read inputs from the control panel. The result is the simple version of Tetris seen in the video below. If you’ve got a similar oscilloscope, the code is up on GitHub.

Care for a more hardware-based game-o-scope? How about a nice game of Pong? Or perhaps a polar breakout-style game is what you’re looking for. Continue reading Tetris On An Oscilloscope, The Software Way”

A handheld computer made on a piece of prototyping board running a Tetris clone

Tetris Clone Uses 1000 Lines Of Code, And Nothing Else

If you’re programming on a modern computer, you typically make use of lots of work done by other people. There’s operating systems to abstract away the complexities of modern hardware, standard libraries to implement common tasks, and tons of third-party libraries that prevent you from having to reinvent the wheel all the time: you’re definitely not the first one trying to draw graphics onto a screen or store data in a file.

But if it’s the wheels you’re most interested in, then there’s nothing wrong with inventing new ones now and then. [Michal Zalewski], for instance, has made a beautiful Tetris clone in just 1000 lines of C, without using anyone else’s code.

The purpose of this exercise is to show that it’s possible to make a game with graphics comparable to modern, complex computing systems, without relying on operating systems or third-party libraries. The hardware consists of not much more than an ARM Cortex-M7 MCU, a 240×320 LCD screen and a few buttons soldered onto a piece of prototyping board, all powered by a set of AAA batteries.

The software is similarly spartan: just pure C code running directly on the CPU core. Graphic elements, some generated by AI and others hand-drawn, are stored in memory as plain bitmaps. They are manipulated by 150 lines of code that shuffles sprites around the display at a speed high enough to generate smooth motion. Game mechanics take up about 250 lines, while sound consists of simple square-wave chiptunes written in just 50 lines of code.

[Michal]’s code is very well documented, and his blog post gives even more details about all the problems he had to solve. One example is the length of keypresses: when do you interpret a keypress as a single “press”, and when does it become “press and hold”? Apparently, waiting 250 ms after the first press and 100 ms after subsequent ones does the trick. [Michal] is a bit of an expert on bare-bones game programming by now: he has previously pushed several 8-bit micros to their very limits. Third-party libraries can make your programming life a lot easier, but it’s good to reflect on the dangers of relying too much on other people’s code.

Continue reading Tetris Clone Uses 1000 Lines Of Code, And Nothing Else”

Tetris Joins Minecraft And DOOM In Running A Computer

There is a select group of computer games whose in-game logic is enough for them to simulate computers in themselves. We’ve seen it in Minecraft and DOOM, and now there’s a new player in town from a surprising quarter: Tetris.

One might wonder how the Russian falling-blocks game could do this, as unlike the previous examples it has a very small playing field. And indeed it’s not quite the Tetris you’re used to playing, but a version played over an infinite board. Then viewed as a continuous progression of the game it can be viewed as somewhat similar to the tape in a Turing machine.

The various moves and outcomes are referred to through a Tetris scripting language, so states can be represented by different sets of blocks and holes while logic elements can be be built up using the various shapes and the game logic. From those a computer can be built, represented entirely in Tetris moves and shapes. It’s a little mind-bending and we’d be lying if we said we understood every nuance of it, but seemingly it works well enough to run the game from within itself.. If it had the catchy music from the NES version, we’d declare it perfect.

Hungry for more? Here’s DOOM doing some adding, and of course Minecraft has a rich computing history.

Tetris Clock Gets Talkative Upgrade

Tetris is arguably one of the most popular video games of all time, and its famous bricks have become cultural icons in themselves, as seen in this clock build from [The Electronic Engineer].

The web interface allows the various sound options to be easily configured.

The basic concept of the Tetris clock is that falling bricks stick together in the shape of numbers to display the time. In this case, the clock is based on the version created by [Brian Lough] which we featured previously. It relies on an RGB LED matrix as a display.

However, the build has had a few upgrades courtesy of [The Electronic Engineer]. With the help of an I2S audio breakout board, the clock can play sounds at various times of day. It’s currently set up with clips from various cartoons announcing lunch and coffee break times. There’s also a web interface added in for configuration purposes, and some text tickers too.

It’s fun to see a popular open project get some upgrades as others dive in to build their own version. We’ve seen some other fun Tetris clocks before, too. Continue reading Tetris Clock Gets Talkative Upgrade”

Tetris Handheld Powered By Tritium Cell, Eventually

The idea of a tritium power cell is pretty straightforward: stick enough of the tiny glowing tubes to a photovoltaic panel and your DIY “nuclear battery” will generate energy for the next decade or so. Only problem is that the power produced, measured in a few microwatts, isn’t enough to do much with. But as [Ian Charnas] demonstrates in his latest video, you can eke some real-world use out of such a cell by storing up its power over a long enough period.

As with previous projects we’ve seen, [Ian] builds his cell by sandwiching an array of keychain-sized tritium tubes between two solar panels. Isolated from any outside light, power produced by the panels is the result of the weak green glow given off by the tube’s phosphorus coating as it gets bombarded with electrons. The panels are then used to charge a bank of thin-film solid state batteries, which are notable for their exceptionally low self-discharge rate.

Some quick math told [Ian] that a week of charging should build up enough of a charge to power a knock-off handheld Tetris game for about 10 minutes. Unfortunately, after waiting the prescribed amount of time, he got only a few seconds of runtime out of his hacked together power source.

His best guess is that he got a bad batch of thin-film batteries, but since he could no longer find the exact part number he used originally, he had to design a whole new PCB for the second attempt. After waiting two long months to switch the game on this time, he was able to play for nearly an hour before his homebrew nuclear energy source was depleted.

We wouldn’t consider this terribly practical from a gaming standpoint, but like the solar harvesting handheld game we covered last year, it’s an interesting demonstration of how even a minuscule amount of power can be put to work for intermittent applications. Here it’s a short bout of wonky Tetris, but the concept could just as easily be applied to an off-grid sensor.

Continue reading Tetris Handheld Powered By Tritium Cell, Eventually”

Tetris For Game Boy Gets Online Multiplayer

Released in 1989, the Game Boy version of Tetris is notable for being the first game to support multiplayer via the so-called “Game Link Cable” accessory. So it’s fitting that, 32 years later, that same game is now playable with others over the Internet thanks to an open source USB adapter from [stacksmashing].

As explained in the video below, the adapter is essentially just a Raspberry Pi Pico paired with some level shifters so that it can talk to the Game Boy’s link port. That said, the custom PCB does implement some very clever edge connectors that let you plug it right into the Link Cable for the original “brick” Game Boy as well as the later Color and Advance variants. This keeps you from having to cut up a Link Cable just to get a male end, which is what [stacksmashing] had to do during the prototyping phase.

The DIY breadboard approach works as well.

Of course, the hardware is only one half of the equation. There’s also an open source software stack which includes a Python server and WebUSB frontend that handles communicating with the Game Boy and connecting players. While the original game only supported a two person head-to-head mode, the relatively simplistic nature of the multiplayer gameplay allowed [stacksmashing] to expand that to an arbitrary number of players with his code. The core rules haven’t changed, and each client Game Boy still thinks it’s in a two player match, but the web interface will show the progress of other players and who ends up on top at the end.

To be clear, this isn’t some transparent Link Cable to TCP/IP solution. While something like that could potentially be possible with the hardware, as of right now, the software [stacksmashing] has put together only works for Tetris. So if you want to battle Pokemon over the net, you’ll have to do your own reverse engineering (or at least wait for somebody else to inevitably do it).

The Link Cable port on the Game Boy, especially on the later versions of the hardware, is a surprisingly versatile interface capable of much more than just multiplayer gaming. While we’re certainly keen to see [stacksmashing] develop this project farther, we’re equally excited to see the non-gaming applications of such an easy to use computer interface for the iconic handheld.

Continue reading Tetris For Game Boy Gets Online Multiplayer”

Tetris On Split-Flap Go Brrr

It hardly seems possible, but engineer collective and split-flap display purveyors [Oat Foundry] were able to build a working implementation of Tetris on a 10 x 40 split-flap display in the span of a single day. Check it out in the video after the break.

This project is a bit understaffed in the details department, but we do know that [Oat Foundry] started with [Timur Bakibayev]’s open-source implementation of Tetris in Python and modified the draw function to work on a split-flap display. As you may have guessed, the biggest obstacle is the refresh rate and how it affects playability — particularly during those tense moments when a player rotates a piece before dropping it. Split-flaps flip quickly from on to off, but flipping back to on requires a full trip around through all the other characters.

We think this is nice work for a one-day build. Should they go further, we’d like to see the same things implemented as [Oat Foundry] does: a high score tracker and a preview of the next piece.

Don’t have a split-flap display? Yeah, us either, but we do have televisions. Turn on the tube and check out this Nano-scale Tetris.

Continue reading “Tetris On Split-Flap Go Brrr”