diff --git a/Machines/PCCompatible/PCCompatible.cpp b/Machines/PCCompatible/PCCompatible.cpp index 905dd7997..2a7750db7 100644 --- a/Machines/PCCompatible/PCCompatible.cpp +++ b/Machines/PCCompatible/PCCompatible.cpp @@ -478,7 +478,7 @@ class MDA { template void write(uint8_t value) { if constexpr (address & 0x8) { - printf("TODO: write MDA control %02x\n", value); + outputter_.set_control(value); } else { if constexpr (address & 0x1) { crtc_.set_register(value); @@ -491,8 +491,7 @@ class MDA { template uint8_t read() { if constexpr (address & 0x8) { - printf("TODO: read MDA control\n"); - return 0xff; + return outputter_.control(); } else { return crtc_.get_register(); } @@ -519,11 +518,22 @@ class MDA { crt.set_display_type(Outputs::Display::DisplayType::RGB); } + void set_control(uint8_t control) { + // b0: 'high resolution' (probably breaks if not 1) + // b3: video enable + // b5: enable blink + control_ = control; + } + + uint8_t control() { + return control_; + } + void perform_bus_cycle_phase1(const Motorola::CRTC::BusState &state) { // Determine new output state. const OutputState new_state = (state.hsync | state.vsync) ? OutputState::Sync : - (state.display_enable ? OutputState::Pixels : OutputState::Border); + ((state.display_enable && control_&0x08) ? OutputState::Pixels : OutputState::Border); // Upon either a state change or just having accumulated too much local time... if(new_state != output_state || count > 882) { @@ -585,6 +595,8 @@ class MDA { break; } + // TODO: blink. + if(((attributes & 7) == 1) && state.row_address == 13) { // Draw as underline. std::fill(pixel_pointer, pixel_pointer + 9, intensity); @@ -631,6 +643,8 @@ class MDA { const uint8_t *ram = nullptr; std::vector font; + + uint8_t control_ = 0; } outputter_; Motorola::CRTC::CRTC6845 crtc_; @@ -942,6 +956,8 @@ class IO { case 0x03f4: return fdc_.status(); case 0x03f5: return fdc_.read(); + case 0x03b8: return mda_.read<8>(); + case 0x02e8: case 0x02e9: case 0x02ea: case 0x02eb: case 0x02ec: case 0x02ed: case 0x02ee: case 0x02ef: case 0x02f8: case 0x02f9: case 0x02fa: case 0x02fb: