1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-18 23:23:56 +00:00

Discovered that the VIC and the VIAs can be simultaneously selected. Adjusted bus appropriately.

This commit is contained in:
Thomas Harte 2016-06-22 17:34:42 -04:00
parent b753690d5e
commit e05003c176

View File

@ -47,35 +47,36 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
// run the phase-2 part of the cycle, which is whatever the 6502 said it should be // run the phase-2 part of the cycle, which is whatever the 6502 said it should be
if(isReadOperation(operation)) if(isReadOperation(operation))
{ {
*value = read_memory(address); uint8_t result = read_memory(address);
if((address&0xfff0) == 0x9000) if((address&0xff00) == 0x9000)
{ {
*value = _mos6560->get_register(address - 0x9000); result &= _mos6560->get_register(address);
} }
else if((address&0xfff0) == 0x9110) if((address&0xfc10) == 0x9010)
{ {
*value = _userPortVIA.get_register(address - 0x9110); result &= _userPortVIA.get_register(address);
} }
else if((address&0xfff0) == 0x9120) if((address&0xfc20) == 0x9020)
{ {
*value = _keyboardVIA.get_register(address - 0x9120); result &= _keyboardVIA.get_register(address);
} }
*value = result;
} }
else else
{ {
uint8_t *ram = ram_pointer(address); uint8_t *ram = ram_pointer(address);
if(ram) *ram = *value; if(ram) *ram = *value;
else if((address&0xfff0) == 0x9000) if((address&0xff00) == 0x9000)
{ {
_mos6560->set_register(address - 0x9000, *value); _mos6560->set_register(address, *value);
} }
else if((address&0xfff0) == 0x9110) if((address&0xfc10) == 0x9010)
{ {
_userPortVIA.set_register(address - 0x9110, *value); _userPortVIA.set_register(address, *value);
} }
else if((address&0xfff0) == 0x9120) if((address&0xfc20) == 0x9020)
{ {
_keyboardVIA.set_register(address - 0x9120, *value); _keyboardVIA.set_register(address, *value);
} }
} }