1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-08-05 08:26:28 +00:00

Started some very basic RIOT unit tests; corrected to pass.

This commit is contained in:
Thomas Harte
2016-06-19 20:12:47 -04:00
parent 065ec618c4
commit 7cf6008e7c
6 changed files with 133 additions and 3 deletions

View File

@@ -50,7 +50,7 @@ template <class T> class MOS6532 {
case 0x07:
_timer.writtenShift = _timer.activeShift = (decodedAddress - 0x04) * 3 + (decodedAddress / 0x07); // i.e. 0, 3, 6, 10
_timer.value = ((unsigned int)(value) << _timer.activeShift) | ((1 << _timer.activeShift)-1);
_timer.status &= ~0x40;
_timer.status &= ~0x80;
break;
}
}
@@ -89,7 +89,7 @@ template <class T> class MOS6532 {
case 0x07:
{
uint8_t value = _timer.status;
_timer.status &= ~0x80;
_timer.status &= ~0x40;
return value;
}
break;
@@ -103,7 +103,8 @@ template <class T> class MOS6532 {
if(_timer.value >= number_of_cycles) {
_timer.value -= number_of_cycles;
} else {
_timer.value = 0x100 + ((_timer.value - (number_of_cycles / 3)) >> _timer.activeShift);
number_of_cycles -= _timer.value;
_timer.value = 0x100 - number_of_cycles;
_timer.activeShift = 0;
_timer.status |= 0xc0;
}