PELLETINO 2: 27 arcade games on a $20 ESP32-C6, including an emulated Street Fighter II
The original PELLETINO only played PacMan. I'm pleased to announce version 2.xx, which has grown by quite a bit.
It's a launcher for the Waveshare ESP32-C6-LCD-1.69. You get a wheel of game logos with a screenshot behind each one. Tap to spin, hold to pick, and it boots straight into that game from then on. You play by tilting the board, since the accelerometer is the controller. No SD card, no PSRAM, just the 16 MB of flash on the board.
The lineup is 27 games: Pac-Man, Ms. Pac-Man, Galaga, Galaxian, Space Invaders, Donkey Kong, Mario Bros., Frogger, Dig Dug, Mr. Do!, Burger Time, Root Beer Tapper, Joust, Moon Patrol, Rally-X, Centipede, Missile Command, Asteroids, Tempest, Lunar Lander, Gyruss, Time Pilot, Arkanoid, Pole Position, Star Wars, Empire Strikes Back and Street Fighter II.
PR's are welcome if you want to add your own favorite game.
How it works:
- Every game is its own firmware. Each one sits in its own flash slot and the launcher chain-boots it, so a game gets the whole chip while it runs. Hold the middle button five seconds and you're back at the menu.
- ESP-IDF allows 16 app slots. That makes the limit 17 games per build, because Pac-Man and Ms. Pac-Man share one image. You pick which ones go on.
- Everything is generated from the ROMs you have. The partition table, the artwork and the menu all come out of that. Drop zips in `roms/`, run `./install.sh`, and it builds and flashes the lot.
- Plus the stuff that makes it feel finished. There's an attract mode when nobody's touching it and high scores that survive power-off. The screen dims instead of turning off, and there are three volume levels.
Street Fighter II was the hard one. For a long time it was just a video of the attract mode, because I figured a CPS-1 on this chip was out of reach. Turns out it isn't, mostly.
- It's a lot of machine. A 10 MHz 68000, a Z80 for sound, a YM2151, an OKI MSM6295, three tile layers and 256 sprites. All on one 160 MHz RISC-V core with 512 KB of RAM.
- Musashi wanted 576 KB of RAM just to start. That's its opcode tables, which it builds at boot, and it's more RAM than the board has. I worked them out at build time instead and packed them into 30 KB, mostly in flash.
- The 68000 spends most of its time waiting. Skipping the game's idle loop took the 68000 from 671 ms of every second to about 300. Putting the 147 instruction handlers the game actually uses in RAM got the rest.
- The ROM is 7.6 MB. It gets read in place from its own flash partition, memory mapped. The C6 can only map 8 MB at once, and that has to include the program. So everything that has to be mapped goes first, and the sound samples come after and get read as needed.
- RAM is still tight. The machine's own work RAM and graphics RAM are 256 KB together. With sound on there's about 45 KB of heap left. Moving the Z80 core into RAM would have helped, but then the graphics RAM doesn't fit. It was short by 4 KB.
- Sound is the expensive part. With sound off it holds full speed easily. With sound on it draws 1 frame in 4 and runs at 99% of real time at 11 kHz. Even reading the accelerometer cost 84 ms a second, so SF2 doesn't read it.
It runs its attract mode. The top button drops a coin and the middle button is a jab, but a six-button fighter isn't happening on two buttons and a tilt sensor. It's a showpiece. I measured all 56 combinations of video mode, frame skip and sound on the board, and they're all in the project's README if you're into that.
The catch is flash. That 7.6 MB partition means a build with SF2 fits about 13 games instead of 17. Mine has Ms. Pac-Man, Pac-Man, Donkey Kong, Galaga, Star Wars, Frogger, Centipede, Burger Time, Joust, Pole Position, Dig Dug, Mario Bros. and Street Fighter II.
Why would I put Street Fighter II on this medal if it's attract-mode only? Cause it's awesome, that's why. Also, this is meant to be a wearable first, so something just for looks fits into the mission statement nicely.
No ROMs, artwork or music are included, you bring your own. The code written for it is 0BSD, but most games use a non-commercial Z80 core, so the bundle is free to share and not to sell.