From 0d7646d42a2c70033fe0a3916b63f92deed27ef0 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 4 Dec 2023 09:45:32 -0500 Subject: [PATCH] Add a cursor-type template parameter. --- Components/6845/CRTC6845.hpp | 15 ++++++++++++++- Machines/AmstradCPC/AmstradCPC.cpp | 7 ++++--- Machines/PCCompatible/PCCompatible.cpp | 18 +++++++++--------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/Components/6845/CRTC6845.hpp b/Components/6845/CRTC6845.hpp index 67d065a25..a187c0dfb 100644 --- a/Components/6845/CRTC6845.hpp +++ b/Components/6845/CRTC6845.hpp @@ -50,9 +50,22 @@ enum Personality { AMS40226 // Type 3. Status is get register, fixed-length VSYNC, no zero-length HSYNC. }; +// https://www.pcjs.org/blog/2018/03/20/ advises that "the behavior of bits 5 and 6 [of register 10, the cursor start +// register is really card specific". +// +// This enum captures those specifics. +enum CursorType { + /// No cursor signal is generated. + None, + /// MDA style: 00 => symmetric blinking; 01 or 10 => no blinking; 11 => short on, long off. + MDA, + /// EGA style: ignore the bits completely. + EGA, +}; + // TODO UM6845R and R12/R13; see http://www.cpcwiki.eu/index.php/CRTC#CRTC_Differences -template class CRTC6845 { +template class CRTC6845 { public: CRTC6845(Personality p, T &bus_handler) noexcept : diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index d720303db..7c2848fee 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -585,6 +585,7 @@ class CRTCBusHandler { InterruptTimer &interrupt_timer_; }; +using CRTC = Motorola::CRTC::CRTC6845; /*! Holds and vends the current keyboard state, acting as the AY's port handler. @@ -683,7 +684,7 @@ class i8255PortHandler : public Intel::i8255::PortHandler { public: i8255PortHandler( KeyboardState &key_state, - const Motorola::CRTC::CRTC6845 &crtc, + const CRTC &crtc, AYDeferrer &ay, Storage::Tape::BinaryTapePlayer &tape_player) : ay_(ay), @@ -742,7 +743,7 @@ class i8255PortHandler : public Intel::i8255::PortHandler { private: AYDeferrer &ay_; - const Motorola::CRTC::CRTC6845 &crtc_; + const CRTC &crtc_; KeyboardState &key_state_; Storage::Tape::BinaryTapePlayer &tape_player_; }; @@ -1219,7 +1220,7 @@ template class ConcreteMachine: CPU::Z80::Processor z80_; CRTCBusHandler crtc_bus_handler_; - Motorola::CRTC::CRTC6845 crtc_; + CRTC crtc_; AYDeferrer ay_; i8255PortHandler i8255_port_handler_; diff --git a/Machines/PCCompatible/PCCompatible.cpp b/Machines/PCCompatible/PCCompatible.cpp index aa2e3c61e..d525086c2 100644 --- a/Machines/PCCompatible/PCCompatible.cpp +++ b/Machines/PCCompatible/PCCompatible.cpp @@ -625,7 +625,7 @@ class MDA { const uint8_t *ram = nullptr; std::vector font; } outputter_; - Motorola::CRTC::CRTC6845 crtc_; + Motorola::CRTC::CRTC6845 crtc_; int full_clock_; }; @@ -885,14 +885,14 @@ class IO { printf("Unhandled in: %04x\n", port); break; - case 0x0000: return dma_.controller.read<0>(); - case 0x0001: return dma_.controller.read<1>(); - case 0x0002: return dma_.controller.read<2>(); - case 0x0003: return dma_.controller.read<3>(); - case 0x0004: return dma_.controller.read<4>(); - case 0x0005: return dma_.controller.read<5>(); - case 0x0006: return dma_.controller.read<6>(); - case 0x0007: return dma_.controller.read<7>(); + case 0x0000: return dma_.controller.template read<0>(); + case 0x0001: return dma_.controller.template read<1>(); + case 0x0002: return dma_.controller.template read<2>(); + case 0x0003: return dma_.controller.template read<3>(); + case 0x0004: return dma_.controller.template read<4>(); + case 0x0005: return dma_.controller.template read<5>(); + case 0x0006: return dma_.controller.template read<6>(); + case 0x0007: return dma_.controller.template read<7>(); case 0x0008: return dma_.controller.status();