Added flash attribute. Implemented more OpCodes
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Desktop
|
||||
private Z80 _cpu = null!;
|
||||
private MemoryBus _memoryBus = null!;
|
||||
private IO_Bus _simpleIoBus = null!;
|
||||
private int _ulaFrameCount = 0;
|
||||
|
||||
// The 16 physical colors of the ZX Spectrum (ARGB format)
|
||||
private readonly int[] SpectrumColors = new int[]
|
||||
@@ -71,6 +72,10 @@ namespace Desktop
|
||||
// Public so the Debugger's background thread can call it 50 times a second
|
||||
public void RenderScreen()
|
||||
{
|
||||
_ulaFrameCount++;
|
||||
// The Spectrum flashes every 16 frames.
|
||||
// This boolean flips between true and false every 16 frames.
|
||||
bool invertFlashPhase = (_ulaFrameCount % 32) >= 16;
|
||||
int[] pixelData = new int[256 * 192];
|
||||
|
||||
// Loop through the 6144 bytes of Pixel RAM
|
||||
@@ -95,10 +100,18 @@ namespace Desktop
|
||||
int ink = attr & 0x07;
|
||||
int paper = (attr >> 3) & 0x07;
|
||||
int brightOffset = (attr & 0x40) != 0 ? 8 : 0;
|
||||
|
||||
bool isFlashSet = (attr & 0x80) != 0;
|
||||
int inkColor = SpectrumColors[ink + brightOffset];
|
||||
int paperColor = SpectrumColors[paper + brightOffset];
|
||||
|
||||
if (isFlashSet && invertFlashPhase)
|
||||
{
|
||||
// Swap the ink and paper colors for this character block!
|
||||
int temp = inkColor;
|
||||
inkColor = paperColor;
|
||||
paperColor = temp;
|
||||
}
|
||||
|
||||
// Draw the 8 pixels
|
||||
for (int bit = 0; bit < 8; bit++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user