I worked on a ZX Spectrum emulator and its build process, exploring ways to keep game snapshots and keymaps separate from the emulator while still selecting the right controls for a loaded game.
I rewrote the ZX Spectrum emulator for the RP2040 in order to have games more easily uploaded, with games separated by the compilation process and a text-file key map whose right map is automatically selected by grepping RAM content.
I can put Z80 files into a directory and call a script to upload them on your Pico; if a preferred game has no keymap, I can just write one, and it's a one minute process explained in the README, and maybe contribute it back.
I shared a video demo of the game-upload and keymap workflow at https://t.co/c5Ra0VLSrU.
After a game is loaded, I match strings inside the RAM once the game is loaded to automatically select its keymap, regardless of filename or how the user obtained the game, including a self made snapshot or alike.
At runtime, my hand-made C parser turns the textual description of the keymap is turned into the actual keymap "bytecode" at runtime.
Because the keymap description becomes bytecode at runtime, I can distribute the emulator in UF2 format, precompiled, and games can be side-loaded.
I was changing what was needed to separate uploading games and keymaps through the build process.
I find writing from the emulator to Spectrum memory a super fun way to show messages at zero memory cost.
I described my new ZX Spectrum emulator implementation as work in progress, with a keymap file loaded into flash alongside Z80 snapshots by a script, not bound to the emulator itself.
I match strings inside RAM once a game is loaded to automatically select the correct keymap, regardless of filename or how the user obtained the game, including a self-made snapshot or alike.
I shared an image of example keymap entries at https://t.co/U1ZtBSiIYy.