From 7614608d9f89113b03c92a93dec4cc6ad679fbb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hein=20Andre=20Gr=C3=B8nnestad?= Date: Tue, 22 Oct 2019 00:22:00 +0200 Subject: [PATCH] #2 First impl. of scanline rendering of border, added some debug rectangles to screen rendering --- .../Commodore64/FormC64Screen.Designer.cs | 118 +++++++++--------- ComputerSystems/Commodore64/FormC64Screen.cs | 10 +- .../Commodore64/FormC64Screen.resx | 16 +-- ComputerSystems/Commodore64/VicIi.cs | 76 ++++++----- 4 files changed, 124 insertions(+), 96 deletions(-) diff --git a/ComputerSystems/Commodore64/FormC64Screen.Designer.cs b/ComputerSystems/Commodore64/FormC64Screen.Designer.cs index 2575774..ca580dc 100644 --- a/ComputerSystems/Commodore64/FormC64Screen.Designer.cs +++ b/ComputerSystems/Commodore64/FormC64Screen.Designer.cs @@ -27,6 +27,7 @@ private void InitializeComponent() { this.pScreen = new System.Windows.Forms.PictureBox(); this.statusMain = new System.Windows.Forms.StatusStrip(); this.lblStatusCpu = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblClockSpeed = new System.Windows.Forms.ToolStripStatusLabel(); this.lblCycles = new System.Windows.Forms.ToolStripStatusLabel(); this.lblInstructions = new System.Windows.Forms.ToolStripStatusLabel(); this.lblKeyboardDisabled = new System.Windows.Forms.ToolStripStatusLabel(); @@ -44,19 +45,18 @@ private void InitializeComponent() { this.btnCopyRawOutput = new System.Windows.Forms.ToolStripMenuItem(); this.separator4 = new System.Windows.Forms.ToolStripSeparator(); this.btnDebugger = new System.Windows.Forms.ToolStripButton(); + this.btnClockSpeedSlower = new System.Windows.Forms.ToolStripButton(); + this.btnClockSpeedFaster = new System.Windows.Forms.ToolStripButton(); this.ofd = new System.Windows.Forms.OpenFileDialog(); this.sfd = new System.Windows.Forms.SaveFileDialog(); this.statusStrip1 = new System.Windows.Forms.StatusStrip(); - this.lblFps = new System.Windows.Forms.ToolStripStatusLabel(); this.lblStatusVic = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblFps = new System.Windows.Forms.ToolStripStatusLabel(); this.lblVicCycles = new System.Windows.Forms.ToolStripStatusLabel(); - this.lblVicGraphicsMode = new System.Windows.Forms.ToolStripStatusLabel(); - this.lblVicScreenOn = new System.Windows.Forms.ToolStripStatusLabel(); this.lblVicCurrentLine = new System.Windows.Forms.ToolStripStatusLabel(); this.lblVicCurrentLineCycle = new System.Windows.Forms.ToolStripStatusLabel(); - this.btnClockSpeedSlower = new System.Windows.Forms.ToolStripButton(); - this.btnClockSpeedFaster = new System.Windows.Forms.ToolStripButton(); - this.lblClockSpeed = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblVicGraphicsMode = new System.Windows.Forms.ToolStripStatusLabel(); + this.lblVicScreenOn = new System.Windows.Forms.ToolStripStatusLabel(); ((System.ComponentModel.ISupportInitialize)(this.pScreen)).BeginInit(); this.statusMain.SuspendLayout(); this.toolMain.SuspendLayout(); @@ -71,7 +71,7 @@ private void InitializeComponent() { this.pScreen.Location = new System.Drawing.Point(0, 25); this.pScreen.Margin = new System.Windows.Forms.Padding(0); this.pScreen.Name = "pScreen"; - this.pScreen.Size = new System.Drawing.Size(806, 568); + this.pScreen.Size = new System.Drawing.Size(1008, 624); this.pScreen.TabIndex = 1; this.pScreen.TabStop = false; this.pScreen.DragDrop += new System.Windows.Forms.DragEventHandler(this.pScreen_DragDropAsync); @@ -87,9 +87,9 @@ private void InitializeComponent() { this.lblCycles, this.lblInstructions, this.lblKeyboardDisabled}); - this.statusMain.Location = new System.Drawing.Point(0, 617); + this.statusMain.Location = new System.Drawing.Point(0, 673); this.statusMain.Name = "statusMain"; - this.statusMain.Size = new System.Drawing.Size(806, 24); + this.statusMain.Size = new System.Drawing.Size(1008, 24); this.statusMain.TabIndex = 2; this.statusMain.Text = "statusStrip1"; // @@ -101,6 +101,13 @@ private void InitializeComponent() { this.lblStatusCpu.Size = new System.Drawing.Size(34, 19); this.lblStatusCpu.Text = "CPU"; // + // lblClockSpeed + // + this.lblClockSpeed.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; + this.lblClockSpeed.Name = "lblClockSpeed"; + this.lblClockSpeed.Size = new System.Drawing.Size(34, 19); + this.lblClockSpeed.Text = "0 Hz"; + // // lblCycles // this.lblCycles.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; @@ -119,7 +126,7 @@ private void InitializeComponent() { // this.lblKeyboardDisabled.ForeColor = System.Drawing.Color.Red; this.lblKeyboardDisabled.Name = "lblKeyboardDisabled"; - this.lblKeyboardDisabled.Size = new System.Drawing.Size(392, 19); + this.lblKeyboardDisabled.Size = new System.Drawing.Size(791, 19); this.lblKeyboardDisabled.Spring = true; this.lblKeyboardDisabled.Text = "Keyboard Disabled"; this.lblKeyboardDisabled.TextAlign = System.Drawing.ContentAlignment.MiddleRight; @@ -143,7 +150,7 @@ private void InitializeComponent() { this.btnClockSpeedFaster}); this.toolMain.Location = new System.Drawing.Point(0, 0); this.toolMain.Name = "toolMain"; - this.toolMain.Size = new System.Drawing.Size(806, 25); + this.toolMain.Size = new System.Drawing.Size(1008, 25); this.toolMain.TabIndex = 0; this.toolMain.Text = "toolStrip1"; // @@ -241,7 +248,7 @@ private void InitializeComponent() { // btnCopyRawOutput // this.btnCopyRawOutput.Name = "btnCopyRawOutput"; - this.btnCopyRawOutput.Size = new System.Drawing.Size(180, 22); + this.btnCopyRawOutput.Size = new System.Drawing.Size(124, 22); this.btnCopyRawOutput.Text = "Copy raw"; this.btnCopyRawOutput.ToolTipText = "Copy raw screen"; this.btnCopyRawOutput.Click += new System.EventHandler(this.BtnCopyRawOutput_Click); @@ -261,6 +268,26 @@ private void InitializeComponent() { this.btnDebugger.Text = "Debugger"; this.btnDebugger.Click += new System.EventHandler(this.BtnMemoryWatch_Click); // + // btnClockSpeedSlower + // + this.btnClockSpeedSlower.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnClockSpeedSlower.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnClockSpeedSlower.Name = "btnClockSpeedSlower"; + this.btnClockSpeedSlower.Size = new System.Drawing.Size(59, 22); + this.btnClockSpeedSlower.Text = "Speed [-]"; + this.btnClockSpeedSlower.ToolTipText = "Clock Speed -"; + this.btnClockSpeedSlower.Click += new System.EventHandler(this.btnSlowDown_Click); + // + // btnClockSpeedFaster + // + this.btnClockSpeedFaster.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnClockSpeedFaster.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnClockSpeedFaster.Name = "btnClockSpeedFaster"; + this.btnClockSpeedFaster.Size = new System.Drawing.Size(62, 22); + this.btnClockSpeedFaster.Text = "Speed [+]"; + this.btnClockSpeedFaster.ToolTipText = "Clock Speed +"; + this.btnClockSpeedFaster.Click += new System.EventHandler(this.btnClockSpeedFaster_Click); + // // ofd // this.ofd.Filter = "PRG-files|*.prg"; @@ -279,19 +306,12 @@ private void InitializeComponent() { this.lblVicCurrentLineCycle, this.lblVicGraphicsMode, this.lblVicScreenOn}); - this.statusStrip1.Location = new System.Drawing.Point(0, 593); + this.statusStrip1.Location = new System.Drawing.Point(0, 649); this.statusStrip1.Name = "statusStrip1"; - this.statusStrip1.Size = new System.Drawing.Size(806, 24); + this.statusStrip1.Size = new System.Drawing.Size(1008, 24); this.statusStrip1.TabIndex = 4; this.statusStrip1.Text = "statusStrip1"; // - // lblFps - // - this.lblFps.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; - this.lblFps.Name = "lblFps"; - this.lblFps.Size = new System.Drawing.Size(36, 19); - this.lblFps.Text = "0 fps"; - // // lblStatusVic // this.lblStatusVic.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; @@ -300,6 +320,13 @@ private void InitializeComponent() { this.lblStatusVic.Size = new System.Drawing.Size(43, 19); this.lblStatusVic.Text = "VIC-II"; // + // lblFps + // + this.lblFps.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; + this.lblFps.Name = "lblFps"; + this.lblFps.Size = new System.Drawing.Size(36, 19); + this.lblFps.Text = "0 fps"; + // // lblVicCycles // this.lblVicCycles.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; @@ -307,20 +334,6 @@ private void InitializeComponent() { this.lblVicCycles.Size = new System.Drawing.Size(52, 19); this.lblVicCycles.Text = "0 cycles"; // - // lblVicGraphicsMode - // - this.lblVicGraphicsMode.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; - this.lblVicGraphicsMode.Name = "lblVicGraphicsMode"; - this.lblVicGraphicsMode.Size = new System.Drawing.Size(45, 19); - this.lblVicGraphicsMode.Text = "Mode:"; - // - // lblVicScreenOn - // - this.lblVicScreenOn.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; - this.lblVicScreenOn.Name = "lblVicScreenOn"; - this.lblVicScreenOn.Size = new System.Drawing.Size(49, 19); - this.lblVicScreenOn.Text = "Screen:"; - // // lblVicCurrentLine // this.lblVicCurrentLine.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; @@ -335,39 +348,26 @@ private void InitializeComponent() { this.lblVicCurrentLineCycle.Size = new System.Drawing.Size(33, 19); this.lblVicCurrentLineCycle.Text = "Pos:"; // - // btnClockSpeedSlower - // - this.btnClockSpeedSlower.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.btnClockSpeedSlower.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnClockSpeedSlower.Name = "btnClockSpeedSlower"; - this.btnClockSpeedSlower.Size = new System.Drawing.Size(59, 22); - this.btnClockSpeedSlower.Text = "Speed [-]"; - this.btnClockSpeedSlower.ToolTipText = "Clock Speed -"; - this.btnClockSpeedSlower.Click += new System.EventHandler(this.btnSlowDown_Click); - // - // btnClockSpeedFaster + // lblVicGraphicsMode // - this.btnClockSpeedFaster.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; - this.btnClockSpeedFaster.ImageTransparentColor = System.Drawing.Color.Magenta; - this.btnClockSpeedFaster.Name = "btnClockSpeedFaster"; - this.btnClockSpeedFaster.Size = new System.Drawing.Size(62, 22); - this.btnClockSpeedFaster.Text = "Speed [+]"; - this.btnClockSpeedFaster.ToolTipText = "Clock Speed +"; - this.btnClockSpeedFaster.Click += new System.EventHandler(this.btnClockSpeedFaster_Click); + this.lblVicGraphicsMode.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; + this.lblVicGraphicsMode.Name = "lblVicGraphicsMode"; + this.lblVicGraphicsMode.Size = new System.Drawing.Size(45, 19); + this.lblVicGraphicsMode.Text = "Mode:"; // - // lblClockSpeed + // lblVicScreenOn // - this.lblClockSpeed.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; - this.lblClockSpeed.Name = "lblClockSpeed"; - this.lblClockSpeed.Size = new System.Drawing.Size(34, 19); - this.lblClockSpeed.Text = "0 Hz"; + this.lblVicScreenOn.BorderSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.Right; + this.lblVicScreenOn.Name = "lblVicScreenOn"; + this.lblVicScreenOn.Size = new System.Drawing.Size(49, 19); + this.lblVicScreenOn.Text = "Screen:"; // // FormC64Screen // this.AllowDrop = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(806, 641); + this.ClientSize = new System.Drawing.Size(1008, 697); this.Controls.Add(this.statusStrip1); this.Controls.Add(this.toolMain); this.Controls.Add(this.statusMain); diff --git a/ComputerSystems/Commodore64/FormC64Screen.cs b/ComputerSystems/Commodore64/FormC64Screen.cs index a47ec2e..c32d2e2 100644 --- a/ComputerSystems/Commodore64/FormC64Screen.cs +++ b/ComputerSystems/Commodore64/FormC64Screen.cs @@ -27,16 +27,19 @@ public partial class FormC64Screen : Form { private readonly Pen _penScanLine; private readonly Pen _penScanLine2; + private readonly Pen _penWhite = new Pen(Color.White); private Timer _uiRefreshTimer; private Bitmap _bC64ScreenBuffer; + private Graphics _gC64ScreenBuffer; public FormC64Screen(C64 c64) { InitializeComponent(); C64 = c64; - _bC64ScreenBuffer = new Bitmap(VicIi.USABLE_WIDTH_BORDER, VicIi.USABLE_HEIGHT_BORDER, PixelFormat.Format24bppRgb); + _bC64ScreenBuffer = new Bitmap(VicIi.FULL_WIDTH, VicIi.FULL_HEIGHT_PAL, PixelFormat.Format24bppRgb); + _gC64ScreenBuffer = Graphics.FromImage(_bC64ScreenBuffer); _bC64ScreenOutputBuffer = new Bitmap(pScreen.Width, pScreen.Height); _gC64ScreenOutputBuffer = Graphics.FromImage(_bC64ScreenOutputBuffer); _penScanLine = new Pen(Color.FromArgb(100, 127, 127, 127)); @@ -114,6 +117,11 @@ public void ApplyCrtFilter() { private void PScreen_Paint(object sender, PaintEventArgs e) { SetPixels(_bC64ScreenBuffer, C64.Vic.ScreenBufferPixels); + + _gC64ScreenBuffer.DrawRectangle(_penWhite, (int)C64.Vic.FullFrame.X, (int)C64.Vic.FullFrame.Y, (int)C64.Vic.FullFrame.Width, (int)C64.Vic.FullFrame.Height); + _gC64ScreenBuffer.DrawRectangle(_penWhite, (int)C64.Vic.BorderFrame.X, (int)C64.Vic.BorderFrame.Y, (int)C64.Vic.BorderFrame.Width, (int)C64.Vic.BorderFrame.Height); + _gC64ScreenBuffer.DrawRectangle(_penWhite, (int)C64.Vic.DisplayFrame.X, (int)C64.Vic.DisplayFrame.Y, (int)C64.Vic.DisplayFrame.Width, (int)C64.Vic.DisplayFrame.Height); + _gC64ScreenOutputBuffer.DrawImage(_bC64ScreenBuffer, 0, 0, _bC64ScreenOutputBuffer.Width, _bC64ScreenOutputBuffer.Height); if (btnUseCrtFilter.Checked) ApplyCrtFilter(); diff --git a/ComputerSystems/Commodore64/FormC64Screen.resx b/ComputerSystems/Commodore64/FormC64Screen.resx index 49ea90f..0645b57 100644 --- a/ComputerSystems/Commodore64/FormC64Screen.resx +++ b/ComputerSystems/Commodore64/FormC64Screen.resx @@ -138,14 +138,14 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGdSURBVDhPvVLJTgJBFJwP8ApD2MIOw8yEfQ8wV038Be9+ - gQeDMV48+B1GE/0Sl3jzxkGNJh5ED2qMMmmrmkZFWW5W0mGofq+6uvpp/4pQKLSpPmcjEAisxWKxI/V3 - Aq1WS2QymRtd101FfSMSifQqlcqz4zgsOlH0BOr1uttoNES5XH7/EvF4PEv5fP6VjeMVjUZ35OYvoMnK - 5XIPEBKmaV4pWtp2ms2mOxbw+XyG2voDiuDAYbVaFchkW5Kwv0EB27bvcE9XknMQj8cPKJBKpc41r9er - dzod0e12BTehui6r5gAOlymArB5lBu12WwpQTNXMBesQuCgWiyO3SPWFLvx+/6okFoAOKJBOpweSsCzr - ki6SyeSxJBYAme3jUJFIJE4lgcHZowDe2A0Gg7YkZ4Dvj7A/SqWSQG1P0dLFLSetUCgM+FSKngCbEdw9 - m/HbV/QIbELzEM8pkLALe4e46woD451pGycPaR3D9DZ1VpS9a04aV61Wo5hcDI0nG4bRn9r8E+FweBcJ - X2Sz2Sec6PK9EfAZ7rylShQ07RPvPYm98+6JJQAAAABJRU5ErkJggg== + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGeSURBVDhPvVI5TgNBENwHkNpr+ZJve7278n3L9qYg8QVy + XkCAjBAJAe9AIMFLOERG5gAQSAQYAkAIvBqqxmPA4COjpJHXNd3VNd2t/StCodCm+pyNQCCwFovFjtTf + CbRaLZHJZG50XTcV9Y1IJNKrVCrPjuMw6ETRE6jX626j0RDlcvn9S8Tj8SzlcrlXJo5PNBrdkZe/gCQL + sQ8QEqZpXila2naazaY7FvD5fIa6+gMlMqxWqwI92ZYk7G9QwLbtO7zTleQcxOPxAwqkUqlzzev16p1O + R3S7XcFLqK7LqDmAw2UKpNPpR9mDdrstBSimYuaCcWi4KBaLI7fo6gtd+P3+VUksAB1QAE8YSMKyrEu6 + SCaTx5JYAPRsH0VFIpE4lQQWZ48CmLEbDAZtSc4A54+CH6VSSSC2p2jp4pabVigUBhyVoifAZCzZPZPx + 21f0CEzK5/NDjFOgwy7sHeKtK2wY30zbKDKkdezB29RdYQXswjU3jadWq1FMHjaNlQ3D6E9N/olwOLyL + GV9ks9knVHQ5bzT4DG/eUiEKmvYJzFSJpc41lUwAAAAASUVORK5CYII= diff --git a/ComputerSystems/Commodore64/VicIi.cs b/ComputerSystems/Commodore64/VicIi.cs index 5c5b3de..0fcc4b1 100644 --- a/ComputerSystems/Commodore64/VicIi.cs +++ b/ComputerSystems/Commodore64/VicIi.cs @@ -95,15 +95,16 @@ public enum TvSystem { public const int FULL_HEIGHT_PAL = 312; public const int USABLE_HEIGHT = 200; public const int USABLE_HEIGHT_BORDER = 284; - + + public int CurrentLine = 0; public int CurrentLineCycle = 0; public bool InVerticalBlank => CurrentLine >= 300 || CurrentLine <= 15; - public bool InBorder => - (CurrentLineCycle >= 50 && CurrentLineCycle <= 92) || - (CurrentLineCycle >= 412 && CurrentLineCycle <= 454); + //public bool InBorder => + // (CurrentLine >= USABLE_HEIGHT + (USABLE_HEIGHT_BORDER / 2) && CurrentLine <= (USABLE_HEIGHT_BORDER / 2)) || + // (CurrentLineCycle >= USABLE_WIDTH + (USABLE_HEIGHT_BORDER / 2) && CurrentLineCycle <= (USABLE_HEIGHT_BORDER / 2)); public int TotalCycles = 0; @@ -119,37 +120,34 @@ public enum TvSystem { public bool InterruptControlRegisterSpriteSpriteCollisionInterruptEnabled => this[REGISTER_INTERRUPT_CONTROL_0x1A].IsBitSet(BitFlag.BIT_2); public bool InterruptControlRegisterLightPenInterruptEnabled => this[REGISTER_INTERRUPT_CONTROL_0x1A].IsBitSet(BitFlag.BIT_3); - //public bool IsInBorder => + + + public Rectangle FullFrame; + public Rectangle BorderFrame; + public Rectangle DisplayFrame; + public VicIi(TvSystem tvSystem) { _tvSystem = tvSystem; - ScreenBufferPixels = new Color[USABLE_HEIGHT_BORDER, USABLE_WIDTH_BORDER]; - } + var fullHeight = tvSystem == TvSystem.PAL ? FULL_HEIGHT_PAL : FULL_HEIGHT_NTSC; - public int X = 0; - public int Y = 0; + FullFrame = new Rectangle(0, 0, FULL_WIDTH, fullHeight); + BorderFrame = new Rectangle((FULL_WIDTH - USABLE_WIDTH_BORDER) / 2, (fullHeight - USABLE_HEIGHT_BORDER) / 2, USABLE_WIDTH_BORDER, USABLE_HEIGHT_BORDER); + DisplayFrame = new Rectangle(BorderFrame.X + 42, BorderFrame.Y + 42, USABLE_WIDTH, USABLE_HEIGHT); + + ScreenBufferPixels = new Color[fullHeight, FULL_WIDTH]; + } public void Cycle() { // Every cycle draws 8 pixels to the screen - //if (InBorder && CurrentLine >= 0 && CurrentLine <= 200) { - // var bgColor = Colors.FromByte((byte)(_registers[0x20] & 0b00001111)); - - // for (int i = 0; i < 8; i++) { - // ScreenBufferPixels[Y, X + i] = bgColor; - // } - - // X += 8; - - // if (X == 40) { - // X = 0; - // Y++; + var p = GetScanlinePoint(); + if (IsInBorder(p)) { + RenderBorder(p); + } - // if (Y == 200) Y = 0; - // } - //} CurrentLineCycle++; @@ -177,13 +175,37 @@ public void Cycle() { } } + TotalCycles++; } - private void RenderBorder() { + private void RenderBorder(Point scanlinePoint) { + + var bgColor = Colors.FromByte((byte)(_registers[0x20] & 0b00001111)); + + for (int i = 0; i < 8; i++) { + ScreenBufferPixels[scanlinePoint.Y, scanlinePoint.X + i] = bgColor; + } + + } + + private Point GetScanlinePoint() { + var p = new Point { + Y = CurrentLine, + X = CurrentLineCycle * 8 + }; + return p; } + private bool IsInBorder(Point p) { + if (DisplayFrame.Contains(p)) return false; + return BorderFrame.Contains(p); + } + + + + private void RenderCharacterMode() { } @@ -193,8 +215,6 @@ private void RenderCharacterMode() { public void UpdateScreenBufferPixels() { var bgColor = Colors.FromByte((byte)(C64.Vic._registers[0x21] & 0b00001111)); - var borderWidth = (USABLE_WIDTH_BORDER - USABLE_WIDTH) / 2; - for (var i = 0; i < 1000; i++) { var petsciiCode = vicRead((ushort)(getScreenMemoryPointer() + i)); var fgColor = Colors.FromByte((byte)(C64.Memory[C64MemoryOffsets.SCREEN_COLOR_RAM + i] & 0b00001111)); @@ -207,7 +227,7 @@ public void UpdateScreenBufferPixels() { var charRow = vicRead((ushort)(getCharacterMemoryPointer() + (petsciiCode * 8) + row)); for (int col = 0; col <= 7; col++) { - ScreenBufferPixels[borderWidth + (line * 8) + row, borderWidth + (characterInLine * 8) + col] = charRow.IsBitSet(7 - (BitIndex)col) ? fgColor : bgColor; + ScreenBufferPixels[DisplayFrame.Y + (line * 8) + row, DisplayFrame.X + (characterInLine * 8) + col] = charRow.IsBitSet(7 - (BitIndex)col) ? fgColor : bgColor; } }