From 0f691766eedcd096611c6564836bd9d932a84957 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 28 Feb 2024 22:13:22 -0500 Subject: [PATCH] Double flash rate. --- Machines/Apple/AppleII/VideoSwitches.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Machines/Apple/AppleII/VideoSwitches.hpp b/Machines/Apple/AppleII/VideoSwitches.hpp index 6763d642b..39a714caa 100644 --- a/Machines/Apple/AppleII/VideoSwitches.hpp +++ b/Machines/Apple/AppleII/VideoSwitches.hpp @@ -310,7 +310,14 @@ template class VideoSwitches { bool annunciator_3 = false; } external_, internal_; - int flash_length = 8406; + // 8406 lines covers a complete on-off cycle, i.e. because the Apple II has a line + // rate of around 15734.26 lines/second, flashing has a frequency of roughly + // 15734.26 / 8406, or roughly 1.83Hz. + // + // Internally that's modelled by a counter that goes to **twice** the value of the + // constant specified below. Hence the divide by two. + static constexpr int flash_length = 8406 / 2; + int flash_ = 0; uint8_t flash_mask() const { return uint8_t((flash_ / flash_length) * 0xff);