From 74d00b84b74536539d4bc1552b1d8e4160a55fb0 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Fri, 17 Feb 2017 00:21:02 +0200 Subject: [PATCH] Treat STOP as a 2-byte instruction --- Core/z80_cpu.c | 1 + Core/z80_disassembler.c | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Core/z80_cpu.c b/Core/z80_cpu.c index 06f52ba..aec3bea 100644 --- a/Core/z80_cpu.c +++ b/Core/z80_cpu.c @@ -32,6 +32,7 @@ static void stop(GB_gameboy_t *gb, uint8_t opcode) else { gb->stopped = true; } + gb->pc++; } /* Operand naming conventions for functions: diff --git a/Core/z80_disassembler.c b/Core/z80_disassembler.c index 2426596..4b1d6ea 100644 --- a/Core/z80_disassembler.c +++ b/Core/z80_disassembler.c @@ -22,8 +22,14 @@ static void nop(GB_gameboy_t *gb, uint8_t opcode, uint16_t *pc) static void stop(GB_gameboy_t *gb, uint8_t opcode, uint16_t *pc) { - GB_log(gb, "STOP\n"); (*pc)++; + uint8_t next = GB_read_memory(gb, (*pc)++); + if (next) { + GB_log(gb, "CORRUPTED STOP (%02x)\n", next); + } + else { + GB_log(gb, "STOP\n"); + } } static char *register_names[] = {"af", "bc", "de", "hl", "sp"};