From 02712d69cdd859d702cc7577e72db27d6f0c9ad5 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 12 Dec 2022 14:34:05 -0600 Subject: Implement fast video --- tb/vga.hpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'tb/vga.hpp') diff --git a/tb/vga.hpp b/tb/vga.hpp index 92446ca..578dd17 100644 --- a/tb/vga.hpp +++ b/tb/vga.hpp @@ -8,6 +8,8 @@ #include #include +#include "avalon.hpp" + namespace taller::vga { struct timings @@ -26,14 +28,19 @@ namespace taller::vga }; template - class display + class display : public avalon::slave { public: - display(Crtc &crtc, std::uint32_t clock_hz) noexcept; + display(Crtc &crtc, std::uint32_t base, std::uint32_t clock_hz, std::uint32_t bus_hz = 0) noexcept; ~display() noexcept; - void tick(bool clk) noexcept; + virtual void tick() noexcept final override; + + virtual bool read(std::uint32_t addr, std::uint32_t &data) noexcept final override; + virtual bool write(std::uint32_t addr, std::uint32_t data, unsigned byte_enable) noexcept final override; + + void signal_tick(bool clk) noexcept; inline bool key(std::size_t index) { @@ -41,6 +48,9 @@ namespace taller::vga } private: + unsigned ticks = 0; + unsigned refresh_ticks = 0; + unsigned max_addr = 0; Crtc& crtc; SDL_Window *window = nullptr; const video_mode *mode = nullptr; -- cgit v1.2.3