Snakes And Ladders: Game Boy Emulator In Python

If a Game Boy was a part of your childhood, you were probably more than once dreaming of spending your entire school day with it. Well, they had to wait a few more years for that, but eventually in 2015, [Asger], [baekalfen], and [troelsy] made that dream reality when they created a Game Boy emulator in Python for a university project. However, it didn’t stop there, and the emulator has since grown into a full-blown open source project, PyBoy, which just reached the version 1.0 release.

Since it started out as an academic project, the three of them had to do their research accordingly, so the background and theory about the Game Boy’s internal functionality and the emulator they wrote is summarized in a report published along with the source code. There is still some work to be done, and sadly there is no sound support implemented yet, but for the most part it’s fully functional and let’s you successfully play your own extracted cartridges, or any ROM file you happen to have in your possession.

Being an emulator, you can also inspect its inner life when run in debug mode, and watch the sprites, tiles, and data as you play, plus do cool things like play the emulation in reverse as shown in the clip below. Even more so, you can just load the instance in your own Python scripts, and start writing your own bots for your games — something’s we’ve seen in action for the NES before. And if you want to dive really deep into the world of the Game Boy, you should definitely watch the 33c3 talk about it.

Continue reading “Snakes And Ladders: Game Boy Emulator In Python”

There Really Was A Sewing Machine Controlled By A Game Boy

These days, high-quality displays and powerful microcontrollers are cheap and plentiful. That wasn’t the case a couple of decades ago, and so engineers sometimes had to get creative. The result of this is products like the Jaguar nu.yell sewing machine, as covered by [Kelsey Lewin].

The later nuotto model was capable of more advanced embroidery patterns. A Mario character cartridge was sold, while a later Kirby edition was scrapped before release.

The Japanese market product eschewed the typical mechanical controls of the era, to instead interface with a Nintendo Game Boy. The sewing machine would hook up to the handheld console via the Link Port, while the user ran a special cartridge containing the control software. This would allow the user to select different stitch types, or embroider letters. Very much a product of its time, the nu yell mimics the then-cutting edge industrial design of the first-generation Apple iMac. The technology was later licensed to Singer, who brought it to the US under the name IZEK. Sales were poor, and the later Jaguar nuotto didn’t get a similar rebranding stateside.

Back in the late 90s, the Game Boy was likely an attractive package to engineers. Packing a Z80 processor, buttons, and a screen, it could act as a simple human interface in lieu of designing one from the ground up.  Aprilia even used them to diagnose motorbike ECUs, and we’ve seen Game Boy parts used in medical hardware from the era, too. Video after the break.

Continue reading “There Really Was A Sewing Machine Controlled By A Game Boy”

Scott Shawcroft Is Programming Game Boys With CircuitPython

Some people like to do things the hard way. Maybe they drive a manual transmission, or they bust out the wire wrap tool instead of a soldering iron, or they code in assembly to stay close to the machine. Doing things the hard way certainly has its merits, and we are not here to argue about that. Scott Shawcroft — project lead for CircuitPython — on the other hand, makes a great case for doing things the easy way in his talk at the 2019 Hackaday Superconference.

In fact, he proved how easy it is right off the bat. There he stood at the podium, presenting in front of a room full of people, poised at an unfamiliar laptop with only the stock text editor. Yet with a single keystroke and a file save operation, Scott was able make the LEDs on his Adafruit Edge Badge — one of the other pieces of hackable hardware in the Supercon swag bag — go from off to battery-draining bright.

Code + Community

As Scott explains, CircuitPython prides itself on being equal parts code and community. In other words, it’s friendly and inviting all the way around. Developing in CircuitPython is easy because the entire environment — the code, toolchain, and the devices — are all extremely portable. Interacting with sensors and other doodads is easy because of the import and library mechanics Python is known for, both of which are growing within the CircuitPython ecosystem all the time.

CircuitPython is so friendly that it can even talk to old hardware relatively easily without devolving into a generational battle. To demonstrate this point, Scott whipped out an original Nintendo Game Boy and a custom cartridge, which he can use to play fun sounds via the Game Boy’s CPU.

Now You’re Playing With Python

It’s interesting to see the platforms on which Scott has used the power of CircuitPython. The Game Boy brings the hardware for sound and pixel generation along with some logic, but he says it’s the code on the cartridge that does the interesting stuff.

The CPU communicates with carts at a rate of 1MHz. As long as you can keep this rate up and the CPU understands your instructions, you can get it to do anything you want.

Scott’s custom cart has a 120MHz SAMD51. He spends a second explaining how he gets from Python libraries down to the wire that goes to the Game Boy’s brain — basically, the C code underneath CircuitPython accesses direct structs defined within the SAMD to do Direct Memory Access (DMA), which allows for jitter-free communication at 1MHz.

He’s using the chip’s lookup tables to generate a 1MHz signal out of clock, read, and A15 in order to send music-playing instructions to the sound register of the Game Boy’s CPU. It sounds like a lot of work, but CircuitPython helps to smooth over the dirty details, leaving behind a simpler interface.

