GBHawk: Fix some tests

This commit is contained in:
alyosha-tas 2021-05-25 10:56:28 -04:00
parent 359657c29a
commit 0b3cd0ec0d
4 changed files with 32 additions and 16 deletions

View File

@ -76,8 +76,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
case 0xFF47: ret = BGP; break; // BGP
case 0xFF48: ret = obj_pal_0; break; // OBP0
case 0xFF49: ret = obj_pal_1; break; // OBP1
case 0xFF4A: ret = window_y; break; // WY
case 0xFF4B: ret = window_x; break; // WX
case 0xFF4A: ret = window_y_read; break; // WY
case 0xFF4B: ret = window_x_read; break; // WX
// These are GBC specific Regs
case 0xFF51: ret = 0xFF; break; // HDMA1 (src_hi)
@ -157,7 +157,6 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
case 0xFF41: // STAT
// note that their is no stat interrupt bug in GBC
STAT = (byte)((value & 0xF8) | (STAT & 7) | 0x80);
//Console.WriteLine("stat " + " " + STAT + " " + value + " " + LY + " " + cycle + " " + Core.REG_FF0F);
if (((STAT & 3) == 0) && STAT.Bit(3) && !glitch_state) { HBL_INT = true; } else { HBL_INT = false; }
if (value.Bit(6) && LCDC.Bit(7))
@ -200,6 +199,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
break;
case 0xFF4A: // WY
window_y = value;
window_y_read = window_y;
if (!window_started && (!LCDC.Bit(7) || (value > LY)))
{
window_y_latch = window_y;
@ -209,6 +209,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
break;
case 0xFF4B: // WX
window_x = value;
window_x_read = window_x;
break;
// These are GBC specific Regs
case 0xFF51: // HDMA1
@ -908,6 +909,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
window_started = false;
if (SL_sprites_index == 0) { no_sprites = true; }
// it is much easier to process sprites if we order them according to the rules of sprite priority first
if (!no_sprites) { reorder_and_assemble_sprites(); }
}
@ -1892,14 +1894,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
scroll_y = 0;
scroll_x = 0;
LY = 0;
LYC = 0xFF;
LYC = 0;
LY_read = 0;
DMA_addr = 0;
BGP = 0xFF;
obj_pal_0 = 0;
obj_pal_1 = 0;
window_y = 0x0;
window_x = 0x0;
window_y = 0xFF;
window_x = 0xFF;
window_y_read = 0;
window_x_read = 0;
window_x_latch = 0xFF;
window_y_latch = 0xFF;
LY_inc = 1;

View File

@ -75,8 +75,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
case 0xFF47: ret = BGP; break; // BGP
case 0xFF48: ret = obj_pal_0; break; // OBP0
case 0xFF49: ret = obj_pal_1; break; // OBP1
case 0xFF4A: ret = window_y; break; // WY
case 0xFF4B: ret = window_x; break; // WX
case 0xFF4A: ret = window_y_read; break; // WY
case 0xFF4B: ret = window_x_read; break; // WX
// These are GBC specific Regs
case 0xFF51: ret = 0xFF; break; // HDMA1 (src_hi)
@ -200,6 +200,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
break;
case 0xFF4A: // WY
window_y = value;
window_y_read = window_y;
if (!window_started && (!LCDC.Bit(7) || (value > LY)))
{
window_y_latch = window_y;
@ -209,6 +210,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
break;
case 0xFF4B: // WX
window_x = value;
window_x_read = window_x;
break;
// These are GBC specific Regs
@ -1837,14 +1839,16 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
scroll_y = 0;
scroll_x = 0;
LY = 0;
LYC = 0xFF;
LYC = 0; // NOTE: frame0_m2stat_count_1_dmg08_cgb04c_out91 returns 1 on GBP, indicating internal state is also zero
LY_read = 0;
DMA_addr = 0;
BGP = 0xFF;
obj_pal_0 = 0;
obj_pal_1 = 0;
window_y = 0x0;
window_x = 0x0;
window_y = 0xFF;
window_x = 0xFF;
window_y_read = 0;
window_x_read = 0;
window_x_latch = 0xFF;
window_y_latch = 0xFF;
LY_inc = 1;

View File

@ -21,8 +21,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
case 0xFF47: ret = BGP; break; // BGP
case 0xFF48: ret = obj_pal_0; break; // OBP0
case 0xFF49: ret = obj_pal_1; break; // OBP1
case 0xFF4A: ret = window_y; break; // WY
case 0xFF4B: ret = window_x; break; // WX
case 0xFF4A: ret = window_y_read; break; // WY
case 0xFF4B: ret = window_x_read; break; // WX
}
return ret;
@ -125,6 +125,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
break;
case 0xFF4A: // WY
window_y = value;
window_y_read = window_y;
if (!window_started && (!LCDC.Bit(7) || (value > LY)))
{
window_y_latch = window_y;
@ -134,6 +135,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
break;
case 0xFF4B: // WX
window_x = value;
window_x_read = window_x;
break;
}
}
@ -1264,13 +1266,15 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
scroll_y = 0;
scroll_x = 0;
LY = 0;
LYC = 0xFF;
LYC = 0; // NOTE: might be internal latch to 0xFF on startup, need to check ex. frame0_m2stat_count_1_dmg08_cgb04c_out91
DMA_addr = 0xFF;
BGP = 0xFF;
obj_pal_0 = 0xFF;
obj_pal_1 = 0xFF;
window_y = 0x0;
window_x = 0x0;
window_y = 0xFF;
window_x = 0xFF;
window_y_read = 0;
window_x_read = 0;
window_x_latch = 0xFF;
window_y_latch = 0xFF;
LY_inc = 1;

View File

@ -31,6 +31,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
public byte obj_pal_1;
public byte window_y;
public byte window_x;
public byte window_y_read;
public byte window_x_read;
public bool DMA_start;
public bool DMA_bus_control;
public int DMA_clock;
@ -203,6 +205,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBHawk
ser.Sync(nameof(obj_pal_1), ref obj_pal_1);
ser.Sync(nameof(window_y), ref window_y);
ser.Sync(nameof(window_x), ref window_x);
ser.Sync(nameof(window_y_read), ref window_y_read);
ser.Sync(nameof(window_x_read), ref window_x_read);
ser.Sync(nameof(DMA_start), ref DMA_start);
ser.Sync(nameof(DMA_bus_control), ref DMA_bus_control);
ser.Sync(nameof(DMA_clock), ref DMA_clock);