From 8652d8b23d544d9edf4a5e8a6d0866c7d9017354 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 26 Oct 2018 21:02:56 -0400 Subject: [PATCH] (Mostly) randomises the 9918 start position. --- Components/9918/9918.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Components/9918/9918.cpp b/Components/9918/9918.cpp index 74eab1d85..26f5604cd 100644 --- a/Components/9918/9918.cpp +++ b/Components/9918/9918.cpp @@ -10,6 +10,7 @@ #include #include +#include using namespace TI::TMS; @@ -73,11 +74,12 @@ Base::Base(Personality p) : mode_timing_.end_of_frame_interrupt_position.row = 193; } - // Establish that output is delayed after reading by `output_lag` cycles. - read_pointer_.row = 0; - read_pointer_.column = 342 - output_lag; - write_pointer_.row = 1; - write_pointer_.column = 0; + // Establish that output is delayed after reading by `output_lag` cycles; start + // at a random position. + read_pointer_.row = rand() % 262; + read_pointer_.column = rand() % (342 - output_lag); + write_pointer_.row = read_pointer_.row; + write_pointer_.column = read_pointer_.column + output_lag; } TMS9918::TMS9918(Personality p):