If you want easy access to hardware no matter how new or nostalgic, the message is clear: snake your way in there with CircuitPython.

Continue reading “Scott Shawcroft Is Programming Game Boys With CircuitPython”

Machine Inside Of A Chip: How Sprite_TM Built The FPGA Game Boy Badge

Kids of the 1990’s would call you a liar if you told them that within thirty years you’d go to a conference and be handed a Super Nintendo Entertainment System to wear around your neck. But that’s what happened with the badge Jeroen Domburg, aka [Sprite_TM], designed for the 2019 Hackaday Superconference. It’s built in the Game Boy form factor, complete with a cartridge slot, beautiful screen, and the familiar button layout. But there’s so much more here, like the HDMI port on the bottom and the ability to completely reconfigure the device by dropping a binary file onto it over USB.

Of course what makes this possible is the FPGA at the heart of the design. The story of how the badge was developed is shared in great detail during Sprite’s Supercon talk. The timeline, the hardware choices, and the oopses along the way make for a great story. But what you really don’t want to miss is how he built the machine inside of the FPGA — the collection of Verilog code known as “gateware” that brings together the System-on-a-Chip (SoC). From his delight at being able to spawn more processor cores by changing a single variable, to the fascinating SNES-inspired graphics subsystem, the inside story shared below is even more interesting than the physical device itself.

Continue reading “Machine Inside Of A Chip: How Sprite_TM Built The FPGA Game Boy Badge”

All The Games In One Cartridge

The original Game Boy was a smash success for Nintendo and has an amazing collection of games. You might relive some childhood nostalgia by booting up a Game Boy emulator, but to really get the full experience you’ll need the battery-draining green-tinted original hardware. Thanks to modern technology you can also load all of the games at one time on the original hardware with this STM32 cartridge that fits right in.

The device can load any Game Boy game (and homebrews) and ROMs can be sent to the cartridge via USB. There were are a lot of hurdles to getting this working properly, the largest of which is power management. A normal cartridge has a battery backup for save data, but using a small coin cell to run an STM32 would kill the battery quickly. To get around that, the cartridge writes the states to nonvolatile memory and then shuts itself off, although this has the side effect of crashing the Game Boy.

The creator of this project, [Emeryth], noted that we featured a similar project from [Dhole] a few years ago, also involving an STM32. [Emeryth] decided that it would be fun to build his own project anyway, and it’s certainly an interesting take on GameBoy hacking. He also has the files for this project available on his Git Hub page.

CircuitPython Slithers Into 100th Board — The OHS 2020 Badge

CircuitPython reached a major milestone last week as it welcomed its 100th board into the fold: the wristwatch form factored badge designed for the 10th annual Open Source Hardware Summit, which takes place March 13th in New York City. Although CircuitPython — an open source derivative of MicroPython — was born at Adafruit, more than half of the boards on this list were produced outside of the company. That just goes to show the strength of the community in support of the snake.

The OSHW 2020 badge joins a litany of familiar boards happy to drop you into a Python interpreter. Among them there’s the Adafruit Feather ecosystem, the ItsyBitsy, specialized boards like the Edge Badge that was in some goodie bags at Supercon, and the CircuitPlayground — that Swiss army knife of sensors which now comes in a Bluetooth version. The first 100 boards were rounded out in strong fashion with [Joey Castillo]’s OpenBook e-reader and the Teensy 4.0. Continue reading “CircuitPython Slithers Into 100th Board — The OHS 2020 Badge”

Teardown: 168-in-1 Retro Handheld Game

The holidays are upon us, and that can mean many furrowed brows trying to figure out what token gift they can give out this year as stocking-stuffers. Something that’s a bit more interesting than a coupon book or a lotto scratcher, but also affordable enough that you can buy a few of them without having to take part in that other great holiday tradition: unnecessary credit debit.

Includes the NES classic Super Militarized Police Bros 3

Which is how I came to possess, at least temporarily, one of these cheap handheld multi-games that are all over Amazon and eBay. The one I ordered carries the brand name Weikin, but there are dozens of identical systems available, all being sold at around the same $20 USD price point. With the outward appearance of a squat Game Boy, these systems promise to provide precisely 168 games for your mobile enjoyment, and many even include a composite video out cable and external controller for the less ambulatory classic game aficionado.

At a glance, the average Hackaday reader will probably see right through this ploy. Invariably, these devices will be using some “NES on a Chip” solution to emulate a handful of legitimate classics mixed in with enough lazy ROM hacked versions of games you almost remember to hit that oddly specific number of 168 titles. It’s nearly a foregone conclusion that at the heart of this little bundle of faux-retro gaming lies a black epoxy blob, the bane of hardware tinkerers everywhere.

Of course, there’s only one way to find out. Let’s crack open one of these budget handhelds to see what cost reduction secrets are inside. Have the designers secured their place on the Nice List? Or have we been sold the proverbial lump of coal?

Continue reading “Teardown: 168-in-1 Retro Handheld Game”