Modernization of drivers part 11 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-08 14:27:23 +00:00
parent 6820f80e8a
commit fdad18e0f5
39 changed files with 590 additions and 588 deletions

View File

@ -707,8 +707,8 @@ ROM_END
DRIVER_INIT_MEMBER(leland_state,ataxx) DRIVER_INIT_MEMBER(leland_state,ataxx)
{ {
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this));
@ -717,8 +717,8 @@ DRIVER_INIT_MEMBER(leland_state,ataxx)
DRIVER_INIT_MEMBER(leland_state,ataxxj) DRIVER_INIT_MEMBER(leland_state,ataxxj)
{ {
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this));
@ -727,8 +727,8 @@ DRIVER_INIT_MEMBER(leland_state,ataxxj)
DRIVER_INIT_MEMBER(leland_state,wsf) DRIVER_INIT_MEMBER(leland_state,wsf)
{ {
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P1_P2"); machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P1_P2");
@ -739,8 +739,8 @@ DRIVER_INIT_MEMBER(leland_state,wsf)
DRIVER_INIT_MEMBER(leland_state,indyheat) DRIVER_INIT_MEMBER(leland_state,indyheat)
{ {
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x02, read8_delegate(FUNC(leland_state::indyheat_wheel_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x02, read8_delegate(FUNC(leland_state::indyheat_wheel_r),this));
@ -756,8 +756,8 @@ DRIVER_INIT_MEMBER(leland_state,indyheat)
DRIVER_INIT_MEMBER(leland_state,brutforc) DRIVER_INIT_MEMBER(leland_state,brutforc)
{ {
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P2"); machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P2");
@ -768,8 +768,8 @@ DRIVER_INIT_MEMBER(leland_state,brutforc)
DRIVER_INIT_MEMBER(leland_state,asylum) DRIVER_INIT_MEMBER(leland_state,asylum)
{ {
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* asylum appears to have some extra RAM for the slave CPU */ /* asylum appears to have some extra RAM for the slave CPU */
machine().device("slave")->memory().space(AS_PROGRAM).install_ram(0xf000, 0xfffb); machine().device("slave")->memory().space(AS_PROGRAM).install_ram(0xf000, 0xfffb);

View File

@ -908,13 +908,13 @@ static const gfx_layout legionna_new_charlayout =
}; };
static void descramble_legionnaire_gfx(running_machine &machine, UINT8* src) void legionna_state::descramble_legionnaire_gfx(UINT8* src)
{ {
UINT8 *buffer; UINT8 *buffer;
int len = 0x10000; int len = 0x10000;
/* rearrange gfx */ /* rearrange gfx */
buffer = auto_alloc_array(machine, UINT8, len); buffer = auto_alloc_array(machine(), UINT8, len);
{ {
int i; int i;
for (i = 0;i < len; i++) for (i = 0;i < len; i++)
@ -928,7 +928,7 @@ static void descramble_legionnaire_gfx(running_machine &machine, UINT8* src)
3,2,1,0)]; 3,2,1,0)];
} }
memcpy(src,buffer,len); memcpy(src,buffer,len);
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
} }
@ -2340,7 +2340,7 @@ DRIVER_INIT_MEMBER(legionna_state,denjinmk)
DRIVER_INIT_MEMBER(legionna_state,legiongfx) DRIVER_INIT_MEMBER(legionna_state,legiongfx)
{ {
descramble_legionnaire_gfx( machine(), machine().root_device().memregion("gfx5")->base() ); descramble_legionnaire_gfx(machine().root_device().memregion("gfx5")->base() );
} }

View File

@ -1978,28 +1978,27 @@ ROM_END
* *
*************************************/ *************************************/
static void init_master_ports(running_machine &machine, UINT8 mvram_base, UINT8 io_base) void leland_state::init_master_ports(UINT8 mvram_base, UINT8 io_base)
{ {
leland_state *state = machine.driver_data<leland_state>();
/* set up the master CPU VRAM I/O */ /* set up the master CPU VRAM I/O */
machine.device("master")->memory().space(AS_IO).install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),state), write8_delegate(FUNC(leland_state::leland_mvram_port_w),state)); machine().device("master")->memory().space(AS_IO).install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),this), write8_delegate(FUNC(leland_state::leland_mvram_port_w),this));
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
machine.device("master")->memory().space(AS_IO).install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),state)); machine().device("master")->memory().space(AS_IO).install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),this));
machine.device("master")->memory().space(AS_IO).install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),state)); machine().device("master")->memory().space(AS_IO).install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),this));
} }
DRIVER_INIT_MEMBER(leland_state,cerberus) DRIVER_INIT_MEMBER(leland_state,cerberus)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = cerberus_bankswitch; m_update_master_bank = &leland_state::cerberus_bankswitch;
membank("bank1")->set_base(memregion("master")->base() + 0x2000); membank("bank1")->set_base(memregion("master")->base() + 0x2000);
membank("bank2")->set_base(memregion("master")->base() + 0xa000); membank("bank2")->set_base(memregion("master")->base() + 0xa000);
membank("bank3")->set_base(memregion("slave")->base() + 0x2000); membank("bank3")->set_base(memregion("slave")->base() + 0x2000);
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x40, 0x80); init_master_ports(0x40, 0x80);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this));
@ -2010,40 +2009,40 @@ DRIVER_INIT_MEMBER(leland_state,cerberus)
DRIVER_INIT_MEMBER(leland_state,mayhem) DRIVER_INIT_MEMBER(leland_state,mayhem)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = mayhem_bankswitch; m_update_master_bank = &leland_state::mayhem_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
} }
DRIVER_INIT_MEMBER(leland_state,powrplay) DRIVER_INIT_MEMBER(leland_state,powrplay)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = mayhem_bankswitch; m_update_master_bank = &leland_state::mayhem_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x40, 0x80); init_master_ports(0x40, 0x80);
} }
DRIVER_INIT_MEMBER(leland_state,wseries) DRIVER_INIT_MEMBER(leland_state,wseries)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = mayhem_bankswitch; m_update_master_bank = &leland_state::mayhem_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x40, 0x80); init_master_ports(0x40, 0x80);
} }
DRIVER_INIT_MEMBER(leland_state,alleymas) DRIVER_INIT_MEMBER(leland_state,alleymas)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = mayhem_bankswitch; m_update_master_bank = &leland_state::mayhem_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
/* kludge warning: the game uses location E0CA to determine if the joysticks are available */ /* kludge warning: the game uses location E0CA to determine if the joysticks are available */
/* it gets cleared by the code, but there is no obvious way for the value to be set to a */ /* it gets cleared by the code, but there is no obvious way for the value to be set to a */
@ -2055,20 +2054,20 @@ DRIVER_INIT_MEMBER(leland_state,alleymas)
DRIVER_INIT_MEMBER(leland_state,upyoural) DRIVER_INIT_MEMBER(leland_state,upyoural)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = mayhem_bankswitch; m_update_master_bank = &leland_state::mayhem_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
} }
DRIVER_INIT_MEMBER(leland_state,dangerz) DRIVER_INIT_MEMBER(leland_state,dangerz)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = dangerz_bankswitch; m_update_master_bank = &leland_state::dangerz_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x40, 0x80); init_master_ports(0x40, 0x80);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this));
@ -2080,42 +2079,42 @@ DRIVER_INIT_MEMBER(leland_state,dangerz)
DRIVER_INIT_MEMBER(leland_state,basebal2) DRIVER_INIT_MEMBER(leland_state,basebal2)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = basebal2_bankswitch; m_update_master_bank = &leland_state::basebal2_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
} }
DRIVER_INIT_MEMBER(leland_state,dblplay) DRIVER_INIT_MEMBER(leland_state,dblplay)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = basebal2_bankswitch; m_update_master_bank = &leland_state::basebal2_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x80, 0x40); init_master_ports(0x80, 0x40);
} }
DRIVER_INIT_MEMBER(leland_state,strkzone) DRIVER_INIT_MEMBER(leland_state,strkzone)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = basebal2_bankswitch; m_update_master_bank = &leland_state::basebal2_bankswitch;
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0x40); init_master_ports(0x00, 0x40);
} }
DRIVER_INIT_MEMBER(leland_state,redlin2p) DRIVER_INIT_MEMBER(leland_state,redlin2p)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = redline_bankswitch; m_update_master_bank = &leland_state::redline_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this));
@ -2128,26 +2127,26 @@ DRIVER_INIT_MEMBER(leland_state,redlin2p)
DRIVER_INIT_MEMBER(leland_state,quarterb) DRIVER_INIT_MEMBER(leland_state,quarterb)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = viper_bankswitch; m_update_master_bank = &leland_state::viper_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x40, 0x80); init_master_ports(0x40, 0x80);
} }
DRIVER_INIT_MEMBER(leland_state,viper) DRIVER_INIT_MEMBER(leland_state,viper)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = viper_bankswitch; m_update_master_bank = &leland_state::viper_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this));
@ -2159,14 +2158,14 @@ DRIVER_INIT_MEMBER(leland_state,viper)
DRIVER_INIT_MEMBER(leland_state,teamqb) DRIVER_INIT_MEMBER(leland_state,teamqb)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = viper_bankswitch; m_update_master_bank = &leland_state::viper_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x40, 0x80); init_master_ports(0x40, 0x80);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
@ -2177,14 +2176,14 @@ DRIVER_INIT_MEMBER(leland_state,teamqb)
DRIVER_INIT_MEMBER(leland_state,aafb) DRIVER_INIT_MEMBER(leland_state,aafb)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = viper_bankswitch; m_update_master_bank = &leland_state::viper_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
@ -2195,14 +2194,14 @@ DRIVER_INIT_MEMBER(leland_state,aafb)
DRIVER_INIT_MEMBER(leland_state,aafbb) DRIVER_INIT_MEMBER(leland_state,aafbb)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = viper_bankswitch; m_update_master_bank = &leland_state::viper_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x80, 0x40); init_master_ports(0x80, 0x40);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
@ -2213,14 +2212,14 @@ DRIVER_INIT_MEMBER(leland_state,aafbb)
DRIVER_INIT_MEMBER(leland_state,aafbd2p) DRIVER_INIT_MEMBER(leland_state,aafbd2p)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = viper_bankswitch; m_update_master_bank = &leland_state::viper_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0x40); init_master_ports(0x00, 0x40);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4");
@ -2231,15 +2230,15 @@ DRIVER_INIT_MEMBER(leland_state,aafbd2p)
DRIVER_INIT_MEMBER(leland_state,offroad) DRIVER_INIT_MEMBER(leland_state,offroad)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = offroad_bankswitch; m_update_master_bank = &leland_state::offroad_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0xc0); init_master_ports(0x00, 0xc0);
init_master_ports(machine(), 0x40, 0x80); /* yes, this is intentional */ init_master_ports(0x40, 0x80); /* yes, this is intentional */
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this));
@ -2251,14 +2250,14 @@ DRIVER_INIT_MEMBER(leland_state,offroad)
DRIVER_INIT_MEMBER(leland_state,offroadt) DRIVER_INIT_MEMBER(leland_state,offroadt)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = offroad_bankswitch; m_update_master_bank = &leland_state::offroad_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x80, 0x40); init_master_ports(0x80, 0x40);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this));
@ -2270,14 +2269,14 @@ DRIVER_INIT_MEMBER(leland_state,offroadt)
DRIVER_INIT_MEMBER(leland_state,pigout) DRIVER_INIT_MEMBER(leland_state,pigout)
{ {
/* master CPU bankswitching */ /* master CPU bankswitching */
m_update_master_bank = offroad_bankswitch; m_update_master_bank = &leland_state::offroad_bankswitch;
leland_rotate_memory(machine(), "master"); leland_rotate_memory("master");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
leland_rotate_memory(machine(), "slave"); leland_rotate_memory("slave");
/* set up the master CPU I/O ports */ /* set up the master CPU I/O ports */
init_master_ports(machine(), 0x00, 0x40); init_master_ports(0x00, 0x40);
/* set up additional input ports */ /* set up additional input ports */
machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN4"); machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN4");

View File

@ -181,7 +181,7 @@ WRITE8_MEMBER(lordgun_state::lordgun_eeprom_w)
// Update light guns positions // Update light guns positions
for (i = 0; i < 2; i++) for (i = 0; i < 2; i++)
if ( (data & (0x04 << i)) && !(m_old & (0x04 << i)) ) if ( (data & (0x04 << i)) && !(m_old & (0x04 << i)) )
lordgun_update_gun(machine(), i); lordgun_update_gun(i);
// latch the bit // latch the bit
eeprom->write_bit(data & 0x40); eeprom->write_bit(data & 0x40);

View File

@ -131,9 +131,8 @@ WRITE8_MEMBER(lwings_state::avengers_prot_bank_w)
m_palette_pen = data * 64; m_palette_pen = data * 64;
} }
static int avengers_fetch_paldata( running_machine &machine ) int lwings_state::avengers_fetch_paldata( )
{ {
lwings_state *state = machine.driver_data<lwings_state>();
static const char pal_data[] = static const char pal_data[] =
/* page 1: 0x03,0x02,0x01,0x00 */ /* page 1: 0x03,0x02,0x01,0x00 */
@ -196,8 +195,8 @@ static int avengers_fetch_paldata( running_machine &machine )
"0000000000000000" "6474667676660100" "7696657575650423" "88A8647474645473" "0000000000000000" "6474667676660100" "7696657575650423" "88A8647474645473"
"0000000000000000" "0001070701050004" "0003060603040303" "0005050505040302"; "0000000000000000" "0001070701050004" "0003060603040303" "0005050505040302";
int bank = state->m_palette_pen / 64; int bank = m_palette_pen / 64;
int offs = state->m_palette_pen % 64; int offs = m_palette_pen % 64;
int page = bank / 4; /* 0..7 */ int page = bank / 4; /* 0..7 */
int base = (3 - (bank & 3)); /* 0..3 */ int base = (3 - (bank & 3)); /* 0..3 */
int row = offs & 0xf; /* 0..15 */ int row = offs & 0xf; /* 0..15 */
@ -218,8 +217,8 @@ static int avengers_fetch_paldata( running_machine &machine )
result = digit0 * 16 + digit1; result = digit0 * 16 + digit1;
if ((state->m_palette_pen & 0x3f) != 0x3f) if ((m_palette_pen & 0x3f) != 0x3f)
state->m_palette_pen++; m_palette_pen++;
return result; return result;
} }
@ -236,7 +235,7 @@ READ8_MEMBER(lwings_state::avengers_protection_r)
if (space.device().safe_pc() == 0x7c7) if (space.device().safe_pc() == 0x7c7)
{ {
/* palette data */ /* palette data */
return avengers_fetch_paldata(machine()); return avengers_fetch_paldata();
} }
/* Point to Angle Function /* Point to Angle Function

View File

@ -44,4 +44,5 @@ public:
UINT32 screen_update_labyrunr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_labyrunr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(labyrunr_vblank_interrupt); INTERRUPT_GEN_MEMBER(labyrunr_vblank_interrupt);
INTERRUPT_GEN_MEMBER(labyrunr_timer_interrupt); INTERRUPT_GEN_MEMBER(labyrunr_timer_interrupt);
void set_pens( );
}; };

View File

@ -81,6 +81,7 @@ public:
UINT32 screen_update_redclash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_redclash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_sraider(screen_device &screen, bool state); void screen_eof_sraider(screen_device &screen, bool state);
void screen_eof_redclash(screen_device &screen, bool state); void screen_eof_redclash(screen_device &screen, bool state);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };
/*----------- defined in video/redclash.c -----------*/ /*----------- defined in video/redclash.c -----------*/

View File

@ -60,4 +60,5 @@ public:
DECLARE_VIDEO_START(ladyfrog_common); DECLARE_VIDEO_START(ladyfrog_common);
UINT32 screen_update_ladyfrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ladyfrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(nmi_callback); TIMER_CALLBACK_MEMBER(nmi_callback);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -68,4 +68,8 @@ public:
UINT32 screen_update_lasso(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_lasso(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_chameleo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_chameleo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
rgb_t get_color( int data );
void wwjgtin_set_last_four_colors( colortable_t *colortable );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse );
void draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -62,4 +62,5 @@ public:
UINT32 screen_update_madgear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_madgear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(lastduel_timer_cb); TIMER_DEVICE_CALLBACK_MEMBER(lastduel_timer_cb);
TIMER_DEVICE_CALLBACK_MEMBER(madgear_timer_cb); TIMER_DEVICE_CALLBACK_MEMBER(madgear_timer_cb);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
}; };

