GBHawk: More double speed mode work
This commit is contained in:
parent
cd7cc7f939
commit
bffe2078d4
|
@ -60,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
public const ushort COND_CHECK = 48;
|
public const ushort COND_CHECK = 48;
|
||||||
public const ushort HALT_FUNC = 49;
|
public const ushort HALT_FUNC = 49;
|
||||||
public const ushort WAIT = 50; // set cpu to wait state during HDMA
|
public const ushort WAIT = 50; // set cpu to wait state during HDMA
|
||||||
public const ushort DIV_RST = 51; // change speed mode
|
public const ushort DIV_RST = 51; // change speed mode and reset divider
|
||||||
|
|
||||||
// test conditions
|
// test conditions
|
||||||
public const ushort ALWAYS_T = 0;
|
public const ushort ALWAYS_T = 0;
|
||||||
|
@ -516,7 +516,6 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
if (stop_time == 32770)
|
if (stop_time == 32770)
|
||||||
{
|
{
|
||||||
// point to speed cange loop
|
// point to speed cange loop
|
||||||
SpeedFunc(1);
|
|
||||||
instr_pntr = 256 * 60 * 2 + 60 * 9;
|
instr_pntr = 256 * 60 * 2 + 60 * 9;
|
||||||
stop_time--;
|
stop_time--;
|
||||||
break;
|
break;
|
||||||
|
@ -736,7 +735,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
||||||
instr_pntr--;
|
instr_pntr--;
|
||||||
break;
|
break;
|
||||||
case DIV_RST:
|
case DIV_RST:
|
||||||
SpeedFunc(2);
|
SpeedFunc(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TotalExecutedCycles++;
|
TotalExecutedCycles++;
|
||||||
|
|
|
@ -1176,13 +1176,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
HDMA_can_start = true;
|
HDMA_can_start = true;
|
||||||
read_case = 18;
|
read_case = 18;
|
||||||
|
|
||||||
if (Core.double_speed)
|
|
||||||
{
|
|
||||||
STAT &= 0xFC;
|
|
||||||
STAT |= 0x00;
|
|
||||||
if (STAT.Bit(3)) { HBL_INT = true; }
|
|
||||||
// the CPU has to be able to see the transition from mode 3 to mode 0 to start HDMA
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
|
@ -1293,13 +1286,10 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
read_case = 8;
|
read_case = 8;
|
||||||
// hbl_countdown = 1;
|
// hbl_countdown = 1;
|
||||||
|
|
||||||
if (!Core.double_speed)
|
|
||||||
{
|
|
||||||
STAT &= 0xFC;
|
STAT &= 0xFC;
|
||||||
STAT |= 0x00;
|
STAT |= 0x00;
|
||||||
if (STAT.Bit(3)) { HBL_INT = true; }
|
if (STAT.Bit(3)) { HBL_INT = true; }
|
||||||
// the CPU has to be able to see the transition from mode 3 to mode 0 to start HDMA
|
// the CPU has to be able to see the transition from mode 3 to mode 0 to start HDMA
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: If Window is turned on midscanline what happens? When is this check done exactly?
|
// TODO: If Window is turned on midscanline what happens? When is this check done exactly?
|
||||||
if ((window_started && window_latch) || (window_is_reset && !window_latch && (LY > window_y_latch)))
|
if ((window_started && window_latch) || (window_is_reset && !window_latch && (LY > window_y_latch)))
|
||||||
|
|
|
@ -299,18 +299,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (temp == 1)
|
else if (temp == 1)
|
||||||
{
|
|
||||||
double_speed = !double_speed;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// reset the divider (only way for speed_change_timing_fine.gbc and speed_change_cancel.gbc to both work)
|
// reset the divider (only way for speed_change_timing_fine.gbc and speed_change_cancel.gbc to both work)
|
||||||
// Console.WriteLine("at stop " + timer.divider_reg + " " + timer.timer_control);
|
// Console.WriteLine("at stop " + timer.divider_reg + " " + timer.timer_control);
|
||||||
|
|
||||||
// only if the timer mode is 1, an extra tick of the timer is counted before the reset
|
// only if the timer mode is 1, an extra tick of the timer is counted before the reset
|
||||||
// this varies between console revisions
|
// this varies between console revisions
|
||||||
if ((timer.timer_control & 3) == 1)
|
if ((timer.timer_control & 7) == 5)
|
||||||
{
|
{
|
||||||
if ((timer.divider_reg & 0x7) == 7)
|
if ((timer.divider_reg & 0x7) == 7)
|
||||||
{
|
{
|
||||||
|
@ -319,6 +314,13 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
||||||
}
|
}
|
||||||
|
|
||||||
timer.divider_reg = 0xFFFF;
|
timer.divider_reg = 0xFFFF;
|
||||||
|
|
||||||
|
double_speed = !double_speed;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue