i8244: add external collision detection

This commit is contained in:
hap 2020-08-14 20:43:54 +02:00
parent d355314cd6
commit a7f7fb9e6a
3 changed files with 27 additions and 2 deletions

View File

@ -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

View File

@ -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();

View File

@ -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;
}