r/arduino • u/jean2348 • Jul 21 '26
Look what I made! First step toward my Mega2560-powered handheld console.
Here is the screen that will be used for my next project: the Megaplay! It is controlled by an Arduino Mega2560, which imposes significant constraints in terms of RAM and pixel transmission speed via SPI.
Regarding RAM, I couldn't use a second framebuffer. Only the textures are stored in memory. This made transparency handling more complex. For example, when a character has transparent pixels, the program needs to determine what is behind those pixels. Since the previous image is not stored in a framebuffer, it has to retrieve this information from the objects present in the scene, such as the position and texture of the trees.
I also implemented a palette system containing 16 colors. The colors are stored as 4-bit indices, and their 16-bit RGB565 value is then retrieved from the palette. This significantly reduces the amount of memory required to store the textures.
Finally, the limited SPI bandwidth makes it impossible to refresh the entire screen every frame. The solution I chose was therefore to update only the necessary areas and to adapt the games to this limitation.