private bool[] _isCellDirty = new bool[Height * CellColumns + 1]; // includes sentinel public Video(MachineEvents events, IMemoryBus memory) { _events = events; _memory = memory; _events.AddEventDelegate(EventCallbacks.FlushRow, FlushRowEvent); _events.AddEventDelegate(EventCallbacks.InverseText, InverseTextEvent); _events.AddEventDelegate(EventCallbacks.LeaveVBlank, LeaveVBlankEvent); _events.AddEventDelegate(EventCallbacks.ResetVsync, ResetVSyncEvent); _flushRowMode = new Action <int>[] { FlushRowMode0, FlushRowMode1, FlushRowMode2, FlushRowMode3, FlushRowMode4, FlushRowMode5, FlushRowMode6, FlushRowMode7, FlushRowMode8, FlushRowMode9, FlushRowModeA, FlushRowModeB, FlushRowModeC, FlushRowModeD, FlushRowModeE, FlushRowModeF }; unchecked { _colorBlack = (int)0xFF000000; // BGRA _colorDarkBlue = (int)0xFF000099; _colorDarkGreen = (int)0xFF117722; _colorMediumBlue = (int)0xFF0000FF; _colorBrown = (int)0xFF885500; _colorLightGrey = (int)0xFF99AAAA; _colorGreen = (int)0xFF00EE11; _colorAquamarine = (int)0xFF55FFAA; _colorDeepRed = (int)0xFFFF1111; _colorPurple = (int)0xFFDD00DD; _colorDarkGrey = (int)0xFF445555; _colorLightBlue = (int)0xFF33AAFF; _colorOrange = (int)0xFFFF4411; _colorPink = (int)0xFFFF9988; _colorYellow = (int)0xFFFFFF11; _colorWhite = (int)0xFFFFFFFF; _colorMonochrome = (int)0xFF00AA00; } SetPalette(); IsMonochrome = false; ScannerOptions = ScannerOptions.None; _isVBlank = true; _events.AddEvent(_cyclesPerVBlankPreset, EventCallbacks.LeaveVBlank); // align flush events with scanner; assumes vcount preset at start of frame [3-15, 3-16] _events.AddEvent(_cyclesPerVSync, EventCallbacks.ResetVsync); _events.AddEvent(_cyclesPerFlash, EventCallbacks.InverseText); }
private void FlushRowEvent() { int y = (_cyclesPerVSync - _cyclesPerVBlankPreset - _events.FindEvent(EventCallbacks.ResetVsync)) / CyclesPerHSync; _flushRowMode[_memory.VideoMode](y - CellHeight); // in arrears if (y < Height) { _events.AddEvent(CyclesPerFlush, EventCallbacks.FlushRow); } else { _isVBlank = true; _events.AddEvent(_cyclesPerVBlank, EventCallbacks.LeaveVBlank); } }