From 169d7a7418ec2cd9b94d432127e07ef34183f35f Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 13 Feb 2023 21:10:14 -0500 Subject: [PATCH] Fix[/revert]: the fetch pointer should be _ahead_. --- Components/9918/Implementation/9918.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Components/9918/Implementation/9918.cpp b/Components/9918/Implementation/9918.cpp index 7a0369e0f..b3f2643b4 100644 --- a/Components/9918/Implementation/9918.cpp +++ b/Components/9918/Implementation/9918.cpp @@ -42,12 +42,14 @@ Base::Base() : mode_timing_.line_interrupt_position = Timing::StartOfSync; } - // Establish that output is delayed after reading by `output_lag` cycles; start - // at a random position. - fetch_pointer_.row = rand() % 262; - fetch_pointer_.column = rand() % (Timing::CyclesPerLine - output_lag); - output_pointer_.row = fetch_pointer_.row; - output_pointer_.column = fetch_pointer_.column + output_lag; + // Establish that output is delayed after reading by `output_lag` cycles, + // i.e. the fetch pointer is currently _ahead_ of the output pointer. + // + // Start at a random position. + output_pointer_.row = rand() % 262; + output_pointer_.column = rand() % (Timing::CyclesPerLine - output_lag); + fetch_pointer_.row = fetch_pointer_.row; + fetch_pointer_.column = output_pointer_.column + output_lag; } template