From c71cd893b4a414ec401c93dfdb4fe771a55c5b95 Mon Sep 17 00:00:00 2001 From: slack Date: Sun, 26 Apr 2009 02:59:49 +0200 Subject: [PATCH] Bugfix in bit rotations --- core/GameBoy.cc | 10 ++-------- core/opcodes.h | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/core/GameBoy.cc b/core/GameBoy.cc index d634d13..28d7038 100644 --- a/core/GameBoy.cc +++ b/core/GameBoy.cc @@ -466,10 +466,7 @@ GameBoy::run_status GameBoy::run_cycle() set_flag_if(regs.A == 0, ZERO_FLAG); reset_flag(ADD_SUB_FLAG); reset_flag(HALF_CARRY_FLAG); - // TODO: Check which of GBCPUman.pdf or - // worldofspectrum z80 reference is correct - // - //set_flag_if(bit7, CARRY_FLAG); + set_flag_if(bit7, CARRY_FLAG); cycles_until_next_instruction = 4; break; } @@ -493,10 +490,7 @@ GameBoy::run_status GameBoy::run_cycle() set_flag_if(regs.A == 0, ZERO_FLAG); reset_flag(ADD_SUB_FLAG); reset_flag(HALF_CARRY_FLAG); - // TODO: Check which of GBCPUman.pdf or - // worldofspectrum z80 reference is correct - // - //set_flag_if(bit0, CARRY_FLAG); + set_flag_if(bit0, CARRY_FLAG); cycles_until_next_instruction = 4; break; } diff --git a/core/opcodes.h b/core/opcodes.h index 6ed1d2c..7333e15 100644 --- a/core/opcodes.h +++ b/core/opcodes.h @@ -260,10 +260,6 @@ break; -// TODO: Check which of GBCPUman.pdf or -// worldofspectrum z80 reference is correct -//set_flag_if(bit7, CARRY_FLAG); -// #define RLC_reg(opcode, reg) \ case opcode: { \ u8 bit7 = regs.reg >> 7; \ @@ -271,6 +267,7 @@ set_flag_if(regs.reg == 0, ZERO_FLAG); \ reset_flag(ADD_SUB_FLAG); \ reset_flag(HALF_CARRY_FLAG); \ + set_flag_if(bit7, CARRY_FLAG); \ cycles_until_next_instruction = 8; \ break; \ } @@ -287,10 +284,6 @@ break; \ } -// TODO: Check which of GBCPUman.pdf or -// worldofspectrum z80 reference is correct -//set_flag_if(bit7, CARRY_FLAG); -// #define RRC_reg(opcode, reg) \ case opcode: { \ u8 bit0 = regs.reg & 1; \ @@ -298,6 +291,7 @@ set_flag_if(regs.reg == 0, ZERO_FLAG); \ reset_flag(ADD_SUB_FLAG); \ reset_flag(HALF_CARRY_FLAG); \ + set_flag_if(bit0, CARRY_FLAG); \ cycles_until_next_instruction = 8; \ break; \ } -- 2.34.1