diff --git a/OSBindings/Mac/Clock SignalTests/TIATests.mm b/OSBindings/Mac/Clock SignalTests/TIATests.mm index 412f54a55..5ebaee5fe 100644 --- a/OSBindings/Mac/Clock SignalTests/TIATests.mm +++ b/OSBindings/Mac/Clock SignalTests/TIATests.mm @@ -29,6 +29,15 @@ static void receive_line(uint8_t *next_line) std::function function = receive_line; _tia.reset(new Atari2600::TIA(function)); line = nullptr; + + _tia->set_playfield(0, 0x00); + _tia->set_playfield(1, 0x00); + _tia->set_playfield(2, 0x00); + _tia->set_player_graphic(0, 0x00); + _tia->set_player_graphic(1, 0x00); + _tia->set_ball_enable(false); + _tia->set_missile_enable(0, false); + _tia->set_missile_enable(1, false); } - (void)testReflectedPlayfield @@ -60,8 +69,8 @@ static void receive_line(uint8_t *next_line) _tia->set_playfield(0, 0x10); _tia->set_playfield(1, 0xf0); _tia->set_playfield(2, 0x0e); - _tia->run_for_cycles(228); + _tia->run_for_cycles(228); XCTAssert(line != nullptr, @"228 cycles should have ended the line"); uint8_t expected_line[] = { @@ -75,4 +84,36 @@ static void receive_line(uint8_t *next_line) XCTAssert(!memcmp(expected_line, line, sizeof(expected_line))); } +- (void)testSinglePlayer +{ + // set a player graphic, reset position so that it'll appear from column 1 + _tia->set_player_graphic(0, 0xff); + _tia->set_player_position(0); + + _tia->run_for_cycles(228); + uint8_t first_expected_line[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + XCTAssert(line != nullptr, @"228 cycles should have ended the line"); + XCTAssert(!memcmp(first_expected_line, line, sizeof(first_expected_line))); + line = nullptr; + + _tia->run_for_cycles(228); + uint8_t second_expected_line[] = { + 0, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + XCTAssert(line != nullptr, @"228 cycles should have ended the line"); + XCTAssert(!memcmp(second_expected_line, line, sizeof(second_expected_line))); +} + @end