Updated Experimental Vic.

This commit is contained in:
saxxonpike 2013-08-30 20:22:12 +00:00
parent c5036bf057
commit 2e178d84e1
15 changed files with 332 additions and 95 deletions

View File

@ -100,8 +100,8 @@
<Compile Include="Computers\Commodore64\Disk\VIC1541.PLA.cs" />
<Compile Include="Computers\Commodore64\Experimental\C64.cs" />
<Compile Include="Computers\Commodore64\Experimental\C64.Glue.cs" />
<Compile Include="Computers\Commodore64\Experimental\C64NTSC.cs" />
<Compile Include="Computers\Commodore64\Experimental\C64PAL.cs" />
<Compile Include="Computers\Commodore64\Experimental\C64Presets.NTSC.cs" />
<Compile Include="Computers\Commodore64\Experimental\C64Presets.PAL.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cia.Interface.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cia.Internal.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Cia.Registers.cs" />
@ -111,10 +111,12 @@
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Sid.Settings.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Sid.SoundProvider.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Userport.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Graphics.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Registers.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Settings.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Sprite.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.State.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Synth.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.Timing.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Internals\Vic.VideoProvider.cs" />
<Compile Include="Computers\Commodore64\Experimental\Chips\Presets.cs" />

View File

@ -5,7 +5,7 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
{
public abstract partial class C64
public sealed partial class C64
{
public void InitializeConnections()
{

View File

@ -6,26 +6,26 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
{
public abstract partial class C64 : IMotherboard
public sealed partial class C64 : IMotherboard
{
protected Rom basicRom;
protected Cassette cassette;
protected Rom characterRom;
protected Cia cia1;
protected Cia cia2;
protected Ram colorRam;
protected Cpu cpu;
protected Expansion expansion;
protected Joystick joystickA;
protected Joystick joystickB;
protected Rom kernalRom;
protected Keyboard keyboard;
protected Ram memory;
protected Pla pla;
protected Serial serial;
protected Sid sid;
protected Userport user;
protected Vic vic;
public Rom basicRom;
public Cassette cassette;
public Rom characterRom;
public Cia cia1;
public Cia cia2;
public Ram colorRam;
public Cpu cpu;
public Expansion expansion;
public Joystick joystickA;
public Joystick joystickB;
public Rom kernalRom;
public Keyboard keyboard;
public Ram memory;
public Pla pla;
public Serial serial;
public Sid sid;
public Userport user;
public Vic vic;
public C64(C64Timing timing)
{

View File

@ -1,18 +0,0 @@
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips;
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
{
public partial class C64NTSC : C64
{
static private C64Timing timing = null;
public C64NTSC(byte[] basicRom, byte[] charRom, byte[] kernalRom) : base(timing)
{
}
}
}

View File

@ -1,37 +0,0 @@
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips;
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
{
public partial class C64PAL : C64
{
static private C64Timing timing = null;
public C64PAL(byte[] basic, byte[] kernal, byte[] character) : base(timing)
{
this.basicRom = Presets.Rom2364(basic);
this.cassette = new Cassette();
this.characterRom = Presets.Rom2332(character);
this.cia1 = Presets.Cia6526(true);
this.cia2 = Presets.Cia6526(true);
this.colorRam = Presets.Ram2114();
this.cpu = new Cpu();
this.expansion = new Expansion();
this.joystickA = new Joystick();
this.joystickB = new Joystick();
this.kernalRom = Presets.Rom2364(kernal);
this.keyboard = new Keyboard();
this.memory = Presets.Ram4864();
this.pla = new Pla();
this.serial = new Serial();
this.sid = Presets.Sid6581();
this.user = new Userport();
this.vic = Presets.Vic6569();
InitializeConnections();
}
}
}

View File

@ -0,0 +1,42 @@
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips;
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
{
static public partial class C64ChipPresets
{
static public C64 NTSC(byte[] basic, byte[] kernal, byte[] character)
{
C64 result = new C64(NTSCTiming());
result.basicRom = ChipPresets.Rom2364(basic);
result.cassette = new Cassette();
result.characterRom = ChipPresets.Rom2332(character);
result.cia1 = ChipPresets.Cia6526(true);
result.cia2 = ChipPresets.Cia6526(true);
result.colorRam = ChipPresets.Ram2114();
result.cpu = new Cpu();
result.expansion = new Expansion();
result.joystickA = new Joystick();
result.joystickB = new Joystick();
result.kernalRom = ChipPresets.Rom2364(kernal);
result.keyboard = new Keyboard();
result.memory = ChipPresets.Ram4864();
result.pla = new Pla();
result.serial = new Serial();
result.sid = ChipPresets.Sid6581();
result.user = new Userport();
result.vic = ChipPresets.Vic6567();
result.InitializeConnections();
return result;
}
static public C64Timing NTSCTiming()
{
return new C64Timing();
}
}
}

View File

@ -0,0 +1,42 @@
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips;
using BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental
{
static public partial class C64ChipPresets
{
static public C64 PAL(byte[] basic, byte[] kernal, byte[] character)
{
C64 result = new C64(PALTiming());
result.basicRom = ChipPresets.Rom2364(basic);
result.cassette = new Cassette();
result.characterRom = ChipPresets.Rom2332(character);
result.cia1 = ChipPresets.Cia6526(true);
result.cia2 = ChipPresets.Cia6526(true);
result.colorRam = ChipPresets.Ram2114();
result.cpu = new Cpu();
result.expansion = new Expansion();
result.joystickA = new Joystick();
result.joystickB = new Joystick();
result.kernalRom = ChipPresets.Rom2364(kernal);
result.keyboard = new Keyboard();
result.memory = ChipPresets.Ram4864();
result.pla = new Pla();
result.serial = new Serial();
result.sid = ChipPresets.Sid6581();
result.user = new Userport();
result.vic = ChipPresets.Vic6569();
result.InitializeConnections();
return result;
}
static public C64Timing PALTiming()
{
return new C64Timing();
}
}
}

View File

@ -0,0 +1,112 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
sealed public partial class Vic
{
const int GRAPHICS_DATA_OUTPUT_MASK = 0xC000;
const int GRAPHICS_DATA_INPUT_SHIFT = 16;
enum GraphicsMode
{
Mode000,
Mode001,
Mode010,
Mode011,
Mode100,
Mode101,
Mode110,
Mode111
}
int g_BufferC;
int g_BufferG;
int g_DataC;
int g_DataG;
int g_FillRasterX;
GraphicsMode g_Mode;
int g_OutData;
int g_OutPixel;
int g_ShiftRegister;
void RenderG()
{
if ((rasterX & 0x7) == g_FillRasterX)
{
g_DataC = g_BufferC;
if (multiColorMode && (bitmapMode || (g_DataC & 0x8) != 0))
{
// load multicolor bits
g_ShiftRegister =
((g_DataG & 0x03) << 0) |
((g_DataG & 0x0C) << 2) |
((g_DataG & 0x30) << 4) |
((g_DataG & 0xC0) << 6)
;
// duplicate bits
g_ShiftRegister |= g_ShiftRegister << 2;
}
else
{
// load single color bits
g_ShiftRegister =
((g_DataG & 0x01) << 1) |
((g_DataG & 0x02) << 2) |
((g_DataG & 0x04) << 3) |
((g_DataG & 0x08) << 4) |
((g_DataG & 0x10) << 5) |
((g_DataG & 0x20) << 6) |
((g_DataG & 0x40) << 7) |
((g_DataG & 0x80) << 8)
;
}
}
switch (g_Mode)
{
default:
break;
case GraphicsMode.Mode001:
break;
case GraphicsMode.Mode010:
break;
case GraphicsMode.Mode011:
break;
case GraphicsMode.Mode100:
break;
case GraphicsMode.Mode101:
break;
case GraphicsMode.Mode110:
break;
case GraphicsMode.Mode111:
break;
}
}
void UpdateGraphicsMode()
{
if (!extraColorMode && !bitmapMode && !multiColorMode)
g_Mode = GraphicsMode.Mode000;
else if (!extraColorMode && !bitmapMode && multiColorMode)
g_Mode = GraphicsMode.Mode001;
else if (!extraColorMode && bitmapMode && !multiColorMode)
g_Mode = GraphicsMode.Mode010;
else if (!extraColorMode && bitmapMode && multiColorMode)
g_Mode = GraphicsMode.Mode011;
else if (extraColorMode && !bitmapMode && !multiColorMode)
g_Mode = GraphicsMode.Mode100;
else if (extraColorMode && !bitmapMode && multiColorMode)
g_Mode = GraphicsMode.Mode101;
else if (extraColorMode && bitmapMode && !multiColorMode)
g_Mode = GraphicsMode.Mode110;
else if (extraColorMode && bitmapMode && multiColorMode)
g_Mode = GraphicsMode.Mode111;
}
}
}

View File

@ -21,13 +21,10 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
public bool OutputIRQ() { return true; }
// exposed internal data
public int Address { get { return 0x3FFF; } }
public int CharacterData { get { return 0xFF; } }
public int ColorData { get { return 0xFFF; } }
public int Address { get { return address; } }
public int CyclesPerFrame { get { return rasterCount * rasterWidth / 8; } }
public int CyclesPerSecond { get { return frequency; } }
public int Data { get { return 0xFF; } }
public int DataPhi1 { get { return 0xFF; } }
public int GraphicsData { get { return 0xFF; } }
public int Data { get { return data; } }
public int DataPhi1 { get { return phi1Data; } }
}
}

View File

@ -7,18 +7,23 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
sealed public partial class Vic
{
int address;
bool aec;
bool ba;
int data;
int phi1Data;
int rasterX;
public Vic(VicSettings settings)
{
backgroundColor = new int[4];
sprites = new Sprite[8];
frequency = 0;
rasterCount = 0;
rasterWidth = 0;
rasterY = 0;
screenHeight = 0;
screenWidth = 0;
spriteMultiColor = new int[2];
videoBuffer = new int[screenHeight * screenWidth];
}
public void Clock()
{
}
public void Reset()
{
}
}
}

View File

@ -5,7 +5,7 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
public class VicSettings
sealed public class VicSettings
{
}
}

View File

@ -23,6 +23,18 @@ namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
public Sprite()
{
}
public void Clock()
{
}
public void LoadP(int value)
{
}
public void LoadS(int value)
{
}
}
}

