From 1f857c619b1e288c6f7aa10c4bf9e06a07c67335 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 12 Oct 2016 21:42:36 -0400 Subject: [PATCH] Fixed timing issues. Static box of frame achieved! --- Machines/Oric/Video.cpp | 12 +++++++----- Outputs/CRT/CRT.hpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index 7ddd97686..146d96f89 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -15,7 +15,7 @@ VideoOutput::VideoOutput(uint8_t *memory) : _frame_counter(0), _counter(0), _state(Sync), _cycles_in_state(0) { - _crt.reset(new Outputs::CRT::CRT(384, 6, Outputs::CRT::DisplayType::PAL50, 1)); + _crt.reset(new Outputs::CRT::CRT(64*6, 6, Outputs::CRT::DisplayType::PAL50, 1)); // TODO: this is a copy and paste from the Electron; factor out. _crt->set_rgb_sampling_function( @@ -42,9 +42,11 @@ void VideoOutput::run_for_cycles(int number_of_cycles) _counter = (_counter + 1)%(312 * 64); // TODO: NTSC State new_state = Blank; - if((_counter & 63) >= 48 && (_counter & 63) <= 53) new_state = Sync; - else if(_counter >= 256*312 && _counter <= 259*312) new_state = Sync; - else if(_counter < 224 && ((_counter&63) < 40)) new_state = Pixels; + int h_counter =_counter & 63; + if( + (h_counter >= 48 && h_counter <= 53) || + (_counter >= 256*64 && _counter <= 259*64)) new_state = Sync; + else if(_counter < 224*64 && h_counter < 40) new_state = Pixels; if(_state != new_state) { @@ -58,7 +60,7 @@ void VideoOutput::run_for_cycles(int number_of_cycles) _cycles_in_state = 0; if(_state == Pixels) _pixel_target = _crt->allocate_write_area(120); } - else _cycles_in_state++; + _cycles_in_state++; if(new_state == Pixels) { _pixel_target[0] = 0x70; diff --git a/Outputs/CRT/CRT.hpp b/Outputs/CRT/CRT.hpp index a38e63795..59d4ca962 100644 --- a/Outputs/CRT/CRT.hpp +++ b/Outputs/CRT/CRT.hpp @@ -103,7 +103,7 @@ class CRT { machines output will run at a fixed multiple of the clock rate; knowing this divisor can improve internal precision. - @param height_of_dispaly The number of lines that nominally form one field of the display, rounded + @param height_of_display The number of lines that nominally form one field of the display, rounded up to the next whole integer. @param colour_cycle_numerator Specifies the numerator for the per-line frequency of the colour subcarrier.