From 8182da2fcddcb63789c5b0c22936d97d3cbf678d Mon Sep 17 00:00:00 2001 From: saxxonpike Date: Sat, 3 Nov 2012 16:15:16 +0000 Subject: [PATCH] c64- VIC bank switching via CIA2 --- BizHawk.Emulation/Computers/Commodore64/MemBus.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/BizHawk.Emulation/Computers/Commodore64/MemBus.cs b/BizHawk.Emulation/Computers/Commodore64/MemBus.cs index d6fb67f0e9..a7b0613fd0 100644 --- a/BizHawk.Emulation/Computers/Commodore64/MemBus.cs +++ b/BizHawk.Emulation/Computers/Commodore64/MemBus.cs @@ -56,6 +56,8 @@ namespace BizHawk.Emulation.Computers.Commodore64 public MemoryLayout layout; // ram + public byte cia2A; + public byte cia2B; public byte[] colorRam; public byte[] ram; public ushort vicOffset; @@ -103,20 +105,26 @@ namespace BizHawk.Emulation.Computers.Commodore64 public byte CIA2ReadPortA() { - return 0; + return cia2A; } public byte CIA2ReadPortB() { - return 0; + return cia2B; } public void CIA2WritePortA(byte val, byte direction) { + cia2A &= (byte)~direction; + cia2A |= (byte)(val & direction); + + vicOffset = (ushort)((cia2A & 0x03) << 14); } public void CIA2WritePortB(byte val, byte direction) { + cia2B &= (byte)~direction; + cia2B |= (byte)(val & direction); } public MemoryDesignation GetDesignation(ushort addr)