summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2020-11-27 11:36:25 +0100
committer Olivier Galibert <galibert@pobox.com>2020-11-27 11:36:25 +0100
commit08effe4cc19200dcbe79a835550ad612229c90f7 (patch)
tree2cc64fe298d9f170b2f7127ee3dac5e4ccccd747
parentb6af728bfaae09aed1c91719a6ffd12a79cd8bfd (diff)
Fix tunhunt, bringing the driver to this side of 2020
-rw-r--r--src/mame/drivers/tunhunt.cpp59
-rw-r--r--src/mame/includes/tunhunt.h24
-rw-r--r--src/mame/video/tunhunt.cpp86
3 files changed, 102 insertions, 67 deletions
diff --git a/src/mame/drivers/tunhunt.cpp b/src/mame/drivers/tunhunt.cpp
index 3e47d54545f..10885dd218b 100644
--- a/src/mame/drivers/tunhunt.cpp
+++ b/src/mame/drivers/tunhunt.cpp
@@ -122,6 +122,32 @@ uint8_t tunhunt_state::dsw2_4r()
return (ioport("DSW")->read()&0x1000)?0x80:0x00;
}
+void tunhunt_state::machine_reset()
+{
+ m_mobsc0 = 0;
+ m_mobsc1 = 0;
+ memset(m_lineh, 0, 13);
+ m_shl0st = 0;
+ m_shl1st = 0;
+ m_vstrlo = 0;
+ m_linesh = 0;
+ m_shl0pc = 0;
+ m_shl1pc = 0;
+ memset(m_linec, 0, 13);
+ m_shl0v = 0;
+ m_shl1v = 0;
+ m_mobjh = 0;
+ memset(m_linev, 0, 13);
+ m_shl0vs = 0;
+ m_shl1vs = 0;
+ m_mobvs = 0;
+ memset(m_linevs, 0, 13);
+ m_shel0h = 0;
+ m_mobst = 0;
+ m_shel1h = 0;
+ m_mobjv = 0;
+}
+
/*************************************
@@ -134,19 +160,38 @@ void tunhunt_state::main_map(address_map &map)
{
map.global_mask(0x7fff);
map(0x0000, 0x03ff).ram().share("workram"); /* Work RAM */
- map(0x1080, 0x10ff).nopw();
- map(0x1200, 0x12ff).nopw();
- map(0x1400, 0x14ff).nopw();
- map(0x1600, 0x160f).writeonly().share("paletteram"); /* COLRAM (D7-D4 SHADE; D3-D0 COLOR) */
- map(0x1800, 0x1800).nopw(); /* SHEL0H */
- map(0x1a00, 0x1a00).nopw(); /* SHEL1H */
- map(0x1c00, 0x1c00).nopw(); /* MOBJV */
+
+ map(0x1080, 0x1080).lw8(NAME([this](uint8_t data) { m_mobsc0 = data; })); // SCAN ROM START FOR MOBJ (unused?)
+ map(0x1081, 0x1081).lw8(NAME([this](uint8_t data) { m_mobsc1 = data; })); // (unused?)
+ map(0x1083, 0x108f).lw8(NAME([this](offs_t offset, uint8_t data) { m_lineh[offset] = data; })); // LINES HORIZ START
+ map(0x1200, 0x1200).lw8(NAME([this](uint8_t data) { m_shl0st = data; })); // SHELL VSTRETCH (LIKE MST OBJ STRECTH)
+ map(0x1201, 0x1201).lw8(NAME([this](uint8_t data) { m_shl1st = data; }));
+ map(0x1202, 0x1202).lw8(NAME([this](uint8_t data) { m_vstrlo = data; })); // VERT (SCREEN ON SIDE) STRETCH MOJ OBJ
+ map(0x1203, 0x1203).lw8(NAME([this](uint8_t data) { m_linesh = data; })); // LINES SLOPE 4 BITS D0-D3 (signed)
+ map(0x1280, 0x1280).lw8(NAME([this](uint8_t data) { m_shl0pc = data; })); // SHELL PICTURE CODE (D3-D0)
+ map(0x1280, 0x1281).lw8(NAME([this](uint8_t data) { m_shl1pc = data; }));
+ map(0x1283, 0x128f).lw8(NAME([this](offs_t offset, uint8_t data) { m_linec[offset] = data; })); // LINE COLOR, 4 BITS D0-D3
+ map(0x1400, 0x1400).lw8(NAME([this](uint8_t data) { m_shl0v = data; })); // SHELL V START(NORMAL SCREEN)
+ map(0x1401, 0x1401).lw8(NAME([this](uint8_t data) { m_shl1v = data; }));
+ map(0x1402, 0x1402).lw8(NAME([this](uint8_t data) { m_mobjh = data; })); // H POSITON (SCREEN ON SIDE) (VSTART - NORMAL SCREEN)
+ map(0x1403, 0x140f).lw8(NAME([this](offs_t offset, uint8_t data) { m_linev[offset] = data; })); // LINES VERTICAL START
+ map(0x1480, 0x1480).lw8(NAME([this](uint8_t data) { m_shl0vs = data; })); // SHELL V STOP (NORMAL SCREEN)
+ map(0x1481, 0x1481).lw8(NAME([this](uint8_t data) { m_shl1vs = data; }));
+ map(0x1482, 0x1482).lw8(NAME([this](uint8_t data) { m_mobvs = data; })); // V STOP OF MOTION OBJECT (NORMAL SCREEN)
+ map(0x1483, 0x148f).lw8(NAME([this](offs_t offset, uint8_t data) { m_linevs[offset] = data; })); // LINES VERT STOP
+ map(0x1600, 0x160f).writeonly().share("paletteram"); // COLRAM (D7-D4 SHADE; D3-D0 COLOR)
+ map(0x1800, 0x1800).lw8(NAME([this](uint8_t data) { m_shel0h = data; })); // SHELL H POSITON (NORMAL SCREEN)
+ map(0x1802, 0x1802).lw8(NAME([this](uint8_t data) { m_mobst = data; })); // STARTING LINE FOR RAM SCAN ON MOBJ
+ map(0x1a00, 0x1a00).lw8(NAME([this](uint8_t data) { m_shel1h = data; }));
+ map(0x1c00, 0x1c00).lw8(NAME([this](uint8_t data) { m_mobjv = data; })); // V POSITION (SCREEN ON SIDE)
map(0x1e00, 0x1eff).w(FUNC(tunhunt_state::videoram_w)).share("videoram"); /* ALPHA */
+
map(0x2000, 0x2000).nopw(); /* watchdog */
map(0x2000, 0x2007).r(FUNC(tunhunt_state::button_r));
map(0x2400, 0x2400).nopw(); /* INT ACK */
map(0x2800, 0x2800).w(FUNC(tunhunt_state::control_w));
map(0x2c00, 0x2fff).writeonly().share("spriteram");
+
map(0x3000, 0x300f).rw("pokey1", FUNC(pokey_device::read), FUNC(pokey_device::write));
map(0x4000, 0x400f).rw("pokey2", FUNC(pokey_device::read), FUNC(pokey_device::write));
map(0x5000, 0x7fff).rom();
diff --git a/src/mame/includes/tunhunt.h b/src/mame/includes/tunhunt.h
index f4a830a02e3..e6b17b02d84 100644
--- a/src/mame/includes/tunhunt.h
+++ b/src/mame/includes/tunhunt.h
@@ -50,6 +50,7 @@ private:
void draw_shell(bitmap_ind16 &bitmap, const rectangle &cliprect, int picture_code,
int hposition,int vstart,int vstop,int vstretch,int hstretch);
void main_map(address_map &map);
+ virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -65,6 +66,29 @@ private:
uint8_t m_control;
tilemap_t *m_fg_tilemap;
bitmap_ind16 m_tmpbitmap;
+
+ uint8_t m_mobsc0;
+ uint8_t m_mobsc1;
+ uint8_t m_lineh[13];
+ uint8_t m_shl0st;
+ uint8_t m_shl1st;
+ uint8_t m_vstrlo;
+ uint8_t m_linesh;
+ uint8_t m_shl0pc;
+ uint8_t m_shl1pc;
+ uint8_t m_linec[13];
+ uint8_t m_shl0v;
+ uint8_t m_shl1v;
+ uint8_t m_mobjh;
+ uint8_t m_linev[13];
+ uint8_t m_shl0vs;
+ uint8_t m_shl1vs;
+ uint8_t m_mobvs;
+ uint8_t m_linevs[13];
+ uint8_t m_shel0h;
+ uint8_t m_mobst;
+ uint8_t m_shel1h;
+ uint8_t m_mobjv;
};
#endif // MAME_INCLUDES_TUNHUNT_H
diff --git a/src/mame/video/tunhunt.cpp b/src/mame/video/tunhunt.cpp
index a5712f2afa1..ffeed76b8e1 100644
--- a/src/mame/video/tunhunt.cpp
+++ b/src/mame/video/tunhunt.cpp
@@ -12,44 +12,6 @@
/****************************************************************************************/
-/* Video Hardware Addresses */
-
-/* Square Generator (13 bytes each) */
-#define LINEV 0x1403 // LINES VERTICAL START
-#define LINEVS 0x1483 // LINES VERT STOP
-#define LINEH 0x1083 // LINES HORIZ START
-#define LINEC 0x1283 // LINE COLOR, 4 BITS D0-D3
-#define LINESH 0x1203 // LINES SLOPE 4 BITS D0-D3 (signed)
-/* LINESH was used for rotation effects in an older version of the game */
-
-/* Shell Object0 */
-#define SHEL0H 0x1800 // SHELL H POSITON (NORMAL SCREEN)
-#define SHL0V 0x1400 // SHELL V START(NORMAL SCREEN)
-#define SHL0VS 0x1480 // SHELL V STOP (NORMAL SCREEN)
-#define SHL0ST 0x1200 // SHELL VSTRETCH (LIKE MST OBJ STRECTH)
-#define SHL0PC 0x1280 // SHELL PICTURE CODE (D3-D0)
-
-/* Shell Object1 (see above) */
-#define SHEL1H 0x1A00
-#define SHL1V 0x1401
-#define SHL1VS 0x1481
-#define SHL1ST 0x1201
-#define SHL1PC 0x1281
-
-/* Motion Object RAM */
-#define MOBJV 0x1C00 // V POSITION (SCREEN ON SIDE)
-#define MOBVS 0x1482 // V STOP OF MOTION OBJECT (NORMAL SCREEN)
-#define MOBJH 0x1402 // H POSITON (SCREEN ON SIDE) (VSTART - NORMAL SCREEN)
-#define MOBST 0x1082 // STARTING LINE FOR RAM SCAN ON MOBJ
-#define VSTRLO 0x1202 // VERT (SCREEN ON SIDE) STRETCH MOJ OBJ
-#define MOTT 0x2C00 // MOTION OBJECT RAM (00-0F NOT USED, BYT CLEARED)
-#define MOBSC0 0x1080 // SCAN ROM START FOR MOBJ (unused?)
-#define MOBSC1 0x1081 // (unused?)
-
-
-
-/****************************************************************************************/
-
void tunhunt_state::videoram_w(offs_t offset, uint8_t data)
{
m_videoram[offset] = data;
@@ -76,7 +38,7 @@ void tunhunt_state::video_start()
m_tmpbitmap.allocate(256, 64, m_screen->format());
- m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tunhunt_state::get_fg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 32, 32);
+ m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tunhunt_state::get_fg_tile_info)), TILEMAP_SCAN_COLS, 8, 8, 8, 32);
m_fg_tilemap->set_transparent_pen(0);
m_fg_tilemap->set_scrollx(0, 64);
@@ -208,9 +170,9 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
*/
bitmap_ind16 &tmpbitmap = m_tmpbitmap;
- //int skip = m_workram[MOBST];
- const int x0 = 255 - m_workram[MOBJV];
- const int y0 = 255 - m_workram[MOBJH];
+ //int skip = m_mobst;
+ const int x0 = 255 - m_mobjv;
+ const int y0 = 255 - m_mobjh;
for (int line = 0; line < 64; line++)
{
@@ -230,7 +192,7 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
}
int scaley;
- switch (m_workram[VSTRLO])
+ switch (m_vstrlo)
{
case 0x01:
scaley = (1 << 16) * 0.33; // seems correct
@@ -241,7 +203,7 @@ void tunhunt_state::draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cl
break;
default:
- scaley = (1 << 16) * m_workram[VSTRLO] / 4; // ???
+ scaley = (1 << 16) * m_vstrlo / 4; // ???
break;
}
const int scalex = 1 << 16;
@@ -290,15 +252,15 @@ void tunhunt_state::draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
color = 0;
z = 0;
- for( span=3; span<16; span++ )
+ for( span=0; span<13; span++ )
{
- x0 = m_workram[span+0x1080];
- y0 = m_workram[span+0x1480];
- y1 = m_workram[span+0x1400];
+ x0 = m_lineh[span];
+ y0 = m_linevs[span];
+ y1 = m_linev[span];
if( y>=y0 && y<=y1 && x>=x0 && x0>=z )
{
- color = m_workram[span+0x1280]&0xf;
+ color = m_linec[span]&0xf;
z = x0; /* give priority to rightmost spans */
}
}
@@ -366,21 +328,25 @@ uint32_t tunhunt_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
draw_motion_object(bitmap, cliprect);
draw_shell(bitmap, cliprect,
- m_workram[SHL0PC], /* picture code */
- m_workram[SHEL0H], /* hposition */
- m_workram[SHL0V], /* vstart */
- m_workram[SHL0VS], /* vstop */
- m_workram[SHL0ST], /* vstretch */
+ m_shl0pc, /* picture code */
+ m_shel0h, /* hposition */
+ m_shl0v, /* vstart */
+ m_shl0vs, /* vstop */
+ m_shl0st, /* vstretch */
m_control&0x08 ); /* hstretch */
draw_shell(bitmap, cliprect,
- m_workram[SHL1PC], /* picture code */
- m_workram[SHEL1H], /* hposition */
- m_workram[SHL1V], /* vstart */
- m_workram[SHL1VS], /* vstop */
- m_workram[SHL1ST], /* vstretch */
+ m_shl1pc, /* picture code */
+ m_shel1h, /* hposition */
+ m_shl1v, /* vstart */
+ m_shl1vs, /* vstop */
+ m_shl1st, /* vstretch */
m_control&0x10 ); /* hstretch */
- m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ rectangle cr = cliprect;
+ if( cr.min_x < 192 )
+ cr.min_x = 192;
+
+ m_fg_tilemap->draw(screen, bitmap, cr, 0, 0);
return 0;
}