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

Merge branch 'master' into Glitches

This commit is contained in:
Thomas Harte 2016-05-05 08:31:40 -04:00
commit bf9917707e
2 changed files with 27 additions and 28 deletions

View File

@ -175,26 +175,25 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
if( interruptDisable&0x40 ) _interrupt_status &= ~Interrupt::HighToneDetect; if( interruptDisable&0x40 ) _interrupt_status &= ~Interrupt::HighToneDetect;
evaluate_interrupts(); evaluate_interrupts();
// TODO: NMI (?) // TODO: NMI
} }
// else
{
uint8_t nextROM = (*value)&0xf;
// if(nextROM&0x08) // latch the paged ROM in case external hardware is being emulated
// { _active_rom = (Electron::ROMSlot)(*value & 0xf);
// _activeRom = (Electron::ROMSlot)(nextROM&0x0e);
// printf("%d -> Paged %d\n", nextROM, _activeRom); // apply the ULA's test
// } if(*value & 0x08)
if(((_active_rom&12) != 8) || (nextROM&8)) {
if(*value & 0x04)
{ {
_active_rom = (Electron::ROMSlot)nextROM; _keyboard_is_active = false;
_basic_is_active = false;
}
else
{
_keyboard_is_active = !(*value & 0x02);
_basic_is_active = !_keyboard_is_active;
} }
// else
// {
// printf("Ignored!");
// }
// printf("%d -> Paged %d\n", nextROM, _activeRom);
} }
} }
break; break;
@ -375,19 +374,18 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
if(isReadOperation(operation)) if(isReadOperation(operation))
{ {
switch(_active_rom) *value = _roms[_active_rom][address & 16383];
if(_keyboard_is_active)
{ {
case ROMSlotKeyboard: *value &= 0xf0;
case ROMSlotKeyboard+1: for(int address_line = 0; address_line < 14; address_line++)
*value = 0xf0; {
for(int address_line = 0; address_line < 14; address_line++) if(!(address&(1 << address_line))) *value |= _key_states[address_line];
{ }
if(!(address&(1 << address_line))) *value |= _key_states[address_line]; }
} if(_basic_is_active)
break; {
default: *value &= _roms[ROMSlotBASIC][address & 16383];
*value = _roms[_active_rom][address & 16383];
break;
} }
} }
} }

View File

@ -187,6 +187,7 @@ class Machine: public CPU6502::Processor<Machine>, Tape::Delegate {
uint8_t _palette[16]; uint8_t _palette[16];
uint8_t _key_states[14]; uint8_t _key_states[14];
ROMSlot _active_rom; ROMSlot _active_rom;
bool _keyboard_is_active, _basic_is_active;
uint8_t _screen_mode; uint8_t _screen_mode;
uint16_t _screenModeBaseAddress; uint16_t _screenModeBaseAddress;
uint16_t _startScreenAddress; uint16_t _startScreenAddress;