fixed tilemap and 'hvc' ram size

This commit is contained in:
Michaël Banaan Ananas 2014-06-09 01:56:49 +00:00
parent 9e1e121f04
commit 8351b66b07
3 changed files with 29 additions and 42 deletions

View File

@ -44,13 +44,14 @@
static ADDRESS_MAP_START( nitedrvr_map, AS_PROGRAM, 8, nitedrvr_state ) static ADDRESS_MAP_START( nitedrvr_map, AS_PROGRAM, 8, nitedrvr_state )
AM_RANGE(0x0000, 0x00ff) AM_RAM AM_MIRROR(0x100) // SCRAM AM_RANGE(0x0000, 0x00ff) AM_RAM AM_MIRROR(0x100) // SCRAM
AM_RANGE(0x0200, 0x027f) AM_RAM_WRITE(nitedrvr_videoram_w) AM_MIRROR(0x180) AM_SHARE("videoram") // PFW AM_RANGE(0x0200, 0x027f) AM_WRITE(nitedrvr_videoram_w) AM_MIRROR(0x180) AM_SHARE("videoram") // PFW
AM_RANGE(0x0400, 0x05ff) AM_WRITE(nitedrvr_hvc_w) AM_SHARE("hvc") // POSH, POSV, CHAR, Watchdog AM_RANGE(0x0400, 0x042f) AM_WRITEONLY AM_MIRROR(0x1c0) AM_SHARE("hvc") // POSH, POSV, CHAR
AM_RANGE(0x0430, 0x043f) AM_WRITE(watchdog_reset_w) AM_MIRROR(0x1c0)
AM_RANGE(0x0600, 0x07ff) AM_READ(nitedrvr_in0_r) AM_RANGE(0x0600, 0x07ff) AM_READ(nitedrvr_in0_r)
AM_RANGE(0x0800, 0x09ff) AM_READ(nitedrvr_in1_r) AM_RANGE(0x0800, 0x09ff) AM_READ(nitedrvr_in1_r)
AM_RANGE(0x0a00, 0x0bff) AM_WRITE(nitedrvr_out0_w) AM_RANGE(0x0a00, 0x0bff) AM_WRITE(nitedrvr_out0_w)
AM_RANGE(0x0c00, 0x0dff) AM_WRITE(nitedrvr_out1_w) AM_RANGE(0x0c00, 0x0dff) AM_WRITE(nitedrvr_out1_w)
AM_RANGE(0x8000, 0x807f) AM_RAM AM_MIRROR(0x380) AM_SHARE("videoram") // PFR AM_RANGE(0x8000, 0x807f) AM_READONLY AM_MIRROR(0x380) AM_SHARE("videoram") // PFR
AM_RANGE(0x8400, 0x87ff) AM_READWRITE(nitedrvr_steering_reset_r, nitedrvr_steering_reset_w) AM_RANGE(0x8400, 0x87ff) AM_READWRITE(nitedrvr_steering_reset_r, nitedrvr_steering_reset_w)
AM_RANGE(0x9000, 0x9fff) AM_ROM // ROM1-ROM2 AM_RANGE(0x9000, 0x9fff) AM_ROM // ROM1-ROM2
AM_RANGE(0xfff0, 0xffff) AM_ROM // ROM2 for 6502 vectors AM_RANGE(0xfff0, 0xffff) AM_ROM // ROM2 for 6502 vectors
@ -130,8 +131,6 @@ static GFXDECODE_START( nitedrvr )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 ) GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 )
GFXDECODE_END GFXDECODE_END
/* Machine Initialization */
/* Machine Driver */ /* Machine Driver */
static MACHINE_CONFIG_START( nitedrvr, nitedrvr_state ) static MACHINE_CONFIG_START( nitedrvr, nitedrvr_state )
@ -142,7 +141,6 @@ static MACHINE_CONFIG_START( nitedrvr, nitedrvr_state )
MCFG_CPU_VBLANK_INT_DRIVER("screen", nitedrvr_state, irq0_line_hold) MCFG_CPU_VBLANK_INT_DRIVER("screen", nitedrvr_state, irq0_line_hold)
MCFG_WATCHDOG_VBLANK_INIT(3) MCFG_WATCHDOG_VBLANK_INIT(3)
MCFG_TIMER_DRIVER_ADD_PERIODIC("crash_timer", nitedrvr_state, nitedrvr_crash_toggle_callback, PERIOD_OF_555_ASTABLE(RES_K(180), 330, CAP_U(1))) MCFG_TIMER_DRIVER_ADD_PERIODIC("crash_timer", nitedrvr_state, nitedrvr_crash_toggle_callback, PERIOD_OF_555_ASTABLE(RES_K(180), 330, CAP_U(1)))
/* video hardware */ /* video hardware */

