1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-24 12:30:17 +00:00

Merge pull request #1252 from TomHarte/CGAAddresses

Revise guess as to CGA address wrapping.
This commit is contained in:
Thomas Harte 2023-12-06 22:32:54 -05:00 committed by GitHub
commit d696c15be5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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