diff --git a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt index 8ad987b299..704754f27d 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt +++ b/BizHawk.Emulation/Consoles/Nintendo/Docs/compatibility.txt @@ -52,14 +52,14 @@ Open bus and bus conflict emulation is not considered complete or thorough in an 061 Multicart Junk 062 Multicart Junk 064 Tengen Good -065 Misc (J) Nothing +065 Misc (J) Decent 066 GxROM Complete 067 Sunsoft-3 Complete 068 Sunsoft-4 Complete 069 FME7 Minimal (missing sound) 070 Misc Complete 071 Camerica Complete -072 Misc (J) Nothing +072 Misc (J) Complete 073 VRC3 Good 074 Pirate (CN) Junk 075 VRC1 Complete diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs index e09bb7592a..6fac86bc04 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/BoardSystem.cs @@ -146,6 +146,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo byte old_value = value; value &= ReadPRG(addr); Debug.Assert(old_value == value, "Found a test case of bus conflict. please report."); + //report: pinball quest (J) return value; } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Irem_H3001.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Irem_H3001.cs index d902f1a1c6..7448e7ac76 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Irem_H3001.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Irem_H3001.cs @@ -52,8 +52,6 @@ namespace BizHawk.Emulation.Consoles.Nintendo case "IREM-H3001": AssertPrg(128, 256); AssertChr(128, 256); AssertVram(0); AssertWram(0); break; - case "IREM-H3001-FLEX": - break; default: return false; } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs index 090d2cc961..e3c2af6181 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/JALECO_JF_17.cs @@ -12,12 +12,22 @@ namespace BizHawk.Emulation.Consoles.Nintendo //Moero!! Pro Tennis //Moero!! Juudou Warriors + //based on the chips on the pcb (3x 4bit registers and some OR gates) i'm gonna speculate something a little different about how this works. + //there isnt enough memory for 2 bank registers, a latched bank, and a latched command. so i think the bank isnt latched--the command is latched. + //when the top 2 bits are 0, then the low 4 bits are written to the register specified by the latch + //when the top 2 bits arent 0, theyre written to the latch + //interestingly, this works (for pinball quest) only when bus conflicts are applied, otherwise the game cant get past the title + class JALECO_JF_17 : NES.NESBoardBase { - int command; + //configuration int prg_bank_mask_16k; - byte prg_bank_16k; + int chr_bank_mask_8k; + + //state + int latch; ByteBuffer prg_banks_16k = new ByteBuffer(2); + ByteBuffer chr_banks_8k = new ByteBuffer(1); public override bool Configure(NES.EDetectionOrigin origin) { @@ -30,12 +40,25 @@ namespace BizHawk.Emulation.Consoles.Nintendo default: return false; } - SetMirrorType(Cart.pad_h, Cart.pad_v); + prg_bank_mask_16k = (Cart.prg_size / 16) - 1; + chr_bank_mask_8k = (Cart.chr_size / 8) - 1; + + SetMirrorType(Cart.pad_h, Cart.pad_v); + prg_banks_16k[1] = 0xFF; + chr_banks_8k[0] = 0; + SyncMap(); + return true; } + void SyncMap() + { + ApplyMemoryMapMask(prg_bank_mask_16k, prg_banks_16k); + ApplyMemoryMapMask(chr_bank_mask_8k, chr_banks_8k); + } + public override void Dispose() { prg_banks_16k.Dispose(); @@ -45,38 +68,47 @@ namespace BizHawk.Emulation.Consoles.Nintendo public override void SyncState(Serializer ser) { base.SyncState(ser); - ser.Sync("prg_bank_mask_16k", ref prg_bank_mask_16k); - ser.Sync("prg_bank_16k", ref prg_bank_16k); + ser.Sync("latch", ref latch); ser.Sync("prg_banks_16k", ref prg_banks_16k); - ser.Sync("command", ref command); + ser.Sync("chr_banks_8k", ref chr_banks_8k); } public override void WritePRG(int addr, byte value) { + //Console.WriteLine("MAP {0:X4} = {1:X2}", addr, value); + + value = HandleNormalPRGConflict(addr, value); + + int command = value >> 6; switch (command) { case 0: + if (latch == 1) + chr_banks_8k[0] = (byte)(value & 0xF); + else if (latch == 2) + prg_banks_16k[0] = (byte)(value & 0xF); + SyncMap(); break; - case 1: - break; - case 2: - prg_bank_16k = (byte)(value & 15); - break; - case 3: + default: + latch = command; break; } - - command = value >> 6; } public override byte ReadPRG(int addr) { - int bank_16k = addr >> 14; - int ofs = addr & ((1 << 14) - 1); - bank_16k = prg_banks_16k[bank_16k]; - bank_16k &= prg_bank_mask_16k; - addr = (bank_16k << 14) | ofs; + addr = ApplyMemoryMap(14, prg_banks_16k, addr); return ROM[addr]; } + + public override byte ReadPPU(int addr) + { + if (addr < 0x2000) + { + addr = ApplyMemoryMap(13, chr_banks_8k, addr); + return base.ReadPPUChr(addr); + } + else return base.ReadPPU(addr); + } } } diff --git a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft3.cs b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft3.cs index f97833c03e..70391e078a 100644 --- a/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft3.cs +++ b/BizHawk.Emulation/Consoles/Nintendo/NES/Boards/Sunsoft3.cs @@ -112,7 +112,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo } - void ClockClock() + void ClockCPU() { if (!irq_enable) return; if (irq_counter == 0) @@ -148,7 +148,7 @@ namespace BizHawk.Emulation.Consoles.Nintendo if (clock_counter == 3) { clock_counter = 0; - ClockClock(); + ClockCPU(); } } }