Treat STOP as a 2-byte instruction

This commit is contained in:
Lior Halphon 2017-02-17 00:21:02 +02:00
parent 6b1363e96e
commit 74d00b84b7
2 changed files with 8 additions and 1 deletions

View File

@ -32,6 +32,7 @@ static void stop(GB_gameboy_t *gb, uint8_t opcode)
else { else {
gb->stopped = true; gb->stopped = true;
} }
gb->pc++;
} }
/* Operand naming conventions for functions: /* Operand naming conventions for functions:

View File

@ -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) static void stop(GB_gameboy_t *gb, uint8_t opcode, uint16_t *pc)
{ {
GB_log(gb, "STOP\n");
(*pc)++; (*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"}; static char *register_names[] = {"af", "bc", "de", "hl", "sp"};