View File

@ -0,0 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
sealed public partial class Vic
{
}
}

View File

@ -5,9 +5,78 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips.Internals
{
sealed public class VicColumnState
{
public VicBAType BA;
public VicFetchType Fetch;
public bool HBlank;
public int RasterX;
}
public enum VicActType
{
None,
SpriteDMA,
SpriteExpandY,
RCAdvance,
RasterAdvance,
RasterAdvanceBottom,
VCReset,
}
public enum VicBAType
{
None,
Badline,
Sprite0,
Sprite01,
Sprite012,
Sprite12,
Sprite123,
Sprite23,
Sprite234,
Sprite34,
Sprite345,
Sprite45,
Sprite456,
Sprite56,
Sprite567,
Sprite67,
Sprite7
}
public enum VicFetchType
{
None,
Graphics,
Color,
Idle,
Refresh,
Sprite,
Pointer
}
public enum VicRowType
{
None,
ScreenVisible,
ScreenBlank,
ResetVCBase
}
sealed public class VicTiming
{
public int ColumnCount;
public int DelayColumn;
public int RasterAdvanceColumn;
public int RasterCount;
public int RasterWidth;
}
sealed public partial class Vic
{
int frequency;
VicColumnState[] pipelineColumns;
VicRowType[] pipelineRows;
int rasterCount;
int rasterWidth;
}

View File

@ -6,7 +6,7 @@ using System.Text;
namespace BizHawk.Emulation.Computers.Commodore64.Experimental.Chips
{
static public class Presets
static public class ChipPresets
{
static public Cia Cia6526(bool todJumper) { return new Cia(Settings6526(todJumper)); }
static public Cia Cia6526A(bool todJumper) { return new Cia(Settings6526A(todJumper)); }