ninjaw.cpp : Updates

Remove register_postload, Simplify handlers, Cleanup sprite priority behavior, Reduce unnecessary lines, Simplify gfxdecodes, Split gfx layout related per each TC0100SCNs, Add notes, Fix namings, Spacings, Use shorter / correct type values
This commit is contained in:
cam900 2019-06-06 23:25:09 +09:00
parent d0d95fb05b
commit 5eeab9b8c1
3 changed files with 141 additions and 148 deletions

View File

@ -327,7 +327,7 @@ rumbling on a subwoofer in the cabinet.)
#include "ninjaw.lh"
void ninjaw_state::parse_control( ) /* assumes Z80 sandwiched between 68Ks */
void ninjaw_state::parse_control() /* assumes Z80 sandwiched between 68Ks */
{
/* bit 0 enables cpu B */
/* however this fails when recovering from a save state
@ -336,7 +336,7 @@ void ninjaw_state::parse_control( ) /* assumes Z80 sandwiched between 68Ks */
}
WRITE16_MEMBER(ninjaw_state::cpua_ctrl_w)
void ninjaw_state::cpua_ctrl_w(u16 data)
{
if ((data &0xff00) && ((data &0xff) == 0))
data = data >> 8;
@ -388,7 +388,7 @@ void ninjaw_state::pancontrol_w(offs_t offset, u8 data)
}
WRITE16_MEMBER(ninjaw_state::tc0100scn_triple_screen_w)
void ninjaw_state::tc0100scn_triple_screen_w(offs_t offset, u16 data, u16 mem_mask)
{
m_tc0100scn[0]->ram_w(offset, data, mem_mask);
m_tc0100scn[1]->ram_w(offset, data, mem_mask);
@ -590,34 +590,25 @@ static const gfx_layout tilelayout =
16,16, /* 16*16 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 8, 12, 0, 4 }, /* pixel bits separated, jump 4 to get to next one */
{ 3, 2, 1, 0, 19, 18, 17, 16,
3+ 32*8, 2+ 32*8, 1+ 32*8, 0+ 32*8, 19+ 32*8, 18+ 32*8, 17+ 32*8, 16+ 32*8 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32,
64*8 + 0*32, 64*8 + 1*32, 64*8 + 2*32, 64*8 + 3*32,
64*8 + 4*32, 64*8 + 5*32, 64*8 + 6*32, 64*8 + 7*32 },
{ STEP4(0,4) }, /* pixel bits separated, jump 4 to get to next one */
{ STEP4(3,-1), STEP4(4*4+3,-1), STEP4(4*4*2*8+3,-1), STEP4(4*4*2*8+4*4+3,-1) },
{ STEP8(0,4*4*2), STEP8(4*4*2*8*2,4*4*2) },
128*8 /* every sprite takes 128 consecutive bytes */
};
static const gfx_layout charlayout =
{
8,8, /* 8*8 characters */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 },
{ 2*4, 3*4, 0*4, 1*4, 6*4, 7*4, 4*4, 5*4 },
{ 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
32*8 /* every sprite takes 32 consecutive bytes */
};
static GFXDECODE_START( gfx_ninjaw_1 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 256 ) /* sprites */
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 256 ) /* scr tiles (screen 1) */
GFXDECODE_ENTRY( "sprites", 0, tilelayout, 0, 256 ) /* sprites */
GFXDECODE_ENTRY( "tc0100scn_1", 0, gfx_8x8x4_packed_msb, 0, 256 ) /* scr tiles (screen 1) */
GFXDECODE_END
static GFXDECODE_START( gfx_ninjaw_23 )
GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0, 256 ) /* sprites */
GFXDECODE_ENTRY( "gfx3", 0, charlayout, 0, 256 ) /* scr tiles (screens 2+) */
static GFXDECODE_START( gfx_ninjaw_2 )
GFXDECODE_ENTRY( "sprites", 0, tilelayout, 0, 256 ) /* sprites */
GFXDECODE_ENTRY( "tc0100scn_2", 0, gfx_8x8x4_packed_msb, 0, 256 ) /* scr tiles (screen 2) */
GFXDECODE_END
static GFXDECODE_START( gfx_ninjaw_3 )
GFXDECODE_ENTRY( "sprites", 0, tilelayout, 0, 256 ) /* sprites */
GFXDECODE_ENTRY( "tc0100scn_3", 0, gfx_8x8x4_packed_msb, 0, 256 ) /* scr tiles (screen 3) */
GFXDECODE_END
@ -630,7 +621,7 @@ class subwoofer_device : public device_t,
public device_sound_interface
{
public:
subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
~subwoofer_device() {}
protected:
@ -649,7 +640,7 @@ extern const device_type SUBWOOFER;
const device_type SUBWOOFER = device_creator<subwoofer_device>;
subwoofer_device::subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
subwoofer_device::subwoofer_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, SUBWOOFER, "Subwoofer", tag, owner, clock),
device_sound_interface(mconfig, *this)
{
@ -695,7 +686,7 @@ to the scrolling background.
Darius2: arbitrary interleaving of 10 to keep cpus synced.
*************************************************************/
void ninjaw_state::postload()
void ninjaw_state::device_post_load()
{
parse_control();
}
@ -706,7 +697,6 @@ void ninjaw_state::machine_start()
save_item(NAME(m_cpua_ctrl));
save_item(NAME(m_pandata));
machine().save().register_postload(save_prepost_delegate(FUNC(ninjaw_state::postload), this));
}
void ninjaw_state::machine_reset()
@ -748,8 +738,8 @@ void ninjaw_state::ninjaw(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode[0], m_tc0110pcr[0], gfx_ninjaw_1);
GFXDECODE(config, m_gfxdecode[1], m_tc0110pcr[1], gfx_ninjaw_23);
GFXDECODE(config, m_gfxdecode[2], m_tc0110pcr[2], gfx_ninjaw_23);
GFXDECODE(config, m_gfxdecode[1], m_tc0110pcr[1], gfx_ninjaw_2);
GFXDECODE(config, m_gfxdecode[2], m_tc0110pcr[2], gfx_ninjaw_3);
config.set_default_layout(layout_ninjaw);
@ -860,8 +850,8 @@ void ninjaw_state::darius2(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode[0], m_tc0110pcr[0], gfx_ninjaw_1);
GFXDECODE(config, m_gfxdecode[1], m_tc0110pcr[1], gfx_ninjaw_23);
GFXDECODE(config, m_gfxdecode[2], m_tc0110pcr[2], gfx_ninjaw_23);
GFXDECODE(config, m_gfxdecode[1], m_tc0110pcr[1], gfx_ninjaw_2);
GFXDECODE(config, m_gfxdecode[2], m_tc0110pcr[2], gfx_ninjaw_3);
config.set_default_layout(layout_ninjaw);
@ -972,24 +962,23 @@ ROM_START( ninjaw )
ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b31_37.11", 0x00000, 0x20000, CRC(0ca5799d) SHA1(6485dde076d15b69b9ee65880dda57ad4f8d129c) )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD16_WORD_SWAP( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD16_WORD_SWAP( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD16_WORD_SWAP( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x100000, "tc0100scn_1", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD16_WORD_SWAP( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "gfx3", 0 )
ROM_COPY( "gfx1", 0x000000, 0x000000, 0x100000 ) /* SCR (screens 2+) */
ROM_REGION( 0x100000, "tc0100scn_2", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
ROM_LOAD16_WORD_SWAP( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
/* The actual board duplicates the SCR gfx roms for 2nd/3rd TC0100SCN */
// ROM_LOAD( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
// ROM_LOAD( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
// ROM_LOAD( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
// ROM_LOAD( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "tc0100scn_3", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
ROM_LOAD16_WORD_SWAP( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x180000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "b31-09.18", 0x000000, 0x80000, CRC(60a73382) SHA1(0ddeb86fcd4d19a58e62bf8564f996d17e36e5c5) )
@ -1027,24 +1016,23 @@ ROM_START( ninjaw1 )
ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b31_37.11", 0x00000, 0x20000, CRC(0ca5799d) SHA1(6485dde076d15b69b9ee65880dda57ad4f8d129c) )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD16_WORD_SWAP( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD16_WORD_SWAP( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD16_WORD_SWAP( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x100000, "tc0100scn_1", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD16_WORD_SWAP( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "gfx3", 0 )
ROM_COPY( "gfx1", 0x000000, 0x000000, 0x100000 ) /* SCR (screens 2+) */
ROM_REGION( 0x100000, "tc0100scn_2", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
ROM_LOAD16_WORD_SWAP( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
/* The actual board duplicates the SCR gfx roms for 2nd/3rd TC0100SCN */
// ROM_LOAD( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
// ROM_LOAD( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
// ROM_LOAD( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
// ROM_LOAD( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "tc0100scn_3", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
ROM_LOAD16_WORD_SWAP( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x180000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "b31-09.18", 0x000000, 0x80000, CRC(60a73382) SHA1(0ddeb86fcd4d19a58e62bf8564f996d17e36e5c5) )
@ -1082,24 +1070,23 @@ ROM_START( ninjawu )
ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b31_37.11", 0x00000, 0x20000, CRC(0ca5799d) SHA1(6485dde076d15b69b9ee65880dda57ad4f8d129c) )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD16_WORD_SWAP( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD16_WORD_SWAP( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD16_WORD_SWAP( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x100000, "tc0100scn_1", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD16_WORD_SWAP( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "gfx3", 0 )
ROM_COPY( "gfx1", 0x000000, 0x000000, 0x100000 ) /* SCR (screens 2+) */
ROM_REGION( 0x100000, "tc0100scn_2", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
ROM_LOAD16_WORD_SWAP( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
/* The actual board duplicates the SCR gfx roms for 2nd/3rd TC0100SCN */
// ROM_LOAD( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
// ROM_LOAD( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
// ROM_LOAD( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
// ROM_LOAD( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "tc0100scn_3", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
ROM_LOAD16_WORD_SWAP( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x180000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "b31-09.18", 0x000000, 0x80000, CRC(60a73382) SHA1(0ddeb86fcd4d19a58e62bf8564f996d17e36e5c5) )
@ -1137,24 +1124,23 @@ ROM_START( ninjawj )
ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "b31_37.11", 0x00000, 0x20000, CRC(0ca5799d) SHA1(6485dde076d15b69b9ee65880dda57ad4f8d129c) )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD16_WORD_SWAP( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD16_WORD_SWAP( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD16_WORD_SWAP( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x200000, "gfx2", 0 )
ROM_LOAD( "b31-07.176", 0x000000, 0x80000, CRC(33568cdb) SHA1(87abf56bbbd3659a1bd3e6ce9e43176be7950b41) ) /* OBJ */
ROM_LOAD( "b31-06.175", 0x080000, 0x80000, CRC(0d59439e) SHA1(54d844492888e7fe2c3bc61afe64f8d47fdee8dc) )
ROM_LOAD( "b31-05.174", 0x100000, 0x80000, CRC(0a1fc9fb) SHA1(a5d6975fd4f7e689c8cafd7c9cd3787797955779) )
ROM_LOAD( "b31-04.173", 0x180000, 0x80000, CRC(2e1e4cb5) SHA1(4733cfc015a68e021108a9e1e8ea807b0e7eac7a) )
ROM_REGION( 0x100000, "tc0100scn_1", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.23", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 1) */
ROM_LOAD16_WORD_SWAP( "b31-02.24", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "gfx3", 0 )
ROM_COPY( "gfx1", 0x000000, 0x000000, 0x100000 ) /* SCR (screens 2+) */
ROM_REGION( 0x100000, "tc0100scn_2", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
ROM_LOAD16_WORD_SWAP( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
/* The actual board duplicates the SCR gfx roms for 2nd/3rd TC0100SCN */
// ROM_LOAD( "b31-01.26", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 2) */
// ROM_LOAD( "b31-02.27", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
// ROM_LOAD( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
// ROM_LOAD( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x100000, "tc0100scn_3", 0 )
ROM_LOAD16_WORD_SWAP( "b31-01.28", 0x00000, 0x80000, CRC(8e8237a7) SHA1(3e181a153d9b4b7f6a620614ea9022285583a5b5) ) /* SCR (screen 3) */
ROM_LOAD16_WORD_SWAP( "b31-02.29", 0x80000, 0x80000, CRC(4c3b4e33) SHA1(f99b379be1af085bf102d4d7cf35803e002fe80b) )
ROM_REGION( 0x180000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "b31-09.18", 0x000000, 0x80000, CRC(60a73382) SHA1(0ddeb86fcd4d19a58e62bf8564f996d17e36e5c5) )
@ -1192,16 +1178,20 @@ ROM_START( darius2 )
ROM_REGION( 0x20000, "audiocpu", 0 ) /* sound cpu */
ROM_LOAD( "c07-28", 0x00000, 0x20000, CRC(da304bc5) SHA1(689b4f329d9a640145f82e12dff3dd1fcf8a28c8) )
ROM_REGION( 0x100000, "gfx1", 0 )
ROM_LOAD( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCR (screen 1) */
ROM_LOAD( "c07-04.11", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "c07-01", 0x00000, 0x80000, CRC(3cf0f050) SHA1(f5a1f7e327a2617fb95ce2837e72945fd7447346) ) /* OBJ */
ROM_LOAD16_WORD_SWAP( "c07-02", 0x80000, 0x80000, CRC(75d16d4b) SHA1(795423278b66eca41accce1f8a4425d65af7b629) )
ROM_REGION( 0x100000, "gfx2", 0 )
ROM_LOAD( "c07-01", 0x00000, 0x80000, CRC(3cf0f050) SHA1(f5a1f7e327a2617fb95ce2837e72945fd7447346) ) /* OBJ */
ROM_LOAD( "c07-02", 0x80000, 0x80000, CRC(75d16d4b) SHA1(795423278b66eca41accce1f8a4425d65af7b629) )
ROM_REGION( 0x100000, "tc0100scn_1", 0 )
ROM_LOAD16_WORD_SWAP( "c07-03.12", 0x00000, 0x80000, CRC(189bafce) SHA1(d885e444523489fe24269b90dec58e0d92cfbd6e) ) /* SCR (screen 1) */
ROM_LOAD16_WORD_SWAP( "c07-04.11", 0x80000, 0x80000, CRC(50421e81) SHA1(27ac420602f1dac00dc32903543a518e6f47fb2f) )
ROM_REGION( 0x100000, "gfx3", 0 )
ROM_COPY( "gfx1", 0x000000, 0x000000, 0x100000 ) /* SCR (screens 2+) */
// The actual board duplicates the SCR gfx ROMs for each TC0100SCNs; TODO : ic position
ROM_REGION( 0x100000, "tc0100scn_2", 0 )
ROM_COPY( "tc0100scn_1", 0x000000, 0x000000, 0x100000 ) /* SCR (screen 2) */
ROM_REGION( 0x100000, "tc0100scn_3", 0 )
ROM_COPY( "tc0100scn_1", 0x000000, 0x000000, 0x100000 ) /* SCR (screen 3) */
ROM_REGION( 0x100000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c07-10.95", 0x00000, 0x80000, CRC(4bbe0ed9) SHA1(081b73c4e4d4fa548445e5548573099bcb1e9213) )

View File

@ -38,6 +38,11 @@ public:
void darius2(machine_config &config);
void ninjaw(machine_config &config);
protected:
virtual void device_post_load() override;
virtual void machine_start() override;
virtual void machine_reset() override;
private:
/* devices */
required_device<cpu_device> m_maincpu;
@ -50,31 +55,27 @@ private:
required_device_array<gfxdecode_device, 3> m_gfxdecode;
/* memory pointers */
required_shared_ptr<uint16_t> m_spriteram;
required_shared_ptr<u16> m_spriteram;
/* memory regions */
required_memory_bank m_z80bank;
/* misc */
uint16_t m_cpua_ctrl;
u16 m_cpua_ctrl;
int m_pandata[4];
void coin_control_w(u8 data);
DECLARE_WRITE16_MEMBER(cpua_ctrl_w);
void cpua_ctrl_w(u16 data);
void sound_bankswitch_w(u8 data);
void pancontrol_w(offs_t offset, u8 data);
DECLARE_WRITE16_MEMBER(tc0100scn_triple_screen_w);
void tc0100scn_triple_screen_w(offs_t offset, u16 data, u16 mem_mask = ~0);
virtual void machine_start() override;
virtual void machine_reset() override;
uint32_t screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void postload();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs, int chip);
u32 screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
u32 screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip);
void parse_control();
uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip);
u32 update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip);
void darius2_master_map(address_map &map);
void darius2_slave_map(address_map &map);
void ninjaw_master_map(address_map &map);

View File

@ -7,29 +7,31 @@
SPRITE DRAW ROUTINE
************************************************************/
void ninjaw_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int x_offs, int y_offs, int chip)
void ninjaw_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int x_offs, int y_offs, int chip)
{
int offs, data, tilenum, color, flipx, flipy;
int x, y, priority, curx, cury;
int code;
#ifdef MAME_DEBUG
int unknown = 0;
#endif
for (offs = (m_spriteram.bytes() / 2) - 4; offs >= 0; offs -= 4)
static const u32 primask[2] =
{
data = m_spriteram[offs + 2];
tilenum = data & 0x7fff;
GFX_PMASK_4, // draw sprites with priority 0 which are over the mid layer
(GFX_PMASK_4 | GFX_PMASK_2) // draw sprites with priority 1 which are under the mid layer
};
for (int offs = 0; offs < (m_spriteram.bytes() / 2); offs += 4)
{
int data = m_spriteram[offs + 2];
const u32 tilenum = data & 0x7fff;
if (!tilenum)
continue;
data = m_spriteram[offs + 0];
x = (data - 32) & 0x3ff; /* aligns sprites on rock outcrops and sewer hole */
int x = (data - 32) & 0x3ff; /* aligns sprites on rock outcrops and sewer hole */
data = m_spriteram[offs + 1];
y = (data - 0) & 0x1ff;
int y = (data - 0) & 0x1ff;
/*
The purpose of the bit at data&0x8 (below) is unknown, but it is set
@ -45,13 +47,11 @@ void ninjaw_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect,
but is again unknown, and there is no obvious visual problem.
*/
data = m_spriteram[offs + 3];
flipx = (data & 0x1);
flipy = (data & 0x2) >> 1;
priority = (data & 0x4) >> 2; // 1 = low
const bool flipx = (data & 0x1);
const bool flipy = (data & 0x2) >> 1;
const int priority = (data & 0x4) >> 2; // 1 = low
/* data&0x8 - unknown */
if (priority != primask)
continue;
color = (data & 0x7f00) >> 8;
const u32 color = (data & 0x7f00) >> 8;
/* data&0x8000 - unknown */
#ifdef MAME_DEBUG
@ -65,14 +65,16 @@ void ninjaw_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect,
if (x > 0x3c0) x -= 0x400;
if (y > 0x180) y -= 0x200;
curx = x;
cury = y;
code = tilenum;
const int curx = x;
const int cury = y;
const u32 code = tilenum;
m_gfxdecode[chip]->gfx(0)->transpen(bitmap,cliprect,
m_gfxdecode[chip]->gfx(0)->prio_transpen(bitmap,cliprect,
code, color,
flipx, flipy,
curx, cury, 0);
curx, cury,
screen.priority(), primask[priority],
0);
}
#ifdef MAME_DEBUG
@ -86,11 +88,11 @@ void ninjaw_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect,
SCREEN REFRESH
**************************************************************/
uint32_t ninjaw_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip)
u32 ninjaw_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs, int chip)
{
tc0100scn_device *tc0100scn = m_tc0100scn[chip];
xoffs *= chip;
uint8_t layer[3], nodraw;
u8 layer[3];
tc0100scn->tilemap_update();
@ -98,27 +100,27 @@ uint32_t ninjaw_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap
layer[1] = layer[0] ^ 1;
layer[2] = 2;
screen.priority().fill(0, cliprect);
/* chip 0 does tilemaps on the left, chip 1 center, chip 2 the right */
// draw bottom layer
nodraw = tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0); /* left */
u8 nodraw = tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1); /* left */
/* Ensure screen blanked even when bottom layers not drawn due to disable bit */
if (nodraw)
bitmap.fill(m_tc0110pcr[chip]->black_pen(), cliprect);
/* Sprites can be under/over the layer below text layer */
draw_sprites(bitmap, cliprect, 1, xoffs, 8, chip); // draw sprites with priority 1 which are under the mid layer
// draw middle layer
tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 0);
draw_sprites(bitmap, cliprect, 0, xoffs, 8, chip); // draw sprites with priority 0 which are over the mid layer
tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[1], 0, 2);
// draw top(text) layer
tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 0);
tc0100scn->tilemap_draw(screen, bitmap, cliprect, layer[2], 0, 4);
/* Sprites can be under/over the layer below text layer */
draw_sprites(screen, bitmap, cliprect, xoffs, 8, chip);
return 0;
}
uint32_t ninjaw_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 0); }
uint32_t ninjaw_state::screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 1); }
uint32_t ninjaw_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 2); }
u32 ninjaw_state::screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 0); }
u32 ninjaw_state::screen_update_middle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 1); }
u32 ninjaw_state::screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect){ return update_screen(screen, bitmap, cliprect, 36 * 8, 2); }