diff --git a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
index 5fb0c7bd6e..356d3b37ea 100644
--- a/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
+++ b/BizHawk.Emulation.Cores/BizHawk.Emulation.Cores.csproj
@@ -720,6 +720,7 @@
+
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs
index 7b70954462..6b55e46485 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GBC_PPU.cs
@@ -109,6 +109,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
LCDC = value;
+
+ Console.WriteLine(value);
break;
case 0xFF41: // STAT
// writing to STAT during mode 0 or 2 causes a STAT IRQ
@@ -363,6 +365,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
LY_inc = 1;
Core.in_vblank = false;
+ STAT &= 0xFC;
+
// special note here, the y coordiate of the window is kept if the window is deactivated
// meaning it will pick up where it left off if re-enabled later
// so we don't reset it in the scanline loop
@@ -431,6 +435,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
Core.REG_FF0F |= 0x01;
}
+ if ((cycle == 84) && (LY == 144))
+ {
+ if (STAT.Bit(5)) { VBL_INT = false; }
+ }
+
if ((LY == 153) && (cycle == 6))
{
LY = 0;
@@ -521,7 +530,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
else if ((cycle >= 80) && (LY < 144))
{
-
if (cycle == 84)
{
STAT &= 0xFC;
@@ -613,8 +621,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
public override void render(int render_cycle)
- {
-
+ {
// we are now in STAT mode 3
// NOTE: presumably the first necessary sprite is fetched at sprite evaulation
// i.e. just keeping track of the lowest x-value sprite
@@ -768,7 +775,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
// There is another priority bit in GBC, that can still override sprite priority
- if (LCDC.Bit(0) && tile_data_latch[2].Bit(7) && Core.GBC_compat)
+ if (LCDC.Bit(0) && tile_data_latch[2].Bit(7) && (ref_pixel != 0) && Core.GBC_compat)
{
use_sprite = false;
}
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs
index 1cae78cc21..5a14dad97f 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/GB_PPU.cs
@@ -128,7 +128,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
}
cycle = 0;
-
LY += LY_inc;
Core.cpu.LY = LY;
@@ -209,6 +208,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
Core.REG_FF0F |= 0x01;
}
+ if ((cycle == 84) && (LY == 144))
+ {
+ if (STAT.Bit(5)) { VBL_INT = false; }
+ }
+
if ((LY == 153) && (cycle == 6))
{
LY = 0;
@@ -243,7 +247,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
if (cycle == 84)
{
-
STAT &= 0xFC;
STAT |= 0x03;
OAM_INT = false;
@@ -340,7 +343,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
LYC_INT = false;
STAT &= 0xFB;
}
-
}
else if ((cycle == 4) && (LY != 0))
{
@@ -419,7 +421,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
first_fetch = true;
no_sprites = false;
evaled_sprites = 0;
-
window_pre_render = false;
window_latch = LCDC.Bit(5);
diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC5.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC5.cs
index 3c1ea0c60f..cbaf5bc601 100644
--- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC5.cs
+++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBHawk/Mappers/Mapper_MBC5.cs
@@ -22,6 +22,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
// some games have sizes that result in a degenerate ROM, account for it here
if (ROM_mask > 4) { ROM_mask |= 3; }
+ if (ROM_mask > 0x100) { ROM_mask |= 0xFF; }
RAM_mask = 0;
if (Core.cart_RAM != null)