diff --git a/Machines/PCCompatible/CGA.hpp b/Machines/PCCompatible/CGA.hpp index 547cb24cd..897924656 100644 --- a/Machines/PCCompatible/CGA.hpp +++ b/Machines/PCCompatible/CGA.hpp @@ -263,7 +263,9 @@ class CGA { // character code + attributes except that these are two bytes worth of graphics. // // Meanwhile, row address is used to invent a 15th address line. - const auto base_address = ((state.refresh_address << 1) + (state.row_address << 13)) & 0x3fff; + const auto base_address = + ((state.refresh_address & 0xfff) << 1) + + ((state.row_address & 1) << 13); const uint8_t bitmap[] = { ram[base_address], ram[base_address + 1], @@ -299,8 +301,8 @@ class CGA { } void serialise_text(const Motorola::CRTC::BusState &state) { - const uint8_t attributes = ram[((state.refresh_address << 1) + 1) & 0xfff]; - const uint8_t glyph = ram[((state.refresh_address << 1) + 0) & 0xfff]; + const uint8_t attributes = ram[((state.refresh_address << 1) + 1) & 0x3fff]; + const uint8_t glyph = ram[((state.refresh_address << 1) + 0) & 0x3fff]; const uint8_t row = font[(glyph * 8) + state.row_address]; uint8_t colours[2] = {