Fix GetPointColor for VGA

This commit is contained in:
Quajak 2020-07-10 16:39:57 +02:00 committed by GitHub
parent e53eea929e
commit cf659bbdb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,4 @@
//#define COSMOSDEBUG //#define COSMOSDEBUG
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
@ -694,7 +694,7 @@ namespace Cosmos.HAL
mDebugger.Send($"GetPixel720x480x4({aX},{aY})"); mDebugger.Send($"GetPixel720x480x4({aX},{aY})");
uint offset = (uint)(aX / 8 + (PixelWidth / 8) * aY); uint offset = (uint)(aX / 8 + (PixelWidth / 8) * aY);
int pixelOffset = (int)(7 - aX % 8);
uint pmask = 1; uint pmask = 1;
uint color = 0; uint color = 0;
@ -703,7 +703,8 @@ namespace Cosmos.HAL
{ {
SetPlane(p); SetPlane(p);
if (_IO.VGAMemoryBlock.Bytes[offset] == 255) var v = _IO.VGAMemoryBlock.Bytes[offset];
if ((v & (1 << pixelOffset)) != 0)
{ {
color += pmask; color += pmask;
} }
@ -711,7 +712,7 @@ namespace Cosmos.HAL
pmask <<= 1; pmask <<= 1;
} }
return color; return (uint)_Palette[color].ToArgb();
} }
/// <summary> /// <summary>