GBHawk: ppu cleanup and more aaccuracy edge case work
This commit is contained in:
parent
0929d224fd
commit
8bd739a4c8
|
@ -273,7 +273,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
public override void tick()
|
||||
{
|
||||
// Do HDMA ticks
|
||||
if (HDMA_active)
|
||||
if (HDMA_active && !Core.cpu.halted && !Core.cpu.stopped)
|
||||
{
|
||||
if (HDMA_length > 0)
|
||||
{
|
||||
|
@ -701,11 +701,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
// i.e. just keeping track of the lowest x-value sprite
|
||||
if (render_cycle == 0)
|
||||
{
|
||||
/*
|
||||
OAM_access_read = false;
|
||||
OAM_access_write = true;
|
||||
VRAM_access_read = false;
|
||||
*/
|
||||
// window X is latched for the scanline, mid-line changes have no effect
|
||||
window_x_latch = window_x;
|
||||
|
||||
|
@ -1199,7 +1194,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
OAM_access_read = true;
|
||||
OAM_access_write = true;
|
||||
VRAM_access_read = true;
|
||||
VRAM_access_write = true;
|
||||
VRAM_access_write = true;
|
||||
|
||||
read_case = 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1228,6 +1225,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
case 17:
|
||||
read_case--;
|
||||
break;
|
||||
case 18:
|
||||
// end of rendering
|
||||
break;
|
||||
}
|
||||
internal_cycle++;
|
||||
|
||||
|
|
|
@ -269,7 +269,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
public override void tick()
|
||||
{
|
||||
// Do HDMA ticks
|
||||
if (HDMA_active)
|
||||
if (HDMA_active && !Core.cpu.halted && !Core.cpu.stopped)
|
||||
{
|
||||
if (HDMA_length > 0)
|
||||
{
|
||||
|
@ -704,11 +704,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
// i.e. just keeping track of the lowest x-value sprite
|
||||
if (render_cycle == 0)
|
||||
{
|
||||
/*
|
||||
OAM_access_read = false;
|
||||
OAM_access_write = true;
|
||||
VRAM_access_read = false;
|
||||
*/
|
||||
// window X is latched for the scanline, mid-line changes have no effect
|
||||
window_x_latch = window_x;
|
||||
|
||||
|
@ -1158,7 +1153,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
case 8: // done reading, we are now in phase 0
|
||||
pre_render = true;
|
||||
|
||||
// the other interrupts appear to be delayed by 1 CPU cycle, so do the same here
|
||||
if (hbl_countdown > 0)
|
||||
{
|
||||
hbl_countdown--;
|
||||
|
@ -1168,7 +1162,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
OAM_access_read = true;
|
||||
OAM_access_write = true;
|
||||
VRAM_access_read = true;
|
||||
VRAM_access_write = true;
|
||||
VRAM_access_write = true;
|
||||
|
||||
read_case = 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1197,6 +1193,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
case 17:
|
||||
read_case--;
|
||||
break;
|
||||
case 18:
|
||||
// end of rendering
|
||||
break;
|
||||
}
|
||||
internal_cycle++;
|
||||
|
||||
|
|
|
@ -459,11 +459,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
// i.e. just keeping track of the lowest x-value sprite
|
||||
if (render_cycle == 0)
|
||||
{
|
||||
/*
|
||||
OAM_access_read = false;
|
||||
OAM_access_write = true;
|
||||
VRAM_access_read = false;
|
||||
*/
|
||||
// window X is latched for the scanline, mid-line changes have no effect
|
||||
window_x_latch = window_x;
|
||||
|
||||
|
@ -620,6 +615,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
|
||||
if (pixel_counter == 160)
|
||||
{
|
||||
hbl_countdown = 2;
|
||||
read_case = 8;
|
||||
}
|
||||
}
|
||||
|
@ -874,15 +870,26 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
case 8: // done reading, we are now in phase 0
|
||||
pre_render = true;
|
||||
|
||||
STAT &= 0xFC;
|
||||
STAT |= 0x00;
|
||||
if (hbl_countdown > 0)
|
||||
{
|
||||
hbl_countdown--;
|
||||
if (hbl_countdown == 0)
|
||||
{
|
||||
VRAM_access_read = true;
|
||||
VRAM_access_write = true;
|
||||
OAM_access_read = true;
|
||||
OAM_access_write = true;
|
||||
|
||||
if (STAT.Bit(3)) { HBL_INT = true; }
|
||||
read_case = 18;
|
||||
}
|
||||
else
|
||||
{
|
||||
STAT &= 0xFC;
|
||||
STAT |= 0x00;
|
||||
|
||||
OAM_access_read = true;
|
||||
OAM_access_write = true;
|
||||
VRAM_access_read = true;
|
||||
VRAM_access_write = true;
|
||||
if (STAT.Bit(3)) { HBL_INT = true; }
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 9:
|
||||
|
@ -902,6 +909,9 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
case 17:
|
||||
read_case--;
|
||||
break;
|
||||
case 18:
|
||||
// end of rendering
|
||||
break;
|
||||
}
|
||||
internal_cycle++;
|
||||
|
||||
|
|
|
@ -58,13 +58,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
{
|
||||
return RAM[addr - 0xE000];
|
||||
}
|
||||
|
||||
if (addr >= 0xF000 && addr < 0xFE00)
|
||||
{
|
||||
return RAM[(RAM_Bank * 0x1000) + (addr - 0xF000)];
|
||||
}
|
||||
if (addr >= 0xFE00 && addr < 0xFEA0 && ppu.DMA_OAM_access)
|
||||
|
||||
if (addr >= 0xFE00 && addr < 0xFEA0)
|
||||
{
|
||||
return OAM[addr - 0xFE00];
|
||||
if (ppu.DMA_OAM_access)
|
||||
{
|
||||
return OAM[addr - 0xFE00];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
if (addr >= 0xFF00 && addr < 0xFF80) // The game GOAL! Requires Hardware Regs to be accessible
|
||||
|
@ -127,7 +136,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
}
|
||||
|
||||
if (ppu.pixel_counter == 160)
|
||||
{
|
||||
{
|
||||
return ppu.bus_return;
|
||||
}
|
||||
return 0xFF;
|
||||
|
@ -323,14 +332,22 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
|
|||
{
|
||||
return RAM[addr - 0xE000];
|
||||
}
|
||||
|
||||
if (addr >= 0xF000 && addr < 0xFE00)
|
||||
{
|
||||
return RAM[(RAM_Bank * 0x1000) + (addr - 0xF000)];
|
||||
}
|
||||
|
||||
if (addr >= 0xFE00 && addr < 0xFEA0 && ppu.DMA_OAM_access)
|
||||
if (addr >= 0xFE00 && addr < 0xFEA0)
|
||||
{
|
||||
return OAM[addr - 0xFE00];
|
||||
if (ppu.DMA_OAM_access)
|
||||
{
|
||||
return OAM[addr - 0xFE00];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
if (addr >= 0xFF00 && addr < 0xFF80) // The game GOAL! Requires Hardware Regs to be accessible
|
||||
|
|
Loading…
Reference in New Issue