From 3344480de764faf6cf663dbe6bb40be66043facd Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Wed, 30 Mar 2016 23:36:24 +0300 Subject: [PATCH] Vblank now returns a white screen if LCD is off, instead of keeping the buffer unmodified. --- Core/display.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Core/display.c b/Core/display.c index 0888393..b5f08bc 100644 --- a/Core/display.c +++ b/Core/display.c @@ -3,6 +3,7 @@ #include #include #include +#include #include "gb.h" #include "display.h" @@ -197,6 +198,11 @@ void display_vblank(GB_gameboy_t *gb) frames++; */ + if (!(gb->io_registers[GB_IO_LCDC] & 0x80)) { + /* LCD is off, memset screen to white */ + memset(gb->screen, 0xFF, 160 * 144 * 4); + } + gb->vblank_callback(gb); if (!gb->turbo) { struct timeval now;