1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Revise guess as to address wrapping.

This commit is contained in:
Thomas Harte 2023-12-06 22:03:24 -05:00
parent 327dc51ece
commit b385e6edad

View File

@ -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] = {