From ae2760e034e4acadbcc68434126afcec90370a05 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 21 Apr 2016 21:07:29 -0400 Subject: [PATCH] Colour phase is now updated and varies per line. --- Machines/Electron/Electron.cpp | 7 +++++-- Machines/Electron/Electron.hpp | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Machines/Electron/Electron.cpp b/Machines/Electron/Electron.cpp index b85797814..8c29dc591 100644 --- a/Machines/Electron/Electron.cpp +++ b/Machines/Electron/Electron.cpp @@ -46,7 +46,8 @@ Machine::Machine() : _audioOutputPosition(0), _current_pixel_line(-1), _use_fast_tape_hack(false), - _crt(nullptr) + _crt(nullptr), + _phase(0) { memset(_key_states, 0, sizeof(_key_states)); memset(_palette, 0xf, sizeof(_palette)); @@ -421,6 +422,8 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin _frameCycles += cycles; + if(!(_frameCycles&127)) _phase += 64; + // deal with frame wraparound by updating the two dependent subsystems // as though the exact end of frame had been hit, then reset those // and allow the frame cycle counter to assume its real value @@ -779,7 +782,7 @@ inline void Machine::update_display() if(this_cycle < 24) { if(final_cycle < 24) return; - _crt->output_colour_burst((24-9) * crt_cycles_multiplier, 0, 12); + _crt->output_colour_burst((24-9) * crt_cycles_multiplier, _phase, 12); _displayOutputPosition += 24-9; this_cycle = 24; // TODO: phase shouldn't be zero on every line diff --git a/Machines/Electron/Electron.hpp b/Machines/Electron/Electron.hpp index 34db2abe4..17b59c1bd 100644 --- a/Machines/Electron/Electron.hpp +++ b/Machines/Electron/Electron.hpp @@ -190,9 +190,10 @@ class Machine: public CPU6502::Processor, Tape::Delegate { uint16_t _screenModeBaseAddress; uint16_t _startScreenAddress; - // Counters related to simultaneous subsystems; + // Counters related to simultaneous subsystems unsigned int _frameCycles, _displayOutputPosition; unsigned int _audioOutputPosition, _audioOutputPositionError; + uint8_t _phase; struct { uint16_t forty1bpp[256];