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

Extend refresh address to 16-bit in 'EGA' mode.

This commit is contained in:
Thomas Harte 2023-12-27 16:17:25 -05:00
parent a617f7305a
commit 99351ee2de

View File

@ -101,7 +101,9 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
void set_register(uint8_t value) {
static constexpr uint8_t masks[] = {
0xff, 0xff, 0xff, 0xff, 0x7f, 0x1f, 0x7f, 0x7f,
0xff, 0x1f, 0x7f, 0x1f, 0x3f, 0xff, 0x3f, 0xff
0xff, 0x1f, 0x7f, 0x1f,
uint8_t(RefreshMask >> 8), uint8_t(RefreshMask),
uint8_t(RefreshMask >> 8), uint8_t(RefreshMask),
};
// Per CPC documentation, skew doesn't work on a "type 1 or 2", i.e. an MC6845 or a UM6845R.
@ -138,7 +140,7 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
}
perform_bus_cycle_phase1();
bus_state_.refresh_address = (bus_state_.refresh_address + 1) & 0x3fff;
bus_state_.refresh_address = (bus_state_.refresh_address + 1) & RefreshMask;
bus_state_.cursor = is_cursor_line_ &&
bus_state_.refresh_address == (registers_[15] | (registers_[14] << 8));
@ -185,6 +187,8 @@ template <class BusHandlerT, Personality personality, CursorType cursor_type> cl
}
private:
static constexpr uint16_t RefreshMask = (personality >= Personality::EGA) ? 0xffff : 0x3fff;
inline void perform_bus_cycle_phase1() {
// Skew theory of operation: keep a history of the last three states, and apply whichever is selected.
character_is_visible_shifter_ = (character_is_visible_shifter_ << 1) | unsigned(character_is_visible_);