An Arduous Endeavor (Part 7): Automated Builds

Wooden Gears
This entry is part 7 of 7 in the series An Arduous Endeavor

My core is finally in a semi-usable state, at least on my local machine. Before I get down to fixing bugs and improving performance, I’d like to get the project built and released so others can use it. And since I’m lazy efficient, I’d like to make this process as automated as possible. It’s time to set up automated builds.

Continue reading →

An Arduous Endeavor (Part 6): Save States and Rewind

Rewind Button
This entry is part 6 of 7 in the series An Arduous Endeavor

Two emulator features that have made my gaming experience much more comfortable are save states and rewind functionality. Save states let you take a snapshot of a game at any point in time, and then come back to it – whether that is after attempting and failing to complete some task, or maybe after leaving the game for a bit to take care of things in real life. Rewind takes that feature to the extreme, essentially performing a snapshot after every video frame, making it very convenient to “undo” a misstep or bad random number generator without even having to plan for it.

Libretro enables both of these features via the retro_serialize and retro_deserialize functions. Once you have these functions implemented, a Libretro frontend is capable of saving/loading any number of save files.

Continue reading →

An Arduous Endeavor (Part 5): Buzzes and Beeps

Piezo Buzzer
This entry is part 5 of 7 in the series An Arduous Endeavor

Sound generation is probably the aspect of emulation that I am least familiar with. As part of my undergrad, I wrote simulators of simple computer architectures and interacted directly with framebuffers to display 2D graphics. But when it came to sound stuff, my experience was strictly at a high level, buffering WAV/MP3 files and relying on some mixing libraries written by others.

Sound emulation in Libretro, though, appears to require passing through integers at the “sample” level. In other words, the raw amplitude values for whatever sample rate we’re running the emulator at.

Continue reading →

An Arduous Endeavor (Part 3): CPU Emulation

Arduino Micro Isometric View
This entry is part 3 of 7 in the series An Arduous Endeavor

Next up was to emulate the CPU: an ATmega32U4 for standard Arduboy units. I started to implement this in a similar fashion to how I implemented the display because “It’s an 8-bit RISC processor, how hard can it be?” And then I saw how many opcodes there were – or rather, how many opcodes there might be, because it’s not totally clear what differentiates one opcode from the other – and I decided that maybe I should rely on someone else’s work for this part.

Then I discovered there were a number of AVR emulators, written with some degree of intended integration into other projects. simavr seemed the most promising for my intended use – I just had to figure out how to integrate it. So I figured it was time to learn a little bit more about CMake.

Continue reading →