1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-16 18:30:32 +00:00

I'm not really sure what's going wrong with paging yet but this fixes the 0xc000 byte error.

This commit is contained in:
Thomas Harte 2016-01-10 12:30:24 -05:00
parent e07981c147
commit d95414b2eb

View File

@ -35,7 +35,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
unsigned int cycles = 1; unsigned int cycles = 1;
if(address < 32768) if(address < 0x8000)
{ {
if(isReadOperation(operation)) if(isReadOperation(operation))
{ {
@ -56,7 +56,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
} }
else else
{ {
if(address > 49152) if(address >= 0xc000)
{ {
if((address & 0xff00) == 0xfe00) if((address & 0xff00) == 0xfe00)
{ {
@ -90,18 +90,34 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
case 0x5: case 0x5:
if(!isReadOperation(operation)) if(!isReadOperation(operation))
{ {
uint8_t nextROM = (*value)&0xf; const uint8_t interruptDisable = (*value)&0xf0;
if((_activeRom&0x12) != 0x8 || nextROM >= 8) if( interruptDisable )
{ {
_activeRom = (Electron::ROMSlot)nextROM; if( interruptDisable&0x10 ) _interruptStatus &= ~InterruptDisplayEnd;
if( interruptDisable&0x20 ) _interruptStatus &= ~InterruptRealTimeClock;
if( interruptDisable&0x40 ) _interruptStatus &= ~InterruptHighToneDetect;
evaluate_interrupts();
// TODO: NMI (?)
} }
// else
{
uint8_t nextROM = (*value)&0xf;
if( (*value)&0x10 ) _interruptStatus &= ~InterruptDisplayEnd; // if(nextROM&0x08)
if( (*value)&0x20 ) _interruptStatus &= InterruptRealTimeClock; // {
if( (*value)&0x40 ) _interruptStatus &= InterruptHighToneDetect; // _activeRom = (Electron::ROMSlot)(nextROM&0x0e);
evaluate_interrupts(); // printf("%d -> Paged %d\n", nextROM, _activeRom);
// }
// TODO: NMI (?) if((_activeRom&12) != 8 || nextROM&8)
{
_activeRom = (Electron::ROMSlot)nextROM;
}
// else
// {
// printf("Ignored!");
// }
// printf("%d -> Paged %d\n", nextROM, _activeRom);
}
} }
break; break;
case 0x6: case 0x6:
@ -119,7 +135,7 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
else else
{ {
if(isReadOperation(operation)) if(isReadOperation(operation))
*value = _os[address - 49152]; *value = _os[address & 16383];
} }
} }
else else
@ -130,13 +146,15 @@ unsigned int Machine::perform_bus_operation(CPU6502::BusOperation operation, uin
{ {
case ROMSlotBASIC: case ROMSlotBASIC:
case ROMSlotBASIC+1: case ROMSlotBASIC+1:
*value = _basic[address - 32768]; *value = _basic[address & 16383];
break; break;
case ROMSlotKeyboard: case ROMSlotKeyboard:
case ROMSlotKeyboard+1: case ROMSlotKeyboard+1:
*value = 0; *value = 0xf0;
break;
default:
*value = 0xff;
break; break;
default: break;
} }
} }
} }