mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Ensured the PIA timer resumes its normal tick rate after being read; fixed those spaces that had crept in where tabs should be.
This commit is contained in:
parent
42677f5f83
commit
aebf636528
@ -354,15 +354,25 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
|
||||
if ((address&0x1280) == 0x280) {
|
||||
if(isReadOperation(operation)) {
|
||||
switch(address & 0xf) {
|
||||
case 0x04: returnValue &= _piaTimerValue >> _piaTimerShift; break;
|
||||
case 0x05: returnValue &= _piaTimerStatus; _piaTimerStatus &= ~0x40; break;
|
||||
case 0x04:
|
||||
returnValue &= _piaTimerValue >> _piaTimerShift;
|
||||
|
||||
if(_writtenPiaTimerShift != _piaTimerShift) {
|
||||
_piaTimerShift = _writtenPiaTimerShift;
|
||||
_piaTimerValue <<= _writtenPiaTimerShift;
|
||||
}
|
||||
break;
|
||||
case 0x05:
|
||||
returnValue &= _piaTimerStatus;
|
||||
_piaTimerStatus &= ~0x40;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(address & 0x0f) {
|
||||
case 0x04: _piaTimerShift = 0; _piaTimerValue = *value << 0; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x05: _piaTimerShift = 3; _piaTimerValue = *value << 3; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x06: _piaTimerShift = 6; _piaTimerValue = *value << 6; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x07: _piaTimerShift = 10; _piaTimerValue = *value << 10; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x04: _writtenPiaTimerShift = _piaTimerShift = 0; _piaTimerValue = *value << 0; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x05: _writtenPiaTimerShift = _piaTimerShift = 3; _piaTimerValue = *value << 3; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x06: _writtenPiaTimerShift = _piaTimerShift = 6; _piaTimerValue = *value << 6; _piaTimerStatus &= ~0xc0; break;
|
||||
case 0x07: _writtenPiaTimerShift = _piaTimerShift = 10; _piaTimerValue = *value << 10; _piaTimerStatus &= ~0xc0; break;
|
||||
}
|
||||
}
|
||||
// printf("Uncaught PIA %04x\n", address);
|
||||
|
@ -37,7 +37,7 @@ class Machine: public CPU6502::Processor<Machine> {
|
||||
|
||||
// the timer
|
||||
unsigned int _piaTimerValue;
|
||||
unsigned int _piaTimerShift;
|
||||
unsigned int _piaTimerShift, _writtenPiaTimerShift;
|
||||
uint8_t _piaTimerStatus;
|
||||
|
||||
// playfield registers
|
||||
|
Loading…
Reference in New Issue
Block a user