Merge pull request #5188 from cam900/wgp_args

wgp.cpp : Updates
This commit is contained in:
R. Belmont 2019-06-09 08:26:40 -04:00 committed by GitHub
commit c8ce578bf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 202 additions and 259 deletions

View File

@ -406,6 +406,7 @@ Stephh's notes (based on the game M68000 code and some tests) :
#include "screen.h" #include "screen.h"
#include "speaker.h" #include "speaker.h"
#include <algorithm>
void wgp_state::parse_control() void wgp_state::parse_control()
{ {
@ -417,7 +418,7 @@ void wgp_state::parse_control()
/* bit 1 is "vibration" acc. to test mode */ /* bit 1 is "vibration" acc. to test mode */
} }
WRITE16_MEMBER(wgp_state::cpua_ctrl_w)/* assumes Z80 sandwiched between 68Ks */ void wgp_state::cpua_ctrl_w(u16 data)/* assumes Z80 sandwiched between 68Ks */
{ {
if ((data &0xff00) && ((data &0xff) == 0)) if ((data &0xff00) && ((data &0xff) == 0))
data = data >> 8; /* for Wgp */ data = data >> 8; /* for Wgp */
@ -470,14 +471,14 @@ INTERRUPT_GEN_MEMBER(wgp_state::cpub_interrupt)
GAME INPUTS GAME INPUTS
**********************************************************/ **********************************************************/
READ16_MEMBER(wgp_state::lan_status_r) u16 wgp_state::lan_status_r()
{ {
logerror("CPU #2 PC %06x: warning - read lan status\n",m_subcpu->pc()); logerror("CPU #2 PC %06x: warning - read lan status\n",m_subcpu->pc());
return (0x4 << 8); /* CPUB expects this in code at $104d0 (Wgp) */ return (0x4 << 8); /* CPUB expects this in code at $104d0 (Wgp) */
} }
WRITE16_MEMBER(wgp_state::rotate_port_w) void wgp_state::rotate_port_w(offs_t offset, u16 data)
{ {
/* This port may be for piv/sprite layer rotation. /* This port may be for piv/sprite layer rotation.
@ -517,7 +518,7 @@ WRITE16_MEMBER(wgp_state::rotate_port_w)
#define UNKNOWN_PORT_TAG "UNKNOWN" #define UNKNOWN_PORT_TAG "UNKNOWN"
#define FAKE_PORT_TAG "FAKE" #define FAKE_PORT_TAG "FAKE"
READ16_MEMBER(wgp_state::adinput_r) u16 wgp_state::adinput_r(offs_t offset)
{ {
int steer = 0x40; int steer = 0x40;
int fake = m_fake.read_safe(0); int fake = m_fake.read_safe(0);
@ -578,7 +579,7 @@ logerror("CPU #0 PC %06x: warning - read unmapped a/d input offset %06x\n",m_mai
return 0xff; return 0xff;
} }
WRITE16_MEMBER(wgp_state::adinput_w) void wgp_state::adinput_w(u16 data)
{ {
/* Each write invites a new interrupt as soon as the /* Each write invites a new interrupt as soon as the
hardware has got the next a/d conversion ready. We set a token hardware has got the next a/d conversion ready. We set a token
@ -587,7 +588,7 @@ WRITE16_MEMBER(wgp_state::adinput_w)
m_int6_timer->adjust(m_maincpu->cycles_to_attotime(10000)); m_int6_timer->adjust(m_maincpu->cycles_to_attotime(10000));
} }
WRITE8_MEMBER(wgp_state::coins_w) void wgp_state::coins_w(u8 data)
{ {
machine().bookkeeping().coin_lockout_w(0, ~data & 0x01); machine().bookkeeping().coin_lockout_w(0, ~data & 0x01);
machine().bookkeeping().coin_lockout_w(1, ~data & 0x02); machine().bookkeeping().coin_lockout_w(1, ~data & 0x02);
@ -600,7 +601,7 @@ WRITE8_MEMBER(wgp_state::coins_w)
SOUND SOUND
**********************************************************/ **********************************************************/
WRITE8_MEMBER(wgp_state::sound_bankswitch_w) void wgp_state::sound_bankswitch_w(u8 data)
{ {
m_z80bank->set_entry(data & 3); m_z80bank->set_entry(data & 3);
} }
@ -830,44 +831,11 @@ INPUT_PORTS_END
GFX DECODING GFX DECODING
***********************************************************/ ***********************************************************/
static const gfx_layout wgp_tilelayout =
{
16,16, /* 16*16 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 },
{ 1*4, 0*4, 5*4, 4*4, 3*4, 2*4, 7*4, 6*4, 9*4, 8*4, 13*4, 12*4, 11*4, 10*4, 15*4, 14*4 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
128*8 /* every sprite takes 128 consecutive bytes */
};
static const gfx_layout wgp_tile2layout =
{
16,16, /* 16*16 sprites */
RGN_FRAC(1,1),
4, /* 4 bits per pixel */
{ 0, 1, 2, 3 },
{ 7*4, 6*4, 15*4, 14*4, 5*4, 4*4, 13*4, 12*4, 3*4, 2*4, 11*4, 10*4, 1*4, 0*4, 9*4, 8*4 },
{ 0*64, 1*64, 2*64, 3*64, 4*64, 5*64, 6*64, 7*64, 8*64, 9*64, 10*64, 11*64, 12*64, 13*64, 14*64, 15*64 },
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 */
};
/* taitoic.c TC0100SCN routines expect scr stuff to be in second gfx slot */ /* taitoic.c TC0100SCN routines expect scr stuff to be in second gfx slot */
static GFXDECODE_START( gfx_wgp ) static GFXDECODE_START( gfx_wgp )
GFXDECODE_ENTRY( "gfx3", 0x0, wgp_tilelayout, 0, 256 ) /* sprites */ GFXDECODE_ENTRY( "sprites", 0x0, gfx_16x16x4_packed_lsb, 0, 256 ) /* sprites */
GFXDECODE_ENTRY( "gfx1", 0x0, charlayout, 0, 256 ) /* sprites & playfield */ GFXDECODE_ENTRY( "tc0100scn", 0x0, gfx_8x8x4_packed_msb, 0, 256 ) /* playfield */
GFXDECODE_ENTRY( "gfx2", 0x0, wgp_tile2layout, 0, 256 ) /* piv */ GFXDECODE_ENTRY( "piv", 0x0, gfx_16x16x4_packed_lsb, 0, 256 ) /* piv */
GFXDECODE_END GFXDECODE_END
@ -879,7 +847,7 @@ However sync to vblank is lacking, which is causing the
graphics glitches. graphics glitches.
***********************************************************/ ***********************************************************/
void wgp_state::postload() void wgp_state::device_post_load()
{ {
parse_control(); parse_control();
} }
@ -897,7 +865,7 @@ void wgp_state::machine_reset()
m_piv_scrolly[i] = 0; m_piv_scrolly[i] = 0;
} }
memset(m_rotate_ctrl, 0, 8 * sizeof(uint16_t)); std::fill(std::begin(m_rotate_ctrl), std::end(m_rotate_ctrl), 0);
} }
void wgp_state::machine_start() void wgp_state::machine_start()
@ -909,7 +877,6 @@ void wgp_state::machine_start()
save_item(NAME(m_cpua_ctrl)); save_item(NAME(m_cpua_ctrl));
save_item(NAME(m_port_sel)); save_item(NAME(m_port_sel));
machine().save().register_postload(save_prepost_delegate(FUNC(wgp_state::postload), this));
} }
void wgp_state::wgp(machine_config &config) void wgp_state::wgp(machine_config &config)
@ -999,20 +966,20 @@ ROM_START( wgp ) // labels actually have the character * instead of +
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */
ROM_LOAD( "c32-24.34", 0x00000, 0x10000, CRC(e9adb447) SHA1(8b7044b6ea864e4cfd60b87abd28c38caecb147d) ) ROM_LOAD( "c32-24.34", 0x00000, 0x10000, CRC(e9adb447) SHA1(8b7044b6ea864e4cfd60b87abd28c38caecb147d) )
ROM_REGION( 0x80000, "gfx1", 0 ) ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */ ROM_LOAD16_WORD_SWAP( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */
ROM_REGION( 0x200000, "gfx2", 0 ) ROM_REGION( 0x200000, "piv", 0 )
ROM_LOAD32_BYTE( "c32-04.9", 0x000000, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */ ROM_LOAD64_WORD( "c32-04.9", 0x000006, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */
ROM_LOAD32_BYTE( "c32-03.10", 0x000001, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) ) ROM_LOAD64_WORD( "c32-03.10", 0x000004, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) )
ROM_LOAD32_BYTE( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) ) ROM_LOAD64_WORD( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) )
ROM_LOAD32_BYTE( "c32-01.12", 0x000003, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) ) ROM_LOAD64_WORD( "c32-01.12", 0x000000, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) )
ROM_REGION( 0x200000, "gfx3", 0 ) ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */ ROM_LOAD32_WORD( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */
ROM_LOAD16_BYTE( "c32-06.70", 0x000001, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) ) ROM_LOAD32_WORD( "c32-06.70", 0x000002, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) )
ROM_LOAD16_BYTE( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) ) ROM_LOAD32_WORD( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) )
ROM_LOAD16_BYTE( "c32-08.68", 0x100001, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) ) ROM_LOAD32_WORD( "c32-08.68", 0x100002, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) )
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */ ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) ) ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) )
@ -1051,20 +1018,20 @@ ROM_START( wgpu )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */
ROM_LOAD( "c32-24.34", 0x00000, 0x10000, CRC(e9adb447) SHA1(8b7044b6ea864e4cfd60b87abd28c38caecb147d) ) ROM_LOAD( "c32-24.34", 0x00000, 0x10000, CRC(e9adb447) SHA1(8b7044b6ea864e4cfd60b87abd28c38caecb147d) )
ROM_REGION( 0x80000, "gfx1", 0 ) ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */ ROM_LOAD16_WORD_SWAP( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */
ROM_REGION( 0x200000, "gfx2", 0 ) ROM_REGION( 0x200000, "piv", 0 )
ROM_LOAD32_BYTE( "c32-04.9", 0x000000, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */ ROM_LOAD64_WORD( "c32-04.9", 0x000006, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */
ROM_LOAD32_BYTE( "c32-03.10", 0x000001, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) ) ROM_LOAD64_WORD( "c32-03.10", 0x000004, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) )
ROM_LOAD32_BYTE( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) ) ROM_LOAD64_WORD( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) )
ROM_LOAD32_BYTE( "c32-01.12", 0x000003, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) ) ROM_LOAD64_WORD( "c32-01.12", 0x000000, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) )
ROM_REGION( 0x200000, "gfx3", 0 ) ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */ ROM_LOAD32_WORD( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */
ROM_LOAD16_BYTE( "c32-06.70", 0x000001, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) ) ROM_LOAD32_WORD( "c32-06.70", 0x000002, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) )
ROM_LOAD16_BYTE( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) ) ROM_LOAD32_WORD( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) )
ROM_LOAD16_BYTE( "c32-08.68", 0x100001, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) ) ROM_LOAD32_WORD( "c32-08.68", 0x100002, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) )
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */ ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) ) ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) )
@ -1103,20 +1070,20 @@ ROM_START( wgpj )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */
ROM_LOAD( "c32-24.34", 0x00000, 0x10000, CRC(e9adb447) SHA1(8b7044b6ea864e4cfd60b87abd28c38caecb147d) ) ROM_LOAD( "c32-24.34", 0x00000, 0x10000, CRC(e9adb447) SHA1(8b7044b6ea864e4cfd60b87abd28c38caecb147d) )
ROM_REGION( 0x80000, "gfx1", 0 ) ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */ ROM_LOAD16_WORD_SWAP( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */
ROM_REGION( 0x200000, "gfx2", 0 ) ROM_REGION( 0x200000, "piv", 0 )
ROM_LOAD32_BYTE( "c32-04.9", 0x000000, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */ ROM_LOAD64_WORD( "c32-04.9", 0x000006, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */
ROM_LOAD32_BYTE( "c32-03.10", 0x000001, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) ) ROM_LOAD64_WORD( "c32-03.10", 0x000004, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) )
ROM_LOAD32_BYTE( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) ) ROM_LOAD64_WORD( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) )
ROM_LOAD32_BYTE( "c32-01.12", 0x000003, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) ) ROM_LOAD64_WORD( "c32-01.12", 0x000000, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) )
ROM_REGION( 0x200000, "gfx3", 0 ) ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */ ROM_LOAD32_WORD( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */
ROM_LOAD16_BYTE( "c32-06.70", 0x000001, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) ) ROM_LOAD32_WORD( "c32-06.70", 0x000002, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) )
ROM_LOAD16_BYTE( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) ) ROM_LOAD32_WORD( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) )
ROM_LOAD16_BYTE( "c32-08.68", 0x100001, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) ) ROM_LOAD32_WORD( "c32-08.68", 0x100002, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) )
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */ ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) ) ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) )
@ -1138,20 +1105,20 @@ ROM_START( wgpjoy )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */
ROM_LOAD( "c32-61.34", 0x00000, 0x10000, CRC(2fcad5a3) SHA1(f0f658490655b521af631af763c07e37834dc5a0) ) ROM_LOAD( "c32-61.34", 0x00000, 0x10000, CRC(2fcad5a3) SHA1(f0f658490655b521af631af763c07e37834dc5a0) )
ROM_REGION( 0x80000, "gfx1", 0 ) ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */ ROM_LOAD16_WORD_SWAP( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */
ROM_REGION( 0x200000, "gfx2", 0 ) ROM_REGION( 0x200000, "piv", 0 )
ROM_LOAD32_BYTE( "c32-04.9", 0x000000, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */ ROM_LOAD64_WORD( "c32-04.9", 0x000006, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */
ROM_LOAD32_BYTE( "c32-03.10", 0x000001, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) ) ROM_LOAD64_WORD( "c32-03.10", 0x000004, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) )
ROM_LOAD32_BYTE( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) ) ROM_LOAD64_WORD( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) )
ROM_LOAD32_BYTE( "c32-01.12", 0x000003, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) ) ROM_LOAD64_WORD( "c32-01.12", 0x000000, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) )
ROM_REGION( 0x200000, "gfx3", 0 ) ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */ ROM_LOAD32_WORD( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */
ROM_LOAD16_BYTE( "c32-06.70", 0x000001, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) ) ROM_LOAD32_WORD( "c32-06.70", 0x000002, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) )
ROM_LOAD16_BYTE( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) ) ROM_LOAD32_WORD( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) )
ROM_LOAD16_BYTE( "c32-08.68", 0x100001, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) ) ROM_LOAD32_WORD( "c32-08.68", 0x100002, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) )
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */ ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) ) ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) )
@ -1173,20 +1140,20 @@ ROM_START( wgpjoya ) /* Older joystick version ??? */
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */
ROM_LOAD( "c32-61.34", 0x00000, 0x10000, CRC(2fcad5a3) SHA1(f0f658490655b521af631af763c07e37834dc5a0) ) ROM_LOAD( "c32-61.34", 0x00000, 0x10000, CRC(2fcad5a3) SHA1(f0f658490655b521af631af763c07e37834dc5a0) )
ROM_REGION( 0x80000, "gfx1", 0 ) ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */ ROM_LOAD16_WORD_SWAP( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */
ROM_REGION( 0x200000, "gfx2", 0 ) ROM_REGION( 0x200000, "piv", 0 )
ROM_LOAD32_BYTE( "c32-04.9", 0x000000, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */ ROM_LOAD64_WORD( "c32-04.9", 0x000006, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */
ROM_LOAD32_BYTE( "c32-03.10", 0x000001, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) ) ROM_LOAD64_WORD( "c32-03.10", 0x000004, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) )
ROM_LOAD32_BYTE( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) ) ROM_LOAD64_WORD( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) )
ROM_LOAD32_BYTE( "c32-01.12", 0x000003, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) ) ROM_LOAD64_WORD( "c32-01.12", 0x000000, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) )
ROM_REGION( 0x200000, "gfx3", 0 ) ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */ ROM_LOAD32_WORD( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */
ROM_LOAD16_BYTE( "c32-06.70", 0x000001, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) ) ROM_LOAD32_WORD( "c32-06.70", 0x000002, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) )
ROM_LOAD16_BYTE( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) ) ROM_LOAD32_WORD( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) )
ROM_LOAD16_BYTE( "c32-08.68", 0x100001, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) ) ROM_LOAD32_WORD( "c32-08.68", 0x100002, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) )
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */ ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) ) ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) )
@ -1208,20 +1175,20 @@ ROM_START( wgp2 )
ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */ ROM_REGION( 0x10000, "audiocpu", 0 ) /* Z80 sound cpu */
ROM_LOAD( "c73-05.34", 0x00000, 0x10000, CRC(7e00a299) SHA1(93696a229f17a15a92a8d9ef3b34d340de5dec44) ) ROM_LOAD( "c73-05.34", 0x00000, 0x10000, CRC(7e00a299) SHA1(93696a229f17a15a92a8d9ef3b34d340de5dec44) )
ROM_REGION( 0x80000, "gfx1", 0 ) ROM_REGION( 0x80000, "tc0100scn", 0 )
ROM_LOAD( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */ ROM_LOAD16_WORD_SWAP( "c32-09.16", 0x00000, 0x80000, CRC(96495f35) SHA1(ce99b4d8aeb98304e8ae3aa4966289c76ae4ff69) ) /* SCR */
ROM_REGION( 0x200000, "gfx2", 0 ) ROM_REGION( 0x200000, "piv", 0 )
ROM_LOAD32_BYTE( "c32-04.9", 0x000000, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */ ROM_LOAD64_WORD( "c32-04.9", 0x000006, 0x80000, CRC(473a19c9) SHA1(4c632f4d5b725790a1be9d1143318d2f682fe9be) ) /* PIV */
ROM_LOAD32_BYTE( "c32-03.10", 0x000001, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) ) ROM_LOAD64_WORD( "c32-03.10", 0x000004, 0x80000, CRC(9ec3e134) SHA1(e82a50927e10e551124a3b81399b052974cfba12) )
ROM_LOAD32_BYTE( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) ) ROM_LOAD64_WORD( "c32-02.11", 0x000002, 0x80000, CRC(c5721f3a) SHA1(4a8e9412de23001b09eb3425ba6006b4c09a907b) )
ROM_LOAD32_BYTE( "c32-01.12", 0x000003, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) ) ROM_LOAD64_WORD( "c32-01.12", 0x000000, 0x80000, CRC(d27d7d93) SHA1(82ae5856bbdb49cb8c2ca20eef86f6b617ea2c45) )
ROM_REGION( 0x200000, "gfx3", 0 ) ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */ ROM_LOAD32_WORD( "c32-05.71", 0x000000, 0x80000, CRC(3698d47a) SHA1(71978f9e1f58fa1259e67d8a7ea68e3ec1314c6b) ) /* OBJ */
ROM_LOAD16_BYTE( "c32-06.70", 0x000001, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) ) ROM_LOAD32_WORD( "c32-06.70", 0x000002, 0x80000, CRC(f0267203) SHA1(7fd7b8d7a9efa405fc647c16fb99ffcb1fe985c5) )
ROM_LOAD16_BYTE( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) ) ROM_LOAD32_WORD( "c32-07.69", 0x100000, 0x80000, CRC(743d46bd) SHA1(6b655b3fbfad8b52e38d7388aab564f5fa3e778c) )
ROM_LOAD16_BYTE( "c32-08.68", 0x100001, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) ) ROM_LOAD32_WORD( "c32-08.68", 0x100002, 0x80000, CRC(faab63b0) SHA1(6e1aaf2642bee7d7bc9e21a7bf7f81d9ff766c50) )
ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */ ROM_REGION( 0x80000, "ymsnd", 0 ) /* ADPCM samples */
ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) ) ROM_LOAD( "c32-11.8", 0x00000, 0x80000, CRC(2b326ff0) SHA1(3c442e3c97234e4514a7bed31644212586869bd0) )
@ -1239,7 +1206,7 @@ void wgp_state::init_wgp()
#if 0 #if 0
/* Patch for coding error that causes corrupt data in /* Patch for coding error that causes corrupt data in
sprite tilemapping area from $4083c0-847f */ sprite tilemapping area from $4083c0-847f */
uint16_t *ROM = (uint16_t *)memregion("maincpu")->base(); u16 *ROM = (u16 *)memregion("maincpu")->base();
ROM[0x25dc / 2] = 0x0602; // faulty value is 0x0206 ROM[0x25dc / 2] = 0x0602; // faulty value is 0x0206
#endif #endif
} }
@ -1247,7 +1214,7 @@ void wgp_state::init_wgp()
void wgp_state::init_wgp2() void wgp_state::init_wgp2()
{ {
/* Code patches to prevent failure in memory checks */ /* Code patches to prevent failure in memory checks */
uint16_t *ROM = (uint16_t *)memregion("sub")->base(); u16 *ROM = (u16 *)memregion("sub")->base();
ROM[0x8008 / 2] = 0x0; ROM[0x8008 / 2] = 0x0;
ROM[0x8010 / 2] = 0x0; ROM[0x8010 / 2] = 0x0;
} }

