Elektrine lite

← Feed

@aparrish@friend.camp

Post #3694688

2026-06-30 16:37 UTC

the main architectural thing i want to do with this emulator is immutable state, or close to it: each component of the SoC is implemented as a function that takes the current state as an argument and returns a list of updates it wants to perform, (rather than actually modifying the state). benefits: helps avoid inconsistent states; no need to worry about the order of changes on any particular tick; helps catch "bus conflicts" (when two components want to update the same value)

Replies (1)

  • @aparrish@friend.camp 2026-06-30 16:42

    turns out this is very difficult to do in python with reasonable speed, for two reasons (I think, at least?): (a) no easy way to take a list of changes (e.g., a field name/value tuple) and actually update the data structure, without a dynamic look up (which is slow); and (b) you have to allocate and free a bunch of value tuples (and a list to store them in) on each tick (also slow). i've cythoned the hell out of the thing and i'm still running at ~0.1x actual gameboy speed

    Open ##3694686