1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-17 13:29:02 +00:00

Ensures an objective copy of the bus address is kept, and forwarded to cards.

This commit is contained in:
Thomas Harte 2018-06-08 20:12:15 -04:00
parent 744c35b617
commit fb4bb21bf6

View File

@ -205,7 +205,7 @@ class ConcreteMachine:
return &speaker_; return &speaker_;
} }
forceinline Cycles perform_bus_operation(CPU::MOS6502::BusOperation operation, uint16_t address, uint8_t *value) { forceinline Cycles perform_bus_operation(const CPU::MOS6502::BusOperation operation, const uint16_t address, uint8_t *const value) {
++ cycles_since_video_update_; ++ cycles_since_video_update_;
++ cycles_since_card_update_; ++ cycles_since_card_update_;
cycles_since_audio_update_ += Cycles(7); cycles_since_audio_update_ += Cycles(7);
@ -232,21 +232,22 @@ class ConcreteMachine:
d000 to e000 : the low ROM area, which can contain indepdently-paged RAM with a language card d000 to e000 : the low ROM area, which can contain indepdently-paged RAM with a language card
e000 onward : the rest of ROM, also potentially replaced with RAM by a language card e000 onward : the rest of ROM, also potentially replaced with RAM by a language card
*/ */
uint16_t accessed_address = address;
MemoryBlock *block = nullptr; MemoryBlock *block = nullptr;
if(address < 0x200) block = &memory_blocks_[0]; if(address < 0x200) block = &memory_blocks_[0];
else if(address < 0xc000) { else if(address < 0xc000) {
if(address < 0x6000 && !isReadOperation(operation)) update_video(); if(address < 0x6000 && !isReadOperation(operation)) update_video();
block = &memory_blocks_[1]; block = &memory_blocks_[1];
address -= 0x200; accessed_address -= 0x200;
} }
else if(address < 0xd000) block = nullptr; else if(address < 0xd000) block = nullptr;
else if(address < 0xe000) {block = &memory_blocks_[2]; address -= 0xd000; } else if(address < 0xe000) {block = &memory_blocks_[2]; accessed_address -= 0xd000; }
else { block = &memory_blocks_[3]; address -= 0xe000; } else { block = &memory_blocks_[3]; accessed_address -= 0xe000; }
bool has_updated_cards = false; bool has_updated_cards = false;
if(block) { if(block) {
if(isReadOperation(operation)) *value = block->read_pointer[address]; if(isReadOperation(operation)) *value = block->read_pointer[accessed_address];
else if(block->write_pointer) block->write_pointer[address] = *value; else if(block->write_pointer) block->write_pointer[accessed_address] = *value;
} else { } else {
// Assume a vapour read unless it turns out otherwise; this is a little // Assume a vapour read unless it turns out otherwise; this is a little
// wasteful but works for now. // wasteful but works for now.