View File

@ -58,15 +58,14 @@ public:
DECLARE_WRITE8_MEMBER(nitedrvr_out0_w); DECLARE_WRITE8_MEMBER(nitedrvr_out0_w);
DECLARE_WRITE8_MEMBER(nitedrvr_out1_w); DECLARE_WRITE8_MEMBER(nitedrvr_out1_w);
DECLARE_WRITE8_MEMBER(nitedrvr_videoram_w); DECLARE_WRITE8_MEMBER(nitedrvr_videoram_w);
DECLARE_WRITE8_MEMBER(nitedrvr_hvc_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info); TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void machine_start(); virtual void machine_start();
virtual void machine_reset(); virtual void machine_reset();
virtual void video_start(); virtual void video_start();
UINT32 screen_update_nitedrvr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_nitedrvr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(nitedrvr_crash_toggle_callback); TIMER_DEVICE_CALLBACK_MEMBER(nitedrvr_crash_toggle_callback);
void draw_box( bitmap_ind16 &bitmap, int bx, int by, int ex, int ey ); void draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, int bx, int by, int ex, int ey);
void draw_roadway( bitmap_ind16 &bitmap ); void draw_roadway(bitmap_ind16 &bitmap, const rectangle &cliprect);
int nitedrvr_steering(); int nitedrvr_steering();
}; };

View File

@ -13,13 +13,6 @@ WRITE8_MEMBER(nitedrvr_state::nitedrvr_videoram_w)
m_bg_tilemap->mark_tile_dirty(offset); m_bg_tilemap->mark_tile_dirty(offset);
} }
WRITE8_MEMBER(nitedrvr_state::nitedrvr_hvc_w)
{
m_hvc[offset & 0x3f] = data;
if ((offset & 0x30) == 0x30)
watchdog_reset_w(space, 0, 0);
}
TILE_GET_INFO_MEMBER(nitedrvr_state::get_bg_tile_info) TILE_GET_INFO_MEMBER(nitedrvr_state::get_bg_tile_info)
{ {
@ -28,47 +21,44 @@ TILE_GET_INFO_MEMBER(nitedrvr_state::get_bg_tile_info)
SET_TILE_INFO_MEMBER(0, code, 0, 0); SET_TILE_INFO_MEMBER(0, code, 0, 0);
} }
void nitedrvr_state::video_start() void nitedrvr_state::video_start()
{ {
m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(nitedrvr_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(nitedrvr_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 8);
} }
void nitedrvr_state::draw_box( bitmap_ind16 &bitmap, int bx, int by, int ex, int ey ) void nitedrvr_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect, int bx, int by, int ex, int ey)
{ {
int x, y; for (int y = by; y < ey; y++)
for (y = by; y < ey; y++)
{ {
for (x = bx; x < ex; x++) for (int x = bx; x < ex; x++)
if ((y < 256) && (x < 256)) if (cliprect.contains(x, y))
bitmap.pix16(y, x) = 1; bitmap.pix16(y, x) = 1;
} }
return;
} }
void nitedrvr_state::draw_roadway( bitmap_ind16 &bitmap ) void nitedrvr_state::draw_roadway(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
int roadway; for (int roadway = 0; roadway < 16; roadway++)
for (roadway = 0; roadway < 16; roadway++)
{ {
int bx, by, ex, ey; int bx = m_hvc[roadway];
int by = m_hvc[roadway + 16];
int ex = bx + ((m_hvc[roadway + 32] & 0xf0) >> 4);
int ey = by + (16 - (m_hvc[roadway + 32] & 0x0f));
bx = m_hvc[roadway]; draw_box(bitmap, cliprect, bx, by, ex, ey);
by = m_hvc[roadway + 16];
ex = bx + ((m_hvc[roadway + 32] & 0xf0) >> 4);
ey = by + (16 - (m_hvc[roadway + 32] & 0x0f));
draw_box(bitmap, bx, by, ex, ey);
} }
} }
UINT32 nitedrvr_state::screen_update_nitedrvr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 nitedrvr_state::screen_update_nitedrvr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); bitmap.fill(0, cliprect);
draw_roadway(bitmap);
// don't wrap playfield
rectangle clip = cliprect;
if (clip.max_y > 63) clip.max_y = 63;
m_bg_tilemap->draw(screen, bitmap, clip, 0, 0);
draw_roadway(bitmap, cliprect);
return 0; return 0;
} }