1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Got at least as far as putting a single dot at the player 0 and player 1 positions. Which may or may not be accurate.

This commit is contained in:
Thomas Harte 2015-07-29 22:37:37 -04:00
parent 164866d613
commit 23df94d011
2 changed files with 36 additions and 8 deletions

View File

@ -59,7 +59,12 @@ void Machine::get_output_pixel(uint8_t *pixel, int offset)
// TODO: almost everything!
uint8_t playfieldColour = ((_playfieldControl&6) == 2) ? ((x < 20) ? _player0Colour : _player1Colour) : _playfieldColour;
uint8_t outputColour = playFieldPixel ? playfieldColour : _backgroundColour;
if(_horizontalTimer == _playerPosition[0]) outputColour = _player0Colour;
if(_horizontalTimer == _playerPosition[1]) outputColour = _player1Colour;
pixel[0] = palette[outputColour >> 4][0];
pixel[1] = palette[outputColour >> 4][1];
pixel[2] = palette[outputColour >> 4][2];
@ -164,24 +169,41 @@ int Machine::perform_bus_operation(CPU6502::BusOperation operation, uint16_t add
}
} else {
switch(address & 0x3f) {
case 0: _vSyncEnabled = !!(*value & 0x02); break;
case 1: _vBlankEnabled = !!(*value & 0x02); break;
case 0x00: _vSyncEnabled = !!(*value & 0x02); break;
case 0x01: _vBlankEnabled = !!(*value & 0x02); break;
case 2: {
case 0x02: {
cycle_count = _horizontalTimer / 3;
output_pixels(3 * cycle_count);
} break;
case 3: _horizontalTimer = 227; break;
case 0x03: _horizontalTimer = 227; break;
case 0x04: _playerAndMissileSize[0] = *value; break;
case 0x05: _playerAndMissileSize[1] = *value; break;
case 0x06: _player0Colour = *value; break;
case 0x07: _player1Colour = *value; break;
case 0x08: _playfieldColour = *value; break;
case 0x09: _backgroundColour = *value; break;
case 0x0a: _playfieldControl = *value; break;
case 0x0d: _playfield[0] = *value; break;
case 0x0e: _playfield[1] = *value; break;
case 0x0f: _playfield[2] = *value; break;
case 0x0a: _playfieldControl = *value; break;
case 0x0b: _playerReflection[0] = *value; break;
case 0x0c: _playerReflection[1] = *value; break;
case 0x0d: _playfield[0] = *value; break;
case 0x0e: _playfield[1] = *value; break;
case 0x0f: _playfield[2] = *value; break;
case 0x10: _playerPosition[0] = _horizontalTimer; break;
case 0x11: _playerPosition[1] = _horizontalTimer; break;
case 0x12: _missilePosition[0] = _horizontalTimer; break;
case 0x13: _missilePosition[1] = _horizontalTimer; break;
case 0x14: _ballPosition = _horizontalTimer; break;
case 0x1b: _playerGraphics[0] = *value; break;
case 0x1c: _playerGraphics[1] = *value; break;
case 0x1d: _missileGraphicsEnable[0] = *value; break;
case 0x1e: _missileGraphicsEnable[1] = *value; break;
case 0x1f: _ballGraphicsEnable = *value; break;
}
}
// printf("Uncaught TIA %04x\n", address);

View File

@ -44,6 +44,12 @@ class Machine: public CPU6502::Processor<Machine> {
uint8_t _player1Colour;
uint8_t _playfieldColour;
uint8_t _backgroundColour;
uint8_t _playerAndMissileSize[2];
uint8_t _playerReflection[2];
uint8_t _playerGraphics[2];
uint8_t _missileGraphicsEnable[2];
uint8_t _ballGraphicsEnable;
uint8_t _playerPosition[2], _missilePosition[2], _ballPosition;
// graphics output
int32_t _horizontalTimer;