From 23df94d0110dee4c5d6ff119a3faa0bbc5c2a39e Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 29 Jul 2015 22:37:37 -0400 Subject: [PATCH] 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. --- Machines/Atari2600.cpp | 38 ++++++++++++++++++++++++++++++-------- Machines/Atari2600.hpp | 6 ++++++ 2 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Machines/Atari2600.cpp b/Machines/Atari2600.cpp index 2e9b4ede0..e515c0435 100644 --- a/Machines/Atari2600.cpp +++ b/Machines/Atari2600.cpp @@ -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); diff --git a/Machines/Atari2600.hpp b/Machines/Atari2600.hpp index 2e97d2dae..049415f5c 100644 --- a/Machines/Atari2600.hpp +++ b/Machines/Atari2600.hpp @@ -44,6 +44,12 @@ class Machine: public CPU6502::Processor { 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;