GBHawk: minor bug fixes and cleanups

This commit is contained in:
alyosha-tas 2020-04-03 12:16:52 -04:00
parent 0422b9b1de
commit 458949a2f9
4 changed files with 19 additions and 8 deletions
BizHawk.Emulation.Cores
CPUs/LR35902
Consoles/Nintendo/GBHawk

View File

@ -562,8 +562,16 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
// reset
instr_table[256 * 60 * 2] = IDLE;
instr_table[256 * 60 * 2 + 1] = IDLE;
instr_table[256 * 60 * 2 + 2] = HALT_CHK;
instr_table[256 * 60 * 2 + 3] = OP;
instr_table[256 * 60 * 2 + 2] = IDLE;
instr_table[256 * 60 * 2 + 3] = IDLE;
instr_table[256 * 60 * 2 + 4] = IDLE;
instr_table[256 * 60 * 2 + 5] = IDLE;
instr_table[256 * 60 * 2 + 6] = IDLE;
instr_table[256 * 60 * 2 + 7] = IDLE;
instr_table[256 * 60 * 2 + 8] = IDLE;
instr_table[256 * 60 * 2 + 9] = IDLE;
instr_table[256 * 60 * 2 + 10] = HALT_CHK;
instr_table[256 * 60 * 2 + 11] = OP;
// halt loop
instr_table[256 * 60 * 2 + 60] = IDLE;

View File

@ -77,7 +77,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
ResetRegisters();
ResetInterrupts();
BuildInstructionTable();
TotalExecutedCycles = 8;
TotalExecutedCycles = 0;
stop_check = false;
instr_pntr = 256 * 60 * 2; // point to reset
stopped = jammed = halted = FlagI = false;

View File

@ -1,5 +1,6 @@
using BizHawk.Common.NumberExtensions;
using BizHawk.Common;
using System;
namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
{
@ -48,12 +49,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (((value & 2) > 0) && Core.GBC_compat)
{
clk_rate = 16;
serial_clock = (15 - (int)(Core.cpu.TotalExecutedCycles % 16)) + 1;
}
else
{
clk_rate = 512;
}
serial_clock = clk_rate;
serial_clock = (511 - (int)(Core.cpu.TotalExecutedCycles % 512)) + 1;
}
can_pulse = true;
}
else
@ -70,12 +72,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (((value & 2) > 0) && Core.GBC_compat)
{
clk_rate = 16;
serial_clock = (15 - (int)(Core.cpu.TotalExecutedCycles % 16)) + 1;
}
else
{
clk_rate = 512;
}
serial_clock = clk_rate;
serial_clock = (511 - (int)(Core.cpu.TotalExecutedCycles % 512)) + 1;
}
can_pulse = true;
}
else

View File

@ -139,7 +139,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public void Reset()
{
divider_reg = 8; // probably always 8 but not confirmed for GB as far as I know
divider_reg = 0;
timer_reload = 0;
timer = 0;
timer_old = 0;