I am proud to write that I have finished my emulator and it is now fully public on GitHub and has a downloadable binary for MacOS.
Since the last devlog I have:
Out of all of this, the biggest challenge (although it was minor, it was very annoying) was figuring out a way to map the colour picker in Dear ImGui to the actual colours drawn in SDL3. The frame buffer expected a 32 bit integer representing the RGBA hex code of the colour, while ImGui wanted a float array with each colour being from 0.0-1.0. I tried to use methods like ImGui::ColorConvertFloat4ToU32, but it ended up all using types native to ImGui that SDL does not support, so I ended up using a standard float array and then writing a simple function to multiply the values by 255 and shift the bits to turn it in to the value SDL expects. Here’s the code: (I know I could’ve only had the bit shifting logic once but why have DRY code when it can be wet 🤣)
int Config::getColor(bool fg){
if(fg){
return static_cast<int>(fgColor[0] * 255) << 24 | static_cast<int>(fgColor[1] * 255) << 16 | static_cast<int>(fgColor[2] * 255) << 8 | 0xFF;
}
return static_cast<int>(bgColor[0] * 255) << 24 | static_cast<int>(bgColor[1] * 255) << 16 | static_cast<int>(bgColor[2] * 255) << 8 | 0xFF;
}
Attached is a picture of the emulator running a ROM that is essentially a backport of the chrome dino game. This was a really fun project and a perfect stepping stone to eventually making a Gameboy emulator!!
I’ve been designing a micro FPV plane, with the goal of a few minutes of flight time as well as the ability to do some basic aerobatics (mainly rolls). I will use ExpressLRS to control the plane and analog video with my goggles. The KiCAD schematic is almost done, I just need to fix a few things with the Electrical Rules Checker and then will assign footprints and start designing the PCB. It uses a STM32F042C4T6 MCU and features a gyroscope, voltage converts (5V step up and 3V3 LDO), and a brushed ESC for controlling the brushed motor that will drive a propeller. I also need to figure out how to properly define solder pads on the PCB for battery input and communication with peripherals (receiver, vtx, servos).
I’ve implemented all of the Chip8 opcodes in C++ and the emulator/interpreter is able to execute them all correctly. I used various test files/ROMs to verify this and debug it along the way. I chose SDL3 to render the project because of the easy support for an array of ints that represent pixel values/colors. It also uses SDL3 for playing sound (using the sound timer) and getting input using the hexadecimal keyboard. I’m now going to work on adding configurable settings (such as background and foreground color) using Dear IMGUI and then porting the project to the web with Emscripten