Looking for a code / architecture review of my project (Apple ][+ Emulator)

TL;DR I am looking for a code/architecture review on https://github.com/st3fan/ewm/pull/172

I am working on an open source Apple 1 / Apple ][+ emulator. This project is pretty far along and works relatively well in general. I based it on SDL2 and that has really paid off in terms not having to invent a lot of things that I need.

The project is at https://github.com/st3fan/ewm and you can find progress reports and blog posts on my blog at https://stefan.arentz.ca/post/

Recently I have been working on speeding up rendering, with the goal to have a performant emulator on the Raspberry Pi Zero. (I’ve mostly been working on macOS) This resulted in the following change:


This patch replaces the rendering in tty.c, which is used in the Bootloader/Menu and the Apple 1. Previously, the tty would be rendered by SDL_RenderCopy’ing individual textures for characters into the main surface. This new appoach uses a second surface with our own managed pixel buffer in which we bitblit the individual characters. The Surface is then simply rendered into the main surface by calling SDL_CreateTextureFromSurface / SDL_RenderCopy / SDL_DestroyTexture. This approach seems to be taking the most advantage of hardware acceleration.

There is more in the PR comments.

I’m looking for feedback on this approach. Does anyone here have a few minutes to maybe check it out and give some suggestions? I’m happy to answer questions here or in the PR or to explain things in more detail.