diff --git a/Core/sgb.c b/Core/sgb.c index c77b0db..f22eb3e 100644 --- a/Core/sgb.c +++ b/Core/sgb.c @@ -269,7 +269,8 @@ static void command_ready(GB_gameboy_t *gb) #endif uint8_t x = command->x; uint8_t y = command->y; - if (x >= 20 || y >= 18 || (count + 3) / 4 > sizeof(gb->sgb->command) - sizeof(*command) - 1) { + count = MIN(count, 20 * 18); + if (x >= 20 || y >= 18) { /* TODO: Verify with the SFC BIOS */ break; }