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 HALT_FUNC = 49;
|
||||
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
|
||||
public const ushort ALWAYS_T = 0;
|
||||
|
@ -516,7 +516,6 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
|||
if (stop_time == 32770)
|
||||
{
|
||||
// point to speed cange loop
|
||||
SpeedFunc(1);
|
||||
instr_pntr = 256 * 60 * 2 + 60 * 9;
|
||||
stop_time--;
|
||||
break;
|
||||
|
@ -736,7 +735,7 @@ namespace BizHawk.Emulation.Cores.Components.LR35902
|
|||
instr_pntr--;
|
||||
break;
|
||||
case DIV_RST:
|
||||
SpeedFunc(2);
|
||||
SpeedFunc(1);
|
||||
break;
|
||||
}
|
||||
TotalExecutedCycles++;
|
||||
|
|
|
@ -63,7 +63,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
switch (addr)
|
||||
{
|
||||
case 0xFF40: ret = LCDC; break; // LCDC
|
||||
case 0xFF41: ret = STAT; break; // STAT
|
||||
case 0xFF41: ret = STAT; break; // STAT
|
||||
case 0xFF42: ret = scroll_y; break; // SCY
|
||||
case 0xFF43: ret = scroll_x; break; // SCX
|
||||
case 0xFF44: ret = LY_read; break; // LY
|
||||
|
@ -1176,13 +1176,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
HDMA_can_start = true;
|
||||
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;
|
||||
|
||||
case 9:
|
||||
|
@ -1293,14 +1286,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
read_case = 8;
|
||||
// hbl_countdown = 1;
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
// 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)))
|
||||
{
|
||||
|
|
|
@ -299,26 +299,28 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
return 0;
|
||||
}
|
||||
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)
|
||||
// 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
|
||||
// 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)
|
||||
{
|
||||
timer.old_state = true;
|
||||
}
|
||||
}
|
||||
|
||||
timer.divider_reg = 0xFFFF;
|
||||
|
||||
double_speed = !double_speed;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue