1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Add a cursor-type template parameter.

This commit is contained in:
Thomas Harte 2023-12-04 09:45:32 -05:00
parent 15868eea24
commit 0d7646d42a
3 changed files with 27 additions and 13 deletions

View File

@ -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 T> class CRTC6845 {
template <class T, CursorType cursor> class CRTC6845 {
public:
CRTC6845(Personality p, T &bus_handler) noexcept :

View File

@ -585,6 +585,7 @@ class CRTCBusHandler {
InterruptTimer &interrupt_timer_;
};
using CRTC = Motorola::CRTC::CRTC6845<CRTCBusHandler, Motorola::CRTC::CursorType::None>;
/*!
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<CRTCBusHandler> &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<CRTCBusHandler> &crtc_;
const CRTC &crtc_;
KeyboardState &key_state_;
Storage::Tape::BinaryTapePlayer &tape_player_;
};
@ -1219,7 +1220,7 @@ template <bool has_fdc> class ConcreteMachine:
CPU::Z80::Processor<ConcreteMachine, false, true> z80_;
CRTCBusHandler crtc_bus_handler_;
Motorola::CRTC::CRTC6845<CRTCBusHandler> crtc_;
CRTC crtc_;
AYDeferrer ay_;
i8255PortHandler i8255_port_handler_;

View File

@ -625,7 +625,7 @@ class MDA {
const uint8_t *ram = nullptr;
std::vector<uint8_t> font;
} outputter_;
Motorola::CRTC::CRTC6845<CRTCOutputter> crtc_;
Motorola::CRTC::CRTC6845<CRTCOutputter, Motorola::CRTC::CursorType::MDA> 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();