Skip to content

Commit

Permalink
#2 Moved some VIC-II code into the VIC-II class, added clock speed ad…
Browse files Browse the repository at this point in the history
…justment, resized window to fit border, some more VIC-II logic
  • Loading branch information
hagronnestad committed Oct 15, 2019
1 parent 86d97f1 commit 1acb388
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 228 deletions.
6 changes: 4 additions & 2 deletions ComputerSystems/Commodore64/C64.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class C64 {
private bool _isRunnning = false;
private TaskCompletionSource<bool> _tcsStop;

public double CpuClockSpeed { get; set; } = 1.0f / CLOCK_PAL;


public Cia Cia { get; private set; }
public VicIi Vic { get; private set; }
Expand All @@ -36,6 +38,7 @@ public void Initialize() {

Cia = new Cia();
Vic = new VicIi();
Vic.C64 = this;
Memory = new C64Bus(Cia, Vic);
Cpu = new Cpu(Memory);

Expand All @@ -51,14 +54,13 @@ public void PowerOn() {
_isRunnning = true;
_tcsStop = new TaskCompletionSource<bool>();

var cpuClockSpeedPal = 1.0f / CLOCK_PAL;
var swCpuClock = Stopwatch.StartNew();

var t = new Thread(() => {
while (_isRunnning) {

// CPU clock
if (swCpuClock.Elapsed.TotalMilliseconds > cpuClockSpeedPal) {
if (swCpuClock.Elapsed.TotalMilliseconds > CpuClockSpeed) {

// Clock CIA 1
Cia.Clock();
Expand Down
155 changes: 139 additions & 16 deletions ComputerSystems/Commodore64/FormC64Screen.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1acb388

Please sign in to comment.