1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Support MDA control: display enable.

This commit is contained in:
Thomas Harte 2023-12-04 16:34:46 -05:00
parent 8103f8e682
commit b0d1dedb65

View File

@ -478,7 +478,7 @@ class MDA {
template <int address>
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 <int address>
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<uint8_t> font;
uint8_t control_ = 0;
} outputter_;
Motorola::CRTC::CRTC6845<CRTCOutputter, Motorola::CRTC::CursorType::MDA> 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: