From a7f7fb9e6a7763320210e9938cd5867b894c6926 Mon Sep 17 00:00:00 2001 From: hap Date: Fri, 14 Aug 2020 20:43:54 +0200 Subject: [PATCH] i8244: add external collision detection --- src/devices/video/i8244.cpp | 18 ++++++++++++++++++ src/devices/video/i8244.h | 1 + src/mame/drivers/odyssey2.cpp | 10 ++++++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp index 35733a9da24..2b2526b71ac 100644 --- a/src/devices/video/i8244.cpp +++ b/src/devices/video/i8244.cpp @@ -469,6 +469,24 @@ int i8244_device::hblank() } +void i8244_device::write_cx(int x, bool cx) +{ + if (cx) + { + // Check if we collide with an already drawn source object + if ( m_vdc.s.collision & m_collision_map[x] ) + { + m_collision_status |= 0x40; + } + // Check if an already drawn object would collide with us + if ( m_vdc.s.collision & 0x40 ) + { + m_collision_status |= m_collision_map[x]; + } + } +} + + uint32_t i8244_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { // Some local constants for this method diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h index 685ba1fb6a2..d27ae19ea52 100644 --- a/src/devices/video/i8244.h +++ b/src/devices/video/i8244.h @@ -35,6 +35,7 @@ public: uint8_t read(offs_t offset); void write(offs_t offset, uint8_t data); + void write_cx(int x, bool cx); // CX pin on current scanline int vblank(); int hblank(); diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp index f638f336871..e7420a31569 100644 --- a/src/mame/drivers/odyssey2.cpp +++ b/src/mame/drivers/odyssey2.cpp @@ -45,7 +45,6 @@ TODO: be correct(see backgamm) - ppp(the tetris game) does not work properly on PAL, is this homebrew NTSC-only, or is it due to PAL video timing? The game does mid-scanline updates -- add 824x vs ef934x collision detection, none of the games use it - g7400 rally doesn't work, car keeps exploding, it is related to ef9341_read: If you invert the returned RAM value, the USA map looks better. If you always return 0, the game can be played but the car is invincible @@ -502,7 +501,7 @@ uint32_t g7400_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, // Use EF934x input d = ef934x_bitmap->pix16( y - yoffs, x - xoffs ) & 0x07; - if ( ! m_ic674_decode[ d & 0x07 ] ) + if ( ! m_ic674_decode[ d ] ) { d |= 0x08; } @@ -511,6 +510,13 @@ uint32_t g7400_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, { // Use i8245 input d |= lum; + + // I outputs to CX + if (x >= xoffs && x < (320 + xoffs) && y >= yoffs) + { + bool cx = !m_ic674_decode[ef934x_bitmap->pix16(y - yoffs, x - xoffs) & 0x07]; + m_i8244->write_cx(x, cx); + } } bitmap.pix16(y, x) = d; }