diff --git a/src/mmu.c b/src/mmu.c index cca507a..d356f2f 100644 --- a/src/mmu.c +++ b/src/mmu.c @@ -86,7 +86,7 @@ void mmu_load_rom(MMU *mmu, const uint8_t *data, size_t size) */ static inline void map_slot(MMU *mmu, size_t slot, size_t bank) { - DEBUG("MMU mapping memory slot %zu to bank 0x%02zX", slot, bank) + TRACE("MMU mapping memory slot %zu to bank 0x%02zX", slot, bank) mmu->map_slots[slot] = mmu->rom_banks[bank]; } diff --git a/src/z80.c b/src/z80.c index 1ad5d89..a278e77 100644 --- a/src/z80.c +++ b/src/z80.c @@ -278,6 +278,7 @@ static inline uint8_t get_interrupt_mode(const Z80 *z80) */ static inline uint8_t handle_interrupt(Z80 *z80) { + TRACE("Z80 triggering mode-%d interrupt", get_interrupt_mode(z80)) z80->regfile.iff1 = z80->regfile.iff2 = 0; stack_push(z80, z80->regfile.pc); diff --git a/src/z80_ops.inc.c b/src/z80_ops.inc.c index ab50992..e5e24c6 100644 --- a/src/z80_ops.inc.c +++ b/src/z80_ops.inc.c @@ -848,7 +848,7 @@ static uint8_t z80_inst_dec_ss(Z80 *z80, uint8_t opcode) static uint8_t z80_inst_bit_b_r(Z80 *z80, uint8_t opcode) { uint8_t *reg = extract_reg(z80, opcode << 3); - uint8_t bit = opcode >> 3; + uint8_t bit = (opcode >> 3) & 0x07; bool z = (((*reg) >> bit) & 1) == 0; if (z) update_flags(z80, 0, 0, 1, 0, 1, 0, 1, 0, 0xFE); @@ -866,7 +866,7 @@ static uint8_t z80_inst_bit_b_r(Z80 *z80, uint8_t opcode) static uint8_t z80_inst_bit_b_hl(Z80 *z80, uint8_t opcode) { uint8_t val = mmu_read_byte(z80->mmu, get_pair(z80, REG_HL)); - uint8_t bit = opcode >> 3; + uint8_t bit = (opcode >> 3) & 0x07; bool z = ((val >> bit) & 1) == 0; if (z) update_flags(z80, 0, 0, 1, 0, 1, 0, 1, 0, 0xFE);