summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author David Haywood <mamehaze@gmail.com>2018-11-01 17:17:30 +0000
committer R. Belmont <rb6502@users.noreply.github.com>2018-11-01 13:17:30 -0400
commit5f636e9894817fb6c7ccf088ef48a40bb50bd47f (patch)
tree81d76d2876401508ba466563b83600dba305c3ae
parentfeb7c9a61aa97468b7eca327c96261a60c25880e (diff)
m52: improvements to alpha1v (promoted to working) (#4223)
* m52 - use multiple palettes and regions instead of kludging into one (nw) * split alpha1v into different class etc. * with named regions these comments are redundant (nw) * (nw) * duplicated line by mistake (nw) * this seems plausible (nw) * fix sprite colours, looks like mpatrol could potentially support 3bpp anyway and the existing kludigng of the sprite clut prom was to save memory * mark it as working, I'm pretty sure 99% of the badness now is just the game * TODO note (nw)
-rw-r--r--src/mame/drivers/m52.cpp374
-rw-r--r--src/mame/includes/m52.h67
-rw-r--r--src/mame/video/m52.cpp244
3 files changed, 399 insertions, 286 deletions
diff --git a/src/mame/drivers/m52.cpp b/src/mame/drivers/m52.cpp
index d48079b913b..60250437104 100644
--- a/src/mame/drivers/m52.cpp
+++ b/src/mame/drivers/m52.cpp
@@ -50,10 +50,8 @@
#include "includes/iremipt.h"
#include "includes/m52.h"
-
#define MASTER_CLOCK XTAL(18'432'000)
-
/*************************************
*
* Memory maps
@@ -66,7 +64,7 @@ void m52_state::main_map(address_map &map)
map(0x8000, 0x83ff).ram().w(FUNC(m52_state::m52_videoram_w)).share("videoram");
map(0x8400, 0x87ff).ram().w(FUNC(m52_state::m52_colorram_w)).share("colorram");
map(0x8800, 0x8800).mirror(0x07ff).r(FUNC(m52_state::m52_protection_r));
- map(0xc800, 0xcbff).mirror(0x0400).writeonly().share("spriteram");
+ map(0xc800, 0xcbff).mirror(0x0400).writeonly().share("spriteram"); // only 0x100 of this used by video code?
map(0xd000, 0xd000).mirror(0x07fc).w("irem_audio", FUNC(irem_audio_device::cmd_w));
map(0xd001, 0xd001).mirror(0x07fc).w(FUNC(m52_state::m52_flipscreen_w)); /* + coin counters */
map(0xd000, 0xd000).mirror(0x07f8).portr("IN0");
@@ -78,15 +76,15 @@ void m52_state::main_map(address_map &map)
}
-void m52_state::alpha1v_map(address_map &map)
+void m52_alpha1v_state::alpha1v_map(address_map &map)
{
map(0x0000, 0x6fff).rom();
map(0x8000, 0x83ff).ram().w(FUNC(m52_state::m52_videoram_w)).share("videoram");
map(0x8400, 0x87ff).ram().w(FUNC(m52_state::m52_colorram_w)).share("colorram");
map(0x8800, 0x8800).mirror(0x07ff).r(FUNC(m52_state::m52_protection_r)); // result is ignored
- map(0xc800, 0xc9ff).writeonly().share("spriteram"); // bigger or mirrored?
+ map(0xc800, 0xc9ff).writeonly().share("spriteram");
map(0xd000, 0xd000).portr("IN0").w("irem_audio", FUNC(irem_audio_device::cmd_w));
- map(0xd001, 0xd001).portr("IN1").w(FUNC(m52_state::alpha1v_flipscreen_w));
+ map(0xd001, 0xd001).portr("IN1").w(FUNC(m52_alpha1v_state::alpha1v_flipscreen_w));
map(0xd002, 0xd002).portr("IN2");
map(0xd003, 0xd003).portr("DSW1");
map(0xd004, 0xd004).portr("DSW2");
@@ -106,7 +104,6 @@ void m52_state::main_portmap(address_map &map)
}
-
/*************************************
*
* Port definitions
@@ -302,12 +299,11 @@ static INPUT_PORTS_START( alpha1v )
INPUT_PORTS_END
-
/*************************************
- *
- * Graphics layouts
- *
- *************************************/
+*
+* Graphics layouts
+*
+*************************************/
static const gfx_layout charlayout =
{
@@ -317,18 +313,18 @@ static const gfx_layout charlayout =
{ RGN_FRAC(0,2), RGN_FRAC(1,2) },
{ STEP8(0,1) },
{ STEP8(0,8) },
- 8*8
+ 8 * 8
};
static const gfx_layout spritelayout =
{
16,16,
- RGN_FRAC(1,2),
- 2,
- { RGN_FRAC(0,2), RGN_FRAC(1,2) },
- { STEP8(0,1), STEP8(16*8,1) },
+ RGN_FRAC(1,3),
+ 3,
+ { RGN_FRAC(2,3), RGN_FRAC(0,3), RGN_FRAC(1,3) },
+ { STEP8(0,1), STEP8(16 * 8,1) },
{ STEP16(0,8) },
- 32*8
+ 32 * 8
};
static const uint32_t bgcharlayout_xoffset[256] =
@@ -351,14 +347,14 @@ static const uint32_t bgcharlayout_xoffset[256] =
STEP4(0x1e0,1), STEP4(0x1e8,1), STEP4(0x1f0,1), STEP4(0x1f8,1)
};
-static const uint32_t bgcharlayout_yoffset[64] =
+static const uint32_t bgcharlayout_yoffset[128] =
{
- STEP32(0x0000,0x200), STEP32(0x4000,0x200)
+ STEP32(0x0000,0x200), STEP32(0x4000,0x200), STEP32(0x8000,0x200), STEP32(0xc000,0x200)
};
static const gfx_layout bgcharlayout =
{
- 256, 64, /* 256x64 image format */
+ 256, 128, /* 256x64 image format */
1, /* 1 image */
2, /* 2 bits per pixel */
{ 4, 0 }, /* the two bitplanes for 4 pixels are packed into one byte */
@@ -370,21 +366,28 @@ static const gfx_layout bgcharlayout =
};
-static GFXDECODE_START( gfx_m52 )
- GFXDECODE_ENTRY( "gfx1", 0x0000, charlayout, 0, 128 )
- GFXDECODE_ENTRY( "gfx2", 0x0000, spritelayout, 128*4, 16 )
- GFXDECODE_ENTRY( "gfx3", 0x0000, bgcharlayout, 128*4+16*4+0*4, 1 )
- GFXDECODE_ENTRY( "gfx4", 0x0000, bgcharlayout, 128*4+16*4+1*4, 1 )
- GFXDECODE_ENTRY( "gfx5", 0x0000, bgcharlayout, 128*4+16*4+2*4, 1 )
+static GFXDECODE_START(gfx_m52_sp)
+ GFXDECODE_ENTRY("sp", 0x0000, spritelayout, 0, 16)
+GFXDECODE_END
+
+static GFXDECODE_START(gfx_m52_tx)
+ GFXDECODE_ENTRY("tx", 0x0000, charlayout, 0, 128)
+GFXDECODE_END
+
+static GFXDECODE_START(gfx_m52_bg)
+ GFXDECODE_ENTRY("bg0", 0x0000, bgcharlayout, 0 * 4, 1)
+ GFXDECODE_ENTRY("bg1", 0x0000, bgcharlayout, 1 * 4, 1)
+ GFXDECODE_ENTRY("bg2", 0x0000, bgcharlayout, 2 * 4, 1)
GFXDECODE_END
+
/*************************************
- *
- * Machine drivers
- *
- *************************************/
+*
+* Machine drivers
+*
+*************************************/
void m52_state::machine_reset()
{
@@ -398,21 +401,26 @@ void m52_state::machine_reset()
MACHINE_CONFIG_START(m52_state::m52)
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", Z80, MASTER_CLOCK/6)
+ MCFG_DEVICE_ADD("maincpu", Z80, MASTER_CLOCK / 6)
MCFG_DEVICE_PROGRAM_MAP(main_map)
MCFG_DEVICE_IO_MAP(main_portmap)
- MCFG_DEVICE_VBLANK_INT_DRIVER("screen", m52_state, irq0_line_hold)
+ MCFG_DEVICE_VBLANK_INT_DRIVER("screen", m52_state, irq0_line_hold)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_m52)
- MCFG_PALETTE_ADD("palette", 128*4+16*4+3*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(512+32+32)
- MCFG_PALETTE_INIT_OWNER(m52_state, m52)
+ MCFG_PALETTE_ADD("sp_palette", 256)
+ MCFG_PALETTE_INDIRECT_ENTRIES(32)
+ MCFG_DEVICE_ADD("sp_gfxdecode", GFXDECODE, "sp_palette", gfx_m52_sp)
+
+ MCFG_PALETTE_ADD("tx_palette", 512)
+ MCFG_DEVICE_ADD("tx_gfxdecode", GFXDECODE, "tx_palette", gfx_m52_tx)
+
+ MCFG_PALETTE_ADD("bg_palette", 3 * 4)
+ MCFG_PALETTE_INDIRECT_ENTRIES(32)
+ MCFG_DEVICE_ADD("bg_gfxdecode", GFXDECODE, "bg_palette", gfx_m52_bg)
MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 136, 376, 282, 22, 274)
+ MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK / 3, 384, 136, 376, 282, 22, 274)
MCFG_SCREEN_UPDATE_DRIVER(m52_state, screen_update_m52)
- MCFG_SCREEN_PALETTE("palette")
/* sound hardware */
//m52_sound_c_audio(config);
@@ -421,176 +429,208 @@ MACHINE_CONFIG_START(m52_state::m52)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(m52_state::alpha1v)
+MACHINE_CONFIG_START(m52_alpha1v_state::alpha1v)
m52(config);
/* basic machine hardware */
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(alpha1v_map)
MCFG_SCREEN_MODIFY("screen")
- MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 136, 376, 282, 16, 272)
+ MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK / 3, 384, 136, 376, 282, 16, 272)
+
MACHINE_CONFIG_END
/*************************************
- *
- * ROM definitions
- *
- *************************************/
+*
+* ROM definitions
+*
+*************************************/
-ROM_START( mpatrol )
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "mpa-1.3m", 0x0000, 0x1000, CRC(5873a860) SHA1(8c03726d6e049c3edbc277440184e31679f78258) )
- ROM_LOAD( "mpa-2.3l", 0x1000, 0x1000, CRC(f4b85974) SHA1(dfb2efb57378a20af6f20569f4360cde95596f93) )
- ROM_LOAD( "mpa-3.3k", 0x2000, 0x1000, CRC(2e1a598c) SHA1(112c3c9678db8a8540a8df3708020c87fd10c91b) )
- ROM_LOAD( "mpa-4.3j", 0x3000, 0x1000, CRC(dd05b587) SHA1(727961b0dafa4a96b580d51013336db2a18aff1e) )
+ROM_START(mpatrol)
+ ROM_REGION(0x10000, "maincpu", 0)
+ ROM_LOAD("mpa-1.3m", 0x0000, 0x1000, CRC(5873a860) SHA1(8c03726d6e049c3edbc277440184e31679f78258))
+ ROM_LOAD("mpa-2.3l", 0x1000, 0x1000, CRC(f4b85974) SHA1(dfb2efb57378a20af6f20569f4360cde95596f93))
+ ROM_LOAD("mpa-3.3k", 0x2000, 0x1000, CRC(2e1a598c) SHA1(112c3c9678db8a8540a8df3708020c87fd10c91b))
+ ROM_LOAD("mpa-4.3j", 0x3000, 0x1000, CRC(dd05b587) SHA1(727961b0dafa4a96b580d51013336db2a18aff1e))
- ROM_REGION( 0x8000, "irem_audio:iremsound", 0 )
- ROM_LOAD( "mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) )
+ ROM_REGION(0x8000, "irem_audio:iremsound", 0)
+ ROM_LOAD("mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80))
- ROM_REGION( 0x2000, "gfx1", 0 )
- ROM_LOAD( "mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649) ) /* chars */
- ROM_LOAD( "mpe-4.3f", 0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545) )
+ ROM_REGION(0x2000, "tx", 0)
+ ROM_LOAD("mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649))
+ ROM_LOAD("mpe-4.3f", 0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545))
- ROM_REGION( 0x2000, "gfx2", 0 )
- ROM_LOAD( "mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b) ) /* sprites */
- ROM_LOAD( "mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2) )
+ /* 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane */
+ ROM_REGION(0x3000, "sp", ROMREGION_ERASE00)
+ ROM_LOAD("mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b))
+ ROM_LOAD("mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2))
- ROM_REGION( 0x1000, "gfx3", 0 )
- ROM_LOAD( "mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84) ) /* background graphics */
+ /* 0x1000-01fff is intentionally left as 0xff fill for the bg regions */
+ ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84))
- ROM_REGION( 0x1000, "gfx4", 0 )
- ROM_LOAD( "mpe-2.3k", 0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee) )
+ ROM_REGION(0x2000, "bg1", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-2.3k", 0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee))
- ROM_REGION( 0x1000, "gfx5", 0 )
- ROM_LOAD( "mpe-3.3h", 0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62) )
+ ROM_REGION(0x2000, "bg2", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-3.3h", 0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62))
- ROM_REGION( 0x0340, "proms", 0 )
- ROM_LOAD( "mpc-4.2a", 0x0000, 0x0200, CRC(07f99284) SHA1(dfc52958f2520e1ce4446dd4c84c91413bbacf76) )
- ROM_LOAD( "mpc-3.1m", 0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
- ROM_LOAD( "mpc-1.1f", 0x0220, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5) ) /* sprite palette */
- ROM_LOAD( "mpc-2.2h", 0x0240, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b) ) /* sprite lookup table */
+ ROM_REGION(0x0200, "tx_pal", 0)
+ ROM_LOAD("mpc-4.2a", 0x0000, 0x0200, CRC(07f99284) SHA1(dfc52958f2520e1ce4446dd4c84c91413bbacf76))
+
+ ROM_REGION(0x0020, "bg_pal", 0)
+ ROM_LOAD("mpc-3.1m", 0x0000, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634))
+
+ ROM_REGION(0x0020, "spr_pal", 0)
+ ROM_LOAD("mpc-1.1f", 0x0000, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5))
+
+ ROM_REGION(0x0100, "spr_clut", 0)
+ ROM_LOAD("mpc-2.2h", 0x0000, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b))
ROM_END
-ROM_START( mpatrolw )
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "mpa-1w.3m", 0x0000, 0x1000, CRC(baa1a1d4) SHA1(7968a7f221e7f4c9c81ddc8de17f6568e17b9ea8) )
- ROM_LOAD( "mpa-2w.3l", 0x1000, 0x1000, CRC(52459e51) SHA1(ae685b7848baa1b87a3f2bce97356286171e16d4) )
- ROM_LOAD( "mpa-3w.3k", 0x2000, 0x1000, CRC(9b249fe5) SHA1(c01e0d572c4c163f3cf4b2aa9f4246427811b78d) )
- ROM_LOAD( "mpa-4w.3j", 0x3000, 0x1000, CRC(fee76972) SHA1(c3166b027f89f61964ead804d3c2da387454c4c2) )
+ROM_START(mpatrolw)
+ ROM_REGION(0x10000, "maincpu", 0)
+ ROM_LOAD("mpa-1w.3m", 0x0000, 0x1000, CRC(baa1a1d4) SHA1(7968a7f221e7f4c9c81ddc8de17f6568e17b9ea8))
+ ROM_LOAD("mpa-2w.3l", 0x1000, 0x1000, CRC(52459e51) SHA1(ae685b7848baa1b87a3f2bce97356286171e16d4))
+ ROM_LOAD("mpa-3w.3k", 0x2000, 0x1000, CRC(9b249fe5) SHA1(c01e0d572c4c163f3cf4b2aa9f4246427811b78d))
+ ROM_LOAD("mpa-4w.3j", 0x3000, 0x1000, CRC(fee76972) SHA1(c3166b027f89f61964ead804d3c2da387454c4c2))
+
+ ROM_REGION(0x8000, "irem_audio:iremsound", 0)
+ ROM_LOAD("mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80))
+
+ ROM_REGION(0x2000, "tx", 0)
+ ROM_LOAD("mpe-5w.3e", 0x0000, 0x1000, CRC(f56e01fe) SHA1(93f582d63b9cd5c6dca207aa57b213c939cdda1d))
+ ROM_LOAD("mpe-4w.3f", 0x1000, 0x1000, CRC(caaba2d9) SHA1(7016a26c2d01e3209749598e993cd8ce91f12c88))
+
+ /* 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane */
+ ROM_REGION(0x3000, "sp", ROMREGION_ERASE00)
+ ROM_LOAD("mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b))
+ ROM_LOAD("mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2))
- ROM_REGION( 0x8000, "irem_audio:iremsound", 0 )
- ROM_LOAD( "mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) )
+ /* 0x1000-01fff is intentionally left as 0xff fill for the bg regions */
+ ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84))
- ROM_REGION( 0x2000, "gfx1", 0 )
- ROM_LOAD( "mpe-5w.3e", 0x0000, 0x1000, CRC(f56e01fe) SHA1(93f582d63b9cd5c6dca207aa57b213c939cdda1d) ) /* chars */
- ROM_LOAD( "mpe-4w.3f", 0x1000, 0x1000, CRC(caaba2d9) SHA1(7016a26c2d01e3209749598e993cd8ce91f12c88) )
+ ROM_REGION(0x2000, "bg1", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-2.3k", 0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee))
- ROM_REGION( 0x2000, "gfx2", 0 )
- ROM_LOAD( "mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b) ) /* sprites */
- ROM_LOAD( "mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2) )
+ ROM_REGION(0x2000, "bg2", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-3.3h", 0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62))
- ROM_REGION( 0x1000, "gfx3", 0 )
- ROM_LOAD( "mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84) ) /* background graphics */
+ ROM_REGION(0x0200, "tx_pal", 0)
+ ROM_LOAD("mpc-4a.2a", 0x0000, 0x0200, CRC(cb0a5ff3) SHA1(d3f88b4e0c4858abac8b52105656ecece0cf4df9))
- ROM_REGION( 0x1000, "gfx4", 0 )
- ROM_LOAD( "mpe-2.3k", 0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee) )
+ ROM_REGION(0x0020, "bg_pal", 0)
+ ROM_LOAD("mpc-3.1m", 0x0000, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634))
- ROM_REGION( 0x1000, "gfx5", 0 )
- ROM_LOAD( "mpe-3.3h", 0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62) )
+ ROM_REGION(0x0020, "spr_pal", 0)
+ ROM_LOAD("mpc-1.1f", 0x0000, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5))
- ROM_REGION( 0x0340, "proms", 0 )
- ROM_LOAD( "mpc-4a.2a", 0x0000, 0x0200, CRC(cb0a5ff3) SHA1(d3f88b4e0c4858abac8b52105656ecece0cf4df9) )
- ROM_LOAD( "mpc-3.1m", 0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
- ROM_LOAD( "mpc-1.1f", 0x0220, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5) ) /* sprite palette */
- ROM_LOAD( "mpc-2.2h", 0x0240, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b) ) /* sprite lookup table */
+ ROM_REGION(0x0100, "spr_clut", 0)
+ ROM_LOAD("mpc-2.2h", 0x0000, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b))
ROM_END
-ROM_START( mranger )
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "mpa-1.3m", 0x0000, 0x1000, CRC(5873a860) SHA1(8c03726d6e049c3edbc277440184e31679f78258) )
- ROM_LOAD( "mra-2.3l", 0x1000, 0x1000, CRC(217dd431) SHA1(7b81f854209afc1fd3df11b7375f36de6bc4a7c3) )
- ROM_LOAD( "mra-3.3k", 0x2000, 0x1000, CRC(9f0af7b2) SHA1(3daaec15b0d3bc30723ebb14b50f66f288f0d096) )
- ROM_LOAD( "mra-4.3j", 0x3000, 0x1000, CRC(7fe8e2cd) SHA1(4ffad9c7a9360999b213b790c6c76cc79c8e49d5) )
+ROM_START(mranger)
+ ROM_REGION(0x10000, "maincpu", 0)
+ ROM_LOAD("mpa-1.3m", 0x0000, 0x1000, CRC(5873a860) SHA1(8c03726d6e049c3edbc277440184e31679f78258))
+ ROM_LOAD("mra-2.3l", 0x1000, 0x1000, CRC(217dd431) SHA1(7b81f854209afc1fd3df11b7375f36de6bc4a7c3))
+ ROM_LOAD("mra-3.3k", 0x2000, 0x1000, CRC(9f0af7b2) SHA1(3daaec15b0d3bc30723ebb14b50f66f288f0d096))
+ ROM_LOAD("mra-4.3j", 0x3000, 0x1000, CRC(7fe8e2cd) SHA1(4ffad9c7a9360999b213b790c6c76cc79c8e49d5))
- ROM_REGION( 0x8000, "irem_audio:iremsound", 0 )
- ROM_LOAD( "mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80) )
+ ROM_REGION(0x8000, "irem_audio:iremsound", 0)
+ ROM_LOAD("mp-s1.1a", 0x7000, 0x1000, CRC(561d3108) SHA1(4998c68a9e9a8002251fa8f07aa1082444a9dc80))
- ROM_REGION( 0x2000, "gfx1", 0 )
- ROM_LOAD( "mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649) ) /* chars */
- ROM_LOAD( "mpe-4.3f", 0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545) )
+ ROM_REGION(0x2000, "tx", 0)
+ ROM_LOAD("mpe-5.3e", 0x0000, 0x1000, CRC(e3ee7f75) SHA1(b03d0d56150d3e9da4a4c871338097b4f450b649))
+ ROM_LOAD("mpe-4.3f", 0x1000, 0x1000, CRC(cca6d023) SHA1(fecb3059fb09897a096add9452b50aec55c07545))
- ROM_REGION( 0x2000, "gfx2", 0 )
- ROM_LOAD( "mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b) ) /* sprites */
- ROM_LOAD( "mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2) )
+ /* 0x2000-0x2fff is intentionally left as 0x00 fill, unused bitplane */
+ ROM_REGION(0x3000, "sp", ROMREGION_ERASE00)
+ ROM_LOAD("mpb-2.3m", 0x0000, 0x1000, CRC(707ace5e) SHA1(93c682e13e74bce29ced3a87bffb29569c114c3b))
+ ROM_LOAD("mpb-1.3n", 0x1000, 0x1000, CRC(9b72133a) SHA1(1393ef92ae1ad58a4b62ca1660c0793d30a8b5e2))
- ROM_REGION( 0x1000, "gfx3", 0 )
- ROM_LOAD( "mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84) ) /* background graphics */
+ /* 0x1000-01fff is intentionally left as 0xff fill for the bg regions */
+ ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-1.3l", 0x0000, 0x1000, CRC(c46a7f72) SHA1(8bb7c9acaf6833fb6c0575b015991b873a305a84))
- ROM_REGION( 0x1000, "gfx4", 0 )
- ROM_LOAD( "mpe-2.3k", 0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee) )
+ ROM_REGION(0x2000, "bg1", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-2.3k", 0x0000, 0x1000, CRC(c7aa1fb0) SHA1(14c6c76e1d0db2c0745e5d6d33ea6945fac8e9ee))
- ROM_REGION( 0x1000, "gfx5", 0 )
- ROM_LOAD( "mpe-3.3h", 0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62) )
+ ROM_REGION(0x2000, "bg2", ROMREGION_ERASEFF)
+ ROM_LOAD("mpe-3.3h", 0x0000, 0x1000, CRC(a0919392) SHA1(8a090cb8d483a3d67c7360058e3fdd70e151cd62))
- ROM_REGION( 0x0340, "proms", 0 )
- ROM_LOAD( "mpc-4.2a", 0x0000, 0x0200, CRC(07f99284) SHA1(dfc52958f2520e1ce4446dd4c84c91413bbacf76) )
- ROM_LOAD( "mpc-3.1m", 0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
- ROM_LOAD( "mpc-1.1f", 0x0220, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5) ) /* sprite palette */
- ROM_LOAD( "mpc-2.2h", 0x0240, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b) ) /* sprite lookup table */
-ROM_END
+ ROM_REGION(0x0200, "tx_pal", 0)
+ ROM_LOAD("mpc-4.2a", 0x0000, 0x0200, CRC(07f99284) SHA1(dfc52958f2520e1ce4446dd4c84c91413bbacf76))
+
+ ROM_REGION(0x0020, "bg_pal", 0)
+ ROM_LOAD("mpc-3.1m", 0x0000, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634))
+ ROM_REGION(0x0020, "spr_pal", 0)
+ ROM_LOAD("mpc-1.1f", 0x0000, 0x0020, CRC(26979b13) SHA1(8c41a8cce4f3384c392a9f7a223a50d7be0e14a5))
-ROM_START( alpha1v )
- ROM_REGION( 0x10000, "maincpu", 0 )
- ROM_LOAD( "2-m3", 0x0000, 0x1000, CRC(3a679d34) SHA1(1a54a43070c56dc91d4d258f29e29613bb309f1c) )
- ROM_LOAD( "3-l3", 0x1000, 0x1000, CRC(2f09df64) SHA1(e91602e9e41ad24dd1d7f384ed81b9bdaadd03e1) )
- ROM_LOAD( "4-k3", 0x2000, 0x1000, CRC(64fb9c8a) SHA1(735fd00cc42193a417e6cde75f12b4cf2e804942) )
- ROM_LOAD( "5-j3", 0x3000, 0x1000, CRC(d1643d18) SHA1(7c794b82e17e2ba0a6237e3fc20d8314f6c2481c) )
- ROM_LOAD( "6-h3", 0x4000, 0x1000, CRC(cf34ab51) SHA1(3696da71e2bc7edd1ee7aeaac87be5386608c09e) )
- ROM_LOAD( "7-f3", 0x5000, 0x1000, CRC(99db9781) SHA1(a56a675cc4cbc9681bfe8052f51f19336eb2a0a6) )
- ROM_LOAD( "7a e3", 0x6000, 0x1000, CRC(3b0b4b0d) SHA1(0d8eea1e2db269943611289b3490a578ee347f85) )
-
- ROM_REGION( 0x8000, "irem_audio:iremsound", 0 )
- ROM_LOAD( "1-a1", 0x7000, 0x1000, CRC(9e07fdd5) SHA1(ed4f462fcfe91fa8e88bfeaaba0a0c11fa0b4601) )
-
- ROM_REGION( 0x2000, "gfx1", 0 )
- ROM_LOAD( "14-e3", 0x0000, 0x1000, CRC(cf00c737) SHA1(415e90289039cac4d04cb1d559f1378ca6a32132) ) /* chars */
- ROM_LOAD( "13-f3", 0x1000, 0x1000, CRC(4b799229) SHA1(42cbdcf787b08b041d30504d699a12c378224933) )
-
- ROM_REGION( 0x3000, "gfx2", 0 ) // 3bpp? (mpatrol is 2bpp..)
- ROM_LOAD( "15-n3", 0x0000, 0x1000, CRC(dc26df76) SHA1(dd1cff7935f5559f9d1b440e02d5e5aa521b0054) )
- ROM_LOAD( "16-l3", 0x1000, 0x1000, CRC(39b9863b) SHA1(da9da9a1066188f050c422dfed1bbbd3ba612ccc) )
- ROM_LOAD( "17-k3", 0x2000, 0x1000, CRC(cfd90773) SHA1(052e126888b6de636db9c521a090699c282b620b) )
-
- /* all the background roms just contain stars.. */
- ROM_REGION( 0x1000, "gfx3", 0 )
- ROM_LOAD( "11-k3", 0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d) ) // these two match..
- ROM_LOAD( "12-jh3", 0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d) )
-
- ROM_REGION( 0x1000, "gfx4", 0 )
- ROM_LOAD( "9-n3", 0x0000, 0x1000, CRC(0fdb7d13) SHA1(e828254a4f94df633d338b5772719276d41c6b7f) )
-
- ROM_REGION( 0x1000, "gfx5", 0 )
- ROM_LOAD( "10-lm3", 0x0000, 0x1000, CRC(9dde3a75) SHA1(293d093485be19bfb20685d76a08ac78e24062bf) )
-
- ROM_REGION( 0x0340, "proms", 0 )
- ROM_LOAD( "63s481-a2", 0x0000, 0x0200, CRC(58678ea8) SHA1(b13a78a5bca8ad5bdec1293512b53654768a7a7a) )
- ROM_LOAD( "18s030-m1", 0x0200, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634) ) /* background palette */
- ROM_LOAD( "mb7051-f1", 0x0220, 0x0020, CRC(d8bdd0df) SHA1(ca522428927911808214d319af314f601497ded4) ) /* sprite palette */
- ROM_LOAD( "mb7052-h2", 0x0240, 0x0100, CRC(ce9f0ef9) SHA1(3afb94ed033f272983bbed22a59856df7824ef8a) ) /* sprite lookup table */
+ ROM_REGION(0x0100, "spr_clut", 0)
+ ROM_LOAD("mpc-2.2h", 0x0000, 0x0100, CRC(7ae4cd97) SHA1(bc0662fac82ffe65f02092d912b2c2b0c7a8ac2b))
ROM_END
+ROM_START(alpha1v)
+ ROM_REGION(0x10000, "maincpu", 0)
+ ROM_LOAD("2-m3", 0x0000, 0x1000, CRC(3a679d34) SHA1(1a54a43070c56dc91d4d258f29e29613bb309f1c))
+ ROM_LOAD("3-l3", 0x1000, 0x1000, CRC(2f09df64) SHA1(e91602e9e41ad24dd1d7f384ed81b9bdaadd03e1))
+ ROM_LOAD("4-k3", 0x2000, 0x1000, CRC(64fb9c8a) SHA1(735fd00cc42193a417e6cde75f12b4cf2e804942))
+ ROM_LOAD("5-j3", 0x3000, 0x1000, CRC(d1643d18) SHA1(7c794b82e17e2ba0a6237e3fc20d8314f6c2481c))
+ ROM_LOAD("6-h3", 0x4000, 0x1000, CRC(cf34ab51) SHA1(3696da71e2bc7edd1ee7aeaac87be5386608c09e))
+ ROM_LOAD("7-f3", 0x5000, 0x1000, CRC(99db9781) SHA1(a56a675cc4cbc9681bfe8052f51f19336eb2a0a6))
+ ROM_LOAD("7a e3", 0x6000, 0x1000, CRC(3b0b4b0d) SHA1(0d8eea1e2db269943611289b3490a578ee347f85))
+
+ ROM_REGION(0x8000, "irem_audio:iremsound", 0)
+ ROM_LOAD("1-a1", 0x7000, 0x1000, CRC(9e07fdd5) SHA1(ed4f462fcfe91fa8e88bfeaaba0a0c11fa0b4601))
+
+ ROM_REGION(0x2000, "tx", 0)
+ ROM_LOAD("14-e3", 0x0000, 0x1000, CRC(cf00c737) SHA1(415e90289039cac4d04cb1d559f1378ca6a32132))
+ ROM_LOAD("13-f3", 0x1000, 0x1000, CRC(4b799229) SHA1(42cbdcf787b08b041d30504d699a12c378224933))
+
+ ROM_REGION(0x3000, "sp", 0) // 3bpp (mpatrol is 2bpp)
+ ROM_LOAD("15-n3", 0x0000, 0x1000, CRC(dc26df76) SHA1(dd1cff7935f5559f9d1b440e02d5e5aa521b0054))
+ ROM_LOAD("16-l3", 0x1000, 0x1000, CRC(39b9863b) SHA1(da9da9a1066188f050c422dfed1bbbd3ba612ccc))
+ ROM_LOAD("17-k3", 0x2000, 0x1000, CRC(cfd90773) SHA1(052e126888b6de636db9c521a090699c282b620b))
+
+ /* all the background roms just contain stars, looks like it wants 2x128 px high images, instead of 3x64, arrangement unclear */
+ ROM_REGION(0x2000, "bg0", ROMREGION_ERASEFF)
+ ROM_LOAD("11-k3", 0x0000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d)) // rom is duplicated
+ ROM_LOAD("12-jh3", 0x1000, 0x1000, CRC(7659440a) SHA1(2efd27c82913513dd03e799f1ed3c10b0863677d))
+
+ ROM_REGION(0x2000, "bg1", ROMREGION_ERASEFF)
+ ROM_LOAD("9-n3", 0x0000, 0x1000, CRC(0fdb7d13) SHA1(e828254a4f94df633d338b5772719276d41c6b7f))
+ ROM_LOAD("10-lm3", 0x1000, 0x1000, CRC(9dde3a75) SHA1(293d093485be19bfb20685d76a08ac78e24062bf))
+
+ ROM_REGION(0x2000, "bg2", ROMREGION_ERASEFF)
+ // unused layer
+
+ ROM_REGION(0x0200, "tx_pal", 0)
+ ROM_LOAD("63s481-a2", 0x0000, 0x0200, CRC(58678ea8) SHA1(b13a78a5bca8ad5bdec1293512b53654768a7a7a))
+
+ ROM_REGION(0x0020, "bg_pal", 0)
+ ROM_LOAD("18s030-m1", 0x0000, 0x0020, CRC(6a57eff2) SHA1(2d1c12dab5915da2ccd466e39436c88be434d634))
+
+ ROM_REGION(0x0020, "spr_pal", 0)
+ ROM_LOAD("mb7051-f1", 0x0000, 0x0020, CRC(d8bdd0df) SHA1(ca522428927911808214d319af314f601497ded4))
+
+ ROM_REGION(0x0100, "spr_clut", 0)
+ ROM_LOAD("mb7052-h2", 0x0000, 0x0100, CRC(ce9f0ef9) SHA1(3afb94ed033f272983bbed22a59856df7824ef8a))
+ROM_END
+
/*************************************
- *
- * Game drivers
- *
- *************************************/
+*
+* Game drivers
+*
+*************************************/
+
+GAME(1982, mpatrol, 0, m52, mpatrol, m52_state, empty_init, ROT0, "Irem", "Moon Patrol", MACHINE_SUPPORTS_SAVE)
+GAME(1982, mpatrolw, mpatrol, m52, mpatrolw, m52_state, empty_init, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", MACHINE_SUPPORTS_SAVE) // USA
+GAME(1982, mranger, mpatrol, m52, mpatrol, m52_state, empty_init, ROT0, "bootleg", "Moon Ranger (bootleg of Moon Patrol)", MACHINE_SUPPORTS_SAVE) // Italy
-GAME( 1982, mpatrol, 0, m52, mpatrol, m52_state, empty_init, ROT0, "Irem", "Moon Patrol", MACHINE_SUPPORTS_SAVE )
-GAME( 1982, mpatrolw, mpatrol, m52, mpatrolw, m52_state, empty_init, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", MACHINE_SUPPORTS_SAVE ) // USA
-GAME( 1982, mranger, mpatrol, m52, mpatrol, m52_state, empty_init, ROT0, "bootleg", "Moon Ranger (bootleg of Moon Patrol)", MACHINE_SUPPORTS_SAVE ) // Italy
-GAME( 1988, alpha1v, 0, alpha1v, alpha1v, m52_state, empty_init, ROT0, "Vision Electronics", "Alpha One (Vision Electronics)", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE )
+GAME(1988, alpha1v, 0, alpha1v, alpha1v, m52_alpha1v_state, empty_init, ROT0, "Vision Electronics", "Alpha One (Vision Electronics)", MACHINE_SUPPORTS_SAVE)
diff --git a/src/mame/includes/m52.h b/src/mame/includes/m52.h
index 5d77946b3f6..04cc7316a6b 100644
--- a/src/mame/includes/m52.h
+++ b/src/mame/includes/m52.h
@@ -13,12 +13,30 @@ public:
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
+ m_sp_gfxdecode(*this, "sp_gfxdecode"),
+ m_tx_gfxdecode(*this, "tx_gfxdecode"),
+ m_bg_gfxdecode(*this, "bg_gfxdecode"),
m_screen(*this, "screen"),
- m_palette(*this, "palette") { }
+ m_sp_palette(*this, "sp_palette"),
+ m_tx_palette(*this, "tx_palette"),
+ m_bg_palette(*this, "bg_palette")
+ { }
void m52(machine_config &config);
- void alpha1v(machine_config &config);
+
+ DECLARE_WRITE8_MEMBER(m52_videoram_w);
+ DECLARE_WRITE8_MEMBER(m52_colorram_w);
+ DECLARE_READ8_MEMBER(m52_protection_r);
+
+protected:
+ virtual void video_start() override;
+ virtual DECLARE_WRITE8_MEMBER(m52_scroll_w);
+
+ /* board mod changes? */
+ int m_spritelimit;
+ bool m_do_bg_fills;
+
+ tilemap_t* m_tx_tilemap;
private:
/* memory pointers */
@@ -27,35 +45,50 @@ private:
optional_shared_ptr<uint8_t> m_spriteram;
/* video-related */
- tilemap_t* m_bg_tilemap;
uint8_t m_bg1xpos;
uint8_t m_bg1ypos;
uint8_t m_bg2xpos;
uint8_t m_bg2ypos;
uint8_t m_bgcontrol;
- DECLARE_WRITE8_MEMBER(m52_scroll_w);
- DECLARE_WRITE8_MEMBER(m52_videoram_w);
- DECLARE_WRITE8_MEMBER(m52_colorram_w);
- DECLARE_READ8_MEMBER(m52_protection_r);
DECLARE_WRITE8_MEMBER(m52_bg1ypos_w);
DECLARE_WRITE8_MEMBER(m52_bg1xpos_w);
DECLARE_WRITE8_MEMBER(m52_bg2xpos_w);
DECLARE_WRITE8_MEMBER(m52_bg2ypos_w);
DECLARE_WRITE8_MEMBER(m52_bgcontrol_w);
DECLARE_WRITE8_MEMBER(m52_flipscreen_w);
- DECLARE_WRITE8_MEMBER(alpha1v_flipscreen_w);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(m52);
- uint32_t screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image);
- void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int initoffs);
+ void init_palette();
+ void init_sprite_palette(const int *resistances_3, const int *resistances_2, double *weights_r, double *weights_g, double *weights_b, double scale);
+ uint32_t screen_update_m52(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ void draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image);
+ void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs);
required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
+ required_device<gfxdecode_device> m_sp_gfxdecode;
+ required_device<gfxdecode_device> m_tx_gfxdecode;
+ required_device<gfxdecode_device> m_bg_gfxdecode;
required_device<screen_device> m_screen;
- required_device<palette_device> m_palette;
- void alpha1v_map(address_map &map);
+ required_device<palette_device> m_sp_palette;
+ required_device<palette_device> m_tx_palette;
+ required_device<palette_device> m_bg_palette;
void main_map(address_map &map);
void main_portmap(address_map &map);
};
+
+class m52_alpha1v_state : public m52_state
+{
+public:
+ m52_alpha1v_state(const machine_config &mconfig, device_type type, const char *tag)
+ : m52_state(mconfig, type, tag)
+ { }
+
+ void alpha1v(machine_config &config);
+
+ void alpha1v_map(address_map &map);
+
+protected:
+ virtual void video_start() override;
+ virtual DECLARE_WRITE8_MEMBER(m52_scroll_w) override;
+ DECLARE_WRITE8_MEMBER(alpha1v_flipscreen_w);
+
+}; \ No newline at end of file
diff --git a/src/mame/video/m52.cpp b/src/mame/video/m52.cpp
index 1bb2852d418..1c5dfb92072 100644
--- a/src/mame/video/m52.cpp
+++ b/src/mame/video/m52.cpp
@@ -10,7 +10,7 @@
#include "video/resnet.h"
#include "includes/m52.h"
-#define BGHEIGHT 64
+#define BGHEIGHT 128
/*************************************
@@ -19,96 +19,99 @@
*
*************************************/
-PALETTE_INIT_MEMBER(m52_state, m52)
+void m52_state::init_palette()
{
- const uint8_t *color_prom = memregion("proms")->base();
- const uint8_t *char_pal = color_prom + 0x000;
- const uint8_t *back_pal = color_prom + 0x200;
- const uint8_t *sprite_pal = color_prom + 0x220;
- const uint8_t *sprite_table = color_prom + 0x240;
- static const int resistances_3[3] = { 1000, 470, 220 };
- static const int resistances_2[2] = { 470, 220 };
+ const int resistances_3[3] = { 1000, 470, 220 };
+ const int resistances_2[2] = { 470, 220 };
double weights_r[3], weights_g[3], weights_b[3], scale;
- int i;
/* compute palette information for characters/backgrounds */
scale = compute_resistor_weights(0, 255, -1.0,
- 3, resistances_3, weights_r, 0, 0,
- 3, resistances_3, weights_g, 0, 0,
- 2, resistances_2, weights_b, 0, 0);
+ 3, resistances_3, weights_r, 0, 0,
+ 3, resistances_3, weights_g, 0, 0,
+ 2, resistances_2, weights_b, 0, 0);
/* character palette */
- for (i = 0; i < 512; i++)
+ const uint8_t *char_pal = memregion("tx_pal")->base();
+ for (int i = 0; i < 512; i++)
{
uint8_t promval = char_pal[i];
- int r = combine_3_weights(weights_r, BIT(promval,0), BIT(promval,1), BIT(promval,2));
- int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
- int b = combine_2_weights(weights_b, BIT(promval,6), BIT(promval,7));
+ int r = combine_3_weights(weights_r, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2));
+ int g = combine_3_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5));
+ int b = combine_2_weights(weights_b, BIT(promval, 6), BIT(promval, 7));
- palette.set_indirect_color(i, rgb_t(r,g,b));
+ m_tx_palette->set_pen_color(i, rgb_t(r, g, b));
}
/* background palette */
- for (i = 0; i < 32; i++)
+ const uint8_t *back_pal = memregion("bg_pal")->base();
+ for (int i = 0; i < 32; i++)
{
uint8_t promval = back_pal[i];
- int r = combine_3_weights(weights_r, BIT(promval,0), BIT(promval,1), BIT(promval,2));
- int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
- int b = combine_2_weights(weights_b, BIT(promval,6), BIT(promval,7));
+ int r = combine_3_weights(weights_r, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2));
+ int g = combine_3_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5));
+ int b = combine_2_weights(weights_b, BIT(promval, 6), BIT(promval, 7));
- palette.set_indirect_color(512+i, rgb_t(r,g,b));
+ m_bg_palette->set_indirect_color(i, rgb_t(r, g, b));
}
+ /* background
+ the palette is a 32x8 PROM with many colors repeated. The address of
+ the colors to pick is as follows:
+ xbb00: mountains
+ 0xxbb: hills
+ 1xxbb: city
+
+ this seems hacky, surely all bytes in the PROM should be used, not just picking the ones that give the colours we want?
+
+ */
+ m_bg_palette->set_pen_indirect(0 * 4 + 0, 0);
+ m_bg_palette->set_pen_indirect(0 * 4 + 1, 4);
+ m_bg_palette->set_pen_indirect(0 * 4 + 2, 8);
+ m_bg_palette->set_pen_indirect(0 * 4 + 3, 12);
+ m_bg_palette->set_pen_indirect(1 * 4 + 0, 0);
+ m_bg_palette->set_pen_indirect(1 * 4 + 1, 1);
+ m_bg_palette->set_pen_indirect(1 * 4 + 2, 2);
+ m_bg_palette->set_pen_indirect(1 * 4 + 3, 3);
+ m_bg_palette->set_pen_indirect(2 * 4 + 0, 0);
+ m_bg_palette->set_pen_indirect(2 * 4 + 1, 16 + 1);
+ m_bg_palette->set_pen_indirect(2 * 4 + 2, 16 + 2);
+ m_bg_palette->set_pen_indirect(2 * 4 + 3, 16 + 3);
+
+ init_sprite_palette(resistances_3, resistances_2, weights_r, weights_g, weights_b, scale);
+}
+
+void m52_state::init_sprite_palette(const int *resistances_3, const int *resistances_2, double *weights_r, double *weights_g, double *weights_b, double scale)
+{
+ const uint8_t *sprite_pal = memregion("spr_pal")->base();
+ const uint8_t *sprite_table = memregion("spr_clut")->base();
+
/* compute palette information for sprites */
compute_resistor_weights(0, 255, scale,
- 2, resistances_2, weights_r, 470, 0,
- 3, resistances_3, weights_g, 470, 0,
- 3, resistances_3, weights_b, 470, 0);
+ 2, resistances_2, weights_r, 470, 0,
+ 3, resistances_3, weights_g, 470, 0,
+ 3, resistances_3, weights_b, 470, 0);
/* sprite palette */
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
uint8_t promval = sprite_pal[i];
- int r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
- int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
- int b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
+ int r = combine_2_weights(weights_r, BIT(promval, 6), BIT(promval, 7));
+ int g = combine_3_weights(weights_g, BIT(promval, 3), BIT(promval, 4), BIT(promval, 5));
+ int b = combine_3_weights(weights_b, BIT(promval, 0), BIT(promval, 1), BIT(promval, 2));
- palette.set_indirect_color(512 + 32 + i, rgb_t(r,g,b));
+ m_sp_palette->set_indirect_color(i, rgb_t(r, g, b));
}
- /* character lookup table */
- for (i = 0; i < 512; i++)
- palette.set_pen_indirect(i, i);
-
/* sprite lookup table */
- for (i = 0; i < 16 * 4; i++)
+ for (int i = 0; i < 256; i++)
{
- uint8_t promval = sprite_table[(i & 3) | ((i & ~3) << 1)];
- palette.set_pen_indirect(512 + i, 512 + 32 + promval);
+ uint8_t promval = sprite_table[i];
+ m_sp_palette->set_pen_indirect(i, promval);
}
-
- /* background */
- /* the palette is a 32x8 PROM with many colors repeated. The address of */
- /* the colors to pick is as follows: */
- /* xbb00: mountains */
- /* 0xxbb: hills */
- /* 1xxbb: city */
- palette.set_pen_indirect(512+16*4+0*4+0, 512);
- palette.set_pen_indirect(512+16*4+0*4+1, 512+4);
- palette.set_pen_indirect(512+16*4+0*4+2, 512+8);
- palette.set_pen_indirect(512+16*4+0*4+3, 512+12);
- palette.set_pen_indirect(512+16*4+1*4+0, 512);
- palette.set_pen_indirect(512+16*4+1*4+1, 512+1);
- palette.set_pen_indirect(512+16*4+1*4+2, 512+2);
- palette.set_pen_indirect(512+16*4+1*4+3, 512+3);
- palette.set_pen_indirect(512+16*4+2*4+0, 512);
- palette.set_pen_indirect(512+16*4+2*4+1, 512+16+1);
- palette.set_pen_indirect(512+16*4+2*4+2, 512+16+2);
- palette.set_pen_indirect(512+16*4+2*4+3, 512+16+3);
}
-
/*************************************
*
* Tilemap info callback
@@ -135,7 +138,7 @@ TILE_GET_INFO_MEMBER(m52_state::get_tile_info)
flag |= TILE_FORCE_LAYER0; /* lines 0 to 6 are opaqe? */
}
- SET_TILE_INFO_MEMBER(0, code, color & 0x3f, flag);
+ SET_TILE_INFO_MEMBER(0, code, color & 0x7f, flag);
}
@@ -148,18 +151,37 @@ TILE_GET_INFO_MEMBER(m52_state::get_tile_info)
void m52_state::video_start()
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(m52_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
+ m_tx_tilemap = &machine().tilemap().create(*m_tx_gfxdecode, tilemap_get_info_delegate(FUNC(m52_state::get_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
- m_bg_tilemap->set_transparent_pen(0);
- m_bg_tilemap->set_scrolldx(127, 127);
- m_bg_tilemap->set_scrolldy(16, 16);
- m_bg_tilemap->set_scroll_rows(4); /* only lines 192-256 scroll */
+ m_tx_tilemap->set_transparent_pen(0);
+ m_tx_tilemap->set_scrolldx(127, 127);
+ m_tx_tilemap->set_scrolldy(16, 16);
+ m_tx_tilemap->set_scroll_rows(4); /* only lines 192-256 scroll */
+
+ init_palette();
save_item(NAME(m_bg1xpos));
save_item(NAME(m_bg1ypos));
save_item(NAME(m_bg2xpos));
save_item(NAME(m_bg2ypos));
save_item(NAME(m_bgcontrol));
+
+ m_spritelimit = 0x100-4;
+ m_do_bg_fills = true;
+}
+
+void m52_alpha1v_state::video_start()
+{
+ m52_state::video_start();
+
+ // is the limit really just higher anyway or is this a board mod?
+ m_spritelimit = 0x200-4;
+ m_do_bg_fills = false; // or you get solid green areas below the stars bg image. does the doubled up tilemap ROM maybe mean double height instead?
+
+ // the scrolling orange powerups 'orbs' are a single tile in the tilemap, your ship is huge, it is unclear where the hitboxes are meant to be
+ // using the same value as mpatrol puts the collision at the very back of your ship
+ // maybe the sprite positioning is incorrect instead or this is just how the game is designed
+ //m_tx_tilemap->set_scrolldx(127+8, 127-8);
}
@@ -179,12 +201,25 @@ WRITE8_MEMBER(m52_state::m52_scroll_w)
So we set the first 3 quarters to 255 and the last to the scroll value
*/
- m_bg_tilemap->set_scrollx(0, 255);
- m_bg_tilemap->set_scrollx(1, 255);
- m_bg_tilemap->set_scrollx(2, 255);
- m_bg_tilemap->set_scrollx(3, -(data + 1));
+ m_tx_tilemap->set_scrollx(0, 255);
+ m_tx_tilemap->set_scrollx(1, 255);
+ m_tx_tilemap->set_scrollx(2, 255);
+ m_tx_tilemap->set_scrollx(3, -(data + 1));
}
+WRITE8_MEMBER(m52_alpha1v_state::m52_scroll_w)
+{
+/*
+ alpha1v must have some board mod to invert scroll register use, as it expects only the first block to remain static
+ the scrolling powerups are part of the tx layer!
+
+ TODO: check if this configuration works with Moon Patrol, maybe the schematics were read incorrectly?
+*/
+ m_tx_tilemap->set_scrollx(0, 255);
+ m_tx_tilemap->set_scrollx(1, -(data + 1));
+ m_tx_tilemap->set_scrollx(2, -(data + 1));
+ m_tx_tilemap->set_scrollx(3, -(data + 1));
+}
/*************************************
@@ -196,14 +231,14 @@ WRITE8_MEMBER(m52_state::m52_scroll_w)
WRITE8_MEMBER(m52_state::m52_videoram_w)
{
m_videoram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
+ m_tx_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(m52_state::m52_colorram_w)
{
m_colorram[offset] = data;
- m_bg_tilemap->mark_tile_dirty(offset);
+ m_tx_tilemap->mark_tile_dirty(offset);
}
@@ -277,7 +312,7 @@ WRITE8_MEMBER(m52_state::m52_flipscreen_w)
machine().bookkeeping().coin_counter_w(1, data & 0x20);
}
-WRITE8_MEMBER(m52_state::alpha1v_flipscreen_w)
+WRITE8_MEMBER(m52_alpha1v_state::alpha1v_flipscreen_w)
{
flip_screen_set(data & 0x01);
}
@@ -290,10 +325,11 @@ WRITE8_MEMBER(m52_state::alpha1v_flipscreen_w)
*
*************************************/
-void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image)
+void m52_state::draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image)
{
rectangle rect;
const rectangle &visarea = m_screen->visible_area();
+ const pen_t *paldata = m_bg_palette->pens();
if (flip_screen())
@@ -308,7 +344,7 @@ void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect,
ypos += 16;
- m_gfxdecode->gfx(image)->transpen(bitmap,cliprect,
+ m_bg_gfxdecode->gfx(image)->transpen(bitmap,cliprect,
0, 0,
flip_screen(),
flip_screen(),
@@ -316,28 +352,32 @@ void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect,
ypos, 0);
- m_gfxdecode->gfx(image)->transpen(bitmap,cliprect,
+ m_bg_gfxdecode->gfx(image)->transpen(bitmap,cliprect,
0, 0,
flip_screen(),
flip_screen(),
xpos - 256,
ypos, 0);
- rect.min_x = visarea.min_x;
- rect.max_x = visarea.max_x;
-
- if (flip_screen())
+ // create a solid fill below the 64 pixel high bg images
+ if (m_do_bg_fills)
{
- rect.min_y = ypos - BGHEIGHT;
- rect.max_y = ypos - 1;
- }
- else
- {
- rect.min_y = ypos + BGHEIGHT;
- rect.max_y = ypos + 2 * BGHEIGHT - 1;
- }
+ rect.min_x = visarea.min_x;
+ rect.max_x = visarea.max_x;
- bitmap.fill(m_gfxdecode->gfx(image)->colorbase() + 3, rect);
+ if (flip_screen())
+ {
+ rect.min_y = ypos - BGHEIGHT;
+ rect.max_y = ypos - 1;
+ }
+ else
+ {
+ rect.min_y = ypos + BGHEIGHT;
+ rect.max_y = ypos + 2 * BGHEIGHT - 1;
+ }
+
+ bitmap.fill(paldata[m_bg_gfxdecode->gfx(image)->colorbase() + 3], rect);
+ }
}
@@ -348,7 +388,7 @@ void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect,
*
*************************************/
-void m52_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int initoffs)
+void m52_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs)
{
int offs;
@@ -361,11 +401,10 @@ void m52_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, in
int flipy = m_spriteram[offs + 1] & 0x80;
int code = m_spriteram[offs + 2];
int sx = m_spriteram[offs + 3];
- rectangle clip;
/* sprites from offsets $00-$7F are processed in the upper half of the frame */
/* sprites from offsets $80-$FF are processed in the lower half of the frame */
- clip = cliprect;
+ rectangle clip = cliprect;
if (!(offs & 0x80))
clip.min_y = 0, clip.max_y = 127;
else
@@ -392,9 +431,9 @@ void m52_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, in
clip = cliprect;
#endif
- m_gfxdecode->gfx(1)->transmask(bitmap,clip,
+ m_sp_gfxdecode->gfx(0)->transmask(bitmap,clip,
code, color, flipx, flipy, sx, sy,
- m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 512 + 32));
+ m_sp_palette->transpen_mask(*m_sp_gfxdecode->gfx(0), color, 0));
}
}
@@ -406,30 +445,31 @@ void m52_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, in
*
*************************************/
-uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+uint32_t m52_state::screen_update_m52(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int offs;
+ const pen_t *paldata = m_sp_palette->pens();
- bitmap.fill(0, cliprect);
+ bitmap.fill(paldata[0], cliprect);
if (!(m_bgcontrol & 0x20))
{
if (!(m_bgcontrol & 0x10))
- draw_background(bitmap, cliprect, m_bg2xpos, m_bg2ypos, 2); /* distant mountains */
+ draw_background(bitmap, cliprect, m_bg2xpos, m_bg2ypos, 0); /* distant mountains */
+ // only one of these be drawn at once (they share the same scroll register) (alpha1v leaves everything enabled)
if (!(m_bgcontrol & 0x02))
- draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 3); /* hills */
-
- if (!(m_bgcontrol & 0x04))
- draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 4); /* cityscape */
+ draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 1); /* hills */
+ else if (!(m_bgcontrol & 0x04))
+ draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 2); /* cityscape */
}
- m_bg_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
+ m_tx_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
- m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
+ m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
/* draw the sprites */
- for (offs = 0x3c; offs <= 0xfc; offs += 0x40)
+ for (offs = 0x3c; offs <= m_spritelimit; offs += 0x40)
draw_sprites(bitmap, cliprect, offs);
return 0;