View File

@ -59,4 +59,6 @@ public:
UINT32 screen_update_lazercmd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_lazercmd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(lazercmd_timer); TIMER_DEVICE_CALLBACK_MEMBER(lazercmd_timer);
TIMER_DEVICE_CALLBACK_MEMBER(bbonk_timer); TIMER_DEVICE_CALLBACK_MEMBER(bbonk_timer);
int vert_scale(int data);
void plot_pattern( bitmap_ind16 &bitmap, int x, int y );
}; };

View File

@ -52,6 +52,8 @@ public:
UINT32 screen_update_legionna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_legionna(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_godzilla(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_godzilla(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_grainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_grainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void descramble_legionnaire_gfx(UINT8* src);
}; };
/*----------- defined in video/legionna.c -----------*/ /*----------- defined in video/legionna.c -----------*/

View File

@ -50,7 +50,7 @@ public:
UINT8 m_sound_port_bank; UINT8 m_sound_port_bank;
UINT8 m_alternate_bank; UINT8 m_alternate_bank;
UINT8 m_master_bank; UINT8 m_master_bank;
void (*m_update_master_bank)(running_machine &machine); void (leland_state::*m_update_master_bank)();
UINT32 m_xrom1_addr; UINT32 m_xrom1_addr;
UINT32 m_xrom2_addr; UINT32 m_xrom2_addr;
UINT8 m_battery_ram_enable; UINT8 m_battery_ram_enable;
@ -152,6 +152,25 @@ public:
DECLARE_READ8_MEMBER(leland_sound_port_r); DECLARE_READ8_MEMBER(leland_sound_port_r);
DECLARE_WRITE8_MEMBER(leland_sound_port_w); DECLARE_WRITE8_MEMBER(leland_sound_port_w);
DECLARE_WRITE8_MEMBER(leland_gfx_port_w); DECLARE_WRITE8_MEMBER(leland_gfx_port_w);
void leland_video_addr_w(address_space &space, int offset, int data, int num);
int leland_vram_port_r(address_space &space, int offset, int num);
void leland_vram_port_w(address_space &space, int offset, int data, int num);
int dial_compute_value(int new_val, int indx);
void update_dangerz_xy();
void cerberus_bankswitch();
void mayhem_bankswitch();
void dangerz_bankswitch();
void basebal2_bankswitch();
void redline_bankswitch();
void viper_bankswitch();
void offroad_bankswitch();
void ataxx_bankswitch();
void leland_init_eeprom(UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type);
void ataxx_init_eeprom(const UINT16 *data);
int keycard_r();
void keycard_w(int data);
void leland_rotate_memory(const char *cpuname);
void init_master_ports(UINT8 mvram_base, UINT8 io_base);
}; };
@ -163,15 +182,6 @@ public:
#define SERIAL_TYPE_ENCRYPT 3 #define SERIAL_TYPE_ENCRYPT 3
#define SERIAL_TYPE_ENCRYPT_XOR 4 #define SERIAL_TYPE_ENCRYPT_XOR 4
void cerberus_bankswitch(running_machine &machine);
void mayhem_bankswitch(running_machine &machine);
void dangerz_bankswitch(running_machine &machine);
void basebal2_bankswitch(running_machine &machine);
void redline_bankswitch(running_machine &machine);
void viper_bankswitch(running_machine &machine);
void offroad_bankswitch(running_machine &machine);
void ataxx_bankswitch(running_machine &machine);
void leland_init_eeprom(running_machine &machine, UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type); void leland_init_eeprom(running_machine &machine, UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type);
void ataxx_init_eeprom(running_machine &machine, const UINT16 *data); void ataxx_init_eeprom(running_machine &machine, const UINT16 *data);

View File

@ -51,4 +51,5 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_lemmings(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_lemmings(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void screen_eof_lemmings(screen_device &screen, bool state); void screen_eof_lemmings(screen_device &screen, bool state);
void lemmings_copy_bitmap(bitmap_rgb32& bitmap, bitmap_ind16& srcbitmap, int* xscroll, int* yscroll, const rectangle& cliprect);
}; };

View File

@ -30,6 +30,7 @@ public:
DECLARE_DRIVER_INIT(cclownz); DECLARE_DRIVER_INIT(cclownz);
virtual void video_start(); virtual void video_start();
TIMER_CALLBACK_MEMBER(gen_ext1_int); TIMER_CALLBACK_MEMBER(gen_ext1_int);
inline void get_crosshair_xy(int player, int *x, int *y);
}; };
/*----------- defined in video/lethalj.c -----------*/ /*----------- defined in video/lethalj.c -----------*/

View File

@ -69,4 +69,9 @@ public:
UINT32 screen_update_prosoccr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_prosoccr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(deco16_interrupt); INTERRUPT_GEN_MEMBER(deco16_interrupt);
INTERRUPT_GEN_MEMBER(prosport_interrupt); INTERRUPT_GEN_MEMBER(prosport_interrupt);
void debug_print(bitmap_ind16 &bitmap);
void liberate_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void prosport_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void boomrang_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
void prosoccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -84,4 +84,5 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_lkage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_lkage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(nmi_callback); TIMER_CALLBACK_MEMBER(nmi_callback);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -109,4 +109,9 @@ public:
void screen_eof_lockon(screen_device &screen, bool state); void screen_eof_lockon(screen_device &screen, bool state);
TIMER_CALLBACK_MEMBER(cursor_callback); TIMER_CALLBACK_MEMBER(cursor_callback);
TIMER_CALLBACK_MEMBER(bufend_callback); TIMER_CALLBACK_MEMBER(bufend_callback);
void scene_draw( );
void ground_draw( );
void objects_draw( );
void rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect );
void hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -68,8 +68,12 @@ public:
TILE_GET_INFO_MEMBER(get_tile_info_3); TILE_GET_INFO_MEMBER(get_tile_info_3);
virtual void video_start(); virtual void video_start();
UINT32 screen_update_lordgun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_lordgun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
inline void lordgun_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
void lorddgun_calc_gun_scr(int i);
void lordgun_update_gun(int i);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };
/*----------- defined in video/lordgun.c -----------*/ /*----------- defined in video/lordgun.c -----------*/
float lordgun_crosshair_mapper(const ioport_field *field, float linear_value); float lordgun_crosshair_mapper(const ioport_field *field, float linear_value);
void lordgun_update_gun(running_machine &machine, int i);

View File

@ -62,4 +62,8 @@ public:
UINT32 screen_update_lsasquad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_lsasquad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_daikaiju(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_daikaiju(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(nmi_callback); TIMER_CALLBACK_MEMBER(nmi_callback);
void draw_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *scrollram );
int draw_layer_daikaiju( bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int * previd, int type );
void drawbg( bitmap_ind16 &bitmap, const rectangle &cliprect, int type );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -62,4 +62,8 @@ public:
UINT32 screen_update_trojan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_trojan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(lwings_interrupt); INTERRUPT_GEN_MEMBER(lwings_interrupt);
INTERRUPT_GEN_MEMBER(avengers_interrupt); INTERRUPT_GEN_MEMBER(avengers_interrupt);
inline int is_sprite_on( UINT8 *buffered_spriteram, int offs );
void lwings_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void trojan_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
int avengers_fetch_paldata( );
}; };

View File

@ -44,13 +44,12 @@
* *
*************************************/ *************************************/
static int dial_compute_value(running_machine &machine, int new_val, int indx) int leland_state::dial_compute_value(int new_val, int indx)
{ {
leland_state *state = machine.driver_data<leland_state>(); int delta = new_val - (int)m_dial_last_input[indx];
int delta = new_val - (int)state->m_dial_last_input[indx]; UINT8 result = m_dial_last_result[indx] & 0x80;
UINT8 result = state->m_dial_last_result[indx] & 0x80;
state->m_dial_last_input[indx] = new_val; m_dial_last_input[indx] = new_val;
if (delta > 0x80) if (delta > 0x80)
delta -= 0x100; delta -= 0x100;
@ -67,9 +66,9 @@ static int dial_compute_value(running_machine &machine, int new_val, int indx)
if (delta > 0x1f) if (delta > 0x1f)
delta = 0x1f; delta = 0x1f;
result |= (state->m_dial_last_result[indx] + delta) & 0x1f; result |= (m_dial_last_result[indx] + delta) & 0x1f;
state->m_dial_last_result[indx] = result; m_dial_last_result[indx] = result;
return result; return result;
} }
@ -84,7 +83,7 @@ static int dial_compute_value(running_machine &machine, int new_val, int indx)
READ8_MEMBER(leland_state::cerberus_dial_1_r) READ8_MEMBER(leland_state::cerberus_dial_1_r)
{ {
int original = ioport("IN0")->read(); int original = ioport("IN0")->read();
int modified = dial_compute_value(machine(), ioport("AN0")->read(), 0); int modified = dial_compute_value(ioport("AN0")->read(), 0);
return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f); return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f);
} }
@ -92,7 +91,7 @@ READ8_MEMBER(leland_state::cerberus_dial_1_r)
READ8_MEMBER(leland_state::cerberus_dial_2_r) READ8_MEMBER(leland_state::cerberus_dial_2_r)
{ {
int original = ioport("IN0")->read(); int original = ioport("IN0")->read();
int modified = dial_compute_value(machine(), ioport("AN1")->read(), 1); int modified = dial_compute_value(ioport("AN1")->read(), 1);
return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f); return (original & 0xc0) | ((modified & 0x80) >> 2) | (modified & 0x1f);
} }
@ -133,48 +132,47 @@ WRITE8_MEMBER(leland_state::alleymas_joystick_kludge)
* *
*************************************/ *************************************/
static void update_dangerz_xy(running_machine &machine) void leland_state::update_dangerz_xy()
{ {
leland_state *state = machine.driver_data<leland_state>(); UINT8 newy = ioport("AN0")->read();
UINT8 newy = state->ioport("AN0")->read(); UINT8 newx = ioport("AN1")->read();
UINT8 newx = state->ioport("AN1")->read(); int deltay = newy - m_dial_last_input[0];
int deltay = newy - state->m_dial_last_input[0]; int deltax = newx - m_dial_last_input[1];
int deltax = newx - state->m_dial_last_input[1];
if (deltay <= -128) deltay += 256; if (deltay <= -128) deltay += 256;
else if (deltay >= 128) deltay -= 256; else if (deltay >= 128) deltay -= 256;
if (deltax <= -128) deltax += 256; if (deltax <= -128) deltax += 256;
else if (deltax >= 128) deltax -= 256; else if (deltax >= 128) deltax -= 256;
state->m_dangerz_y += deltay; m_dangerz_y += deltay;
state->m_dangerz_x += deltax; m_dangerz_x += deltax;
if (state->m_dangerz_y < 0) state->m_dangerz_y = 0; if (m_dangerz_y < 0) m_dangerz_y = 0;
else if (state->m_dangerz_y >= 1024) state->m_dangerz_y = 1023; else if (m_dangerz_y >= 1024) m_dangerz_y = 1023;
if (state->m_dangerz_x < 0) state->m_dangerz_x = 0; if (m_dangerz_x < 0) m_dangerz_x = 0;
else if (state->m_dangerz_x >= 1024) state->m_dangerz_x = 1023; else if (m_dangerz_x >= 1024) m_dangerz_x = 1023;
state->m_dial_last_input[0] = newy; m_dial_last_input[0] = newy;
state->m_dial_last_input[1] = newx; m_dial_last_input[1] = newx;
} }
READ8_MEMBER(leland_state::dangerz_input_y_r) READ8_MEMBER(leland_state::dangerz_input_y_r)
{ {
update_dangerz_xy(machine()); update_dangerz_xy();
return m_dangerz_y & 0xff; return m_dangerz_y & 0xff;
} }
READ8_MEMBER(leland_state::dangerz_input_x_r) READ8_MEMBER(leland_state::dangerz_input_x_r)
{ {
update_dangerz_xy(machine()); update_dangerz_xy();
return m_dangerz_x & 0xff; return m_dangerz_x & 0xff;
} }
READ8_MEMBER(leland_state::dangerz_input_upper_r) READ8_MEMBER(leland_state::dangerz_input_upper_r)
{ {
update_dangerz_xy(machine()); update_dangerz_xy();
return ((m_dangerz_y >> 2) & 0xc0) | ((m_dangerz_x >> 8) & 0x03); return ((m_dangerz_y >> 2) & 0xc0) | ((m_dangerz_x >> 8) & 0x03);
} }
@ -204,13 +202,13 @@ READ8_MEMBER(leland_state::redline_pedal_2_r)
READ8_MEMBER(leland_state::redline_wheel_1_r) READ8_MEMBER(leland_state::redline_wheel_1_r)
{ {
return dial_compute_value(machine(), ioport("AN0")->read(), 0); return dial_compute_value(ioport("AN0")->read(), 0);
} }
READ8_MEMBER(leland_state::redline_wheel_2_r) READ8_MEMBER(leland_state::redline_wheel_2_r)
{ {
return dial_compute_value(machine(), ioport("AN1")->read(), 1); return dial_compute_value(ioport("AN1")->read(), 1);
} }
@ -223,19 +221,19 @@ READ8_MEMBER(leland_state::redline_wheel_2_r)
READ8_MEMBER(leland_state::offroad_wheel_1_r) READ8_MEMBER(leland_state::offroad_wheel_1_r)
{ {
return dial_compute_value(machine(), ioport("AN3")->read(), 0); return dial_compute_value(ioport("AN3")->read(), 0);
} }
READ8_MEMBER(leland_state::offroad_wheel_2_r) READ8_MEMBER(leland_state::offroad_wheel_2_r)
{ {
return dial_compute_value(machine(), ioport("AN4")->read(), 1); return dial_compute_value(ioport("AN4")->read(), 1);
} }
READ8_MEMBER(leland_state::offroad_wheel_3_r) READ8_MEMBER(leland_state::offroad_wheel_3_r)
{ {
return dial_compute_value(machine(), ioport("AN5")->read(), 2); return dial_compute_value(ioport("AN5")->read(), 2);
} }
@ -250,7 +248,7 @@ READ8_MEMBER(leland_state::ataxx_trackball_r)
{ {
static const char *const tracknames[] = { "AN0", "AN1", "AN2", "AN3" }; static const char *const tracknames[] = { "AN0", "AN1", "AN2", "AN3" };
return dial_compute_value(machine(), ioport(tracknames[offset])->read(), offset); return dial_compute_value(ioport(tracknames[offset])->read(), offset);
} }
@ -265,7 +263,7 @@ READ8_MEMBER(leland_state::indyheat_wheel_r)
{ {
static const char *const tracknames[] = { "AN0", "AN1", "AN2" }; static const char *const tracknames[] = { "AN0", "AN1", "AN2" };
return dial_compute_value(machine(), ioport(tracknames[offset])->read(), offset); return dial_compute_value(ioport(tracknames[offset])->read(), offset);
} }
@ -355,7 +353,7 @@ MACHINE_RESET_MEMBER(leland_state,leland)
/* initialize the master banks */ /* initialize the master banks */
m_master_length = memregion("master")->bytes(); m_master_length = memregion("master")->bytes();
m_master_base = memregion("master")->base(); m_master_base = memregion("master")->base();
(*m_update_master_bank)(machine()); (this->*m_update_master_bank)();
/* initialize the slave banks */ /* initialize the slave banks */
m_slave_length = memregion("slave")->bytes(); m_slave_length = memregion("slave")->bytes();
@ -399,7 +397,7 @@ MACHINE_RESET_MEMBER(leland_state,ataxx)
/* initialize the master banks */ /* initialize the master banks */
m_master_length = memregion("master")->bytes(); m_master_length = memregion("master")->bytes();
m_master_base = memregion("master")->base(); m_master_base = memregion("master")->base();
ataxx_bankswitch(machine()); ataxx_bankswitch();
/* initialize the slave banks */ /* initialize the slave banks */
m_slave_length = memregion("slave")->bytes(); m_slave_length = memregion("slave")->bytes();
@ -466,7 +464,7 @@ WRITE8_MEMBER(leland_state::leland_master_alt_bankswitch_w)
if ((m_alternate_bank ^ data) & 0x0f) if ((m_alternate_bank ^ data) & 0x0f)
logerror("%04X:alternate_bank = %02X\n", space.device().safe_pc(), data & 0x0f); logerror("%04X:alternate_bank = %02X\n", space.device().safe_pc(), data & 0x0f);
m_alternate_bank = data & 15; m_alternate_bank = data & 15;
(*m_update_master_bank)(machine()); (this->*m_update_master_bank)();
/* sound control is in the rest */ /* sound control is in the rest */
leland_80186_control_w(machine().device("custom"), space, offset, data); leland_80186_control_w(machine().device("custom"), space, offset, data);
@ -474,128 +472,121 @@ WRITE8_MEMBER(leland_state::leland_master_alt_bankswitch_w)
/* bankswitching for Cerberus */ /* bankswitching for Cerberus */
void cerberus_bankswitch(running_machine &machine) void leland_state::cerberus_bankswitch()
{ {
/* no bankswitching */ /* no bankswitching */
} }
/* bankswitching for Mayhem 2002, Power Play, World Series Baseball, and Alley Master */ /* bankswitching for Mayhem 2002, Power Play, World Series Baseball, and Alley Master */
void mayhem_bankswitch(running_machine &machine) void leland_state::mayhem_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = ((state->m_sound_port_bank & 0x24) == 0); m_battery_ram_enable = ((m_sound_port_bank & 0x24) == 0);
address = (!(state->m_sound_port_bank & 0x04)) ? &state->m_master_base[0x10000] : &state->m_master_base[0x1c000]; address = (!(m_sound_port_bank & 0x04)) ? &m_master_base[0x10000] : &m_master_base[0x1c000];
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000]; address = m_battery_ram_enable ? m_battery_ram : &address[0x8000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
} }
/* bankswitching for Danger Zone */ /* bankswitching for Danger Zone */
void dangerz_bankswitch(running_machine &machine) void leland_state::dangerz_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = ((state->m_top_board_bank & 0x80) != 0); m_battery_ram_enable = ((m_top_board_bank & 0x80) != 0);
address = (!(state->m_alternate_bank & 1)) ? &state->m_master_base[0x02000] : &state->m_master_base[0x12000]; address = (!(m_alternate_bank & 1)) ? &m_master_base[0x02000] : &m_master_base[0x12000];
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000]; address = m_battery_ram_enable ? m_battery_ram : &address[0x8000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
} }
/* bankswitching for Baseball the Season II, Super Baseball, and Strike Zone */ /* bankswitching for Baseball the Season II, Super Baseball, and Strike Zone */
void basebal2_bankswitch(running_machine &machine) void leland_state::basebal2_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = (state->m_top_board_bank & 0x80); m_battery_ram_enable = (m_top_board_bank & 0x80);
if (!state->m_battery_ram_enable) if (!m_battery_ram_enable)
address = (!(state->m_sound_port_bank & 0x04)) ? &state->m_master_base[0x10000] : &state->m_master_base[0x1c000]; address = (!(m_sound_port_bank & 0x04)) ? &m_master_base[0x10000] : &m_master_base[0x1c000];
else else
address = (!(state->m_top_board_bank & 0x40)) ? &state->m_master_base[0x28000] : &state->m_master_base[0x30000]; address = (!(m_top_board_bank & 0x40)) ? &m_master_base[0x28000] : &m_master_base[0x30000];
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
address = state->m_battery_ram_enable ? state->m_battery_ram : &address[0x8000]; address = m_battery_ram_enable ? m_battery_ram : &address[0x8000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
} }
/* bankswitching for Red Line Racer */ /* bankswitching for Red Line Racer */
void redline_bankswitch(running_machine &machine) void leland_state::redline_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
static const UINT32 bank_list[] = { 0x10000, 0x18000, 0x02000, 0x02000 }; static const UINT32 bank_list[] = { 0x10000, 0x18000, 0x02000, 0x02000 };
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = ((state->m_alternate_bank & 3) == 1); m_battery_ram_enable = ((m_alternate_bank & 3) == 1);
address = &state->m_master_base[bank_list[state->m_alternate_bank & 3]]; address = &m_master_base[bank_list[m_alternate_bank & 3]];
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000]; address = m_battery_ram_enable ? m_battery_ram : &m_master_base[0xa000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
} }
/* bankswitching for Viper, Quarterback, Team Quarterback, and All American Football */ /* bankswitching for Viper, Quarterback, Team Quarterback, and All American Football */
void viper_bankswitch(running_machine &machine) void leland_state::viper_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
static const UINT32 bank_list[] = { 0x02000, 0x10000, 0x18000, 0x02000 }; static const UINT32 bank_list[] = { 0x02000, 0x10000, 0x18000, 0x02000 };
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = ((state->m_alternate_bank & 0x04) != 0); m_battery_ram_enable = ((m_alternate_bank & 0x04) != 0);
address = &state->m_master_base[bank_list[state->m_alternate_bank & 3]]; address = &m_master_base[bank_list[m_alternate_bank & 3]];
if (bank_list[state->m_alternate_bank & 3] >= state->m_master_length) if (bank_list[m_alternate_bank & 3] >= m_master_length)
{ {
logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_alternate_bank & 3); logerror("%s:Master bank %02X out of range!\n", machine().describe_context(), m_alternate_bank & 3);
address = &state->m_master_base[bank_list[0]]; address = &m_master_base[bank_list[0]];
} }
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000]; address = m_battery_ram_enable ? m_battery_ram : &m_master_base[0xa000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
} }
/* bankswitching for Super Offroad, Super Offroad Track Pack, and Pig Out */ /* bankswitching for Super Offroad, Super Offroad Track Pack, and Pig Out */
void offroad_bankswitch(running_machine &machine) void leland_state::offroad_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
static const UINT32 bank_list[] = { 0x02000, 0x02000, 0x10000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000 }; static const UINT32 bank_list[] = { 0x02000, 0x02000, 0x10000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000 };
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = ((state->m_alternate_bank & 7) == 1); m_battery_ram_enable = ((m_alternate_bank & 7) == 1);
address = &state->m_master_base[bank_list[state->m_alternate_bank & 7]]; address = &m_master_base[bank_list[m_alternate_bank & 7]];
if (bank_list[state->m_alternate_bank & 7] >= state->m_master_length) if (bank_list[m_alternate_bank & 7] >= m_master_length)
{ {
logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_alternate_bank & 7); logerror("%s:Master bank %02X out of range!\n", machine().describe_context(), m_alternate_bank & 7);
address = &state->m_master_base[bank_list[0]]; address = &m_master_base[bank_list[0]];
} }
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
address = state->m_battery_ram_enable ? state->m_battery_ram : &state->m_master_base[0xa000]; address = m_battery_ram_enable ? m_battery_ram : &m_master_base[0xa000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
} }
/* bankswitching for Ataxx, WSF, Indy Heat, and Brute Force */ /* bankswitching for Ataxx, WSF, Indy Heat, and Brute Force */
void ataxx_bankswitch(running_machine &machine) void leland_state::ataxx_bankswitch()
{ {
leland_state *state = machine.driver_data<leland_state>();
static const UINT32 bank_list[] = static const UINT32 bank_list[] =
{ {
0x02000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000, 0x40000, 0x48000, 0x02000, 0x18000, 0x20000, 0x28000, 0x30000, 0x38000, 0x40000, 0x48000,
@ -603,25 +594,25 @@ void ataxx_bankswitch(running_machine &machine)
}; };
UINT8 *address; UINT8 *address;
state->m_battery_ram_enable = ((state->m_master_bank & 0x30) == 0x10); m_battery_ram_enable = ((m_master_bank & 0x30) == 0x10);
address = &state->m_master_base[bank_list[state->m_master_bank & 15]]; address = &m_master_base[bank_list[m_master_bank & 15]];
if (bank_list[state->m_master_bank & 15] >= state->m_master_length) if (bank_list[m_master_bank & 15] >= m_master_length)
{ {
logerror("%s:Master bank %02X out of range!\n", machine.describe_context(), state->m_master_bank & 15); logerror("%s:Master bank %02X out of range!\n", machine().describe_context(), m_master_bank & 15);
address = &state->m_master_base[bank_list[0]]; address = &m_master_base[bank_list[0]];
} }
state->membank("bank1")->set_base(address); membank("bank1")->set_base(address);
if (state->m_battery_ram_enable) if (m_battery_ram_enable)
address = state->m_battery_ram; address = m_battery_ram;
else if ((state->m_master_bank & 0x30) == 0x20) else if ((m_master_bank & 0x30) == 0x20)
address = &state->m_ataxx_qram[(state->m_master_bank & 0xc0) << 8]; address = &m_ataxx_qram[(m_master_bank & 0xc0) << 8];
else else
address = &state->m_master_base[0xa000]; address = &m_master_base[0xa000];
state->membank("bank2")->set_base(address); membank("bank2")->set_base(address);
state->m_wcol_enable = ((state->m_master_bank & 0x30) == 0x30); m_wcol_enable = ((m_master_bank & 0x30) == 0x30);
} }
@ -632,7 +623,7 @@ void ataxx_bankswitch(running_machine &machine)
* *
*************************************/ *************************************/
void leland_init_eeprom(running_machine &machine, UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type) void leland_state::leland_init_eeprom(UINT8 default_val, const UINT16 *data, UINT8 serial_offset, UINT8 serial_type)
{ {
UINT8 xorval = (serial_type == SERIAL_TYPE_ADD_XOR || serial_type == SERIAL_TYPE_ENCRYPT_XOR) ? 0xff : 0x00; UINT8 xorval = (serial_type == SERIAL_TYPE_ADD_XOR || serial_type == SERIAL_TYPE_ENCRYPT_XOR) ? 0xff : 0x00;
UINT8 eeprom_data[64*2]; UINT8 eeprom_data[64*2];
@ -743,7 +734,7 @@ void leland_init_eeprom(running_machine &machine, UINT8 default_val, const UINT1
* *
*************************************/ *************************************/
void ataxx_init_eeprom(running_machine &machine, const UINT16 *data) void leland_state::ataxx_init_eeprom(const UINT16 *data)
{ {
UINT8 eeprom_data[128*2]; UINT8 eeprom_data[128*2];
UINT8 serial_offset = 0; UINT8 serial_offset = 0;
@ -918,79 +909,77 @@ WRITE8_MEMBER(leland_state::ataxx_battery_ram_w)
--------------------------------------------------------------------*/ --------------------------------------------------------------------*/
static int keycard_r(running_machine &machine) int leland_state::keycard_r()
{ {
leland_state *state = machine.driver_data<leland_state>();
int result = 0; int result = 0;
if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_r)\n", machine.describe_context()); if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_r)\n", machine().describe_context());
/* if we have a valid keycard read state, we're reading from the keycard */ /* if we have a valid keycard read state, we're reading from the keycard */
if (state->m_keycard_state & 0x80) if (m_keycard_state & 0x80)
{ {
/* clock in new data */ /* clock in new data */
if (state->m_keycard_bit == 1) if (m_keycard_bit == 1)
{ {
state->m_keycard_shift = 0xff; /* no data, but this is where we would clock it in */ m_keycard_shift = 0xff; /* no data, but this is where we would clock it in */
if (LOG_KEYCARDS) logerror(" (clocked in %02X)\n", state->m_keycard_shift); if (LOG_KEYCARDS) logerror(" (clocked in %02X)\n", m_keycard_shift);
} }
/* clock in the bit */ /* clock in the bit */
result = (~state->m_keycard_shift & 1) << ((state->m_keycard_state >> 4) & 3); result = (~m_keycard_shift & 1) << ((m_keycard_state >> 4) & 3);
if (LOG_KEYCARDS) logerror(" (read %02X)\n", result); if (LOG_KEYCARDS) logerror(" (read %02X)\n", result);
} }
return result; return result;
} }
static void keycard_w(running_machine &machine, int data) void leland_state::keycard_w(int data)
{ {
leland_state *state = machine.driver_data<leland_state>();
int new_state = data & 0xb0; int new_state = data & 0xb0;
int new_clock = data & 0x40; int new_clock = data & 0x40;
if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_w=%02X)\n", machine.describe_context(), data); if (LOG_KEYCARDS_FULL) logerror(" (%s:keycard_w=%02X)\n", machine().describe_context(), data);
/* check for going active */ /* check for going active */
if (!state->m_keycard_state && new_state) if (!m_keycard_state && new_state)
{ {
state->m_keycard_command[0] = state->m_keycard_command[1] = state->m_keycard_command[2] = 0; m_keycard_command[0] = m_keycard_command[1] = m_keycard_command[2] = 0;
if (LOG_KEYCARDS) logerror("keycard going active (state=%02X)\n", new_state); if (LOG_KEYCARDS) logerror("keycard going active (state=%02X)\n", new_state);
} }
/* check for going inactive */ /* check for going inactive */
else if (state->m_keycard_state && !new_state) else if (m_keycard_state && !new_state)
{ {
state->m_keycard_command[0] = state->m_keycard_command[1] = state->m_keycard_command[2] = 0; m_keycard_command[0] = m_keycard_command[1] = m_keycard_command[2] = 0;
if (LOG_KEYCARDS) logerror("keycard going inactive\n"); if (LOG_KEYCARDS) logerror("keycard going inactive\n");
} }
/* check for clocks */ /* check for clocks */
else if (state->m_keycard_state == new_state) else if (m_keycard_state == new_state)
{ {
/* work off of falling edge */ /* work off of falling edge */
if (!new_clock && state->m_keycard_clock) if (!new_clock && m_keycard_clock)
{ {
state->m_keycard_shift >>= 1; m_keycard_shift >>= 1;
state->m_keycard_bit = (state->m_keycard_bit + 1) & 7; m_keycard_bit = (m_keycard_bit + 1) & 7;
} }
/* look for a bit write */ /* look for a bit write */
else if (!new_clock && !state->m_keycard_clock && !(data & 0x80)) else if (!new_clock && !m_keycard_clock && !(data & 0x80))
{ {
if (LOG_KEYCARDS) logerror(" (write %02X)\n", data); if (LOG_KEYCARDS) logerror(" (write %02X)\n", data);
state->m_keycard_shift &= ~0x80; m_keycard_shift &= ~0x80;
if (data & (1 << ((new_state >> 4) & 3))) if (data & (1 << ((new_state >> 4) & 3)))
state->m_keycard_shift |= 0x80; m_keycard_shift |= 0x80;
/* clock out the data on the last bit */ /* clock out the data on the last bit */
if (state->m_keycard_bit == 7) if (m_keycard_bit == 7)
{ {
if (LOG_KEYCARDS) logerror(" (clocked out %02X)\n", state->m_keycard_shift); if (LOG_KEYCARDS) logerror(" (clocked out %02X)\n", m_keycard_shift);
state->m_keycard_command[0] = state->m_keycard_command[1]; m_keycard_command[0] = m_keycard_command[1];
state->m_keycard_command[1] = state->m_keycard_command[2]; m_keycard_command[1] = m_keycard_command[2];
state->m_keycard_command[2] = state->m_keycard_shift; m_keycard_command[2] = m_keycard_shift;
if (state->m_keycard_command[0] == 0x62 && state->m_keycard_command[1] == 0x00 && state->m_keycard_command[2] == 0x80) if (m_keycard_command[0] == 0x62 && m_keycard_command[1] == 0x00 && m_keycard_command[2] == 0x80)
{ {
if (LOG_KEYCARDS) logerror(" (got command $62)\n"); if (LOG_KEYCARDS) logerror(" (got command $62)\n");
} }
@ -1002,12 +991,12 @@ static void keycard_w(running_machine &machine, int data)
else else
{ {
/* only an error if the selected bit changes; read/write transitions are okay */ /* only an error if the selected bit changes; read/write transitions are okay */
if ((new_state & 0x30) != (state->m_keycard_state & 0x30)) if ((new_state & 0x30) != (m_keycard_state & 0x30))
if (LOG_KEYCARDS) logerror("ERROR: Caught keycard state transition %02X -> %02X\n", state->m_keycard_state, new_state); if (LOG_KEYCARDS) logerror("ERROR: Caught keycard state transition %02X -> %02X\n", m_keycard_state, new_state);
} }
state->m_keycard_state = new_state; m_keycard_state = new_state;
state->m_keycard_clock = new_clock; m_keycard_clock = new_clock;
} }
@ -1034,7 +1023,7 @@ READ8_MEMBER(leland_state::leland_master_analog_key_r)
break; break;
case 0x02: /* FF = keycard serial data read */ case 0x02: /* FF = keycard serial data read */
result = keycard_r(machine()); result = keycard_r();
/* bit 7 indicates the analog input is busy for some games */ /* bit 7 indicates the analog input is busy for some games */
result &= ~0x80; result &= ~0x80;
@ -1062,11 +1051,11 @@ WRITE8_MEMBER(leland_state::leland_master_analog_key_w)
if ((m_top_board_bank ^ data) & 0xc0) if ((m_top_board_bank ^ data) & 0xc0)
logerror("%04X:top_board_bank = %02X\n", space.device().safe_pc(), data & 0xc0); logerror("%04X:top_board_bank = %02X\n", space.device().safe_pc(), data & 0xc0);
m_top_board_bank = data & 0xc0; m_top_board_bank = data & 0xc0;
(*m_update_master_bank)(machine()); (this->*m_update_master_bank)();
break; break;
case 0x02: /* FF = keycard data write */ case 0x02: /* FF = keycard data write */
keycard_w(machine(), data); keycard_w(data);
break; break;
} }
} }
@ -1201,7 +1190,7 @@ WRITE8_MEMBER(leland_state::ataxx_master_output_w)
if ((m_master_bank ^ data) & 0xff) if ((m_master_bank ^ data) & 0xff)
logerror("%04X:master_bank = %02X\n", space.device().safe_pc(), data & 0xff); logerror("%04X:master_bank = %02X\n", space.device().safe_pc(), data & 0xff);
m_master_bank = data; m_master_bank = data;
ataxx_bankswitch(machine()); ataxx_bankswitch();
break; break;
case 0x05: /* /SLV0 */ case 0x05: /* /SLV0 */
@ -1322,7 +1311,7 @@ WRITE8_MEMBER(leland_state::leland_sound_port_w)
if ((m_sound_port_bank ^ data) & 0x24) if ((m_sound_port_bank ^ data) & 0x24)
logerror("%s:sound_port_bank = %02X\n", machine().describe_context(), data & 0x24); logerror("%s:sound_port_bank = %02X\n", machine().describe_context(), data & 0x24);
m_sound_port_bank = data & 0x24; m_sound_port_bank = data & 0x24;
(*m_update_master_bank)(machine()); (this->*m_update_master_bank)();
} }
@ -1408,11 +1397,11 @@ READ8_MEMBER(leland_state::leland_raster_r)
*************************************/ *************************************/
/* also called by Ataxx */ /* also called by Ataxx */
void leland_rotate_memory(running_machine &machine, const char *cpuname) void leland_state::leland_rotate_memory(const char *cpuname)
{ {
int startaddr = 0x10000; int startaddr = 0x10000;
int banks = (machine.root_device().memregion(cpuname)->bytes() - startaddr) / 0x8000; int banks = (machine().root_device().memregion(cpuname)->bytes() - startaddr) / 0x8000;
UINT8 *ram = machine.root_device().memregion(cpuname)->base(); UINT8 *ram = machine().root_device().memregion(cpuname)->base();
UINT8 temp[0x2000]; UINT8 temp[0x2000];
int i; int i;

View File

@ -41,18 +41,17 @@ void labyrunr_state::palette_init()
} }
static void set_pens( running_machine &machine ) void labyrunr_state::set_pens( )
{ {
labyrunr_state *state = machine.driver_data<labyrunr_state>();
int i; int i;
for (i = 0x00; i < 0x100; i += 2) for (i = 0x00; i < 0x100; i += 2)
{ {
UINT16 data = state->m_paletteram[i | 1] | (state->m_paletteram[i] << 8); UINT16 data = m_paletteram[i | 1] | (m_paletteram[i] << 8);
rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10)); rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
colortable_palette_set_color(machine.colortable, i >> 1, color); colortable_palette_set_color(machine().colortable, i >> 1, color);
} }
} }
@ -181,7 +180,7 @@ UINT32 labyrunr_state::screen_update_labyrunr(screen_device &screen, bitmap_ind1
UINT8 ctrl_0 = k007121_ctrlram_r(m_k007121, space, 0); UINT8 ctrl_0 = k007121_ctrlram_r(m_k007121, space, 0);
rectangle finalclip0, finalclip1; rectangle finalclip0, finalclip1;
set_pens(machine()); set_pens();
machine().priority_bitmap.fill(0, cliprect); machine().priority_bitmap.fill(0, cliprect);
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);

View File

@ -224,13 +224,12 @@ VIDEO_START_MEMBER(ladybug_state,sraider)
m_bg_tilemap->set_transparent_pen(0); m_bg_tilemap->set_transparent_pen(0);
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void ladybug_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
ladybug_state *state = machine.driver_data<ladybug_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = state->m_spriteram.bytes() - 2 * 0x40; offs >= 2 * 0x40; offs -= 0x40) for (offs = m_spriteram.bytes() - 2 * 0x40; offs >= 2 * 0x40; offs -= 0x40)
{ {
int i = 0; int i = 0;
@ -257,14 +256,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if (spriteram[offs + i] & 0x80) if (spriteram[offs + i] & 0x80)
{ {
if (spriteram[offs + i] & 0x40) /* 16x16 */ if (spriteram[offs + i] & 0x40) /* 16x16 */
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
(spriteram[offs + i + 1] >> 2) + 4 * (spriteram[offs + i + 2] & 0x10), (spriteram[offs + i + 1] >> 2) + 4 * (spriteram[offs + i + 2] & 0x10),
spriteram[offs + i + 2] & 0x0f, spriteram[offs + i + 2] & 0x0f,
spriteram[offs + i] & 0x20,spriteram[offs + i] & 0x10, spriteram[offs + i] & 0x20,spriteram[offs + i] & 0x10,
spriteram[offs + i + 3], spriteram[offs + i + 3],
offs / 4 - 8 + (spriteram[offs + i] & 0x0f),0); offs / 4 - 8 + (spriteram[offs + i] & 0x0f),0);
else /* 8x8 */ else /* 8x8 */
drawgfx_transpen(bitmap,cliprect,machine.gfx[2], drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
spriteram[offs + i + 1] + 16 * (spriteram[offs + i + 2] & 0x10), spriteram[offs + i + 1] + 16 * (spriteram[offs + i + 2] & 0x10),
spriteram[offs + i + 2] & 0x0f, spriteram[offs + i + 2] & 0x0f,
spriteram[offs + i] & 0x20,spriteram[offs + i] & 0x10, spriteram[offs + i] & 0x20,spriteram[offs + i] & 0x10,
@ -294,7 +293,7 @@ UINT32 ladybug_state::screen_update_ladybug(screen_device &screen, bitmap_ind16
} }
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }
@ -357,7 +356,7 @@ UINT32 ladybug_state::screen_update_sraider(screen_device &screen, bitmap_ind16
m_bg_tilemap->draw(bitmap, cliprect, 0, flip_screen()); m_bg_tilemap->draw(bitmap, cliprect, 0, flip_screen());
// now the sprites // now the sprites
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -89,32 +89,31 @@ WRITE8_MEMBER(ladyfrog_state::ladyfrog_scrlram_w)
m_bg_tilemap->set_scrolly(offset, data); m_bg_tilemap->set_scrolly(offset, data);
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void ladyfrog_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
ladyfrog_state *state = machine.driver_data<ladyfrog_state>();
int i; int i;
for (i = 0; i < 0x20; i++) for (i = 0; i < 0x20; i++)
{ {
int pr = state->m_spriteram[0x9f - i]; int pr = m_spriteram[0x9f - i];
int offs = (pr & 0x1f) * 4; int offs = (pr & 0x1f) * 4;
{ {
int code, sx, sy, flipx, flipy, pal; int code, sx, sy, flipx, flipy, pal;
code = state->m_spriteram[offs + 2] + ((state->m_spriteram[offs + 1] & 0x10) << 4) + state->m_spritetilebase; code = m_spriteram[offs + 2] + ((m_spriteram[offs + 1] & 0x10) << 4) + m_spritetilebase;
pal = state->m_spriteram[offs + 1] & 0x0f; pal = m_spriteram[offs + 1] & 0x0f;
sx = state->m_spriteram[offs + 3]; sx = m_spriteram[offs + 3];
sy = 238 - state->m_spriteram[offs + 0]; sy = 238 - m_spriteram[offs + 0];
flipx = ((state->m_spriteram[offs + 1] & 0x40)>>6); flipx = ((m_spriteram[offs + 1] & 0x40)>>6);
flipy = ((state->m_spriteram[offs + 1] & 0x80)>>7); flipy = ((m_spriteram[offs + 1] & 0x80)>>7);
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
pal, pal,
flipx,flipy, flipx,flipy,
sx,sy,15); sx,sy,15);
if (state->m_spriteram[offs + 3] > 240) if (m_spriteram[offs + 3] > 240)
{ {
sx = (state->m_spriteram[offs + 3] - 256); sx = (m_spriteram[offs + 3] - 256);
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
pal, pal,
flipx,flipy, flipx,flipy,
@ -154,6 +153,6 @@ VIDEO_START_MEMBER(ladyfrog_state,toucheme)
UINT32 ladyfrog_state::screen_update_ladyfrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 ladyfrog_state::screen_update_ladyfrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -38,7 +38,7 @@
***************************************************************************/ ***************************************************************************/
static rgb_t get_color( int data ) rgb_t lasso_state::get_color( int data )
{ {
int bit0, bit1, bit2; int bit0, bit1, bit2;
int r, g, b; int r, g, b;
@ -104,14 +104,13 @@ PALETTE_INIT_MEMBER(lasso_state,wwjgtin)
} }
static void wwjgtin_set_last_four_colors( running_machine &machine, colortable_t *colortable ) void lasso_state::wwjgtin_set_last_four_colors( colortable_t *colortable )
{ {
lasso_state *state = machine.driver_data<lasso_state>();
int i; int i;
/* the last palette entries can be changed */ /* the last palette entries can be changed */
for(i = 0; i < 3; i++) for(i = 0; i < 3; i++)
colortable_palette_set_color(colortable, 0x3d + i, get_color(state->m_last_colors[i])); colortable_palette_set_color(colortable, 0x3d + i, get_color(m_last_colors[i]));
} }
@ -260,22 +259,21 @@ WRITE8_MEMBER(lasso_state::pinbo_video_control_w)
* *
*************************************/ *************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse ) void lasso_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int reverse )
{ {
lasso_state *state = machine.driver_data<lasso_state>();
const UINT8 *finish, *source; const UINT8 *finish, *source;
int inc; int inc;
if (reverse) if (reverse)
{ {
source = state->m_spriteram; source = m_spriteram;
finish = state->m_spriteram + state->m_spriteram.bytes(); finish = m_spriteram + m_spriteram.bytes();
inc = 4; inc = 4;
} }
else else
{ {
source = state->m_spriteram + state->m_spriteram.bytes() - 4; source = m_spriteram + m_spriteram.bytes() - 4;
finish = state->m_spriteram - 4; finish = m_spriteram - 4;
inc = -4; inc = -4;
} }
@ -289,13 +287,13 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipx = source[1] & 0x40; flipx = source[1] & 0x40;
flipy = source[1] & 0x80; flipy = source[1] & 0x80;
if (state->flip_screen_x()) if (flip_screen_x())
{ {
sx = 240 - sx; sx = 240 - sx;
flipx = !flipx; flipx = !flipx;
} }
if (state->flip_screen_y()) if (flip_screen_y())
flipy = !flipy; flipy = !flipy;
else else
sy = 240 - sy; sy = 240 - sy;
@ -303,8 +301,8 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
code = source[1] & 0x3f; code = source[1] & 0x3f;
color = source[2] & 0x0f; color = source[2] & 0x0f;
drawgfx_transpen(bitmap, cliprect, machine.gfx[1], drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
code | ((UINT16)state->m_gfxbank << 6), code | ((UINT16)m_gfxbank << 6),
color, color,
flipx, flipy, flipx, flipy,
sx,sy,0); sx,sy,0);
@ -314,9 +312,8 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
} }
static void draw_lasso( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lasso_state::draw_lasso( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lasso_state *state = machine.driver_data<lasso_state>();
offs_t offs; offs_t offs;
pen_t pen = 0x3f; pen_t pen = 0x3f;
@ -327,16 +324,16 @@ static void draw_lasso( running_machine &machine, bitmap_ind16 &bitmap, const re
UINT8 x; UINT8 x;
UINT8 y = offs >> 5; UINT8 y = offs >> 5;
if (state->flip_screen_y()) if (flip_screen_y())
y = ~y; y = ~y;
if ((y < cliprect.min_y) || (y > cliprect.max_y)) if ((y < cliprect.min_y) || (y > cliprect.max_y))
continue; continue;
x = (offs & 0x1f) << 3; x = (offs & 0x1f) << 3;
data = state->m_bitmap_ram[offs]; data = m_bitmap_ram[offs];
if (state->flip_screen_x()) if (flip_screen_x())
x = ~x; x = ~x;
for (bit = 0; bit < 8; bit++) for (bit = 0; bit < 8; bit++)
@ -344,7 +341,7 @@ static void draw_lasso( running_machine &machine, bitmap_ind16 &bitmap, const re
if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x)) if ((data & 0x80) && (x >= cliprect.min_x) && (x <= cliprect.max_x))
bitmap.pix16(y, x) = pen; bitmap.pix16(y, x) = pen;
if (state->flip_screen_x()) if (flip_screen_x())
x = x - 1; x = x - 1;
else else
x = x + 1; x = x + 1;
@ -361,8 +358,8 @@ UINT32 lasso_state::screen_update_lasso(screen_device &screen, bitmap_ind16 &bit
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_lasso(machine(), bitmap, cliprect); draw_lasso(bitmap, cliprect);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
return 0; return 0;
} }
@ -373,7 +370,7 @@ UINT32 lasso_state::screen_update_chameleo(screen_device &screen, bitmap_ind16 &
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
return 0; return 0;
} }
@ -382,7 +379,7 @@ UINT32 lasso_state::screen_update_chameleo(screen_device &screen, bitmap_ind16 &
UINT32 lasso_state::screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 lasso_state::screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
colortable_palette_set_color(machine().colortable, 0, get_color(*m_back_color)); colortable_palette_set_color(machine().colortable, 0, get_color(*m_back_color));
wwjgtin_set_last_four_colors(machine(), machine().colortable); wwjgtin_set_last_four_colors(machine().colortable);
m_track_tilemap->set_scrollx(0, m_track_scroll[0] + m_track_scroll[1] * 256); m_track_tilemap->set_scrollx(0, m_track_scroll[0] + m_track_scroll[1] * 256);
m_track_tilemap->set_scrolly(0, m_track_scroll[2] + m_track_scroll[3] * 256); m_track_tilemap->set_scrolly(0, m_track_scroll[2] + m_track_scroll[3] * 256);
@ -392,7 +389,7 @@ UINT32 lasso_state::screen_update_wwjgtin(screen_device &screen, bitmap_ind16 &b
else else
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
draw_sprites(machine(), bitmap, cliprect, 1); // reverse order draw_sprites(bitmap, cliprect, 1); // reverse order
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;

View File

@ -197,14 +197,13 @@ WRITE16_MEMBER(lastduel_state::lastduel_palette_word_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) void lastduel_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
{ {
lastduel_state *state = machine.driver_data<lastduel_state>();
UINT16 *buffered_spriteram16 = state->m_spriteram->buffer(); UINT16 *buffered_spriteram16 = m_spriteram->buffer();
int offs; int offs;
if (!state->m_sprite_pri_mask) if (!m_sprite_pri_mask)
if (pri == 1) if (pri == 1)
return; /* only low priority sprites in lastduel */ return; /* only low priority sprites in lastduel */
@ -213,11 +212,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int attr, sy, sx, flipx, flipy, code, color; int attr, sy, sx, flipx, flipy, code, color;
attr = buffered_spriteram16[offs + 1]; attr = buffered_spriteram16[offs + 1];
if (state->m_sprite_pri_mask) /* only madgear seems to have this */ if (m_sprite_pri_mask) /* only madgear seems to have this */
{ {
if (pri == 1 && (attr & state->m_sprite_pri_mask)) if (pri == 1 && (attr & m_sprite_pri_mask))
continue; continue;
if (pri == 0 && !(attr & state->m_sprite_pri_mask)) if (pri == 0 && !(attr & m_sprite_pri_mask))
continue; continue;
} }
@ -228,10 +227,10 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
sy -= 0x200; sy -= 0x200;
flipx = attr & 0x20; flipx = attr & 0x20;
flipy = attr & state->m_sprite_flipy_mask; /* 0x40 for lastduel, 0x80 for madgear */ flipy = attr & m_sprite_flipy_mask; /* 0x40 for lastduel, 0x80 for madgear */
color = attr & 0x0f; color = attr & 0x0f;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 496 - sx; sx = 496 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -240,7 +239,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
} }
drawgfx_transpen(bitmap,cliprect, drawgfx_transpen(bitmap,cliprect,
machine.gfx[0], machine().gfx[0],
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -252,9 +251,9 @@ UINT32 lastduel_state::screen_update_lastduel(screen_device &screen, bitmap_ind1
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
draw_sprites(machine(), bitmap, cliprect, 1); draw_sprites(bitmap, cliprect, 1);
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -264,18 +263,18 @@ UINT32 lastduel_state::screen_update_madgear(screen_device &screen, bitmap_ind16
if (m_tilemap_priority) if (m_tilemap_priority)
{ {
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1 | TILEMAP_DRAW_OPAQUE, 0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1 | TILEMAP_DRAW_OPAQUE, 0);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 1); draw_sprites(bitmap, cliprect, 1);
} }
else else
{ {
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
draw_sprites(machine(), bitmap, cliprect, 1); draw_sprites(bitmap, cliprect, 1);
} }
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;

View File

@ -16,7 +16,7 @@
/* 2 4 + 5 10 14 + 15 */ /* 2 4 + 5 10 14 + 15 */
/* 3 6 + 7 11 16 + 17 */ /* 3 6 + 7 11 16 + 17 */
/* 4 8 + 9 12 18 + 19 */ /* 4 8 + 9 12 18 + 19 */
static int vert_scale(int data) int lazercmd_state::vert_scale(int data)
{ {
return ((data & 0x07) << 1) + ((data & 0xf8) >> 3) * VERT_CHR; return ((data & 0x07) << 1) + ((data & 0xf8) >> 3) * VERT_CHR;
} }
@ -24,12 +24,12 @@ static int vert_scale(int data)
/* plot a bitmap marker */ /* plot a bitmap marker */
/* hardware has 2 marker sizes 2x2 and 4x2 selected by jumper */ /* hardware has 2 marker sizes 2x2 and 4x2 selected by jumper */
/* meadows lanes normaly use 2x2 pixels and lazer command uses either */ /* meadows lanes normaly use 2x2 pixels and lazer command uses either */
static void plot_pattern( running_machine &machine, bitmap_ind16 &bitmap, int x, int y ) void lazercmd_state::plot_pattern( bitmap_ind16 &bitmap, int x, int y )
{ {
int xbit, ybit, size; int xbit, ybit, size;
size = 2; size = 2;
if (machine.root_device().ioport("DSW")->read() & 0x40) if (machine().root_device().ioport("DSW")->read() & 0x40)
{ {
size = 4; size = 4;
} }
@ -75,7 +75,7 @@ UINT32 lazercmd_state::screen_update_lazercmd(screen_device &screen, bitmap_ind1
x = m_marker_x - 1; /* normal video lags marker by 1 pixel */ x = m_marker_x - 1; /* normal video lags marker by 1 pixel */
y = vert_scale(m_marker_y) - VERT_CHR; /* first line used as scratch pad */ y = vert_scale(m_marker_y) - VERT_CHR; /* first line used as scratch pad */
plot_pattern(machine(), bitmap, x, y); plot_pattern(bitmap, x, y);
return 0; return 0;
} }

View File

@ -245,10 +245,9 @@ VIDEO_START_MEMBER(legionna_state,godzilla)
*************************************************************************/ *************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void legionna_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
legionna_state *state = machine.driver_data<legionna_state>(); UINT16 *spriteram16 = m_spriteram;
UINT16 *spriteram16 = state->m_spriteram;
int offs,fx,fy,x,y,color,sprite,cur_pri; int offs,fx,fy,x,y,color,sprite,cur_pri;
int dx,dy,ax,ay; int dx,dy,ax,ay;
int pri_mask; int pri_mask;
@ -260,7 +259,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
pri_mask = 0; pri_mask = 0;
if (state->m_has_extended_priority) if (m_has_extended_priority)
{ {
cur_pri = (spriteram16[offs+1] & 0xc000) >> 14; cur_pri = (spriteram16[offs+1] & 0xc000) >> 14;
@ -310,7 +309,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
sprite &= 0x3fff; sprite &= 0x3fff;
if (state->m_has_extended_banking) if (m_has_extended_banking)
{ {
if(data & 0x0040) if(data & 0x0040)
{ {
@ -360,10 +359,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
for (ax=0; ax<dx; ax++) for (ax=0; ax<dx; ax++)
for (ay=0; ay<dy; ay++) for (ay=0; ay<dy; ay++)
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3],
sprite++, sprite++,
color,fx,fy,(x+ax*16)+state->m_sprite_xoffs,y+ay*16+state->m_sprite_yoffs, color,fx,fy,(x+ax*16)+m_sprite_xoffs,y+ay*16+m_sprite_yoffs,
machine.priority_bitmap,pri_mask, 15); machine().priority_bitmap,pri_mask, 15);
} }
} }
else else
@ -371,10 +370,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
for (ax=0; ax<dx; ax++) for (ax=0; ax<dx; ax++)
for (ay=0; ay<dy; ay++) for (ay=0; ay<dy; ay++)
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3],
sprite++, sprite++,
color,fx,fy,(x+ax*16)+state->m_sprite_xoffs,y+(dy-ay-1)*16+state->m_sprite_yoffs, color,fx,fy,(x+ax*16)+m_sprite_xoffs,y+(dy-ay-1)*16+m_sprite_yoffs,
machine.priority_bitmap,pri_mask,15); machine().priority_bitmap,pri_mask,15);
} }
} }
} }
@ -385,10 +384,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
for (ax=0; ax<dx; ax++) for (ax=0; ax<dx; ax++)
for (ay=0; ay<dy; ay++) for (ay=0; ay<dy; ay++)
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3],
sprite++, sprite++,
color,fx,fy,(x+(dx-ax-1)*16)+state->m_sprite_xoffs,y+ay*16+state->m_sprite_yoffs, color,fx,fy,(x+(dx-ax-1)*16)+m_sprite_xoffs,y+ay*16+m_sprite_yoffs,
machine.priority_bitmap,pri_mask,15); machine().priority_bitmap,pri_mask,15);
} }
} }
else else
@ -396,10 +395,10 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
for (ax=0; ax<dx; ax++) for (ax=0; ax<dx; ax++)
for (ay=0; ay<dy; ay++) for (ay=0; ay<dy; ay++)
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[3], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[3],
sprite++, sprite++,
color,fx,fy,(x+(dx-ax-1)*16)+state->m_sprite_xoffs,y+(dy-ay-1)*16+state->m_sprite_yoffs, color,fx,fy,(x+(dx-ax-1)*16)+m_sprite_xoffs,y+(dy-ay-1)*16+m_sprite_yoffs,
machine.priority_bitmap,pri_mask, 15); machine().priority_bitmap,pri_mask, 15);
} }
} }
} }
@ -430,7 +429,7 @@ UINT32 legionna_state::screen_update_legionna(screen_device &screen, bitmap_ind1
if (!(m_layer_disable&0x0002)) m_background_layer->draw(bitmap, cliprect, 0, 1); if (!(m_layer_disable&0x0002)) m_background_layer->draw(bitmap, cliprect, 0, 1);
if (!(m_layer_disable&0x0001)) m_text_layer->draw(bitmap, cliprect, 0, 2); if (!(m_layer_disable&0x0001)) m_text_layer->draw(bitmap, cliprect, 0, 2);
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
return 0; return 0;
@ -460,7 +459,7 @@ UINT32 legionna_state::screen_update_godzilla(screen_device &screen, bitmap_ind1
if (!(m_layer_disable&0x0004)) m_foreground_layer->draw(bitmap, cliprect, 0,1); if (!(m_layer_disable&0x0004)) m_foreground_layer->draw(bitmap, cliprect, 0,1);
if (!(m_layer_disable&0x0008)) m_text_layer->draw(bitmap, cliprect, 0,2); if (!(m_layer_disable&0x0008)) m_text_layer->draw(bitmap, cliprect, 0,2);
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
return 0; return 0;
} }
@ -492,7 +491,7 @@ UINT32 legionna_state::screen_update_grainbow(screen_device &screen, bitmap_ind1
if(!(m_layer_disable & 8)) if(!(m_layer_disable & 8))
m_text_layer->draw(bitmap, cliprect, 0,8); m_text_layer->draw(bitmap, cliprect, 0,8);
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
return 0; return 0;
} }

View File

@ -129,10 +129,9 @@ WRITE8_MEMBER(leland_state::leland_gfx_port_w)
* *
*************************************/ *************************************/
static void leland_video_addr_w(address_space &space, int offset, int data, int num) void leland_state::leland_video_addr_w(address_space &space, int offset, int data, int num)
{ {
leland_state *drvstate = space.machine().driver_data<leland_state>(); struct vram_state_data *state = m_vram_state + num;
struct vram_state_data *state = drvstate->m_vram_state + num;
if (!offset) if (!offset)
state->m_addr = (state->m_addr & 0xfe00) | ((data << 1) & 0x01fe); state->m_addr = (state->m_addr & 0xfe00) | ((data << 1) & 0x01fe);
@ -148,10 +147,9 @@ static void leland_video_addr_w(address_space &space, int offset, int data, int
* *
*************************************/ *************************************/
static int leland_vram_port_r(address_space &space, int offset, int num) int leland_state::leland_vram_port_r(address_space &space, int offset, int num)
{ {
leland_state *drvstate = space.machine().driver_data<leland_state>(); struct vram_state_data *state = m_vram_state + num;
struct vram_state_data *state = drvstate->m_vram_state + num;
int addr = state->m_addr; int addr = state->m_addr;
int inc = (offset >> 2) & 2; int inc = (offset >> 2) & 2;
int ret; int ret;
@ -159,18 +157,18 @@ static int leland_vram_port_r(address_space &space, int offset, int num)
switch (offset & 7) switch (offset & 7)
{ {
case 3: /* read hi/lo (alternating) */ case 3: /* read hi/lo (alternating) */
ret = drvstate->m_video_ram[addr]; ret = m_video_ram[addr];
addr += inc & (addr << 1); addr += inc & (addr << 1);
addr ^= 1; addr ^= 1;
break; break;
case 5: /* read hi */ case 5: /* read hi */
ret = drvstate->m_video_ram[addr | 1]; ret = m_video_ram[addr | 1];
addr += inc; addr += inc;
break; break;
case 6: /* read lo */ case 6: /* read lo */
ret = drvstate->m_video_ram[addr & ~1]; ret = m_video_ram[addr & ~1];
addr += inc; addr += inc;
break; break;
@ -196,11 +194,10 @@ static int leland_vram_port_r(address_space &space, int offset, int num)
* *
*************************************/ *************************************/
static void leland_vram_port_w(address_space &space, int offset, int data, int num) void leland_state::leland_vram_port_w(address_space &space, int offset, int data, int num)
{ {
leland_state *drvstate = space.machine().driver_data<leland_state>(); UINT8 *video_ram = m_video_ram;
UINT8 *video_ram = drvstate->m_video_ram; struct vram_state_data *state = m_vram_state + num;
struct vram_state_data *state = drvstate->m_vram_state + num;
int addr = state->m_addr; int addr = state->m_addr;
int inc = (offset >> 2) & 2; int inc = (offset >> 2) & 2;
int trans = (offset >> 4) & num; int trans = (offset >> 4) & num;

View File

@ -107,10 +107,10 @@ WRITE16_MEMBER(lemmings_state::lemmings_vram_w)
} }
void lemmings_copy_bitmap(running_machine &machine, bitmap_rgb32& bitmap, bitmap_ind16& srcbitmap, int* xscroll, int* yscroll, const rectangle& cliprect) void lemmings_state::lemmings_copy_bitmap(bitmap_rgb32& bitmap, bitmap_ind16& srcbitmap, int* xscroll, int* yscroll, const rectangle& cliprect)
{ {
int y,x; int y,x;
const pen_t *paldata = machine.pens; const pen_t *paldata = machine().pens;
for (y=cliprect.min_y; y<cliprect.max_y;y++) for (y=cliprect.min_y; y<cliprect.max_y;y++)
{ {
@ -144,17 +144,17 @@ UINT32 lemmings_state::screen_update_lemmings(screen_device &screen, bitmap_rgb3
/* Pixel layer can be windowed in hardware (two player mode) */ /* Pixel layer can be windowed in hardware (two player mode) */
if ((m_control_data[6] & 2) == 0) if ((m_control_data[6] & 2) == 0)
{ {
lemmings_copy_bitmap(machine(), bitmap, m_bitmap0, &x1, &y, cliprect); lemmings_copy_bitmap(bitmap, m_bitmap0, &x1, &y, cliprect);
} }
else else
{ {
rect.max_x = 159; rect.max_x = 159;
rect.min_x = 0; rect.min_x = 0;
lemmings_copy_bitmap(machine(), bitmap, m_bitmap0, &x0, &y, rect); lemmings_copy_bitmap(bitmap, m_bitmap0, &x0, &y, rect);
rect.max_x = 319; rect.max_x = 319;
rect.min_x = 160; rect.min_x = 160;
lemmings_copy_bitmap(machine(), bitmap, m_bitmap0, &x1, &y, rect); lemmings_copy_bitmap(bitmap, m_bitmap0, &x1, &y, rect);
} }
m_sprgen2->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0800, 0x0800, 0x200, 0xff); m_sprgen2->inefficient_copy_sprite_bitmap(bitmap, cliprect, 0x0800, 0x0800, 0x200, 0xff);

View File

@ -20,15 +20,15 @@
* *
*************************************/ *************************************/
INLINE void get_crosshair_xy(running_machine &machine, int player, int *x, int *y) inline void lethalj_state::get_crosshair_xy(int player, int *x, int *y)
{ {
static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" }; static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
int width = visarea.width(); int width = visarea.width();
int height = visarea.height(); int height = visarea.height();
*x = ((machine.root_device().ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255; *x = ((machine().root_device().ioport(gunnames[player * 2])->read_safe(0x00) & 0xff) * width) / 255;
*y = ((machine.root_device().ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255; *y = ((machine().root_device().ioport(gunnames[1 + player * 2])->read_safe(0x00) & 0xff) * height) / 255;
} }
@ -49,7 +49,7 @@ READ16_MEMBER(lethalj_state::lethalj_gun_r)
case 4: case 4:
case 5: case 5:
/* latch the crosshair position */ /* latch the crosshair position */
get_crosshair_xy(machine(), offset - 4, &beamx, &beamy); get_crosshair_xy(offset - 4, &beamx, &beamy);
m_gunx = beamx; m_gunx = beamx;
m_guny = beamy; m_guny = beamy;
m_blank_palette = 1; m_blank_palette = 1;

View File

@ -15,7 +15,7 @@
#include "includes/liberate.h" #include "includes/liberate.h"
#if 0 #if 0
void debug_print(bitmap_ind16 &bitmap) void liberate_state::debug_print(bitmap_ind16 &bitmap)
{ {
int i, j; int i, j;
char buf[20 * 16]; char buf[20 * 16];
@ -278,10 +278,9 @@ PALETTE_INIT_MEMBER(liberate_state,liberate)
/***************************************************************************/ /***************************************************************************/
static void liberate_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void liberate_state::liberate_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
liberate_state *state = machine.driver_data<liberate_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
/* Sprites */ /* Sprites */
@ -314,7 +313,7 @@ static void liberate_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
if (multi && fy == 0) if (multi && fy == 0)
sy -= 16; sy -= 16;
if (state->flip_screen()) if (flip_screen())
{ {
sy = 240 - sy; sy = 240 - sy;
sx = 240 - sx; sx = 240 - sx;
@ -333,13 +332,13 @@ static void liberate_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
sy2 = sy + 16; sy2 = sy + 16;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
color, color,
fx,fy, fx,fy,
sx,sy,0); sx,sy,0);
if (multi) if (multi)
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code+1, code+1,
color, color,
fx,fy, fx,fy,
@ -347,11 +346,10 @@ static void liberate_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
} }
} }
static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void liberate_state::prosport_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
liberate_state *state = machine.driver_data<liberate_state>();
int offs, multi, fx, fy, sx, sy, sy2, code, code2, color, gfx_region; int offs, multi, fx, fy, sx, sy, sy2, code, code2, color, gfx_region;
UINT8 *spriteram = state->m_spriteram; UINT8 *spriteram = m_spriteram;
for (offs = 0x000; offs < 0x800; offs += 4) for (offs = 0x000; offs < 0x800; offs += 4)
{ {
@ -361,10 +359,10 @@ static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
code = spriteram[offs + 1] + ((spriteram[offs + 0] & 0x3) << 8); code = spriteram[offs + 1] + ((spriteram[offs + 0] & 0x3) << 8);
code2 = code + 1; code2 = code + 1;
if(state->m_io_ram[0] & 0x40) //dynamic ram-based gfxs for Pro Golf if(m_io_ram[0] & 0x40) //dynamic ram-based gfxs for Pro Golf
gfx_region = 3 + 4; gfx_region = 3 + 4;
else else
gfx_region = ((state->m_io_ram[0] & 0x30) >> 4) + 4; gfx_region = ((m_io_ram[0] & 0x30) >> 4) + 4;
multi = spriteram[offs + 0] & 0x10; multi = spriteram[offs + 0] & 0x10;
@ -376,7 +374,7 @@ static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
// sy = (240 - spriteram[offs + 2]);//-16; // sy = (240 - spriteram[offs + 2]);//-16;
sy = 240 - sy; sy = 240 - sy;
color = 1;//(state->m_io_ram[4] & 2) + 1;//(spriteram[offs + 0] & 0x4) >> 2; color = 1;//(m_io_ram[4] & 2) + 1;//(spriteram[offs + 0] & 0x4) >> 2;
fy = spriteram[offs + 0] & 0x02; fy = spriteram[offs + 0] & 0x02;
fx = spriteram[offs + 0] & 0x04; fx = spriteram[offs + 0] & 0x04;
@ -385,7 +383,7 @@ static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
// if (multi) sy -= 16; // if (multi) sy -= 16;
if ((fy && multi) || (fx && multi)) { code2 = code; code++; } if ((fy && multi) || (fx && multi)) { code2 = code; code++; }
if (state->flip_screen()) if (flip_screen())
{ {
sy = 240 - sy; sy = 240 - sy;
sx = 240 - sx; sx = 240 - sx;
@ -398,13 +396,13 @@ static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
sy2 = sy + 16; sy2 = sy + 16;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx_region], drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx_region],
code, code,
color, color,
fx,fy, fx,fy,
sx,sy,0); sx,sy,0);
if (multi) if (multi)
drawgfx_transpen(bitmap,cliprect,machine.gfx[gfx_region], drawgfx_transpen(bitmap,cliprect,machine().gfx[gfx_region],
code2, code2,
color, color,
fx,fy, fx,fy,
@ -412,10 +410,9 @@ static void prosport_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
} }
} }
static void boomrang_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri ) void liberate_state::boomrang_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri )
{ {
liberate_state *state = machine.driver_data<liberate_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs, multi, fx, fy, sx, sy, sy2, code, code2, color; int offs, multi, fx, fy, sx, sy, sy2, code, code2, color;
for (offs = 0x000; offs < 0x800; offs += 4) for (offs = 0x000; offs < 0x800; offs += 4)
@ -446,7 +443,7 @@ static void boomrang_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
// if (multi) sy -= 16; // if (multi) sy -= 16;
if (fy && multi) { code2 = code; code++; } if (fy && multi) { code2 = code; code++; }
if (state->flip_screen()) if (flip_screen())
{ {
sy = 240 - sy; sy = 240 - sy;
sx = 240 - sx; sx = 240 - sx;
@ -459,13 +456,13 @@ static void boomrang_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
sy2 = sy + 16; sy2 = sy + 16;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
color, color,
fx,fy, fx,fy,
sx,sy,0); sx,sy,0);
if (multi) if (multi)
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code2, code2,
color, color,
fx,fy, fx,fy,
@ -473,10 +470,9 @@ static void boomrang_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
} }
} }
static void prosoccr_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void liberate_state::prosoccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
liberate_state *state = machine.driver_data<liberate_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs, code, fx, fy, sx, sy; int offs, code, fx, fy, sx, sy;
for (offs = 0x000; offs < 0x400; offs += 4) for (offs = 0x000; offs < 0x400; offs += 4)
@ -490,7 +486,7 @@ static void prosoccr_draw_sprites( running_machine &machine, bitmap_ind16 &bitma
fx = spriteram[offs + 0] & 4; fx = spriteram[offs + 0] & 4;
fy = spriteram[offs + 0] & 2; fy = spriteram[offs + 0] & 2;
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
0, 0,
fx,fy, fx,fy,
@ -511,7 +507,7 @@ UINT32 liberate_state::screen_update_prosoccr(screen_device &screen, bitmap_ind1
m_back_tilemap->draw(bitmap, cliprect, 0, 0); m_back_tilemap->draw(bitmap, cliprect, 0, 0);
m_fix_tilemap->draw(bitmap, cliprect, 0, 0); m_fix_tilemap->draw(bitmap, cliprect, 0, 0);
prosoccr_draw_sprites(machine(), bitmap, cliprect); prosoccr_draw_sprites(bitmap, cliprect);
return 0; return 0;
} }
@ -554,7 +550,7 @@ UINT32 liberate_state::screen_update_prosport(screen_device &screen, bitmap_ind1
tile, 1, 0, 0, 248 - 8 * mx, 8 * my, 0); tile, 1, 0, 0, 248 - 8 * mx, 8 * my, 0);
} }
prosport_draw_sprites(machine(), bitmap, cliprect); prosport_draw_sprites(bitmap, cliprect);
return 0; return 0;
} }
@ -569,11 +565,11 @@ UINT32 liberate_state::screen_update_boomrang(screen_device &screen, bitmap_ind1
else else
m_back_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_back_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
boomrang_draw_sprites(machine(),bitmap,cliprect,8); boomrang_draw_sprites(bitmap,cliprect,8);
if (!m_background_disable) if (!m_background_disable)
m_back_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_back_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
boomrang_draw_sprites(machine(), bitmap, cliprect, 0); boomrang_draw_sprites(bitmap, cliprect, 0);
m_fix_tilemap->draw(bitmap, cliprect, 0, 0); m_fix_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -588,7 +584,7 @@ UINT32 liberate_state::screen_update_liberate(screen_device &screen, bitmap_ind1
else else
m_back_tilemap->draw(bitmap, cliprect, 0, 0); m_back_tilemap->draw(bitmap, cliprect, 0, 0);
liberate_draw_sprites(machine(), bitmap, cliprect); liberate_draw_sprites(bitmap, cliprect);
m_fix_tilemap->draw(bitmap, cliprect, 0, 0); m_fix_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }

View File

@ -97,10 +97,9 @@ void lkage_state::video_start()
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lkage_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lkage_state *state = machine.driver_data<lkage_state>(); const UINT8 *source = m_spriteram;
const UINT8 *source = state->m_spriteram;
const UINT8 *finish = source + 0x60; const UINT8 *finish = source + 0x60;
while (source < finish) while (source < finish)
@ -118,7 +117,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int flipx = attributes & 0x01; int flipx = attributes & 0x01;
int flipy = attributes & 0x02; int flipy = attributes & 0x02;
int height = (attributes & 0x08) ? 2 : 1; int height = (attributes & 0x08) ? 2 : 1;
int sx = source[0] - 15 + state->m_sprite_dx; int sx = source[0] - 15 + m_sprite_dx;
int sy = 256 - 16 * height - source[1]; int sy = 256 - 16 * height - source[1];
int sprite_number = source[3] + ((attributes & 0x04) << 6); int sprite_number = source[3] + ((attributes & 0x04) << 6);
int y; int y;
@ -132,12 +131,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
priority_mask = 0xf0; priority_mask = 0xf0;
} }
if (state->flip_screen_x()) if (flip_screen_x())
{ {
sx = 239 - sx - 24; sx = 239 - sx - 24;
flipx = !flipx; flipx = !flipx;
} }
if (state->flip_screen_y()) if (flip_screen_y())
{ {
sy = 254 - 16 * height - sy; sy = 254 - 16 * height - sy;
flipy = !flipy; flipy = !flipy;
@ -152,13 +151,13 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
pdrawgfx_transpen( pdrawgfx_transpen(
bitmap, bitmap,
cliprect, cliprect,
machine.gfx[1], machine().gfx[1],
sprite_number ^ y, sprite_number ^ y,
color, color,
flipx,flipy, flipx,flipy,
sx&0xff, sx&0xff,
sy + 16*y, sy + 16*y,
machine.priority_bitmap, machine().priority_bitmap,
priority_mask,0 ); priority_mask,0 );
} }
source += 4; source += 4;
@ -213,7 +212,7 @@ UINT32 lkage_state::screen_update_lkage(screen_device &screen, bitmap_ind16 &bit
m_bg_tilemap->draw(bitmap, cliprect, 0, 1); m_bg_tilemap->draw(bitmap, cliprect, 0, 1);
m_fg_tilemap->draw(bitmap, cliprect, 0, (m_vreg[1] & 2) ? 2 : 4); m_fg_tilemap->draw(bitmap, cliprect, 0, (m_vreg[1] & 2) ? 2 : 4);
m_tx_tilemap->draw(bitmap, cliprect, 0, 4); m_tx_tilemap->draw(bitmap, cliprect, 0, 4);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
} }
else else
{ {

View File

@ -163,13 +163,12 @@ WRITE16_MEMBER(lockon_state::lockon_scene_v_scr_w)
m_scroll_v = data & 0x81ff; m_scroll_v = data & 0x81ff;
} }
static void scene_draw( running_machine &machine ) void lockon_state::scene_draw( )
{ {
lockon_state *state = machine.driver_data<lockon_state>();
UINT32 y; UINT32 y;
/* 3bpp characters */ /* 3bpp characters */
const UINT8 *const gfx1 = state->memregion("gfx2")->base(); const UINT8 *const gfx1 = memregion("gfx2")->base();
const UINT8 *const gfx2 = gfx1 + 0x10000; const UINT8 *const gfx2 = gfx1 + 0x10000;
const UINT8 *const gfx3 = gfx1 + 0x20000; const UINT8 *const gfx3 = gfx1 + 0x20000;
const UINT8 *const clut = gfx1 + 0x30000; const UINT8 *const clut = gfx1 + 0x30000;
@ -185,20 +184,20 @@ static void scene_draw( running_machine &machine )
UINT16 *bmpaddr; UINT16 *bmpaddr;
UINT32 ram_mask = 0x7ff; UINT32 ram_mask = 0x7ff;
y_offs = (y + state->m_scroll_v) & 0x1ff; y_offs = (y + m_scroll_v) & 0x1ff;
/* Clamp - stops tilemap wrapping when screen is rotated */ /* Clamp - stops tilemap wrapping when screen is rotated */
if (BIT(state->m_scroll_v, 15) && y_offs & 0x100) if (BIT(m_scroll_v, 15) && y_offs & 0x100)
ram_mask = 0x7; ram_mask = 0x7;
x_offs = (state->m_scroll_h - 8) & 0x1ff; x_offs = (m_scroll_h - 8) & 0x1ff;
y_gran = y_offs & 7; y_gran = y_offs & 7;
if (x_offs & 7) if (x_offs & 7)
{ {
UINT32 tileidx; UINT32 tileidx;
UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f); UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f);
UINT16 ram_val = state->m_scene_ram[addr & ram_mask]; UINT16 ram_val = m_scene_ram[addr & ram_mask];
colour = (clut[ram_val & 0x7fff] & 0x3f) << 3; colour = (clut[ram_val & 0x7fff] & 0x3f) << 3;
tileidx = ((ram_val & 0x0fff) << 3) + y_gran; tileidx = ((ram_val & 0x0fff) << 3) + y_gran;
@ -208,7 +207,7 @@ static void scene_draw( running_machine &machine )
d2 = *(gfx3 + tileidx); d2 = *(gfx3 + tileidx);
} }
bmpaddr = &state->m_back_buffer->pix16(y); bmpaddr = &m_back_buffer->pix16(y);
for (x = 0; x < FRAMEBUFFER_MAX_X; ++x) for (x = 0; x < FRAMEBUFFER_MAX_X; ++x)
{ {
@ -219,7 +218,7 @@ static void scene_draw( running_machine &machine )
{ {
UINT32 tileidx; UINT32 tileidx;
UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f); UINT16 addr = ((y_offs & ~7) << 3) + ((x_offs >> 3) & 0x3f);
UINT16 ram_val = state->m_scene_ram[addr & ram_mask]; UINT16 ram_val = m_scene_ram[addr & ram_mask];
colour = (clut[ram_val & 0x7fff] & 0x3f) << 3; colour = (clut[ram_val & 0x7fff] & 0x3f) << 3;
tileidx = ((ram_val & 0x0fff) << 3) + y_gran; tileidx = ((ram_val & 0x0fff) << 3) + y_gran;
@ -299,25 +298,24 @@ TIMER_CALLBACK_MEMBER(lockon_state::bufend_callback)
rom_data3 = gfx_rom[gfx_addr + 0x20000]; \ rom_data3 = gfx_rom[gfx_addr + 0x20000]; \
} }
static void ground_draw( running_machine &machine ) void lockon_state::ground_draw( )
{ {
lockon_state *state = machine.driver_data<lockon_state>();
/* ROM pointers */ /* ROM pointers */
const UINT8 *const gfx_rom = state->memregion("gfx4")->base(); const UINT8 *const gfx_rom = memregion("gfx4")->base();
const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((state->m_ground_ctrl >> 2) & 0x3 ? 0x10000 : 0); const UINT8 *const lut_rom = gfx_rom + 0x30000 + ((m_ground_ctrl >> 2) & 0x3 ? 0x10000 : 0);
const UINT8 *const clut_rom = gfx_rom + 0x50000; const UINT8 *const clut_rom = gfx_rom + 0x50000;
UINT32 lut_a15_14 = (state->m_ground_ctrl & 0x3) << 14; UINT32 lut_a15_14 = (m_ground_ctrl & 0x3) << 14;
UINT32 clut_a14_12 = (state->m_ground_ctrl & 0x70) << 8; UINT32 clut_a14_12 = (m_ground_ctrl & 0x70) << 8;
UINT32 gfx_a15 = (state->m_ground_ctrl & 0x40) << 9; UINT32 gfx_a15 = (m_ground_ctrl & 0x40) << 9;
UINT32 offs = 3; UINT32 offs = 3;
UINT32 y; UINT32 y;
/* TODO: Clean up and emulate CS of GFX ROMs? */ /* TODO: Clean up and emulate CS of GFX ROMs? */
for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y) for (y = 0; y < FRAMEBUFFER_MAX_Y; ++y)
{ {
UINT16 *bmpaddr = &state->m_back_buffer->pix16(y); UINT16 *bmpaddr = &m_back_buffer->pix16(y);
UINT8 ls163; UINT8 ls163;
UINT32 clut_addr; UINT32 clut_addr;
UINT32 gfx_addr; UINT32 gfx_addr;
@ -328,20 +326,20 @@ static void ground_draw( running_machine &machine )
UINT32 x; UINT32 x;
/* Draw this line? */ /* Draw this line? */
if (!(state->m_ground_ram[offs] & 0x8000)) if (!(m_ground_ram[offs] & 0x8000))
{ {
UINT32 gfx_a2_0 = state->m_ground_ram[offs] & 0x0007; UINT32 gfx_a2_0 = m_ground_ram[offs] & 0x0007;
UINT32 gfx_a6_5 = (state->m_ground_ram[offs] & 0x0018) << 2; UINT32 gfx_a6_5 = (m_ground_ram[offs] & 0x0018) << 2;
UINT32 clut_a4_3 = (state->m_ground_ram[offs] & 0x0018) >> 1; UINT32 clut_a4_3 = (m_ground_ram[offs] & 0x0018) >> 1;
UINT8 tz2213_x = state->m_ground_ram[offs + 1] & 0xff; UINT8 tz2213_x = m_ground_ram[offs + 1] & 0xff;
UINT8 tz2213_dx = state->m_ground_ram[offs + 2] & 0xff; UINT8 tz2213_dx = m_ground_ram[offs + 2] & 0xff;
UINT32 lut_address = lut_a15_14 + ((state->m_ground_ram[offs] & 0x7fe0) >> 1); UINT32 lut_address = lut_a15_14 + ((m_ground_ram[offs] & 0x7fe0) >> 1);
UINT32 cy = state->m_ground_ram[offs + 2] & 0x0100; UINT32 cy = m_ground_ram[offs + 2] & 0x0100;
UINT32 color; UINT32 color;
UINT32 gpbal2_0_prev; UINT32 gpbal2_0_prev;
ls163 = state->m_ground_ram[offs + 1] >> 8; ls163 = m_ground_ram[offs + 1] >> 8;
gpbal2_0_prev = ((ls163 & 3) << 1) | BIT(tz2213_x, 7); gpbal2_0_prev = ((ls163 & 3) << 1) | BIT(tz2213_x, 7);
@ -379,9 +377,9 @@ static void ground_draw( running_machine &machine )
offs += 3; offs += 3;
/* End of list marker */ /* End of list marker */
if (state->m_ground_ram[offs + 2] & 0x8000) if (m_ground_ram[offs + 2] & 0x8000)
{ {
state->m_bufend_timer->adjust(attotime::from_hz(FRAMEBUFFER_CLOCK) * (FRAMEBUFFER_MAX_X * y)); m_bufend_timer->adjust(attotime::from_hz(FRAMEBUFFER_CLOCK) * (FRAMEBUFFER_MAX_X * y));
} }
} }
} }
@ -418,7 +416,7 @@ do { \
if (px < FRAMEBUFFER_MAX_X) \ if (px < FRAMEBUFFER_MAX_X) \
if (COLOR != 0xf) \ if (COLOR != 0xf) \
{ \ { \
UINT8 clr = state->m_obj_pal_ram[(pal << 4) + COLOR]; \ UINT8 clr = m_obj_pal_ram[(pal << 4) + COLOR]; \
UINT16 *pix = (line + px); \ UINT16 *pix = (line + px); \
if (!(clr == 0xff && ((*pix & 0xe00) == 0xa00))) \ if (!(clr == 0xff && ((*pix & 0xe00) == 0xa00))) \
*pix = 0x400 + clr; \ *pix = 0x400 + clr; \
@ -426,17 +424,16 @@ do { \
px = (px + 1) & 0x7ff; \ px = (px + 1) & 0x7ff; \
} while(0) } while(0)
static void objects_draw( running_machine &machine ) void lockon_state::objects_draw( )
{ {
UINT32 offs; UINT32 offs;
lockon_state *state = machine.driver_data<lockon_state>();
const UINT8 *const romlut = state->memregion("user1")->base(); const UINT8 *const romlut = memregion("user1")->base();
const UINT16 *const chklut = (UINT16*)state->memregion("user2")->base(); const UINT16 *const chklut = (UINT16*)memregion("user2")->base();
const UINT8 *const gfxrom = state->memregion("gfx5")->base(); const UINT8 *const gfxrom = memregion("gfx5")->base();
const UINT8 *const sproms = state->memregion("proms")->base() + 0x800; const UINT8 *const sproms = memregion("proms")->base() + 0x800;
for (offs = 0; offs < state->m_object_ram.bytes(); offs += 4) for (offs = 0; offs < m_object_ram.bytes(); offs += 4)
{ {
UINT32 y; UINT32 y;
UINT32 xpos; UINT32 xpos;
@ -452,19 +449,19 @@ static void objects_draw( running_machine &machine )
UINT32 opsta15_8; UINT32 opsta15_8;
/* Retrieve the object attributes */ /* Retrieve the object attributes */
ypos = state->m_object_ram[offs] & 0x03ff; ypos = m_object_ram[offs] & 0x03ff;
xpos = state->m_object_ram[offs + 3] & 0x07ff; xpos = m_object_ram[offs + 3] & 0x07ff;
ysize = (state->m_object_ram[offs] >> 10) & 0x3; ysize = (m_object_ram[offs] >> 10) & 0x3;
xsize = (state->m_object_ram[offs] >> 12) & 0x3; xsize = (m_object_ram[offs] >> 12) & 0x3;
yflip = BIT(state->m_object_ram[offs], 14); yflip = BIT(m_object_ram[offs], 14);
xflip = BIT(state->m_object_ram[offs], 15); xflip = BIT(m_object_ram[offs], 15);
scale = state->m_object_ram[offs + 1] & 0xff; scale = m_object_ram[offs + 1] & 0xff;
pal = (state->m_object_ram[offs + 1] >> 8) & 0x7f; pal = (m_object_ram[offs + 1] >> 8) & 0x7f;
opsta = state->m_object_ram[offs + 2]; opsta = m_object_ram[offs + 2];
if (state->m_iden) if (m_iden)
{ {
state->m_obj_pal_ram[(pal << 4) + state->m_obj_pal_addr] = state->m_obj_pal_latch; m_obj_pal_ram[(pal << 4) + m_obj_pal_addr] = m_obj_pal_latch;
break; break;
} }
@ -484,7 +481,7 @@ static void objects_draw( running_machine &machine )
UINT32 tile; UINT32 tile;
UINT8 cnt; UINT8 cnt;
UINT32 yidx; UINT32 yidx;
UINT16 *line = &state->m_back_buffer->pix16(y); UINT16 *line = &m_back_buffer->pix16(y);
UINT32 px = xpos; UINT32 px = xpos;
/* Outside the limits? */ /* Outside the limits? */
@ -595,7 +592,7 @@ static void objects_draw( running_machine &machine )
} }
/* Check for the end of list marker */ /* Check for the end of list marker */
if (state->m_object_ram[offs + 1] & 0x8000) if (m_object_ram[offs + 1] & 0x8000)
return; return;
} }
} }
@ -607,7 +604,7 @@ WRITE16_MEMBER(lockon_state::lockon_tza112_w)
{ {
m_obj_pal_latch = data & 0xff; m_obj_pal_latch = data & 0xff;
m_obj_pal_addr = offset & 0xf; m_obj_pal_addr = offset & 0xf;
objects_draw(machine()); objects_draw();
} }
} }
@ -684,29 +681,28 @@ do { \
if (carry) --CNT; \ if (carry) --CNT; \
} while(0) } while(0)
static void rotate_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lockon_state::rotate_draw( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lockon_state *state = machine.driver_data<lockon_state>();
UINT32 y; UINT32 y;
/* Counters */ /* Counters */
UINT32 cxy = state->m_xsal & 0xff; UINT32 cxy = m_xsal & 0xff;
UINT32 cyy = state->m_ysal & 0x1ff; UINT32 cyy = m_ysal & 0x1ff;
/* Accumulator values and deltas */ /* Accumulator values and deltas */
UINT8 axy = state->m_x0ll & 0xff; UINT8 axy = m_x0ll & 0xff;
UINT8 daxy = state->m_dx0ll & 0xff; UINT8 daxy = m_dx0ll & 0xff;
UINT8 ayy = state->m_y0ll & 0xff; UINT8 ayy = m_y0ll & 0xff;
UINT8 dayy = state->m_dy0ll & 0xff; UINT8 dayy = m_dy0ll & 0xff;
UINT8 dayx = state->m_dyll & 0xff; UINT8 dayx = m_dyll & 0xff;
UINT8 daxx = state->m_dxll & 0xff; UINT8 daxx = m_dxll & 0xff;
UINT32 xy_up = BIT(state->m_xsal, 8); UINT32 xy_up = BIT(m_xsal, 8);
UINT32 yx_up = BIT(state->m_dyll, 9); UINT32 yx_up = BIT(m_dyll, 9);
UINT32 axx_en = !BIT(state->m_dxll, 8); UINT32 axx_en = !BIT(m_dxll, 8);
UINT32 ayx_en = !BIT(state->m_dyll, 8); UINT32 ayx_en = !BIT(m_dyll, 8);
UINT32 axy_en = !BIT(state->m_dx0ll, 8); UINT32 axy_en = !BIT(m_dx0ll, 8);
UINT32 ayy_en = !BIT(state->m_dy0ll, 8); UINT32 ayy_en = !BIT(m_dy0ll, 8);
for (y = 0; y <= cliprect.max_y; ++y) for (y = 0; y <= cliprect.max_y; ++y)
{ {
@ -725,7 +721,7 @@ static void rotate_draw( running_machine &machine, bitmap_ind16 &bitmap, const r
cx &= 0x1ff; cx &= 0x1ff;
cy &= 0x1ff; cy &= 0x1ff;
*dst++ = state->m_front_buffer->pix16(cy, cx); *dst++ = m_front_buffer->pix16(cy, cx);
if (axx_en) if (axx_en)
INCREMENT(axx, cx); INCREMENT(axx, cx);
@ -789,13 +785,12 @@ static void rotate_draw( running_machine &machine, bitmap_ind16 &bitmap, const r
*******************************************************************************************/ *******************************************************************************************/
static void hud_draw( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lockon_state::hud_draw( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lockon_state *state = machine.driver_data<lockon_state>(); UINT8 *tile_rom = memregion("gfx3")->base();
UINT8 *tile_rom = state->memregion("gfx3")->base();
UINT32 offs; UINT32 offs;
for (offs = 0x0; offs <= state->m_hud_ram.bytes(); offs += 2) for (offs = 0x0; offs <= m_hud_ram.bytes(); offs += 2)
{ {
UINT32 y; UINT32 y;
UINT32 y_pos; UINT32 y_pos;
@ -808,14 +803,14 @@ static void hud_draw( running_machine &machine, bitmap_ind16 &bitmap, const rect
UINT32 rom_a12_7; UINT32 rom_a12_7;
/* End of sprite list marker */ /* End of sprite list marker */
if (state->m_hud_ram[offs + 1] & 0x8000) if (m_hud_ram[offs + 1] & 0x8000)
break; break;
y_pos = state->m_hud_ram[offs] & 0x1ff; y_pos = m_hud_ram[offs] & 0x1ff;
x_pos = state->m_hud_ram[offs + 1] & 0x1ff; x_pos = m_hud_ram[offs + 1] & 0x1ff;
x_size = (state->m_hud_ram[offs + 1] >> 12) & 7; x_size = (m_hud_ram[offs + 1] >> 12) & 7;
code = (state->m_hud_ram[offs] >> 9) & 0x7f; code = (m_hud_ram[offs] >> 9) & 0x7f;
colour = 0x200 + ((state->m_hud_ram[offs + 1] >> 9) & 7); colour = 0x200 + ((m_hud_ram[offs + 1] >> 9) & 7);
layout = (code >> 5) & 3; layout = (code >> 5) & 3;
rom_a12_7 = (code & 0xfe) << 6; rom_a12_7 = (code & 0xfe) << 6;
@ -923,13 +918,13 @@ UINT32 lockon_state::screen_update_lockon(screen_device &screen, bitmap_ind16 &b
} }
/* Scan out the frame buffer in rotated order */ /* Scan out the frame buffer in rotated order */
rotate_draw(machine(), bitmap, cliprect); rotate_draw(bitmap, cliprect);
/* Draw the character tilemap */ /* Draw the character tilemap */
m_tilemap->draw(bitmap, cliprect, 0, 0); m_tilemap->draw(bitmap, cliprect, 0, 0);
/* Draw the HUD */ /* Draw the HUD */
hud_draw(machine(), bitmap, cliprect); hud_draw(bitmap, cliprect);
return 0; return 0;
} }
@ -945,8 +940,8 @@ void lockon_state::screen_eof_lockon(screen_device &screen, bool state)
m_back_buffer = tmp; m_back_buffer = tmp;
/* Draw the frame buffer layers */ /* Draw the frame buffer layers */
scene_draw(machine()); scene_draw();
ground_draw(machine()); ground_draw();
objects_draw(machine()); objects_draw();
} }
} }

View File

@ -61,31 +61,29 @@ WRITE16_MEMBER(lordgun_state::lordgun_paletteram_w)
***************************************************************************/ ***************************************************************************/
INLINE void get_tile_info(running_machine &machine, tile_data &tileinfo, tilemap_memory_index tile_index, int _N_) inline void lordgun_state::get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_)
{ {
lordgun_state *state = machine.driver_data<lordgun_state>(); UINT16 attr = m_vram[_N_][tile_index * 2 + 0 ];
UINT16 attr = state->m_vram[_N_][tile_index * 2 + 0 ]; UINT16 code = m_vram[_N_][ tile_index * 2 + 1 ];
UINT16 code = state->m_vram[_N_][ tile_index * 2 + 1 ];
UINT16 pri = (attr & 0x0e00) >> 9; UINT16 pri = (attr & 0x0e00) >> 9;
SET_TILE_INFO( _N_, code, ((attr & 0x0030) >> 4) + 0x10 + 0x4 * ((_N_ + 1) & 3) + pri*0x800/0x40, TILE_FLIPXY(attr >> 14)); SET_TILE_INFO_MEMBER( _N_, code, ((attr & 0x0030) >> 4) + 0x10 + 0x4 * ((_N_ + 1) & 3) + pri*0x800/0x40, TILE_FLIPXY(attr >> 14));
} }
TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_0){ get_tile_info(machine(), tileinfo, tile_index, 0); } TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_0){ get_tile_info(tileinfo, tile_index, 0); }
TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_1){ get_tile_info(machine(), tileinfo, tile_index, 1); } TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_1){ get_tile_info(tileinfo, tile_index, 1); }
TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_2){ get_tile_info(machine(), tileinfo, tile_index, 2); } TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_2){ get_tile_info(tileinfo, tile_index, 2); }
TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_3){ get_tile_info(machine(), tileinfo, tile_index, 3); } TILE_GET_INFO_MEMBER(lordgun_state::get_tile_info_3){ get_tile_info(tileinfo, tile_index, 3); }
INLINE void lordgun_vram_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int _N_) inline void lordgun_state::lordgun_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_)
{ {
lordgun_state *state = space.machine().driver_data<lordgun_state>(); COMBINE_DATA(&m_vram[_N_][offset]);
COMBINE_DATA(&state->m_vram[_N_][offset]); m_tilemap[_N_]->mark_tile_dirty(offset/2);
state->m_tilemap[_N_]->mark_tile_dirty(offset/2);
} }
WRITE16_MEMBER(lordgun_state::lordgun_vram_0_w){ lordgun_vram_w(space, offset, data, mem_mask, 0); } WRITE16_MEMBER(lordgun_state::lordgun_vram_0_w){ lordgun_vram_w(offset, data, mem_mask, 0); }
WRITE16_MEMBER(lordgun_state::lordgun_vram_1_w){ lordgun_vram_w(space, offset, data, mem_mask, 1); } WRITE16_MEMBER(lordgun_state::lordgun_vram_1_w){ lordgun_vram_w(offset, data, mem_mask, 1); }
WRITE16_MEMBER(lordgun_state::lordgun_vram_2_w){ lordgun_vram_w(space, offset, data, mem_mask, 2); } WRITE16_MEMBER(lordgun_state::lordgun_vram_2_w){ lordgun_vram_w(offset, data, mem_mask, 2); }
WRITE16_MEMBER(lordgun_state::lordgun_vram_3_w){ lordgun_vram_w(space, offset, data, mem_mask, 3); } WRITE16_MEMBER(lordgun_state::lordgun_vram_3_w){ lordgun_vram_w(offset, data, mem_mask, 3); }
/*************************************************************************** /***************************************************************************
@ -182,32 +180,30 @@ float lordgun_crosshair_mapper(ioport_field *field, float linear_value)
return lordgun_gun_x_table[x] * 1.0f / 0x1BF; return lordgun_gun_x_table[x] * 1.0f / 0x1BF;
} }
static void lorddgun_calc_gun_scr(running_machine &machine, int i) void lordgun_state::lorddgun_calc_gun_scr(int i)
{ {
lordgun_state *state = machine.driver_data<lordgun_state>(); // popmessage("%03x, %02x", machine, "LIGHT0_X"), ioport("LIGHT0_Y")->read());
// popmessage("%03x, %02x", machine, "LIGHT0_X"), state->ioport("LIGHT0_Y")->read());
int x = state->ioport(gunnames[i])->read() - 0x3c; int x = ioport(gunnames[i])->read() - 0x3c;
if ( (x < 0) || (x > sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0])) ) if ( (x < 0) || (x > sizeof(lordgun_gun_x_table)/sizeof(lordgun_gun_x_table[0])) )
x = 0; x = 0;
state->m_gun[i].scr_x = lordgun_gun_x_table[x]; m_gun[i].scr_x = lordgun_gun_x_table[x];
state->m_gun[i].scr_y = state->ioport(gunnames[i+2])->read(); m_gun[i].scr_y = ioport(gunnames[i+2])->read();
} }
void lordgun_update_gun(running_machine &machine, int i) void lordgun_state::lordgun_update_gun(int i)
{ {
lordgun_state *state = machine.driver_data<lordgun_state>(); const rectangle &visarea = machine().primary_screen->visible_area();
const rectangle &visarea = machine.primary_screen->visible_area();
state->m_gun[i].hw_x = state->ioport(gunnames[i])->read(); m_gun[i].hw_x = ioport(gunnames[i])->read();
state->m_gun[i].hw_y = state->ioport(gunnames[i+2])->read(); m_gun[i].hw_y = ioport(gunnames[i+2])->read();
lorddgun_calc_gun_scr(machine, i); lorddgun_calc_gun_scr(i);
if (!visarea.contains(state->m_gun[i].scr_x, state->m_gun[i].scr_y)) if (!visarea.contains(m_gun[i].scr_x, m_gun[i].scr_y))
state->m_gun[i].hw_x = state->m_gun[i].hw_y = 0; m_gun[i].hw_x = m_gun[i].hw_y = 0;
} }
@ -235,11 +231,10 @@ void lordgun_update_gun(running_machine &machine, int i)
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void lordgun_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
lordgun_state *state = machine.driver_data<lordgun_state>(); UINT16 *s = m_spriteram;
UINT16 *s = state->m_spriteram; UINT16 *end = m_spriteram + m_spriteram.bytes()/2;
UINT16 *end = state->m_spriteram + state->m_spriteram.bytes()/2;
for ( ; s < end; s += 8/2 ) for ( ; s < end; s += 8/2 )
{ {
@ -278,7 +273,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
{ {
for (x = x0; x != x1; x += dx) for (x = x0; x != x1; x += dx)
{ {
drawgfx_transpen( bitmap, cliprect, machine.gfx[4], drawgfx_transpen( bitmap, cliprect, machine().gfx[4],
code, color + pri * 0x800/0x40, code, color + pri * 0x800/0x40,
flipx, flipy, flipx, flipy,
sx + x * 0x10, sy + y * 0x10, sx + x * 0x10, sy + y * 0x10,
@ -373,7 +368,7 @@ UINT32 lordgun_state::screen_update_lordgun(screen_device &screen, bitmap_ind16
if (layers_ctrl & 2) m_tilemap[1]->draw(*m_bitmaps[1], cliprect, 0, 0); if (layers_ctrl & 2) m_tilemap[1]->draw(*m_bitmaps[1], cliprect, 0, 0);
if (layers_ctrl & 4) m_tilemap[2]->draw(*m_bitmaps[2], cliprect, 0, 0); if (layers_ctrl & 4) m_tilemap[2]->draw(*m_bitmaps[2], cliprect, 0, 0);
if (layers_ctrl & 8) m_tilemap[3]->draw(*m_bitmaps[3], cliprect, 0, 0); if (layers_ctrl & 8) m_tilemap[3]->draw(*m_bitmaps[3], cliprect, 0, 0);
if (layers_ctrl & 16) draw_sprites(machine(), *m_bitmaps[4], cliprect); if (layers_ctrl & 16) draw_sprites(*m_bitmaps[4], cliprect);
// copy to screen bitmap // copy to screen bitmap

View File

@ -1,9 +1,8 @@
#include "emu.h" #include "emu.h"
#include "includes/lsasquad.h" #include "includes/lsasquad.h"
static void draw_layer( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *scrollram ) void lsasquad_state::draw_layer( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *scrollram )
{ {
lsasquad_state *state = machine.driver_data<lsasquad_state>();
int offs, scrollx, scrolly; int offs, scrollx, scrolly;
scrollx = scrollram[3]; scrollx = scrollram[3];
@ -15,7 +14,7 @@ static void draw_layer( running_machine &machine, bitmap_ind16 &bitmap, const re
base = 64 * scrollram[offs + 1]; base = 64 * scrollram[offs + 1];
sx = 8 * (offs / 4) + scrollx; sx = 8 * (offs / 4) + scrollx;
if (state->flip_screen()) if (flip_screen())
sx = 248 - sx; sx = 248 - sx;
sx &= 0xff; sx &= 0xff;
@ -25,62 +24,61 @@ static void draw_layer( running_machine &machine, bitmap_ind16 &bitmap, const re
int attr; int attr;
sy = 8 * y + scrolly; sy = 8 * y + scrolly;
if (state->flip_screen()) if (flip_screen())
sy = 248 - sy; sy = 248 - sy;
sy &= 0xff; sy &= 0xff;
attr = state->m_videoram[base + 2 * y + 1]; attr = m_videoram[base + 2 * y + 1];
code = state->m_videoram[base + 2 * y] + ((attr & 0x0f) << 8); code = m_videoram[base + 2 * y] + ((attr & 0x0f) << 8);
color = attr >> 4; color = attr >> 4;
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
code, code,
color, color,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx,sy,15); sx,sy,15);
if (sx > 248) /* wraparound */ if (sx > 248) /* wraparound */
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
code, code,
color, color,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx-256,sy,15); sx-256,sy,15);
} }
} }
} }
static int draw_layer_daikaiju( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int * previd, int type ) int lsasquad_state::draw_layer_daikaiju( bitmap_ind16 &bitmap, const rectangle &cliprect, int offs, int * previd, int type )
{ {
lsasquad_state *state = machine.driver_data<lsasquad_state>();
int id, scrollx, scrolly, initoffs, globalscrollx; int id, scrollx, scrolly, initoffs, globalscrollx;
int stepx = 0; int stepx = 0;
initoffs = offs; initoffs = offs;
globalscrollx = 0; globalscrollx = 0;
id = state->m_scrollram[offs + 2]; id = m_scrollram[offs + 2];
for( ; offs < 0x400; offs += 4) for( ; offs < 0x400; offs += 4)
{ {
int base, y, sx, sy, code, color; int base, y, sx, sy, code, color;
//id change //id change
if (id != state->m_scrollram[offs + 2]) if (id != m_scrollram[offs + 2])
{ {
*previd = id; *previd = id;
return offs; return offs;
} }
else else
{ {
id = state->m_scrollram[offs + 2]; id = m_scrollram[offs + 2];
} }
//skip empty (??) column, potential probs with 1st column in scrollram (scroll 0, tile 0, id 0) //skip empty (??) column, potential probs with 1st column in scrollram (scroll 0, tile 0, id 0)
if ((state->m_scrollram[offs + 0] | state->m_scrollram[offs + 1] | state->m_scrollram[offs + 2] | state->m_scrollram[offs + 3]) == 0) if ((m_scrollram[offs + 0] | m_scrollram[offs + 1] | m_scrollram[offs + 2] | m_scrollram[offs + 3]) == 0)
continue; continue;
//local scroll x/y //local scroll x/y
scrolly = -state->m_scrollram[offs + 0]; scrolly = -m_scrollram[offs + 0];
scrollx = state->m_scrollram[offs + 3]; scrollx = m_scrollram[offs + 3];
//check for global x scroll used in bg layer in game (starts at offset 0 in scrollram //check for global x scroll used in bg layer in game (starts at offset 0 in scrollram
// and game name/logo on title screen (starts in the middle of scrollram, but with different // and game name/logo on title screen (starts in the middle of scrollram, but with different
@ -99,10 +97,10 @@ static int draw_layer_daikaiju( running_machine &machine, bitmap_ind16 &bitmap,
} }
} }
base = 64 * state->m_scrollram[offs + 1]; base = 64 * m_scrollram[offs + 1];
sx = scrollx + stepx; sx = scrollx + stepx;
if (state->flip_screen()) if (flip_screen())
sx = 248 - sx; sx = 248 - sx;
sx &= 0xff; sx &= 0xff;
@ -111,26 +109,26 @@ static int draw_layer_daikaiju( running_machine &machine, bitmap_ind16 &bitmap,
int attr; int attr;
sy = 8 * y + scrolly; sy = 8 * y + scrolly;
if (state->flip_screen()) if (flip_screen())
sy = 248 - sy; sy = 248 - sy;
sy &= 0xff; sy &= 0xff;
attr = state->m_videoram[base + 2 * y + 1]; attr = m_videoram[base + 2 * y + 1];
code = state->m_videoram[base + 2 * y] + ((attr & 0x0f) << 8); code = m_videoram[base + 2 * y] + ((attr & 0x0f) << 8);
color = attr >> 4; color = attr >> 4;
if ((type == 0 && color != 0x0d) || (type != 0 && color == 0x0d)) if ((type == 0 && color != 0x0d) || (type != 0 && color == 0x0d))
{ {
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
code, code,
color, color,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx,sy,15); sx,sy,15);
if (sx > 248) /* wraparound */ if (sx > 248) /* wraparound */
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
code, code,
color, color,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx-256,sy,15); sx-256,sy,15);
} }
} }
@ -138,33 +136,31 @@ static int draw_layer_daikaiju( running_machine &machine, bitmap_ind16 &bitmap,
return offs; return offs;
} }
static void drawbg( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int type ) void lsasquad_state::drawbg( bitmap_ind16 &bitmap, const rectangle &cliprect, int type )
{ {
lsasquad_state *state = machine.driver_data<lsasquad_state>();
int i = 0; int i = 0;
int id = -1; int id = -1;
while (i < 0x400) while (i < 0x400)
{ {
if (!(state->m_scrollram[i + 2] & 1)) if (!(m_scrollram[i + 2] & 1))
{ {
i = draw_layer_daikaiju(machine, bitmap, cliprect, i, &id, type); i = draw_layer_daikaiju(bitmap, cliprect, i, &id, type);
} }
else else
{ {
id = state->m_scrollram[i + 2]; id = m_scrollram[i + 2];
i += 4; i += 4;
} }
} }
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lsasquad_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lsasquad_state *state = machine.driver_data<lsasquad_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{ {
int sx, sy, attr, code, color, flipx, flipy; int sx, sy, attr, code, color, flipx, flipy;
@ -176,7 +172,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipx = attr & 0x40; flipx = attr & 0x40;
flipy = attr & 0x80; flipy = attr & 0x80;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -184,13 +180,13 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
color, color,
flipx,flipy, flipx,flipy,
sx,sy,15); sx,sy,15);
/* wraparound */ /* wraparound */
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -202,10 +198,10 @@ UINT32 lsasquad_state::screen_update_lsasquad(screen_device &screen, bitmap_ind1
{ {
bitmap.fill(511, cliprect); bitmap.fill(511, cliprect);
draw_layer(machine(), bitmap, cliprect, m_scrollram + 0x000); draw_layer(bitmap, cliprect, m_scrollram + 0x000);
draw_layer(machine(), bitmap, cliprect, m_scrollram + 0x080); draw_layer(bitmap, cliprect, m_scrollram + 0x080);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
draw_layer(machine(), bitmap, cliprect, m_scrollram + 0x100); draw_layer(bitmap, cliprect, m_scrollram + 0x100);
return 0; return 0;
} }
@ -213,8 +209,8 @@ UINT32 lsasquad_state::screen_update_lsasquad(screen_device &screen, bitmap_ind1
UINT32 lsasquad_state::screen_update_daikaiju(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 lsasquad_state::screen_update_daikaiju(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
bitmap.fill(511, cliprect); bitmap.fill(511, cliprect);
drawbg(machine(), bitmap, cliprect, 0); // bottom drawbg(bitmap, cliprect, 0); // bottom
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
drawbg(machine(), bitmap, cliprect, 1); // top = palette $d ? drawbg(bitmap, cliprect, 1); // top = palette $d ?
return 0; return 0;
} }

View File

@ -157,7 +157,7 @@ WRITE8_MEMBER(lwings_state::trojan_bg2_image_w)
***************************************************************************/ ***************************************************************************/
INLINE int is_sprite_on( UINT8 *buffered_spriteram, int offs ) inline int lwings_state::is_sprite_on( UINT8 *buffered_spriteram, int offs )
{ {
int sx, sy; int sx, sy;
@ -167,13 +167,12 @@ INLINE int is_sprite_on( UINT8 *buffered_spriteram, int offs )
return sx || sy; return sx || sy;
} }
static void lwings_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lwings_state::lwings_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lwings_state *state = machine.driver_data<lwings_state>(); UINT8 *buffered_spriteram = m_spriteram->buffer();
UINT8 *buffered_spriteram = state->m_spriteram->buffer();
int offs; int offs;
for (offs = state->m_spriteram->bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4)
{ {
if (is_sprite_on(buffered_spriteram, offs)) if (is_sprite_on(buffered_spriteram, offs))
{ {
@ -188,7 +187,7 @@ static void lwings_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
flipx = buffered_spriteram[offs + 1] & 0x02; flipx = buffered_spriteram[offs + 1] & 0x02;
flipy = buffered_spriteram[offs + 1] & 0x04; flipy = buffered_spriteram[offs + 1] & 0x04;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -196,7 +195,7 @@ static void lwings_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[2], drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
code,color, code,color,
flipx,flipy, flipx,flipy,
sx,sy,15); sx,sy,15);
@ -204,13 +203,12 @@ static void lwings_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
} }
} }
static void trojan_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void lwings_state::trojan_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
lwings_state *state = machine.driver_data<lwings_state>(); UINT8 *buffered_spriteram = m_spriteram->buffer();
UINT8 *buffered_spriteram = state->m_spriteram->buffer();
int offs; int offs;
for (offs = state->m_spriteram->bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram->bytes() - 4; offs >= 0; offs -= 4)
{ {
if (is_sprite_on(buffered_spriteram, offs)) if (is_sprite_on(buffered_spriteram, offs))
{ {
@ -226,7 +224,7 @@ static void trojan_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
((buffered_spriteram[offs + 1] & 0x80) << 3); ((buffered_spriteram[offs + 1] & 0x80) << 3);
color = (buffered_spriteram[offs + 1] & 0x0e) >> 1; color = (buffered_spriteram[offs + 1] & 0x0e) >> 1;
if (state->m_bg2_avenger_hw) if (m_bg2_avenger_hw)
{ {
flipx = 0; /* Avengers */ flipx = 0; /* Avengers */
flipy = ~buffered_spriteram[offs + 1] & 0x10; flipy = ~buffered_spriteram[offs + 1] & 0x10;
@ -237,7 +235,7 @@ static void trojan_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
flipy = 1; flipy = 1;
} }
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -245,7 +243,7 @@ static void trojan_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[2], drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
code,color, code,color,
flipx,flipy, flipx,flipy,
sx,sy,15); sx,sy,15);
@ -256,7 +254,7 @@ static void trojan_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,
UINT32 lwings_state::screen_update_lwings(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 lwings_state::screen_update_lwings(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg1_tilemap->draw(bitmap, cliprect, 0, 0); m_bg1_tilemap->draw(bitmap, cliprect, 0, 0);
lwings_draw_sprites(machine(), bitmap, cliprect); lwings_draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -265,7 +263,7 @@ UINT32 lwings_state::screen_update_trojan(screen_device &screen, bitmap_ind16 &b
{ {
m_bg2_tilemap->draw(bitmap, cliprect, 0, 0); m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
trojan_draw_sprites(machine(), bitmap, cliprect); trojan_draw_sprites(bitmap, cliprect);
m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;

View File

@ -427,7 +427,7 @@ UINT32 ladybug_state::screen_update_redclash(screen_device &screen, bitmap_ind16
{ {
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
redclash_draw_stars(machine(), bitmap, cliprect, 0x60, 0, 0x00, 0xff); redclash_draw_stars(machine(), bitmap, cliprect, 0x60, 0, 0x00, 0xff);
draw_sprites(machine(), bitmap, cliprect); ::draw_sprites(machine(), bitmap, cliprect);
draw_bullets(machine(), bitmap, cliprect); draw_bullets(machine(), bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;