diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-05-04 12:44:03 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-05-04 12:44:03 +0100 |
commit | 2fc29f20a343504780125aa2bed048cece79a37b (patch) | |
tree | 1d362b368492d9ad2bcde1cebddfe4dbe2cf8d0b /tr8vm.c | |
parent | 011190bb0980df90824e4565b745fe276961f21b (diff) | |
download | tr8vm-2fc29f20a343504780125aa2bed048cece79a37b.tar.gz tr8vm-2fc29f20a343504780125aa2bed048cece79a37b.zip |
Update the full fb once to sync with RAM
This is after loading the programm.
Diffstat (limited to 'tr8vm.c')
-rw-r--r-- | tr8vm.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -94,6 +94,12 @@ static uint32_t palette[] = uint8_t ram[UINT16_MAX + 1] = { 0 }; uint32_t *fb_data = NULL; +static void update_fb() +{ + for (uint16_t addr = 0; addr < 16384; addr++) + fb_data[addr] = palette[ram[VIDEO_RAM + addr] & 15]; +} + void write_m(uint16_t addr, uint8_t b) { if (addr >= VIDEO_RAM && addr < (VIDEO_RAM + 16384)) @@ -186,6 +192,13 @@ int main(int argc, char *argv[]) int pitch = 0; uint8_t rc; + /* update full fb once to sync with RAM */ + pitch = 0; + fb_data = NULL; + SDL_LockTexture(fb, NULL, (void **)&fb_data, &pitch); + update_fb(); + SDL_UnlockTexture(fb); + SDL_Event ev; while (1) { |