December Adventure Day 16
Emulators Galore
Having made good progress writing a lightweight Psion emulator launcher on day 15 of my December Adventure, I decided to continue with it, flesh out the device support, and add a few quality-of-life improvements.
psiemu
As an active contributor to the explit28/Psion-ROM repository on GitHub, I’m aware of the large number of Psion variants out there, but I’d not fully internalized it until I tried to produce a UI to make it quick and easy to see them all, and select one.
After some consideration, I decided to separate the different vendors into their own sections, with Psion and Acorn being the most obvious ones. Ultimately, I’d like to add Geofox, Diamond, Oregon Scientific and Ericsson in there too, but I don’t think we’ve complete emulation for any of their devices yet.
Modeling the ‘Vendor → Device → Variant’ hierarchy
Introducing new sections forced me to rework the layout and selection handling. To keep things simple, I broke my rendering code into helpers responsible for the different sections. For example,
def render_device_section(devices, is_section_active, y_pos, selection):
for device_index, profile in enumerate(devices):
title = profile["title"].ljust(22)
variants = profile["variants"]
for variant_index, variant in enumerate(variants):
name = variant["name"]
languages = language_symbol(variant)
if is_section_active and device_index == selection.device and variant_index == selection.variant:
name = "-> " + name
else:
name = " " + name
title += f"{name} {languages} "
stdscr.addstr(y_pos + device_index, 0, " " + title)
return y_pos + len(devices)
This renders vendor data in the following structure:
{
"name": "Acorn",
"devices": [
{
"id": "pocketbk",
"title": "Acorn Pocket Book",
"resolution": (240, 80),
"scale": 2,
"variants": [
{
"name": "V1.91F",
"bios": "191f",
"languages": [
"en-GB",
],
}
]
},
# ...
],
},
Right now the layout code is all hand-crafted as I’m fairly new to Curses, but I have a sense there are many conveniences I can take advantage of in the future. I’m looking forward to learning what’s possible.
In addition to adding support for different vendors, I decided to lean more on structured data, starting with supported languages (as shown in the example above). Using metadata like this should allow for richer UI in the future, and I experimented with using emoji as a minimal way to display the languages:
Ultimately, I find the additional color distracts me from the other details in the grid, so I’ve decided not to keep them, but I enjoyed seeing what’s possible.
As I progressed through the day, I added more devices and variants to the launcher, making sure the relevant ROMs were present in the explit28/Psion-ROM repository. My hope is that this can serve as a single source for all preserved Psion and Psion-related firmware. The MAME emulators are a good test for that.
Wrapping up, I created a new repository on Codeberg and pushed what I have. Nascent as it is, it’s nice to get the launcher to a point where I’m happy to share it and invite collaboration.
The day ended on a high when Alex shared a screenshot of it running. 🥳