1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-11 04:28:58 +00:00

It looks like writes should always go to RAM.

Now I see the screen buffer being filled with `0xffff`s, along with what is probably disk motor control data.
This commit is contained in:
Thomas Harte 2019-05-04 17:29:30 -04:00
parent 98bc570bf7
commit 537b604fc9

View File

@ -98,29 +98,33 @@ class ConcreteMachine:
break;
}
printf("\n");
}
} else {
if(cycle.data_select_active()) {
uint16_t *memory_base = nullptr;
bool is_read_only = false;
// When ROM overlay is enabled, the ROM begins at both $000000 and $400000,
// and RAM is available at $600000.
//
// Otherwise RAM is mapped at $000000 and ROM from $400000.
if((ROM_is_overlay_ && word_address < 0x600000) || (!ROM_is_overlay_ && word_address & 0x200000)) {
memory_base = rom_.data();
word_address %= rom_.size();
is_read_only = true;
} else {
//
// Writes to the RAM area, at least, seem to go to RAM regardless of the ROM
// overlay setting, so for now I'm gambling below that writes just always go to RAM.
if(
!(cycle.operation & Microcycle::Read) ||
(
(ROM_is_overlay_ && word_address >= 0x600000) ||
(!ROM_is_overlay_ && !(word_address & 0x200000))
)
) {
memory_base = ram_.data();
word_address %= ram_.size();
is_read_only = false;
} else {
memory_base = rom_.data();
word_address %= rom_.size();
}
if(!is_read_only || (cycle.operation & Microcycle::Read)) {
switch(cycle.operation & (Microcycle::SelectWord | Microcycle::SelectByte | Microcycle::Read | Microcycle::InterruptAcknowledge)) {
default: break;
@ -140,9 +144,9 @@ class ConcreteMachine:
);
break;
}
}
} else {
// Add delay if this is a RAM access and video blocks it momentarily.
// TODO: add delay if this is a RAM access and video blocks it momentarily.
// "Each [video] fetch took two cycles out of eight"
}
}
}