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