@@ -80,8 +80,9 @@ class Renderer
8080 Renderer& operator =(Renderer&&) = delete ;
8181
8282 constexpr DisplayFormat GetDisplayFormat () const noexcept { return m_displayFormat; }
83- void SetDisplayFormat (DisplayFormat display, bool highResolution) noexcept ;
83+ void SetDisplayFormat (DisplayFormat display, bool highResolution, bool fps60 ) noexcept ;
8484 static bool isValidDisplayFormat (DisplayFormat display) noexcept ;
85+
8586 static constexpr uint16_t getDisplayWidth (DisplayFormat display) noexcept
8687 {
8788 return display == DisplayFormat::NTSCMonitor ? 360 : 384 ;
@@ -103,6 +104,7 @@ class Renderer
103104 return m_screen.m_width == 720 ;
104105 }
105106
107+ void IncrementCursorTime (double ns) noexcept ;
106108 virtual std::pair<uint16_t , uint16_t > DrawLine (const uint8_t * lineA, const uint8_t * lineB, uint16_t lineNumber) noexcept = 0;
107109 const Plane& RenderFrame () noexcept ;
108110
@@ -155,7 +157,7 @@ class Renderer
155157 uint8_t m_cursorColor : 4 {}; /* *< YRGB color code. */
156158 std::array<uint16_t , 16 > m_cursorPatterns{};
157159 bool m_cursorBlinkType{}; /* *< false is on/off, true is on/complement. */
158- uint8_t m_cursorBlinkOn : 3 {}; /* *< ON period (zero not allowed). */
160+ uint8_t m_cursorBlinkOn : 3 {1 }; /* *< ON period (zero not allowed). */
159161 uint8_t m_cursorBlinkOff : 3 {}; /* *< OFF period (if zero, blink is disabled). */
160162
161163 // Image Contribution Factor.
@@ -229,9 +231,16 @@ class Renderer
229231 };
230232
231233protected:
234+ static constexpr double DELTA_50FPS = 240'000'000 .; /* *< GB VII.2.3.4.2 GC_Blnk. */
235+ static constexpr double DELTA_60FPS = 200'000'000 .; /* *< GB VII.2.3.4.2 GC_Blnk. */
236+
237+ double m_cursorTime{0.0 }; /* *< Keeps track of the emulated time for cursor blink. */
238+ bool m_cursorIsOn{true }; /* *< Keeps the state of the cursor (ON or OFF/complement). true when ON. */
239+
232240 uint16_t m_lineNumber{}; /* *< Current line being drawn, starts at 0. Handled by the caller. */
233241 DisplayFormat m_displayFormat{DisplayFormat::PAL}; /* *< Used to select 360/384 width and 240/280 height. */
234242 bool m_highResolution{false }; /* *< True for 480/560, false for 240/280 pixels height. */
243+ bool m_60FPS{false }; /* *< False for 50FPS, true for 60FPS. */
235244
236245 virtual void DrawCursor () noexcept = 0;
237246 void DrawLineBackdrop () noexcept
0 commit comments