From 0687d4a304f10978b885e41ec60a1ed2780acb84 Mon Sep 17 00:00:00 2001 From: Asnivor Date: Mon, 3 Dec 2018 21:16:58 +0000 Subject: [PATCH 1/2] needs testing/a second eye on it - #1363 --- BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs index e348ae9ce1..c10e7e6ec3 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs @@ -227,8 +227,8 @@ namespace BizHawk.Emulation.Cores.PCEngine for (; Registers[LENR] < 0xFFFF; Registers[LENR]--, wordsDone++) { VRAM[Registers[DESR] & 0x7FFF] = VRAM[Registers[SOUR] & 0x7FFF]; - UpdatePatternData(Registers[DESR]); - UpdateSpriteData(Registers[DESR]); + UpdatePatternData((ushort)(Registers[DESR] & 0x7FFF)); + UpdateSpriteData((ushort)(Registers[DESR] & 0x7FFF)); Registers[DESR] = (ushort)(Registers[DESR] + advanceDest); Registers[SOUR] = (ushort)(Registers[SOUR] + advanceSource); From 04b84a5c2e840948421ca475445451858d615d4a Mon Sep 17 00:00:00 2001 From: Asnivor Date: Mon, 3 Dec 2018 23:06:48 +0000 Subject: [PATCH 2/2] pcehawk: mask only when addr attached to vram --- BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs index c10e7e6ec3..4dd59e373f 100644 --- a/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs +++ b/BizHawk.Emulation.Cores/Consoles/PC Engine/VDC.cs @@ -227,8 +227,8 @@ namespace BizHawk.Emulation.Cores.PCEngine for (; Registers[LENR] < 0xFFFF; Registers[LENR]--, wordsDone++) { VRAM[Registers[DESR] & 0x7FFF] = VRAM[Registers[SOUR] & 0x7FFF]; - UpdatePatternData((ushort)(Registers[DESR] & 0x7FFF)); - UpdateSpriteData((ushort)(Registers[DESR] & 0x7FFF)); + UpdatePatternData(Registers[DESR]); + UpdateSpriteData(Registers[DESR]); Registers[DESR] = (ushort)(Registers[DESR] + advanceDest); Registers[SOUR] = (ushort)(Registers[SOUR] + advanceSource); @@ -267,8 +267,8 @@ namespace BizHawk.Emulation.Cores.PCEngine int tileNo = addr >> 4; int tileLineOffset = addr & 0x7; - int bitplane01 = VRAM[(tileNo * 16) + tileLineOffset]; - int bitplane23 = VRAM[(tileNo * 16) + tileLineOffset + 8]; + int bitplane01 = VRAM[((tileNo * 16) + tileLineOffset) & 0x7FFF]; + int bitplane23 = VRAM[((tileNo * 16) + tileLineOffset + 8) & 0x7FFF]; int patternBufferBase = (tileNo * 64) + (tileLineOffset * 8); @@ -290,7 +290,7 @@ namespace BizHawk.Emulation.Cores.PCEngine int line = addr & 0x0F; int ofs = (tileNo * 256) + (line * 16) + 15; - ushort value = VRAM[addr]; + ushort value = VRAM[addr & 0x7FFF]; byte bitAnd = (byte)(~(1 << bitplane)); byte bitOr = (byte)(1 << bitplane);