View File

@ -57,57 +57,54 @@ protected:
virtual void machine_reset() override; virtual void machine_reset() override;
virtual void video_start() override; virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual void device_post_load() override;
private: private:
DECLARE_WRITE8_MEMBER(coins_w); void coins_w(u8 data);
DECLARE_WRITE16_MEMBER(cpua_ctrl_w); void cpua_ctrl_w(u16 data);
DECLARE_READ16_MEMBER(lan_status_r); u16 lan_status_r();
DECLARE_WRITE16_MEMBER(rotate_port_w); void rotate_port_w(offs_t offset, u16 data);
DECLARE_READ16_MEMBER(adinput_r); u16 adinput_r(offs_t offset);
DECLARE_WRITE16_MEMBER(adinput_w); void adinput_w(u16 data);
DECLARE_WRITE8_MEMBER(sound_bankswitch_w); void sound_bankswitch_w(u8 data);
DECLARE_WRITE16_MEMBER(pivram_word_w); void pivram_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_WRITE16_MEMBER(piv_ctrl_word_w); void piv_ctrl_word_w(offs_t offset, u16 data, u16 mem_mask = ~0);
DECLARE_VIDEO_START(wgp2); DECLARE_VIDEO_START(wgp2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(cpub_interrupt); INTERRUPT_GEN_MEMBER(cpub_interrupt);
void cpu2_map(address_map &map); void cpu2_map(address_map &map);
void main_map(address_map &map); void main_map(address_map &map);
void z80_sound_map(address_map &map); void z80_sound_map(address_map &map);
TILE_GET_INFO_MEMBER(get_piv0_tile_info); template<unsigned Offset> TILE_GET_INFO_MEMBER(get_piv_tile_info);
TILE_GET_INFO_MEMBER(get_piv1_tile_info);
TILE_GET_INFO_MEMBER(get_piv2_tile_info);
void postload();
inline void common_get_piv_tile_info(tile_data &tileinfo, int tile_index, int num);
void core_vh_start(int piv_xoffs, int piv_yoffs); void core_vh_start(int piv_xoffs, int piv_yoffs);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs); void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs);
void piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, uint32_t priority); void piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u32 priority);
void parse_control(); void parse_control();
/* memory pointers */ /* memory pointers */
required_shared_ptr<uint16_t> m_spritemap; required_shared_ptr<u16> m_spritemap;
required_shared_ptr<uint16_t> m_spriteram; required_shared_ptr<u16> m_spriteram;
required_shared_ptr<uint16_t> m_pivram; required_shared_ptr<u16> m_pivram;
required_shared_ptr<uint16_t> m_piv_ctrlram; required_shared_ptr<u16> m_piv_ctrlram;
/* video-related */ /* video-related */
tilemap_t *m_piv_tilemap[3]; tilemap_t *m_piv_tilemap[3];
uint16_t m_piv_ctrl_reg; u16 m_piv_ctrl_reg;
uint16_t m_piv_zoom[3]; u16 m_piv_zoom[3];
uint16_t m_piv_scrollx[3]; u16 m_piv_scrollx[3];
uint16_t m_piv_scrolly[3]; u16 m_piv_scrolly[3];
uint16_t m_rotate_ctrl[8]; u16 m_rotate_ctrl[8];
int m_piv_xoffs; int m_piv_xoffs;
int m_piv_yoffs; int m_piv_yoffs;
uint8_t m_dislayer[4]; u8 m_dislayer[4];
/* misc */ /* misc */
uint16_t m_cpua_ctrl; u16 m_cpua_ctrl;
uint16_t m_port_sel; u16 m_port_sel;
emu_timer *m_int6_timer; emu_timer *m_int6_timer;
emu_timer *m_cpub_int6_timer; emu_timer *m_cpub_int6_timer;

