diff --git a/tia.cpp b/tia.cpp index 9bf7a8e..b7f2d29 100644 --- a/tia.cpp +++ b/tia.cpp @@ -135,7 +135,7 @@ namespace tia audio::tick(); // [TODO] Pintar pixels - if ( (!vsync_set) && (!vblank_set) && (color_clock >= 68) && (current_scanline >= 40) && (current_scanline < 232) && (!hmove || color_clock >= 92) ) { + if ( (!vsync_set) && (!vblank_set) && (color_clock >= 68) && (current_scanline >= 37) && (current_scanline < 229) && (!hmove || color_clock >= 92) ) { const uint8_t pixel_clock = color_clock - 68; } @@ -153,13 +153,13 @@ namespace tia { switch (address & 0x0f) { case 0x00: return collisions[0]; - case 0x01: return collisions[2]; - case 0x02: return collisions[3]; - case 0x03: return collisions[4]; - case 0x04: return collisions[5]; - case 0x05: return collisions[6]; - case 0x06: return collisions[7]; - case 0x07: return collisions[8]; + case 0x01: return collisions[1]; + case 0x02: return collisions[2]; + case 0x03: return collisions[3]; + case 0x04: return collisions[4]; + case 0x05: return collisions[5]; + case 0x06: return collisions[6]; + case 0x07: return collisions[7]; case 0x08: return get_paddle_state(0); case 0x09: return get_paddle_state(1); @@ -179,7 +179,11 @@ namespace tia // [TODO] Procesar segons l'adreça resultant switch (address) { case 0x00: // VSYNC + const bool old_vsync = vsync_set; vsync_set = value & 0x20; + if (old_vsync && !vsync_set) { // Resetejem el frame + current_scanline = 0; + } break; case 0x01: // VBLANK @@ -322,6 +326,13 @@ namespace tia ball_pos += ball_hmotion; hmove = true; break; + + case 0x2B: // HMCLR + player0_hmotion = player1_hmotion = missile0_hmotion = missile1_hmotion = ball_hmotion = 0; + break; + case 0x2C: // CXCLR + for (int i=0;i<8;++i) collisions[i] = 0; + break; } }