How can I send raw bitmapped data to SDL2 for display?

MickelBriyaeh

New member
I'm currently working on a C-based retro-computer emulator that utilizes SDL2 for graphics and sound. My goal is to implement memory mapped graphics within this emulator.

The machine I'm emulating is a 16-bit WORD machine, where each RAM location holds 16 bits. The screen resolution is 512 x 256 pixels, supporting only black and white colors. The graphics data is stored in an 8 K block of memory, which consists of 8192 locations, each holding 16 bits. Each bit represents a pixel, with 0 indicating black and 1 indicating white.

Based on my understanding of SDL2, it seems that the minimum pixel format it supports is 8 bits per pixel, which corresponds to an index into a palette of 256 colors. However, I'm uncertain about how to directly send this raw bitmapped data to an SDL2 function and retrieve a Surface that can be blitted onto the display.

If anyone has insights or knowledge about a method to accomplish this, I would greatly appreciate your guidance. Specifically, I'm looking for a way to pass the raw bitmapped data to an SDL2 function that can provide a Surface compatible with the emulator's graphics, allowing me to subsequently blit it onto the display.
 
Top