View File

@ -5,12 +5,14 @@
#include "screen.h" #include "screen.h"
// reference : https://www.youtube.com/watch?v=Sb3I3eQQvcU
/*******************************************************************/ /*******************************************************************/
inline void wgp_state::common_get_piv_tile_info(tile_data &tileinfo, int tile_index, int num) template<unsigned Offset>
TILE_GET_INFO_MEMBER(wgp_state::get_piv_tile_info)
{ {
uint16_t tilenum = m_pivram[tile_index + num * 0x1000]; /* 3 blocks of $2000 */ const u16 tilenum = m_pivram[tile_index + Offset]; /* 3 blocks of $2000 */
uint16_t attr = m_pivram[tile_index + num * 0x1000 + 0x8000]; /* 3 blocks of $2000 */ const u16 attr = m_pivram[tile_index + Offset + 0x8000]; /* 3 blocks of $2000 */
SET_TILE_INFO_MEMBER(2, SET_TILE_INFO_MEMBER(2,
tilenum & 0x3fff, tilenum & 0x3fff,
@ -18,27 +20,12 @@ inline void wgp_state::common_get_piv_tile_info(tile_data &tileinfo, int tile_in
TILE_FLIPYX((attr & 0xc0) >> 6)); TILE_FLIPYX((attr & 0xc0) >> 6));
} }
TILE_GET_INFO_MEMBER(wgp_state::get_piv0_tile_info)
{
common_get_piv_tile_info(tileinfo, tile_index, 0);
}
TILE_GET_INFO_MEMBER(wgp_state::get_piv1_tile_info)
{
common_get_piv_tile_info(tileinfo, tile_index, 1);
}
TILE_GET_INFO_MEMBER(wgp_state::get_piv2_tile_info)
{
common_get_piv_tile_info(tileinfo, tile_index, 2);
}
void wgp_state::core_vh_start(int piv_xoffs, int piv_yoffs) void wgp_state::core_vh_start(int piv_xoffs, int piv_yoffs)
{ {
m_piv_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wgp_state::get_piv0_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_piv_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wgp_state::get_piv_tile_info<0x0000>),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_piv_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wgp_state::get_piv1_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_piv_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wgp_state::get_piv_tile_info<0x1000>),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_piv_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wgp_state::get_piv2_tile_info),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64); m_piv_tilemap[2] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wgp_state::get_piv_tile_info<0x2000>),this), TILEMAP_SCAN_ROWS, 16, 16, 64, 64);
m_piv_xoffs = piv_xoffs; m_piv_xoffs = piv_xoffs;
m_piv_yoffs = piv_yoffs; m_piv_yoffs = piv_yoffs;
@ -120,7 +107,7 @@ custom chip capable of four rather than three tilemaps.)
*******************************************************************/ *******************************************************************/
WRITE16_MEMBER(wgp_state::pivram_word_w) void wgp_state::pivram_word_w(offs_t offset, u16 data, u16 mem_mask)
{ {
COMBINE_DATA(&m_pivram[offset]); COMBINE_DATA(&m_pivram[offset]);
@ -138,9 +125,9 @@ WRITE16_MEMBER(wgp_state::pivram_word_w)
} }
} }
WRITE16_MEMBER(wgp_state::piv_ctrl_word_w) void wgp_state::piv_ctrl_word_w(offs_t offset, u16 data, u16 mem_mask)
{ {
uint16_t a, b; u16 a, b;
COMBINE_DATA(&m_piv_ctrlram[offset]); COMBINE_DATA(&m_piv_ctrlram[offset]);
data = m_piv_ctrlram[offset]; data = m_piv_ctrlram[offset];
@ -317,13 +304,13 @@ Memory Map
structure for each big sprite: the hardware is probably structure for each big sprite: the hardware is probably
constructing each 4x4 sprite from 4 2x2 sprites... */ constructing each 4x4 sprite from 4 2x2 sprites... */
static const uint8_t xlookup[16] = static const u8 xlookup[16] =
{ 0, 1, 0, 1, { 0, 1, 0, 1,
2, 3, 2, 3, 2, 3, 2, 3,
0, 1, 0, 1, 0, 1, 0, 1,
2, 3, 2, 3 }; 2, 3, 2, 3 };
static const uint8_t ylookup[16] = static const u8 ylookup[16] =
{ 0, 0, 1, 1, { 0, 0, 1, 1,
0, 0, 1, 1, 0, 0, 1, 1,
2, 2, 3, 3, 2, 2, 3, 3,
@ -331,44 +318,39 @@ static const uint8_t ylookup[16] =
void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs) void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs)
{ {
uint16_t *spriteram = m_spriteram; int i, j, k;
int offs, i, j, k; // u16 rotate = 0;
int x, y, curx, cury; const u32 tile_mask = (m_gfxdecode->gfx(0)->elements()) - 1;
int zx, zy, zoomx, zoomy, priority = 0; static const u32 primasks[2] = {0x0, 0xfffc}; /* fff0 => under rhs of road only */
uint8_t small_sprite, col, flipx, flipy;
uint16_t code, bigsprite, map_index;
// uint16_t rotate = 0;
uint16_t tile_mask = (m_gfxdecode->gfx(0)->elements()) - 1;
static const int primasks[2] = {0x0, 0xfffc}; /* fff0 => under rhs of road only */
for (offs = 0x1ff; offs >= 0; offs--) for (int offs = 0x1ff; offs >= 0; offs--)
{ {
code = (spriteram[0xe00 + offs]); const int code = (m_spriteram[0xe00 + offs]);
if (code) /* do we have an active sprite ? */ if (code) /* do we have an active sprite ? */
{ {
i = (code << 3) & 0xfff; /* yes, so we look up its sprite entry */ i = (code << 3) & 0xfff; /* yes, so we look up its sprite entry */
x = spriteram[i]; int x = m_spriteram[i];
y = spriteram[i + 1]; int y = m_spriteram[i + 1];
bigsprite = spriteram[i + 2] & 0x3fff; const int bigsprite = m_spriteram[i + 2] & 0x3fff;
/* The last five words [i + 3 through 7] must be zoom/rotation /* The last five words [i + 3 through 7] must be zoom/rotation
control: for time being we kludge zoom using 1 word. control: for time being we kludge zoom using 1 word.
Timing problems are causing many glitches. */ Timing problems are causing many glitches. */
if ((spriteram[i + 4] == 0xfff6) && (spriteram[i + 5] == 0)) if ((m_spriteram[i + 4] == 0xfff6) && (m_spriteram[i + 5] == 0))
continue; continue;
// if (((spriteram[i + 4] != 0xf800) && (spriteram[i + 4] != 0xfff6)) // if (((m_spriteram[i + 4] != 0xf800) && (m_spriteram[i + 4] != 0xfff6))
// || ((spriteram[i + 5] != 0xf800) && (spriteram[i + 5] != 0)) // || ((m_spriteram[i + 5] != 0xf800) && (m_spriteram[i + 5] != 0))
// || spriteram[i + 7] != 0) // || m_spriteram[i + 7] != 0)
// rotate = i << 1; // rotate = i << 1;
/***** Begin zoom kludge ******/ /***** Begin zoom kludge ******/
zoomx = (spriteram[i + 3] & 0x1ff) + 1; const int zoomx = (m_spriteram[i + 3] & 0x1ff) + 1;
zoomy = (spriteram[i + 3] & 0x1ff) + 1; const int zoomy = (m_spriteram[i + 3] & 0x1ff) + 1;
y -= 4; y -= 4;
// distant sprites were some 16 pixels too far down // // distant sprites were some 16 pixels too far down //
@ -380,38 +362,38 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const
if (x & 0x8000) x -= 0x10000; if (x & 0x8000) x -= 0x10000;
if (y & 0x8000) y -= 0x10000; if (y & 0x8000) y -= 0x10000;
map_index = bigsprite << 1; /* now we access sprite tilemap */ const int map_index = bigsprite << 1; /* now we access sprite tilemap */
/* don't know what selects 2x2 sprites: we use a nasty kludge which seems to work */ /* don't know what selects 2x2 sprites: we use a nasty kludge which seems to work */
i = m_spritemap[map_index + 0xa]; i = m_spritemap[map_index + 0xa];
j = m_spritemap[map_index + 0xc]; j = m_spritemap[map_index + 0xc];
small_sprite = ((i > 0) & (i <= 8) & (j > 0) & (j <= 8)); const bool small_sprite = ((i > 0) & (i <= 8) & (j > 0) & (j <= 8));
if (small_sprite) if (small_sprite)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
code = m_spritemap[(map_index + (i << 1))] & tile_mask; const u32 tile = m_spritemap[(map_index + (i << 1))] & tile_mask;
col = m_spritemap[(map_index + (i << 1) + 1)] & 0xf; const u32 col = m_spritemap[(map_index + (i << 1) + 1)] & 0xf;
/* not known what controls priority */ /* not known what controls priority */
priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4; const int priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4;
flipx = 0; // no flip xy? int flipx = 0; // no flip xy?
flipy = 0; int flipy = 0;
k = xlookup[i]; // assumes no xflip k = xlookup[i]; // assumes no xflip
j = ylookup[i]; // assumes no yflip j = ylookup[i]; // assumes no yflip
curx = x + ((k * zoomx) / 2); const int curx = x + ((k * zoomx) / 2);
cury = y + ((j * zoomy) / 2); const int cury = y + ((j * zoomy) / 2);
zx = x + (((k + 1) * zoomx) / 2) - curx; const int zx = x + (((k + 1) * zoomx) / 2) - curx;
zy = y + (((j + 1) * zoomy) / 2) - cury; const int zy = y + (((j + 1) * zoomy) / 2) - cury;
m_gfxdecode->gfx(0)->prio_zoom_transpen(bitmap,cliprect, m_gfxdecode->gfx(0)->prio_zoom_transpen(bitmap,cliprect,
code, tile,
col, col,
flipx, flipy, flipx, flipy,
curx,cury, curx,cury,
@ -423,26 +405,26 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const
{ {
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
code = m_spritemap[(map_index + (i << 1))] & tile_mask; const u32 tile = m_spritemap[(map_index + (i << 1))] & tile_mask;
col = m_spritemap[(map_index + (i << 1) + 1)] & 0xf; const u32 col = m_spritemap[(map_index + (i << 1) + 1)] & 0xf;
/* not known what controls priority */ /* not known what controls priority */
priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4; const int priority = (m_spritemap[(map_index + (i << 1) + 1)] & 0x70) >> 4;
flipx = 0; // no flip xy? int flipx = 0; // no flip xy?
flipy = 0; int flipy = 0;
k = xlookup[i]; // assumes no xflip k = xlookup[i]; // assumes no xflip
j = ylookup[i]; // assumes no yflip j = ylookup[i]; // assumes no yflip
curx = x + ((k * zoomx) / 4); const int curx = x + ((k * zoomx) / 4);
cury = y + ((j * zoomy) / 4); const int cury = y + ((j * zoomy) / 4);
zx = x + (((k + 1) * zoomx) / 4) - curx; const int zx = x + (((k + 1) * zoomx) / 4) - curx;
zy = y + (((j + 1) * zoomy) / 4) - cury; const int zy = y + (((j + 1) * zoomy) / 4) - cury;
m_gfxdecode->gfx(0)->prio_zoom_transpen(bitmap,cliprect, m_gfxdecode->gfx(0)->prio_zoom_transpen(bitmap,cliprect,
code, tile,
col, col,
flipx, flipy, flipx, flipy,
curx,cury, curx,cury,
@ -469,20 +451,20 @@ void wgp_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const
*********************************************************/ *********************************************************/
static inline void bryan2_drawscanline(bitmap_ind16 &bitmap, int x, int y, int length, static inline void bryan2_drawscanline(bitmap_ind16 &bitmap, int x, int y, int length,
const uint16_t *src, int transparent, uint32_t orient, bitmap_ind8 &priority, int pri) const u16 *src, bool transparent, u32 orient, bitmap_ind8 &priority, u8 pri, u8 primask = 0xff)
{ {
uint16_t *dsti = &bitmap.pix16(y, x); u16 *dsti = &bitmap.pix16(y, x);
uint8_t *dstp = &priority.pix8(y, x); u8 *dstp = &priority.pix8(y, x);
if (transparent) if (transparent)
{ {
while (length--) while (length--)
{ {
uint32_t spixel = *src++; const u32 spixel = *src++;
if (spixel < 0x7fff) if (spixel < 0x7fff)
{ {
*dsti = spixel; *dsti = spixel;
*dstp = pri; *dstp = (*dstp & primask) | pri;
} }
dsti++; dsti++;
dstp++; dstp++;
@ -493,38 +475,35 @@ static inline void bryan2_drawscanline(bitmap_ind16 &bitmap, int x, int y, int l
while (length--) while (length--)
{ {
*dsti++ = *src++; *dsti++ = *src++;
*dstp++ = pri; *dstp = (*dstp & primask) | pri;
dstp++;
} }
} }
} }
void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, uint32_t priority) void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, u32 priority)
{ {
bitmap_ind16 &srcbitmap = m_piv_tilemap[layer]->pixmap(); bitmap_ind16 &srcbitmap = m_piv_tilemap[layer]->pixmap();
bitmap_ind8 &flagsbitmap = m_piv_tilemap[layer]->flagsmap(); bitmap_ind8 &flagsbitmap = m_piv_tilemap[layer]->flagsmap();
uint16_t *dst16,*src16; int y_index;
uint8_t *tsrc;
int y_index, src_y_index, row_index, row_zoom;
/* I have a fairly strong feeling these should be uint32_t's, x_index is /* I have a fairly strong feeling these should be u32's, x_index is
falling through from max +ve to max -ve quite a lot in this routine */ falling through from max +ve to max -ve quite a lot in this routine */
int sx, x_index, x_step; int sx;
uint32_t zoomx, zoomy; u16 scanline[512];
uint16_t scanline[512];
uint16_t row_colbank, row_scroll;
int flipscreen = 0; /* n/a */ int flipscreen = 0; /* n/a */
uint16_t screen_width = cliprect.width(); const int screen_width = cliprect.width();
uint16_t min_y = cliprect.min_y; const int min_y = cliprect.min_y;
uint16_t max_y = cliprect.max_y; const int max_y = cliprect.max_y;
int width_mask = 0x3ff; const int width_mask = 0x3ff;
zoomx = 0x10000; /* No overall X zoom, unlike TC0480SCP */ const u32 zoomx = 0x10000; /* No overall X zoom, unlike TC0480SCP */
/* Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max ??? /* Y-axis zoom offers expansion/compression: 0x7f = no zoom, 0xff = max ???
In WGP see: stage 4 (big spectator stand) In WGP see: stage 4 (big spectator stand)
@ -534,7 +513,7 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons
In WGP2 see: road at big hill (default course) */ In WGP2 see: road at big hill (default course) */
/* This calculation may be wrong, the y_index one too */ /* This calculation may be wrong, the y_index one too */
zoomy = 0x10000 - (((m_piv_ctrlram[0x08 + layer] & 0xff) - 0x7f) * 512); const u32 zoomy = 0x10000 - (((m_piv_ctrlram[0x08 + layer] & 0xff) - 0x7f) * 512);
if (!flipscreen) if (!flipscreen)
{ {
@ -554,22 +533,22 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons
{ {
int a; int a;
src_y_index = (y_index >> 16) & 0x3ff; const int src_y_index = (y_index >> 16) & 0x3ff;
row_index = src_y_index; const int row_index = src_y_index;
row_zoom = m_pivram[row_index + layer * 0x400 + 0x3400] & 0xff; const int row_zoom = m_pivram[row_index + layer * 0x400 + 0x3400] & 0xff;
row_colbank = m_pivram[row_index + layer * 0x400 + 0x3400] >> 8; u16 row_colbank = m_pivram[row_index + layer * 0x400 + 0x3400] >> 8;
a = (row_colbank & 0xe0); /* kill bit 4 */ a = (row_colbank & 0xe0); /* kill bit 4 */
row_colbank = (((row_colbank & 0xf) << 1) | a) << 4; row_colbank = (((row_colbank & 0xf) << 1) | a) << 4;
row_scroll = m_pivram[row_index + layer * 0x1000 + 0x4000]; u16 row_scroll = m_pivram[row_index + layer * 0x1000 + 0x4000];
a = (row_scroll & 0xffe0) >> 1; /* kill bit 4 */ a = (row_scroll & 0xffe0) >> 1; /* kill bit 4 */
row_scroll = ((row_scroll & 0xf) | a) & width_mask; row_scroll = ((row_scroll & 0xf) | a) & width_mask;
x_index = sx - (row_scroll << 16); int x_index = sx - (row_scroll << 16);
x_step = zoomx; int x_step = zoomx;
if (row_zoom > 0x7f) /* zoom in: reduce x_step */ if (row_zoom > 0x7f) /* zoom in: reduce x_step */
{ {
x_step -= (((row_zoom - 0x7f) << 8) & 0xffff); x_step -= (((row_zoom - 0x7f) << 8) & 0xffff);
@ -579,9 +558,9 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons
x_step += (((0x7f - row_zoom) << 8) & 0xffff); x_step += (((0x7f - row_zoom) << 8) & 0xffff);
} }
src16 = &srcbitmap.pix16(src_y_index); u16 *src16 = &srcbitmap.pix16(src_y_index);
tsrc = &flagsbitmap.pix8(src_y_index); u8 *tsrc = &flagsbitmap.pix8(src_y_index);
dst16 = scanline; u16 *dst16 = scanline;
if (flags & TILEMAP_DRAW_OPAQUE) if (flags & TILEMAP_DRAW_OPAQUE)
{ {
@ -603,7 +582,7 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons
} }
} }
bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, screen.priority(), priority); bryan2_drawscanline(bitmap, 0, y, screen_width, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? false : true, ROT0, screen.priority(), priority);
y_index += zoomy; y_index += zoomy;
} }
@ -615,10 +594,9 @@ void wgp_state::piv_layer_draw(screen_device &screen, bitmap_ind16 &bitmap, cons
SCREEN REFRESH SCREEN REFRESH
**************************************************************/ **************************************************************/
uint32_t wgp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) u32 wgp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
int i; u8 layer[3];
uint8_t layer[3];
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
if (machine().input().code_pressed_once (KEYCODE_V)) if (machine().input().code_pressed_once (KEYCODE_V))
@ -646,7 +624,7 @@ uint32_t wgp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
} }
#endif #endif
for (i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
m_piv_tilemap[i]->set_scrollx(0, m_piv_scrollx[i]); m_piv_tilemap[i]->set_scrollx(0, m_piv_scrollx[i]);
m_piv_tilemap[i]->set_scrolly(0, m_piv_scrolly[i]); m_piv_tilemap[i]->set_scrolly(0, m_piv_scrolly[i]);
@ -654,6 +632,7 @@ uint32_t wgp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
m_tc0100scn->tilemap_update(); m_tc0100scn->tilemap_update();
screen.priority().fill(0, cliprect);
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
layer[0] = 0; layer[0] = 0;
@ -713,7 +692,7 @@ uint32_t wgp_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, c
char buf[80]; char buf[80];
int i; int i;
for (i = 0; i < 8; i += 1) for (int i = 0; i < 8; i += 1)
{ {
sprintf (buf, "%02x: %04x", i, rotate_ctrl[i]); sprintf (buf, "%02x: %04x", i, rotate_ctrl[i]);
ui_draw_text (buf, 0, i*8); ui_draw_text (buf, 0, i*8);