Project Description
Last year I've got the new Raspberry Pi Pico based DIY console called Picopad, explored the available SDK(s) a bit and managed to get a C64 emulator MCUME running on it, but the joystick emulation wasn't enough to start playing games expecting an initial keyboard input.
Goal for this Hackweek
- Complete the accessories: there are some small add-on boards with sensors that still need a bit of soldering to be ready to use
- Continue work on the C64 emulator: get USB keyboard working first to see if it makes games waiting for a keypress playable. Then work on the OSD emulation so that no physical keyboard is necessary.
Summary after hackweek 23
I was able to spend something like 2.5 days due to various circumstances (including traveling to Brno for OpenAlt on Friday).
- soldering of accessory sensor boards - postponed
- exploring the SDK space: the official repository has some hw documentation and binaries of the preloaded games. I didn't check the micropython/circuitpython stuff as that was out of scope of my main focus
- the preloaded games are built using the PicoLibSDK which is not using the official raspberry pico-sdk, only a cross toolchain is needed and one small tool elf2uf2 from the sdk to create uf2 images. You can tell it comes from the Windows world, not based on standard build systems but on .bat files (.sh versions provided too). It provides a bootloader where you can browse UF2 files from the sdcard and it will copy them to the pico's flash and boot it (and retain the SD card bootloader part). Some special programs can be compiled in a way that they are not flashed first, but loaded to RAM. There are few more games than what's preloaded and also some small tools like to control volume etc. I was able to compile the sources from Linux so despite the weird build environment that's working.
- Next I wanted to try the gameboy emulator and find out it's not based on PicoLibSDK but it's built using platformio which downloads whatever is needed (toolchain, IIUC the official sdk and some arduino layers) so that's a bit opaque. The instructions there are for vscode and docker - I was able to zypper in python311-platformio and run just the pio command. It offers a build of the standard pico UF2 file that can be loaded to the internal flash using BOOTSEL button over USB mass storage, thus no integration to the sd bootloader from PicoLibSDK. That one didn't however boot for me. Alternatively it builds a PP2 file for the picopad-loader from the same repository, that's similar in the principle as the one from PicoLibSDK, some code originates from it, but it's incompatible. Oh well. That one did work though, so got the emulator working rather nicely with one of the Mario games, which was a first bigger success, and we spent some time with my daughter playing :)
- Next I wanted to get a C64 emulator working. There are various forks of MCUME on github that include pico support - I found out that one of them has been updated just this year to support some devices similar to the picopad, mainly the ST7789 TFT LCD. This is based on the pico-sdk with its cmake build system so it felt most familiar to a linux person. But there's no integration with any of the two loaders described above, so one gets a UF2 that's the only thing the pico will be running. But it can load c64 game files from the sd card. Getting it to build and boot turned out to be surprisingly easy - just had to edit a add a bunch of defines for a new target device to wire up the particular GPIO ports (LCD, sound, joystick...) used on picopad. Then it booted on the first try to the familiar C64 screen from my childhood!
- Encouraged by the rather cheap success I tried to download a few games onto the SDK. Then I realized that my childhood memories of needing just the joystick are not accurate and there was always some "press F1 to start" or built-in trainers that asked Y/N questions for unlimited lives and such... and I wasn't able to start anything. But at least one of them had a cracker intro that demonstrated the sound to be working! And that's when I've run out of time so far.
Future work
Due to the last point above I'll obviously need some keyboard support for the C64 games. There seems to be USB keyboard support in the emulator which I will try first so I can proceed and see if the games actually work. But it's obviously not optimal for normal PicoPad use. What I've found is similar DYI consoles exist with grids of buttons for keyboard. I think an OSD keyboard will be a better way, there already seems to be some unfinished code on of the forks of Teensy64 (which is what MCUME is based).
Final thoughts
It was very educational, hope I'll have some time to continue working on this. What's a bit disappointing coming from Linux (kernel) world is how messy this area seems to be - various forks of stuff with large non-descriptive commits, code copy pasted from one to another (and never updated afterwards), non-standard build systems, Windows-centric environments, incompatible loaders and approaches to stuff... hopefully things will consolidate a bit eventually :)
Comments
-
about 1 year ago by rhopkins | Reply
Nice! My first computer was a Sinclair Spectrum but I spent lots of my time on the Atari ST. I recently got a Mega ST without a keyboard so used a Raspberry Pi Pico to emulate the HD6301 keyboard controller so I could plug a USB keyboard and mouse into it. I had to use both cores and overclock the pico to make it work, and the USB host stack was a bit buggy at the time, but it does work quite well.
Similar Projects
This project is one of its kind!