1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Fixed association of motion registers and actual registers.

This commit is contained in:
Thomas Harte 2015-08-10 16:43:45 +01:00
parent 0e52b7365e
commit 42677f5f83
2 changed files with 14 additions and 14 deletions

View File

@ -108,7 +108,7 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
// figure out missile colour // figure out missile colour
int missileIndex = _objectCounter[2+c] - 4; int missileIndex = _objectCounter[2+c] - 4;
int missileSize = 1 << ((_playerAndMissileSize[c] >> 4)&3); int missileSize = 1 << ((_playerAndMissileSize[c] >> 4)&3);
missilePixels[c] = (missileIndex >= 0 && missileIndex < missileSize && (_missileGraphicsEnable[c]&2)) ? 1 : 0; missilePixels[c] = (missileIndex >= 0 && missileIndex < missileSize && (_missileGraphicsEnable[c]&2) && !(_missileGraphicsReset[c]&2)) ? 1 : 0;
} }
// get the ball proposed colour // get the ball proposed colour
@ -146,11 +146,11 @@ void Machine::output_pixels(int count)
// update hmove // update hmove
if (!(_horizontalTimer&3) && _hMoveFlags) { if (!(_horizontalTimer&3) && _hMoveFlags) {
for(int c = 0; c < 5; c++) { for(int c = 0; c < 5; c++) {
if ((_hMoveCounter^8^(_objectMotion[0] >> 4)) == 0xf) _hMoveFlags &= ~(1 << c); if ((_hMoveCounter^8^(_objectMotion[c] >> 4)) == 0xf) _hMoveFlags &= ~(1 << c);
if (_hMoveFlags&(1 << c)) _objectCounter[c] = (_objectCounter[c]+1)%160; if (_hMoveFlags&(1 << c)) _objectCounter[c] = (_objectCounter[c]+1)%160;
} }
_hMoveCounter --; _hMoveCounter = (_hMoveCounter-1)&0xf;
} }
// logic: if in vsync, output that; otherwise if in vblank then output that; // logic: if in vsync, output that; otherwise if in vblank then output that;
@ -224,14 +224,11 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
int cycles_run_for = 1; int cycles_run_for = 1;
const int32_t ready_line_disable_time = 0;//horizontalTimerReload; const int32_t ready_line_disable_time = 0;//horizontalTimerReload;
// printf("[%d]%d ", _horizontalTimer, _horizontalTimer%3);
if(operation == CPU6502::BusOperation::Ready) { if(operation == CPU6502::BusOperation::Ready) {
int32_t distance_to_end_of_ready = _horizontalTimer;// - ready_line_disable_time + horizontalTimerReload + 1; int32_t distance_to_end_of_ready = _horizontalTimer;// - ready_line_disable_time + horizontalTimerReload + 1;
cycles_run_for = distance_to_end_of_ready / 3; cycles_run_for = distance_to_end_of_ready / 3;
output_pixels(distance_to_end_of_ready); output_pixels(distance_to_end_of_ready);
set_ready_line(false); set_ready_line(false);
// printf("- ");
} else { } else {
output_pixels(3); output_pixels(3);
if(_horizontalTimer == ready_line_disable_time) if(_horizontalTimer == ready_line_disable_time)
@ -269,14 +266,14 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
case 0x07: returnValue &= 0x3f; break; // player / player, missile / missile collisions case 0x07: returnValue &= 0x3f; break; // player / player, missile / missile collisions
} }
} else { } else {
switch(address & 0x3f) { const uint16_t decodedAddress = address & 0x3f;
switch(decodedAddress) {
case 0x00: _vSyncEnabled = !!(*value & 0x02); break; case 0x00: _vSyncEnabled = !!(*value & 0x02); break;
case 0x01: _vBlankEnabled = !!(*value & 0x02); break; case 0x01: _vBlankEnabled = !!(*value & 0x02); break;
case 0x02: { case 0x02:
// printf("W ");
set_ready_line(true); set_ready_line(true);
} break; break;
case 0x03: case 0x03:
_horizontalTimer = 0; _horizontalTimer = 0;
break; break;
@ -329,9 +326,12 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
case 0x26: _playerGraphicsLatchEnable[1] = *value; break; case 0x26: _playerGraphicsLatchEnable[1] = *value; break;
case 0x27: _ballGraphicsEnableDelay = *value; break; case 0x27: _ballGraphicsEnableDelay = *value; break;
// TODO: this should lock, not case 0x28:
case 0x28: _objectCounter[2] = _objectCounter[0]; break; case 0x29:
case 0x29: _objectCounter[3] = _objectCounter[1]; break; if (!(*value&0x02) && _missileGraphicsReset[decodedAddress - 0x28]&0x02)
_objectCounter[decodedAddress - 0x26] = _objectCounter[decodedAddress - 0x28]; // TODO: +3 for normal, +6 for double, +10 for quad
_missileGraphicsReset[decodedAddress - 0x28] = *value;
break;
case 0x2a: case 0x2a:
_vBlankExtend = true; _vBlankExtend = true;

View File

@ -56,7 +56,7 @@ class Machine: public CPU6502::Processor<Machine> {
uint8_t _playerAndMissileSize[2]; uint8_t _playerAndMissileSize[2];
// missile registers // missile registers
uint8_t _missileGraphicsEnable[2]; uint8_t _missileGraphicsEnable[2], _missileGraphicsReset[2];
// ball registers // ball registers
uint8_t _ballGraphicsEnable, _ballGraphicsEnableLatch; uint8_t _ballGraphicsEnable, _ballGraphicsEnableLatch;