Modernization of drivers part 12 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2013-02-11 11:18:02 +00:00
parent 0e937ed6b4
commit 90f9ca6918
101 changed files with 1156 additions and 1144 deletions

View File

@ -337,7 +337,7 @@ WRITE8_MEMBER(mw8080bw_state::tornbase_audio_w)
/* if (data & 0x10) enable CHEER sound */ /* if (data & 0x10) enable CHEER sound */
if (tornbase_get_cabinet_type(machine()) == TORNBASE_CAB_TYPE_UPRIGHT_OLD) if (tornbase_get_cabinet_type() == TORNBASE_CAB_TYPE_UPRIGHT_OLD)
{ {
/* if (data & 0x20) enable WHISTLE sound */ /* if (data & 0x20) enable WHISTLE sound */
@ -4195,7 +4195,7 @@ WRITE8_MEMBER(mw8080bw_state::invaders_audio_2_w)
discrete_sound_w(m_discrete, space, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10); discrete_sound_w(m_discrete, space, INVADERS_NODE(INVADERS_SAUCER_HIT_EN, 1), data & 0x10);
/* the flip screen line is only connected on the cocktail PCB */ /* the flip screen line is only connected on the cocktail PCB */
if (invaders_is_cabinet_cocktail(machine())) if (invaders_is_cabinet_cocktail())
{ {
m_flip_screen = (data >> 5) & 0x01; m_flip_screen = (data >> 5) & 0x01;
} }

View File

@ -412,10 +412,10 @@ the NMI handler in the other games.
***************************************************************************/ ***************************************************************************/
#if 0 #if 0
static int find_sample(int num) int m72_state::find_sample(int num)
{ {
UINT8 *rom = machine.root_device().memregion("samples")->base(); UINT8 *rom = machine().root_device().memregion("samples")->base();
int len = machine.root_device().memregion("samples")->bytes(); int len = machine().root_device().memregion("samples")->bytes();
int addr = 0; int addr = 0;
while (num--) while (num--)
@ -683,7 +683,7 @@ static const UINT8 dkgenm72_crc[CRC_LEN] = { 0xc8,0xb4,0xdc,0xf8, 0xd3,0xba,0
static void copy_le(UINT16 *dest, const UINT8 *src, UINT8 bytes) void m72_state::copy_le(UINT16 *dest, const UINT8 *src, UINT8 bytes)
{ {
int i; int i;
@ -708,45 +708,44 @@ WRITE16_MEMBER(m72_state::protection_w)
copy_le(&m_protection_ram[0x0fe0],m_protection_crc,CRC_LEN); copy_le(&m_protection_ram[0x0fe0],m_protection_crc,CRC_LEN);
} }
static void install_protection_handler(running_machine &machine, const UINT8 *code,const UINT8 *crc) void m72_state::install_protection_handler(const UINT8 *code,const UINT8 *crc)
{ {
m72_state *state = machine.driver_data<m72_state>(); m_protection_ram = auto_alloc_array(machine(), UINT16, 0x1000/2);
state->m_protection_ram = auto_alloc_array(machine, UINT16, 0x1000/2); m_protection_code = code;
state->m_protection_code = code; m_protection_crc = crc;
state->m_protection_crc = crc; machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xb0000, 0xb0fff, "bank1");
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xb0000, 0xb0fff, "bank1"); machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),this));
machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xb0ffa, 0xb0ffb, read16_delegate(FUNC(m72_state::protection_r),state)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::protection_w),this));
machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::protection_w),state)); membank("bank1")->set_base(m_protection_ram);
state->membank("bank1")->set_base(state->m_protection_ram);
} }
DRIVER_INIT_MEMBER(m72_state,bchopper) DRIVER_INIT_MEMBER(m72_state,bchopper)
{ {
install_protection_handler(machine(), bchopper_code,bchopper_crc); install_protection_handler(bchopper_code,bchopper_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,mrheli) DRIVER_INIT_MEMBER(m72_state,mrheli)
{ {
install_protection_handler(machine(), bchopper_code,mrheli_crc); install_protection_handler(bchopper_code,mrheli_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::bchopper_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,nspirit) DRIVER_INIT_MEMBER(m72_state,nspirit)
{ {
install_protection_handler(machine(), nspirit_code,nspirit_crc); install_protection_handler(nspirit_code,nspirit_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::nspirit_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::nspirit_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,imgfight) DRIVER_INIT_MEMBER(m72_state,imgfight)
{ {
install_protection_handler(machine(), imgfight_code,imgfightj_crc); install_protection_handler(imgfight_code,imgfightj_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::imgfight_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::imgfight_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,loht) DRIVER_INIT_MEMBER(m72_state,loht)
{ {
install_protection_handler(machine(), loht_code,loht_crc); install_protection_handler(loht_code,loht_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::loht_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::loht_sample_trigger_w),this));
@ -756,25 +755,25 @@ DRIVER_INIT_MEMBER(m72_state,loht)
DRIVER_INIT_MEMBER(m72_state,xmultiplm72) DRIVER_INIT_MEMBER(m72_state,xmultiplm72)
{ {
install_protection_handler(machine(), xmultiplm72_code,xmultiplm72_crc); install_protection_handler(xmultiplm72_code,xmultiplm72_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::xmultiplm72_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::xmultiplm72_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,dbreedm72) DRIVER_INIT_MEMBER(m72_state,dbreedm72)
{ {
install_protection_handler(machine(), dbreedm72_code,dbreedm72_crc); install_protection_handler(dbreedm72_code,dbreedm72_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dbreedm72_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dbreedm72_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,airduel) DRIVER_INIT_MEMBER(m72_state,airduel)
{ {
install_protection_handler(machine(), airduel_code,airduel_crc); install_protection_handler(airduel_code,airduel_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::airduel_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::airduel_sample_trigger_w),this));
} }
DRIVER_INIT_MEMBER(m72_state,dkgenm72) DRIVER_INIT_MEMBER(m72_state,dkgenm72)
{ {
install_protection_handler(machine(), dkgenm72_code,dkgenm72_crc); install_protection_handler(dkgenm72_code,dkgenm72_crc);
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dkgenm72_sample_trigger_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::dkgenm72_sample_trigger_w),this));
} }

View File

@ -204,9 +204,9 @@ psoldier dip locations still need verification.
#include "sound/okim6295.h" #include "sound/okim6295.h"
#define M92_IRQ_0 ((state->m_irq_vectorbase+0)/4) /* VBL interrupt */ #define M92_IRQ_0 ((m_irq_vectorbase+0)/4) /* VBL interrupt */
#define M92_IRQ_1 ((state->m_irq_vectorbase+4)/4) /* Sprite buffer complete interrupt */ #define M92_IRQ_1 ((m_irq_vectorbase+4)/4) /* Sprite buffer complete interrupt */
#define M92_IRQ_2 ((state->m_irq_vectorbase+8)/4) /* Raster interrupt */ #define M92_IRQ_2 ((m_irq_vectorbase+8)/4) /* Raster interrupt */
#define M92_IRQ_3 ((m_irq_vectorbase+12)/4) /* Sound cpu interrupt */ #define M92_IRQ_3 ((m_irq_vectorbase+12)/4) /* Sound cpu interrupt */
@ -226,21 +226,20 @@ MACHINE_RESET_MEMBER(m92_state,m92)
TIMER_DEVICE_CALLBACK_MEMBER(m92_state::m92_scanline_interrupt) TIMER_DEVICE_CALLBACK_MEMBER(m92_state::m92_scanline_interrupt)
{ {
m92_state *state = machine().driver_data<m92_state>();
int scanline = param; int scanline = param;
/* raster interrupt */ /* raster interrupt */
if (scanline == m_raster_irq_position) if (scanline == m_raster_irq_position)
{ {
machine().primary_screen->update_partial(scanline); machine().primary_screen->update_partial(scanline);
state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, M92_IRQ_2); m_maincpu->set_input_line_and_vector(0, HOLD_LINE, M92_IRQ_2);
} }
/* VBLANK interrupt */ /* VBLANK interrupt */
else if (scanline == machine().primary_screen->visible_area().max_y + 1) else if (scanline == machine().primary_screen->visible_area().max_y + 1)
{ {
machine().primary_screen->update_partial(scanline); machine().primary_screen->update_partial(scanline);
state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, M92_IRQ_0); m_maincpu->set_input_line_and_vector(0, HOLD_LINE, M92_IRQ_0);
} }
} }
@ -908,11 +907,9 @@ GFXDECODE_END
/***************************************************************************/ /***************************************************************************/
void m92_sprite_interrupt(running_machine &machine) void m92_state::m92_sprite_interrupt()
{ {
m92_state *state = machine.driver_data<m92_state>(); m_maincpu->set_input_line_and_vector(0, HOLD_LINE, M92_IRQ_1);
state->m_maincpu->set_input_line_and_vector(0, HOLD_LINE, M92_IRQ_1);
} }
static MACHINE_CONFIG_START( m92, m92_state ) static MACHINE_CONFIG_START( m92, m92_state )

View File

@ -349,33 +349,32 @@ READ16_MEMBER(macrossp_state::macrossp_soundcmd_r)
return soundlatch_word_r(space, offset, mem_mask); return soundlatch_word_r(space, offset, mem_mask);
} }
static void update_colors( running_machine &machine ) void macrossp_state::update_colors( )
{ {
macrossp_state *state = machine.driver_data<macrossp_state>();
int i, r, g, b; int i, r, g, b;
for (i = 0; i < 0x1000; i++) for (i = 0; i < 0x1000; i++)
{ {
b = ((state->m_paletteram[i] & 0x0000ff00) >> 8); b = ((m_paletteram[i] & 0x0000ff00) >> 8);
g = ((state->m_paletteram[i] & 0x00ff0000) >> 16); g = ((m_paletteram[i] & 0x00ff0000) >> 16);
r = ((state->m_paletteram[i] & 0xff000000) >> 24); r = ((m_paletteram[i] & 0xff000000) >> 24);
if (state->m_fade_effect > b) if (m_fade_effect > b)
b = 0; b = 0;
else else
b -= state->m_fade_effect; b -= m_fade_effect;
if (state->m_fade_effect > g) if (m_fade_effect > g)
g = 0; g = 0;
else else
g -= state->m_fade_effect; g -= m_fade_effect;
if (state->m_fade_effect > r) if (m_fade_effect > r)
r = 0; r = 0;
else else
r -= state->m_fade_effect; r -= m_fade_effect;
palette_set_color(machine, i, MAKE_RGB(r, g, b)); palette_set_color(machine(), i, MAKE_RGB(r, g, b));
} }
} }
@ -387,7 +386,7 @@ WRITE32_MEMBER(macrossp_state::macrossp_palette_fade_w)
if (m_old_fade != m_fade_effect) if (m_old_fade != m_fade_effect)
{ {
m_old_fade = m_fade_effect; m_old_fade = m_fade_effect;
update_colors(machine()); update_colors();
} }
} }

View File

@ -23,16 +23,16 @@ INPUT_CHANGED_MEMBER(madalien_state::coin_inserted)
} }
INLINE UINT8 shift_common(running_machine &machine, UINT8 hi, UINT8 lo) inline UINT8 madalien_state::shift_common(UINT8 hi, UINT8 lo)
{ {
const UINT8 *table = machine.root_device().memregion("user2")->base(); const UINT8 *table = machine().root_device().memregion("user2")->base();
return table[((hi & 0x07) << 8) | lo]; return table[((hi & 0x07) << 8) | lo];
} }
READ8_MEMBER(madalien_state::shift_r) READ8_MEMBER(madalien_state::shift_r)
{ {
return shift_common(machine(), *m_shift_hi, *m_shift_lo); return shift_common(*m_shift_hi, *m_shift_lo);
} }
READ8_MEMBER(madalien_state::shift_rev_r) READ8_MEMBER(madalien_state::shift_rev_r)
@ -40,7 +40,7 @@ READ8_MEMBER(madalien_state::shift_rev_r)
UINT8 hi = *m_shift_hi ^ 0x07; UINT8 hi = *m_shift_hi ^ 0x07;
UINT8 lo = BITSWAP8(*m_shift_lo,0,1,2,3,4,5,6,7); UINT8 lo = BITSWAP8(*m_shift_lo,0,1,2,3,4,5,6,7);
UINT8 ret = shift_common(machine(), hi, lo); UINT8 ret = shift_common(hi, lo);
return BITSWAP8(ret,7,0,1,2,3,4,5,6) & 0x7f; return BITSWAP8(ret,7,0,1,2,3,4,5,6) & 0x7f;
} }

View File

@ -99,7 +99,7 @@ void maygay1b_state::m1_draw_lamps(int data,int strobe, int col)
* *
*************************************/ *************************************/
static void update_outputs(i8279_state *chip, UINT16 which) void maygay1b_state::update_outputs(i8279_state *chip, UINT16 which)
{ {
static const UINT8 ls48_map[16] = static const UINT8 ls48_map[16] =
{ 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 }; { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0x00 };
@ -456,23 +456,22 @@ WRITE8_MEMBER(maygay1b_state::m1_8279_2_w)
// called if board is reset /////////////////////////////////////////////// // called if board is reset ///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
static void m1_stepper_reset(running_machine &machine) void maygay1b_state::m1_stepper_reset()
{ {
maygay1b_state *state = machine.driver_data<maygay1b_state>();
int pattern = 0,i; int pattern = 0,i;
for ( i = 0; i < 6; i++) for ( i = 0; i < 6; i++)
{ {
stepper_reset_position(i); stepper_reset_position(i);
if ( stepper_optic_state(i) ) pattern |= 1<<i; if ( stepper_optic_state(i) ) pattern |= 1<<i;
} }
state->m_optic_pattern = pattern; m_optic_pattern = pattern;
} }
void maygay1b_state::machine_reset() void maygay1b_state::machine_reset()
{ {
m_vfd->reset(); // reset display1 m_vfd->reset(); // reset display1
m_duart68681 = machine().device( "duart68681" ); m_duart68681 = machine().device( "duart68681" );
m1_stepper_reset(machine()); m1_stepper_reset();
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View File

@ -2751,7 +2751,7 @@ ROM_END
* *
*************************************/ *************************************/
static void mcr_init(running_machine &machine, int cpuboard, int vidboard, int ssioboard) void mcr_state::mcr_init(int cpuboard, int vidboard, int ssioboard)
{ {
mcr_cpu_board = cpuboard; mcr_cpu_board = cpuboard;
mcr_sprite_board = vidboard; mcr_sprite_board = vidboard;
@ -2759,21 +2759,20 @@ static void mcr_init(running_machine &machine, int cpuboard, int vidboard, int s
mcr12_sprite_xoffs = 0; mcr12_sprite_xoffs = 0;
mcr12_sprite_xoffs_flip = 0; mcr12_sprite_xoffs_flip = 0;
state_save_register_global(machine, input_mux); state_save_register_global(machine(), input_mux);
state_save_register_global(machine, last_op4); state_save_register_global(machine(), last_op4);
midway_ssio_device *ssio = machine.device<midway_ssio_device>("ssio"); midway_ssio_device *ssio = machine().device<midway_ssio_device>("ssio");
if (ssio != NULL) if (ssio != NULL)
{ {
mcr_state *state = machine.driver_data<mcr_state>(); ssio->set_custom_output(0, 0xff, write8_delegate(FUNC(mcr_state::mcr_control_port_w), this));
ssio->set_custom_output(0, 0xff, write8_delegate(FUNC(mcr_state::mcr_control_port_w), state));
} }
} }
DRIVER_INIT_MEMBER(mcr_state,solarfox) DRIVER_INIT_MEMBER(mcr_state,solarfox)
{ {
mcr_init(machine(), 90009, 91399, 90908); mcr_init(90009, 91399, 90908);
mcr12_sprite_xoffs = 16; mcr12_sprite_xoffs = 16;
machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x1c, read8_delegate(FUNC(mcr_state::solarfox_ip0_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x1c, read8_delegate(FUNC(mcr_state::solarfox_ip0_r),this));
@ -2783,7 +2782,7 @@ DRIVER_INIT_MEMBER(mcr_state,solarfox)
DRIVER_INIT_MEMBER(mcr_state,kick) DRIVER_INIT_MEMBER(mcr_state,kick)
{ {
mcr_init(machine(), 90009, 91399, 90908); mcr_init(90009, 91399, 90908);
mcr12_sprite_xoffs_flip = 16; mcr12_sprite_xoffs_flip = 16;
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xf0, read8_delegate(FUNC(mcr_state::kick_ip1_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xf0, read8_delegate(FUNC(mcr_state::kick_ip1_r),this));
@ -2792,7 +2791,7 @@ DRIVER_INIT_MEMBER(mcr_state,kick)
DRIVER_INIT_MEMBER(mcr_state,dpoker) DRIVER_INIT_MEMBER(mcr_state,dpoker)
{ {
mcr_init(machine(), 90009, 91399, 90908); mcr_init(90009, 91399, 90908);
mcr12_sprite_xoffs_flip = 16; mcr12_sprite_xoffs_flip = 16;
machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x8e, read8_delegate(FUNC(mcr_state::dpoker_ip0_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x8e, read8_delegate(FUNC(mcr_state::dpoker_ip0_r),this));
@ -2820,13 +2819,13 @@ DRIVER_INIT_MEMBER(mcr_state,dpoker)
DRIVER_INIT_MEMBER(mcr_state,mcr_90010) DRIVER_INIT_MEMBER(mcr_state,mcr_90010)
{ {
mcr_init(machine(), 90010, 91399, 90913); mcr_init(90010, 91399, 90913);
} }
DRIVER_INIT_MEMBER(mcr_state,wacko) DRIVER_INIT_MEMBER(mcr_state,wacko)
{ {
mcr_init(machine(), 90010, 91399, 90913); mcr_init(90010, 91399, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip1_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip2_r),this));
@ -2836,7 +2835,7 @@ DRIVER_INIT_MEMBER(mcr_state,wacko)
DRIVER_INIT_MEMBER(mcr_state,twotiger) DRIVER_INIT_MEMBER(mcr_state,twotiger)
{ {
mcr_init(machine(), 90010, 91399, 90913); mcr_init(90010, 91399, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::twotiger_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::twotiger_op4_w),this));
machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe800, 0xefff, 0, 0x1000, read8_delegate(FUNC(mcr_state::twotiger_videoram_r),this), write8_delegate(FUNC(mcr_state::twotiger_videoram_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xe800, 0xefff, 0, 0x1000, read8_delegate(FUNC(mcr_state::twotiger_videoram_r),this), write8_delegate(FUNC(mcr_state::twotiger_videoram_w),this));
@ -2845,7 +2844,7 @@ DRIVER_INIT_MEMBER(mcr_state,twotiger)
DRIVER_INIT_MEMBER(mcr_state,kroozr) DRIVER_INIT_MEMBER(mcr_state,kroozr)
{ {
mcr_init(machine(), 90010, 91399, 91483); mcr_init(90010, 91399, 91483);
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x47, read8_delegate(FUNC(mcr_state::kroozr_ip1_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x47, read8_delegate(FUNC(mcr_state::kroozr_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x34, write8_delegate(FUNC(mcr_state::kroozr_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x34, write8_delegate(FUNC(mcr_state::kroozr_op4_w),this));
@ -2854,7 +2853,7 @@ DRIVER_INIT_MEMBER(mcr_state,kroozr)
DRIVER_INIT_MEMBER(mcr_state,journey) DRIVER_INIT_MEMBER(mcr_state,journey)
{ {
mcr_init(machine(), 91475, 91464, 90913); mcr_init(91475, 91464, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::journey_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::journey_op4_w),this));
} }
@ -2862,13 +2861,13 @@ DRIVER_INIT_MEMBER(mcr_state,journey)
DRIVER_INIT_MEMBER(mcr_state,mcr_91490) DRIVER_INIT_MEMBER(mcr_state,mcr_91490)
{ {
mcr_init(machine(), 91490, 91464, 90913); mcr_init(91490, 91464, 90913);
} }
DRIVER_INIT_MEMBER(mcr_state,dotrone) DRIVER_INIT_MEMBER(mcr_state,dotrone)
{ {
mcr_init(machine(), 91490, 91464, 91657); mcr_init(91490, 91464, 91657);
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::dotron_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::dotron_op4_w),this));
} }
@ -2876,7 +2875,7 @@ DRIVER_INIT_MEMBER(mcr_state,dotrone)
DRIVER_INIT_MEMBER(mcr_state,nflfoot) DRIVER_INIT_MEMBER(mcr_state,nflfoot)
{ {
mcr_init(machine(), 91490, 91464, 91657); mcr_init(91490, 91464, 91657);
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0x80, read8_delegate(FUNC(mcr_state::nflfoot_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0x80, read8_delegate(FUNC(mcr_state::nflfoot_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::nflfoot_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::nflfoot_op4_w),this));
@ -2895,7 +2894,7 @@ DRIVER_INIT_MEMBER(mcr_state,nflfoot)
DRIVER_INIT_MEMBER(mcr_state,demoderb) DRIVER_INIT_MEMBER(mcr_state,demoderb)
{ {
mcr_init(machine(), 91490, 91464, 90913); mcr_init(91490, 91464, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip1_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip2_r),this));

View File

@ -1523,19 +1523,17 @@ ROM_END
* *
*************************************/ *************************************/
static void mcr_common_init(running_machine &machine) void mcr3_state::mcr_common_init()
{ {
mcr3_state *state = machine.driver_data<mcr3_state>(); state_save_register_global(machine(), m_input_mux);
state_save_register_global(machine(), m_latched_input);
state_save_register_global(machine, state->m_input_mux); state_save_register_global(machine(), m_last_op4);
state_save_register_global(machine, state->m_latched_input);
state_save_register_global(machine, state->m_last_op4);
} }
DRIVER_INIT_MEMBER(mcr3_state,demoderm) DRIVER_INIT_MEMBER(mcr3_state,demoderm)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::demoderm_ip1_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::demoderm_ip1_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::demoderm_ip2_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::demoderm_ip2_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::demoderm_op6_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::demoderm_op6_w),this));
@ -1544,14 +1542,14 @@ DRIVER_INIT_MEMBER(mcr3_state,demoderm)
DRIVER_INIT_MEMBER(mcr3_state,sarge) DRIVER_INIT_MEMBER(mcr3_state,sarge)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(midway_turbo_chip_squeak_device::write),m_turbo_chip_squeak.target())); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(midway_turbo_chip_squeak_device::write),m_turbo_chip_squeak.target()));
} }
DRIVER_INIT_MEMBER(mcr3_state,maxrpm) DRIVER_INIT_MEMBER(mcr3_state,maxrpm)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::maxrpm_ip1_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x01, 0x01, read8_delegate(FUNC(mcr3_state::maxrpm_ip1_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::maxrpm_ip2_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::maxrpm_ip2_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::maxrpm_op5_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::maxrpm_op5_w),this));
@ -1567,7 +1565,7 @@ DRIVER_INIT_MEMBER(mcr3_state,maxrpm)
DRIVER_INIT_MEMBER(mcr3_state,rampage) DRIVER_INIT_MEMBER(mcr3_state,rampage)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x04, 0x04, read8_delegate(FUNC(mcr3_state::rampage_ip4_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x04, 0x04, read8_delegate(FUNC(mcr3_state::rampage_ip4_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::rampage_op6_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::rampage_op6_w),this));
} }
@ -1575,7 +1573,7 @@ DRIVER_INIT_MEMBER(mcr3_state,rampage)
DRIVER_INIT_MEMBER(mcr3_state,powerdrv) DRIVER_INIT_MEMBER(mcr3_state,powerdrv)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::powerdrv_ip2_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x02, 0x02, read8_delegate(FUNC(mcr3_state::powerdrv_ip2_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::powerdrv_op5_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::powerdrv_op5_w),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::powerdrv_op6_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::powerdrv_op6_w),this));
@ -1584,7 +1582,7 @@ DRIVER_INIT_MEMBER(mcr3_state,powerdrv)
DRIVER_INIT_MEMBER(mcr3_state,stargrds) DRIVER_INIT_MEMBER(mcr3_state,stargrds)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(mcr3_state::stargrds_ip0_r),this)); machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x00, read8_delegate(FUNC(mcr3_state::stargrds_ip0_r),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::stargrds_op5_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x05, 0x05, write8_delegate(FUNC(mcr3_state::stargrds_op5_w),this));
machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::stargrds_op6_w),this)); machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x06, 0x06, write8_delegate(FUNC(mcr3_state::stargrds_op6_w),this));
@ -1593,7 +1591,7 @@ DRIVER_INIT_MEMBER(mcr3_state,stargrds)
DRIVER_INIT_MEMBER(mcr3_state,spyhunt) DRIVER_INIT_MEMBER(mcr3_state,spyhunt)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
@ -1605,7 +1603,7 @@ DRIVER_INIT_MEMBER(mcr3_state,spyhunt)
DRIVER_INIT_MEMBER(mcr3_state,crater) DRIVER_INIT_MEMBER(mcr3_state,crater)
{ {
mcr_common_init(machine()); mcr_common_init();
m_spyhunt_sprite_color_mask = 0x03; m_spyhunt_sprite_color_mask = 0x03;
m_spyhunt_scroll_offset = 96; m_spyhunt_scroll_offset = 96;
@ -1614,7 +1612,7 @@ DRIVER_INIT_MEMBER(mcr3_state,crater)
DRIVER_INIT_MEMBER(mcr3_state,turbotag) DRIVER_INIT_MEMBER(mcr3_state,turbotag)
{ {
mcr_common_init(machine()); mcr_common_init();
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),this)); machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this)); machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));

View File

@ -1534,20 +1534,19 @@ ROM_END
* *
*************************************/ *************************************/
static void mcr68_common_init(running_machine &machine, int clip, int xoffset) void mcr68_state::mcr68_common_init(int clip, int xoffset)
{ {
mcr68_state *state = machine.driver_data<mcr68_state>();
state->m_sprite_clip = clip; m_sprite_clip = clip;
state->m_sprite_xoffset = xoffset; m_sprite_xoffset = xoffset;
state_save_register_global(machine, state->m_control_word); state_save_register_global(machine(), m_control_word);
} }
DRIVER_INIT_MEMBER(mcr68_state,zwackery) DRIVER_INIT_MEMBER(mcr68_state,zwackery)
{ {
mcr68_common_init(machine(), 0, 0); mcr68_common_init(0, 0);
/* Zwackery doesn't care too much about this value; currently taken from Blasted */ /* Zwackery doesn't care too much about this value; currently taken from Blasted */
m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16); m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
@ -1556,7 +1555,7 @@ DRIVER_INIT_MEMBER(mcr68_state,zwackery)
DRIVER_INIT_MEMBER(mcr68_state,xenophob) DRIVER_INIT_MEMBER(mcr68_state,xenophob)
{ {
mcr68_common_init(machine(), 0, -4); mcr68_common_init(0, -4);
/* Xenophobe doesn't care too much about this value; currently taken from Blasted */ /* Xenophobe doesn't care too much about this value; currently taken from Blasted */
m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16); m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
@ -1568,7 +1567,7 @@ DRIVER_INIT_MEMBER(mcr68_state,xenophob)
DRIVER_INIT_MEMBER(mcr68_state,spyhunt2) DRIVER_INIT_MEMBER(mcr68_state,spyhunt2)
{ {
mcr68_common_init(machine(), 0, -6); mcr68_common_init(0, -6);
/* Spy Hunter II doesn't care too much about this value; currently taken from Blasted */ /* Spy Hunter II doesn't care too much about this value; currently taken from Blasted */
m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16); m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
@ -1582,7 +1581,7 @@ DRIVER_INIT_MEMBER(mcr68_state,spyhunt2)
DRIVER_INIT_MEMBER(mcr68_state,blasted) DRIVER_INIT_MEMBER(mcr68_state,blasted)
{ {
mcr68_common_init(machine(), 0, 0); mcr68_common_init(0, 0);
/* Blasted checks the timing of VBLANK relative to the 493 interrupt */ /* Blasted checks the timing of VBLANK relative to the 493 interrupt */
/* VBLANK is required to come within 220-256 E clocks (i.e., 2200-2560 CPU clocks) */ /* VBLANK is required to come within 220-256 E clocks (i.e., 2200-2560 CPU clocks) */
@ -1598,7 +1597,7 @@ DRIVER_INIT_MEMBER(mcr68_state,blasted)
DRIVER_INIT_MEMBER(mcr68_state,intlaser) DRIVER_INIT_MEMBER(mcr68_state,intlaser)
{ {
mcr68_common_init(machine(), 0, 0); mcr68_common_init(0, 0);
/* Copied from Blasted */ /* Copied from Blasted */
m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16); m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
@ -1612,7 +1611,7 @@ DRIVER_INIT_MEMBER(mcr68_state,intlaser)
DRIVER_INIT_MEMBER(mcr68_state,archrivl) DRIVER_INIT_MEMBER(mcr68_state,archrivl)
{ {
mcr68_common_init(machine(), 16, 0); mcr68_common_init(16, 0);
/* Arch Rivals doesn't care too much about this value; currently taken from Blasted */ /* Arch Rivals doesn't care too much about this value; currently taken from Blasted */
m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16); m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * (256 + 16);
@ -1630,7 +1629,7 @@ DRIVER_INIT_MEMBER(mcr68_state,archrivl)
DRIVER_INIT_MEMBER(mcr68_state,pigskin) DRIVER_INIT_MEMBER(mcr68_state,pigskin)
{ {
mcr68_common_init(machine(), 16, 0); mcr68_common_init(16, 0);
/* Pigskin doesn't care too much about this value; currently taken from Tri-Sports */ /* Pigskin doesn't care too much about this value; currently taken from Tri-Sports */
m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * 115; m_timing_factor = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10) * 115;
@ -1641,7 +1640,7 @@ DRIVER_INIT_MEMBER(mcr68_state,pigskin)
DRIVER_INIT_MEMBER(mcr68_state,trisport) DRIVER_INIT_MEMBER(mcr68_state,trisport)
{ {
mcr68_common_init(machine(), 0, 0); mcr68_common_init(0, 0);
/* Tri-Sports checks the timing of VBLANK relative to the 493 interrupt */ /* Tri-Sports checks the timing of VBLANK relative to the 493 interrupt */
/* VBLANK is required to come within 87-119 E clocks (i.e., 870-1190 CPU clocks) */ /* VBLANK is required to come within 87-119 E clocks (i.e., 870-1190 CPU clocks) */

View File

@ -3608,10 +3608,10 @@ ROM_START( tshingen )
ROM_END ROM_END
static void rodlandj_gfx_unmangle(running_machine &machine, const char *region) void megasys1_state::rodlandj_gfx_unmangle(const char *region)
{ {
UINT8 *rom = machine.root_device().memregion(region)->base(); UINT8 *rom = machine().root_device().memregion(region)->base();
int size = machine.root_device().memregion(region)->bytes(); int size = machine().root_device().memregion(region)->bytes();
UINT8 *buffer; UINT8 *buffer;
int i; int i;
@ -3622,7 +3622,7 @@ static void rodlandj_gfx_unmangle(running_machine &machine, const char *region)
| ((rom[i] & 0x48) << 1) | ((rom[i] & 0x48) << 1)
| ((rom[i] & 0x10) << 2); | ((rom[i] & 0x10) << 2);
buffer = auto_alloc_array(machine, UINT8, size); buffer = auto_alloc_array(machine(), UINT8, size);
memcpy(buffer,rom,size); memcpy(buffer,rom,size);
@ -3637,13 +3637,13 @@ static void rodlandj_gfx_unmangle(running_machine &machine, const char *region)
rom[i] = buffer[a]; rom[i] = buffer[a];
} }
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
static void jitsupro_gfx_unmangle(running_machine &machine, const char *region) void megasys1_state::jitsupro_gfx_unmangle(const char *region)
{ {
UINT8 *rom = machine.root_device().memregion(region)->base(); UINT8 *rom = machine().root_device().memregion(region)->base();
int size = machine.root_device().memregion(region)->bytes(); int size = machine().root_device().memregion(region)->bytes();
UINT8 *buffer; UINT8 *buffer;
int i; int i;
@ -3651,7 +3651,7 @@ static void jitsupro_gfx_unmangle(running_machine &machine, const char *region)
for (i = 0;i < size;i++) for (i = 0;i < size;i++)
rom[i] = BITSWAP8(rom[i],0x4,0x3,0x5,0x7,0x6,0x2,0x1,0x0); rom[i] = BITSWAP8(rom[i],0x4,0x3,0x5,0x7,0x6,0x2,0x1,0x0);
buffer = auto_alloc_array(machine, UINT8, size); buffer = auto_alloc_array(machine(), UINT8, size);
memcpy(buffer,rom,size); memcpy(buffer,rom,size);
@ -3664,13 +3664,13 @@ static void jitsupro_gfx_unmangle(running_machine &machine, const char *region)
rom[i] = buffer[a]; rom[i] = buffer[a];
} }
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
static void stdragona_gfx_unmangle(running_machine &machine, const char *region) void megasys1_state::stdragona_gfx_unmangle(const char *region)
{ {
UINT8 *rom = machine.root_device().memregion(region)->base(); UINT8 *rom = machine().root_device().memregion(region)->base();
int size = machine.root_device().memregion(region)->bytes(); int size = machine().root_device().memregion(region)->bytes();
UINT8 *buffer; UINT8 *buffer;
int i; int i;
@ -3678,7 +3678,7 @@ static void stdragona_gfx_unmangle(running_machine &machine, const char *region)
for (i = 0;i < size;i++) for (i = 0;i < size;i++)
rom[i] = BITSWAP8(rom[i],3,7,5,6,4,2,1,0); rom[i] = BITSWAP8(rom[i],3,7,5,6,4,2,1,0);
buffer = auto_alloc_array(machine, UINT8, size); buffer = auto_alloc_array(machine(), UINT8, size);
memcpy(buffer,rom,size); memcpy(buffer,rom,size);
@ -3691,7 +3691,7 @@ static void stdragona_gfx_unmangle(running_machine &machine, const char *region)
rom[i] = buffer[a]; rom[i] = buffer[a];
} }
auto_free(machine, buffer); auto_free(machine(), buffer);
} }
/************************************* /*************************************
@ -3927,8 +3927,8 @@ DRIVER_INIT_MEMBER(megasys1_state,jitsupro)
astyanax_rom_decode(machine(), "maincpu"); // Code astyanax_rom_decode(machine(), "maincpu"); // Code
jitsupro_gfx_unmangle(machine(), "gfx1"); // Gfx jitsupro_gfx_unmangle("gfx1"); // Gfx
jitsupro_gfx_unmangle(machine(), "gfx4"); jitsupro_gfx_unmangle("gfx4");
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_r),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_r),this));
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20000, 0x20009, write16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20000, 0x20009, write16_delegate(FUNC(megasys1_state::megasys1A_mcu_hs_w),this));
@ -3954,8 +3954,8 @@ DRIVER_INIT_MEMBER(megasys1_state,rodland)
DRIVER_INIT_MEMBER(megasys1_state,rodlandj) DRIVER_INIT_MEMBER(megasys1_state,rodlandj)
{ {
rodlandj_gfx_unmangle(machine(), "gfx1"); rodlandj_gfx_unmangle("gfx1");
rodlandj_gfx_unmangle(machine(), "gfx4"); rodlandj_gfx_unmangle("gfx4");
astyanax_rom_decode(machine(), "maincpu"); astyanax_rom_decode(machine(), "maincpu");
} }
@ -4025,8 +4025,8 @@ DRIVER_INIT_MEMBER(megasys1_state,stdragona)
{ {
phantasm_rom_decode(machine(), "maincpu"); phantasm_rom_decode(machine(), "maincpu");
stdragona_gfx_unmangle(machine(), "gfx1"); stdragona_gfx_unmangle("gfx1");
stdragona_gfx_unmangle(machine(), "gfx4"); stdragona_gfx_unmangle("gfx4");
machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_r),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00000, 0x3ffff, read16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_r),this));
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x23ff0, 0x23ff9, write16_delegate(FUNC(megasys1_state::stdragon_mcu_hs_w),this));

View File

@ -558,7 +558,7 @@ TIMER_CALLBACK_MEMBER(metro_state::metro_blit_done)
update_irq_state(); update_irq_state();
} }
INLINE int blt_read( const UINT8 *ROM, const int offs ) inline int metro_state::blt_read( const UINT8 *ROM, const int offs )
{ {
return ROM[offs]; return ROM[offs];
} }
@ -6263,16 +6263,15 @@ ROM_END
***************************************************************************/ ***************************************************************************/
static void metro_common( running_machine &machine ) void metro_state::metro_common( )
{ {
metro_state *state = machine.driver_data<metro_state>();
memset(state->m_requested_int, 0, ARRAY_LENGTH(state->m_requested_int)); memset(m_requested_int, 0, ARRAY_LENGTH(m_requested_int));
state->m_vblank_bit = 0; m_vblank_bit = 0;
state->m_blitter_bit = 2; m_blitter_bit = 2;
state->m_irq_line = 2; m_irq_line = 2;
*state->m_irq_enable = 0; *m_irq_enable = 0;
} }
@ -6280,7 +6279,7 @@ DRIVER_INIT_MEMBER(metro_state,metro)
{ {
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
metro_common(machine()); metro_common();
m_porta = 0x00; m_porta = 0x00;
m_portb = 0x00; m_portb = 0x00;
@ -6307,7 +6306,7 @@ DRIVER_INIT_MEMBER(metro_state,daitorid)
{ {
address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
metro_common(machine()); metro_common();
m_porta = 0x00; m_porta = 0x00;
m_portb = 0x00; m_portb = 0x00;
@ -6333,7 +6332,7 @@ DRIVER_INIT_MEMBER(metro_state,balcube)
src += 2; src += 2;
} }
metro_common(machine()); metro_common();
m_irq_line = 1; m_irq_line = 1;
} }
@ -6360,13 +6359,13 @@ DRIVER_INIT_MEMBER(metro_state,dharmak)
DRIVER_INIT_MEMBER(metro_state,blzntrnd) DRIVER_INIT_MEMBER(metro_state,blzntrnd)
{ {
metro_common(machine()); metro_common();
m_irq_line = 1; m_irq_line = 1;
} }
DRIVER_INIT_MEMBER(metro_state,mouja) DRIVER_INIT_MEMBER(metro_state,mouja)
{ {
metro_common(machine()); metro_common();
m_irq_line = -1; /* split interrupt handlers */ m_irq_line = -1; /* split interrupt handlers */
m_vblank_bit = 1; m_vblank_bit = 1;
m_mouja_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(metro_state::mouja_irq_callback),this)); m_mouja_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(metro_state::mouja_irq_callback),this));
@ -6374,7 +6373,7 @@ DRIVER_INIT_MEMBER(metro_state,mouja)
DRIVER_INIT_MEMBER(metro_state,gakusai) DRIVER_INIT_MEMBER(metro_state,gakusai)
{ {
metro_common(machine()); metro_common();
m_irq_line = -1; m_irq_line = -1;
m_vblank_bit = 1; m_vblank_bit = 1;
m_blitter_bit = 3; m_blitter_bit = 3;
@ -6382,7 +6381,7 @@ DRIVER_INIT_MEMBER(metro_state,gakusai)
DRIVER_INIT_MEMBER(metro_state,puzzlet) DRIVER_INIT_MEMBER(metro_state,puzzlet)
{ {
metro_common(machine()); metro_common();
m_irq_line = 0; m_irq_line = 0;
m_vblank_bit = 1; m_vblank_bit = 1;
m_blitter_bit = 0; m_blitter_bit = 0;

View File

@ -2080,17 +2080,17 @@ ROM_END
* *
*************************************/ *************************************/
static void bootleg_decode( running_machine &machine ) void mitchell_state::bootleg_decode( )
{ {
address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
space.set_decrypted_region(0x0000, 0x7fff, machine.root_device().memregion("maincpu")->base() + 0x50000); space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x50000);
machine.root_device().membank("bank1")->configure_decrypted_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x60000, 0x4000); machine().root_device().membank("bank1")->configure_decrypted_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x60000, 0x4000);
} }
static void configure_banks( running_machine &machine ) void mitchell_state::configure_banks( )
{ {
machine.root_device().membank("bank1")->configure_entries(0, 16, machine.root_device().memregion("maincpu")->base() + 0x10000, 0x4000); machine().root_device().membank("bank1")->configure_entries(0, 16, machine().root_device().memregion("maincpu")->base() + 0x10000, 0x4000);
} }
@ -2098,19 +2098,19 @@ DRIVER_INIT_MEMBER(mitchell_state,dokaben)
{ {
m_input_type = 0; m_input_type = 0;
mgakuen2_decode(machine()); mgakuen2_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,pang) DRIVER_INIT_MEMBER(mitchell_state,pang)
{ {
m_input_type = 0; m_input_type = 0;
pang_decode(machine()); pang_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,pangb) DRIVER_INIT_MEMBER(mitchell_state,pangb)
{ {
m_input_type = 0; m_input_type = 0;
bootleg_decode(machine()); bootleg_decode();
configure_banks(machine()); configure_banks();
if (m_nvram != NULL) if (m_nvram != NULL)
m_nvram->set_base(&m_dummy_nvram, sizeof(m_dummy_nvram)); /* for pangba */ m_nvram->set_base(&m_dummy_nvram, sizeof(m_dummy_nvram)); /* for pangba */
} }
@ -2118,28 +2118,28 @@ DRIVER_INIT_MEMBER(mitchell_state,cworld)
{ {
m_input_type = 0; m_input_type = 0;
cworld_decode(machine()); cworld_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,hatena) DRIVER_INIT_MEMBER(mitchell_state,hatena)
{ {
m_input_type = 0; m_input_type = 0;
hatena_decode(machine()); hatena_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,spang) DRIVER_INIT_MEMBER(mitchell_state,spang)
{ {
m_input_type = 3; m_input_type = 3;
m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */
spang_decode(machine()); spang_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,spangbl) DRIVER_INIT_MEMBER(mitchell_state,spangbl)
{ {
m_input_type = 3; m_input_type = 3;
m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */
bootleg_decode(machine()); bootleg_decode();
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,spangj) DRIVER_INIT_MEMBER(mitchell_state,spangj)
@ -2147,31 +2147,31 @@ DRIVER_INIT_MEMBER(mitchell_state,spangj)
m_input_type = 3; m_input_type = 3;
m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */
spangj_decode(machine()); spangj_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,sbbros) DRIVER_INIT_MEMBER(mitchell_state,sbbros)
{ {
m_input_type = 3; m_input_type = 3;
m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */ m_nvram->set_base(&memregion("maincpu")->base()[0xe000], 0x80); /* NVRAM */
sbbros_decode(machine()); sbbros_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,qtono1) DRIVER_INIT_MEMBER(mitchell_state,qtono1)
{ {
m_input_type = 0; m_input_type = 0;
qtono1_decode(machine()); qtono1_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,qsangoku) DRIVER_INIT_MEMBER(mitchell_state,qsangoku)
{ {
m_input_type = 0; m_input_type = 0;
qsangoku_decode(machine()); qsangoku_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,mgakuen) DRIVER_INIT_MEMBER(mitchell_state,mgakuen)
{ {
m_input_type = 1; m_input_type = 1;
configure_banks(machine()); configure_banks();
machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x03, 0x03, "DSW0"); machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x03, 0x03, "DSW0");
machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x04, 0x04, "DSW1"); machine().device("maincpu")->memory().space(AS_IO).install_read_port(0x04, 0x04, "DSW1");
} }
@ -2179,39 +2179,39 @@ DRIVER_INIT_MEMBER(mitchell_state,mgakuen2)
{ {
m_input_type = 1; m_input_type = 1;
mgakuen2_decode(machine()); mgakuen2_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,pkladies) DRIVER_INIT_MEMBER(mitchell_state,pkladies)
{ {
m_input_type = 1; m_input_type = 1;
mgakuen2_decode(machine()); mgakuen2_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,pkladiesbl) DRIVER_INIT_MEMBER(mitchell_state,pkladiesbl)
{ {
m_input_type = 1; m_input_type = 1;
bootleg_decode(machine()); bootleg_decode();
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,marukin) DRIVER_INIT_MEMBER(mitchell_state,marukin)
{ {
m_input_type = 1; m_input_type = 1;
marukin_decode(machine()); marukin_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,block) DRIVER_INIT_MEMBER(mitchell_state,block)
{ {
m_input_type = 2; m_input_type = 2;
m_nvram->set_base(&memregion("maincpu")->base()[0xff80], 0x80); /* NVRAM */ m_nvram->set_base(&memregion("maincpu")->base()[0xff80], 0x80); /* NVRAM */
block_decode(machine()); block_decode(machine());
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,blockbl) DRIVER_INIT_MEMBER(mitchell_state,blockbl)
{ {
m_input_type = 2; m_input_type = 2;
m_nvram->set_base(&memregion("maincpu")->base()[0xff80], 0x80); /* NVRAM */ m_nvram->set_base(&memregion("maincpu")->base()[0xff80], 0x80); /* NVRAM */
bootleg_decode(machine()); bootleg_decode();
configure_banks(machine()); configure_banks();
} }
DRIVER_INIT_MEMBER(mitchell_state,mstworld) DRIVER_INIT_MEMBER(mitchell_state,mstworld)
@ -2257,8 +2257,8 @@ DRIVER_INIT_MEMBER(mitchell_state,mstworld)
} }
auto_free(machine(), source); auto_free(machine(), source);
bootleg_decode(machine()); bootleg_decode();
configure_banks(machine()); configure_banks();
} }

View File

@ -2191,18 +2191,17 @@ ROM_START( wpksocv2 )
ROM_END ROM_END
static void configure_banks(running_machine &machine) void ms32_state::configure_banks()
{ {
ms32_state *state = machine.driver_data<ms32_state>(); state_save_register_global(machine(), m_to_main);
state_save_register_global(machine, state->m_to_main); membank("bank4")->configure_entries(0, 16, memregion("audiocpu")->base() + 0x14000, 0x4000);
state->membank("bank4")->configure_entries(0, 16, state->memregion("audiocpu")->base() + 0x14000, 0x4000); membank("bank5")->configure_entries(0, 16, memregion("audiocpu")->base() + 0x14000, 0x4000);
state->membank("bank5")->configure_entries(0, 16, state->memregion("audiocpu")->base() + 0x14000, 0x4000);
} }
DRIVER_INIT_MEMBER(ms32_state,ms32_common) DRIVER_INIT_MEMBER(ms32_state,ms32_common)
{ {
m_nvram_8 = auto_alloc_array(machine(), UINT8, 0x2000); m_nvram_8 = auto_alloc_array(machine(), UINT8, 0x2000);
configure_banks(machine()); configure_banks();
} }
/* SS91022-10: desertwr, gratiaa, tp2m32, gametngk */ /* SS91022-10: desertwr, gratiaa, tp2m32, gametngk */

View File

@ -552,9 +552,9 @@ MACHINE_CONFIG_END
#define TORNBASE_CAB_TYPE_PORT_TAG ("CAB") #define TORNBASE_CAB_TYPE_PORT_TAG ("CAB")
UINT8 tornbase_get_cabinet_type(running_machine &machine) UINT8 mw8080bw_state::tornbase_get_cabinet_type()
{ {
return machine.root_device().ioport(TORNBASE_CAB_TYPE_PORT_TAG)->read(); return machine().root_device().ioport(TORNBASE_CAB_TYPE_PORT_TAG)->read();
} }
@ -568,7 +568,7 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_hit_right_input_r)
{ {
UINT32 ret; UINT32 ret;
switch (tornbase_get_cabinet_type(machine())) switch (tornbase_get_cabinet_type())
{ {
case TORNBASE_CAB_TYPE_UPRIGHT_OLD: case TORNBASE_CAB_TYPE_UPRIGHT_OLD:
ret = ioport(TORNBASE_L_HIT_PORT_TAG)->read(); ret = ioport(TORNBASE_L_HIT_PORT_TAG)->read();
@ -589,7 +589,7 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::tornbase_pitch_left_input_r)
{ {
UINT32 ret; UINT32 ret;
switch (tornbase_get_cabinet_type(machine())) switch (tornbase_get_cabinet_type())
{ {
case TORNBASE_CAB_TYPE_UPRIGHT_OLD: case TORNBASE_CAB_TYPE_UPRIGHT_OLD:
case TORNBASE_CAB_TYPE_UPRIGHT_NEW: case TORNBASE_CAB_TYPE_UPRIGHT_NEW:
@ -2122,24 +2122,21 @@ MACHINE_START_MEMBER(mw8080bw_state,spcenctr)
} }
#if 0 #if 0
UINT8 spcenctr_get_trench_width( *running_machine &machine ) UINT8 mw8080bw_state::spcenctr_get_trench_width()
{ {
mw8080bw_state *state = machine.driver_data<mw8080bw_state>(); return m_spcenctr_trench_width;
return state->m_spcenctr_trench_width;
} }
UINT8 spcenctr_get_trench_center( *running_machine &machine ) UINT8 mw8080bw_state::spcenctr_get_trench_center()
{ {
mw8080bw_state *state = machine.driver_data<mw8080bw_state>(); return m_spcenctr_trench_center;
return state->m_spcenctr_trench_center;
} }
UINT8 spcenctr_get_trench_slope( *running_machine &machine, UINT8 addr ) UINT8 mw8080bw_state::spcenctr_get_trench_slope(UINT8 addr )
{ {
mw8080bw_state *state = machine.driver_data<mw8080bw_state>(); return m_spcenctr_trench_slope[addr & 0x0f];
return state->m_spcenctr_trench_slope[addr & 0x0f];
} }
#endif #endif
@ -2519,7 +2516,7 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_sw6_sw7_r)
/* upright PCB : switches visible /* upright PCB : switches visible
cocktail PCB: HI */ cocktail PCB: HI */
if (invaders_is_cabinet_cocktail(machine())) if (invaders_is_cabinet_cocktail())
ret = 0x03; ret = 0x03;
else else
ret = ioport(INVADERS_SW6_SW7_PORT_TAG)->read(); ret = ioport(INVADERS_SW6_SW7_PORT_TAG)->read();
@ -2535,7 +2532,7 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_sw5_r)
/* upright PCB : switch visible /* upright PCB : switch visible
cocktail PCB: HI */ cocktail PCB: HI */
if (invaders_is_cabinet_cocktail(machine())) if (invaders_is_cabinet_cocktail())
ret = 0x01; ret = 0x01;
else else
ret = ioport(INVADERS_SW5_PORT_TAG)->read(); ret = ioport(INVADERS_SW5_PORT_TAG)->read();
@ -2551,7 +2548,7 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in0_control_r)
/* upright PCB : P1 controls /* upright PCB : P1 controls
cocktail PCB: HI */ cocktail PCB: HI */
if (invaders_is_cabinet_cocktail(machine())) if (invaders_is_cabinet_cocktail())
ret = 0x07; ret = 0x07;
else else
ret = ioport(INVADERS_P1_CONTROL_PORT_TAG)->read(); ret = ioport(INVADERS_P1_CONTROL_PORT_TAG)->read();
@ -2573,7 +2570,7 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in2_control_r)
/* upright PCB : P1 controls /* upright PCB : P1 controls
cocktail PCB: P2 controls */ cocktail PCB: P2 controls */
if (invaders_is_cabinet_cocktail(machine())) if (invaders_is_cabinet_cocktail())
ret = ioport(INVADERS_P2_CONTROL_PORT_TAG)->read(); ret = ioport(INVADERS_P2_CONTROL_PORT_TAG)->read();
else else
ret = ioport(INVADERS_P1_CONTROL_PORT_TAG)->read(); ret = ioport(INVADERS_P1_CONTROL_PORT_TAG)->read();
@ -2582,9 +2579,9 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in2_control_r)
} }
int invaders_is_cabinet_cocktail(running_machine &machine) int mw8080bw_state::invaders_is_cabinet_cocktail()
{ {
return machine.root_device().ioport(INVADERS_CAB_TYPE_PORT_TAG)->read(); return machine().root_device().ioport(INVADERS_CAB_TYPE_PORT_TAG)->read();
} }
@ -2788,9 +2785,9 @@ MACHINE_CONFIG_END
#ifdef UNUSED_FUNCTION #ifdef UNUSED_FUNCTION
static UINT32 invad2ct_coin_input_r(void *param) UINT32 mw8080bw_state::invad2ct_coin_input_r(void *param)
{ {
UINT32 ret = machine.root_device().ioport(INVAD2CT_COIN_INPUT_PORT_TAG)->read(); UINT32 ret = machine().root_device().ioport(INVAD2CT_COIN_INPUT_PORT_TAG)->read();
coin_counter_w(machine, 0, !ret); coin_counter_w(machine, 0, !ret);

View File

@ -37,9 +37,9 @@
* *
*************************************/ *************************************/
void mystston_on_scanline_interrupt(running_machine &machine) void mystston_state::mystston_on_scanline_interrupt()
{ {
machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
} }

View File

@ -94,4 +94,5 @@ public:
TIMER_CALLBACK_MEMBER(interrupt_callback); TIMER_CALLBACK_MEMBER(interrupt_callback);
DECLARE_WRITE8_MEMBER(ic8j1_output_changed); DECLARE_WRITE8_MEMBER(ic8j1_output_changed);
DECLARE_WRITE8_MEMBER(ic8j2_output_changed); DECLARE_WRITE8_MEMBER(ic8j2_output_changed);
inline void plot_pixel_m10( bitmap_ind16 &bm, int x, int y, int col );
}; };

View File

@ -53,4 +53,8 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_m107(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_m107(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(m107_scanline_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(m107_scanline_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void m107_update_scroll_positions();
void m107_tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int laynum, int category,int opaque);
void m107_screenrefresh(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };

View File

@ -35,4 +35,5 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image);
}; };

View File

@ -21,4 +21,6 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_m57(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_m57(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };

View File

@ -31,4 +31,6 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -106,4 +106,9 @@ public:
UINT32 screen_update_spelunk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_spelunk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_youjyudn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_youjyudn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_horizon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_horizon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void m62_amplify_contrast(palette_t *palette, UINT32 numcolors);
void register_savestate( );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int colormask, int prioritymask, int priority );
void m62_start( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 );
void m62_textlayer( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 );
}; };

View File

@ -123,4 +123,13 @@ public:
TIMER_CALLBACK_MEMBER(m72_scanline_interrupt); TIMER_CALLBACK_MEMBER(m72_scanline_interrupt);
TIMER_CALLBACK_MEMBER(kengo_scanline_interrupt); TIMER_CALLBACK_MEMBER(kengo_scanline_interrupt);
TIMER_CALLBACK_MEMBER(delayed_ram16_w); TIMER_CALLBACK_MEMBER(delayed_ram16_w);
inline void m72_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum);
inline void rtype2_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum);
void register_savestate();
inline void changecolor(int color,int r,int g,int b);
void m72_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void majtitle_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
int find_sample(int num);
void copy_le(UINT16 *dest, const UINT8 *src, UINT8 bytes);
void install_protection_handler(const UINT8 *code,const UINT8 *crc);
}; };

View File

@ -48,4 +48,11 @@ public:
INTERRUPT_GEN_MEMBER(m90_interrupt); INTERRUPT_GEN_MEMBER(m90_interrupt);
INTERRUPT_GEN_MEMBER(dynablsb_interrupt); INTERRUPT_GEN_MEMBER(dynablsb_interrupt);
INTERRUPT_GEN_MEMBER(bomblord_interrupt); INTERRUPT_GEN_MEMBER(bomblord_interrupt);
inline void get_tile_info(tile_data &tileinfo,int tile_index,int layer,int page_mask);
inline void bomblord_get_tile_info(tile_data &tileinfo,int tile_index,int layer);
inline void dynablsb_get_tile_info(tile_data &tileinfo,int tile_index,int layer);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void bomblord_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void dynablsb_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void markdirty(tilemap_t *tmap,int page,offs_t offset);
}; };

View File

@ -79,6 +79,11 @@ public:
UINT32 screen_update_ppan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_ppan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(spritebuffer_callback); TIMER_CALLBACK_MEMBER(spritebuffer_callback);
TIMER_DEVICE_CALLBACK_MEMBER(m92_scanline_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(m92_scanline_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void ppan_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void m92_update_scroll_positions();
void m92_draw_tiles(bitmap_ind16 &bitmap,const rectangle &cliprect);
void m92_sprite_interrupt();
}; };
/*----------- defined in drivers/m92.c -----------*/ /*----------- defined in drivers/m92.c -----------*/

View File

@ -73,4 +73,8 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); UINT32 screen_update_macrossp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void screen_eof_macrossp(screen_device &screen, bool state); void screen_eof_macrossp(screen_device &screen, bool state);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority );
void draw_layer( bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer );
void sortlayers(int *layer,int *pri);
void update_colors( );
}; };

View File

@ -63,6 +63,11 @@ public:
DECLARE_VIDEO_START(madalien); DECLARE_VIDEO_START(madalien);
DECLARE_PALETTE_INIT(madalien); DECLARE_PALETTE_INIT(madalien);
UINT32 screen_update_madalien(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_madalien(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline int scan_helper(int col, int row, int section);
void draw_edges(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int scroll_mode);
void draw_headlight(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip);
void draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip);
inline UINT8 shift_common(UINT8 hi, UINT8 lo);
}; };
/*----------- defined in video/madalien.c -----------*/ /*----------- defined in video/madalien.c -----------*/

View File

@ -28,4 +28,5 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_mainsnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mainsnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly );
}; };

View File

@ -62,4 +62,6 @@ public:
TIMER_CALLBACK_MEMBER(pacnpal_io_run); TIMER_CALLBACK_MEMBER(pacnpal_io_run);
TIMER_CALLBACK_MEMBER(phozon_io_run); TIMER_CALLBACK_MEMBER(phozon_io_run);
TIMER_CALLBACK_MEMBER(mappy_io_run); TIMER_CALLBACK_MEMBER(mappy_io_run);
void mappy_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base);
void phozon_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base);
}; };

View File

@ -46,4 +46,5 @@ public:
UINT32 screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_hopprobo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(marineb_vblank_irq); INTERRUPT_GEN_MEMBER(marineb_vblank_irq);
INTERRUPT_GEN_MEMBER(wanted_vblank_irq); INTERRUPT_GEN_MEMBER(wanted_vblank_irq);
void set_tilemap_scrolly( int cols );
}; };

View File

@ -90,6 +90,7 @@ public:
DECLARE_WRITE8_MEMBER(mario_sh_sound_w); DECLARE_WRITE8_MEMBER(mario_sh_sound_w);
DECLARE_WRITE8_MEMBER(mario_sh1_w); DECLARE_WRITE8_MEMBER(mario_sh1_w);
DECLARE_WRITE8_MEMBER(mario_sh2_w); DECLARE_WRITE8_MEMBER(mario_sh2_w);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };
/*----------- defined in audio/mario.c -----------*/ /*----------- defined in audio/mario.c -----------*/

View File

@ -27,4 +27,5 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_markham(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_markham(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -81,4 +81,6 @@ public:
DECLARE_DRIVER_INIT(m1); DECLARE_DRIVER_INIT(m1);
virtual void machine_start(); virtual void machine_start();
virtual void machine_reset(); virtual void machine_reset();
void update_outputs(i8279_state *chip, UINT16 which);
void m1_stepper_reset();
}; };

View File

@ -43,4 +43,6 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_mcatadv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mcatadv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_mcatadv(screen_device &screen, bool state); void screen_eof_mcatadv(screen_device &screen, bool state);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void mcatadv_draw_tilemap_part( UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap_t* current_tilemap, bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -109,6 +109,11 @@ public:
DECLARE_WRITE16_MEMBER(mcr_ipu_sio_transmit); DECLARE_WRITE16_MEMBER(mcr_ipu_sio_transmit);
DECLARE_WRITE_LINE_MEMBER(ipu_ctc_interrupt); DECLARE_WRITE_LINE_MEMBER(ipu_ctc_interrupt);
DECLARE_WRITE8_MEMBER(ipu_break_changed); DECLARE_WRITE8_MEMBER(ipu_break_changed);
void mcr_set_color(int index, int data);
void journey_set_color(int index, int data);
void render_sprites_91399(bitmap_ind16 &bitmap, const rectangle &cliprect);
void render_sprites_91464(bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int sprmask, int colormask);
void mcr_init(int cpuboard, int vidboard, int ssioboard);
}; };
/*----------- defined in machine/mcr.c -----------*/ /*----------- defined in machine/mcr.c -----------*/

View File

@ -65,4 +65,6 @@ public:
DECLARE_PALETTE_INIT(spyhunt); DECLARE_PALETTE_INIT(spyhunt);
UINT32 screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
UINT32 screen_update_spyhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_spyhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mcr3_update_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int code_xor, int dx, int dy);
void mcr_common_init();
}; };

View File

@ -109,6 +109,13 @@ public:
DECLARE_WRITE8_MEMBER(zwackery_pia1_w); DECLARE_WRITE8_MEMBER(zwackery_pia1_w);
DECLARE_WRITE_LINE_MEMBER(zwackery_ca2_w); DECLARE_WRITE_LINE_MEMBER(zwackery_ca2_w);
DECLARE_WRITE_LINE_MEMBER(zwackery_pia_irq); DECLARE_WRITE_LINE_MEMBER(zwackery_pia_irq);
void mcr68_update_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
void zwackery_update_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
void mcr68_common_init();
void update_mcr68_interrupts();
inline void update_interrupts();
void subtract_from_counter(int counter, int count);
void mcr68_common_init(int clip, int xoffset);
}; };
/*----------- defined in machine/mcr68.c -----------*/ /*----------- defined in machine/mcr68.c -----------*/

View File

@ -49,6 +49,7 @@ public:
INTERRUPT_GEN_MEMBER(meadows_interrupt); INTERRUPT_GEN_MEMBER(meadows_interrupt);
INTERRUPT_GEN_MEMBER(minferno_interrupt); INTERRUPT_GEN_MEMBER(minferno_interrupt);
INTERRUPT_GEN_MEMBER(audio_interrupt); INTERRUPT_GEN_MEMBER(audio_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip);
}; };

View File

@ -116,4 +116,10 @@ public:
INTERRUPT_GEN_MEMBER(megasys1D_irq); INTERRUPT_GEN_MEMBER(megasys1D_irq);
TIMER_DEVICE_CALLBACK_MEMBER(megasys1A_scanline); TIMER_DEVICE_CALLBACK_MEMBER(megasys1A_scanline);
TIMER_DEVICE_CALLBACK_MEMBER(megasys1B_scanline); TIMER_DEVICE_CALLBACK_MEMBER(megasys1B_scanline);
inline void scrollram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int which);
void create_tilemaps();
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
void rodlandj_gfx_unmangle(const char *region);
void jitsupro_gfx_unmangle(const char *region);
void stdragona_gfx_unmangle(const char *region);
}; };

View File

@ -80,4 +80,6 @@ public:
UINT32 screen_update_mermaid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mermaid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void screen_eof_mermaid(screen_device &screen, bool state); void screen_eof_mermaid(screen_device &screen, bool state);
INTERRUPT_GEN_MEMBER(vblank_irq); INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
UINT8 collision_check( rectangle& rect );
}; };

View File

@ -50,4 +50,5 @@ public:
virtual void machine_reset(); virtual void machine_reset();
virtual void video_start(); virtual void video_start();
UINT32 screen_update_metlclsh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_metlclsh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -178,6 +178,14 @@ public:
TIMER_CALLBACK_MEMBER(metro_blit_done); TIMER_CALLBACK_MEMBER(metro_blit_done);
void update_irq_state(); void update_irq_state();
IRQ_CALLBACK_MEMBER(metro_irq_callback); IRQ_CALLBACK_MEMBER(metro_irq_callback);
inline UINT8 get_tile_pix( UINT16 code, UINT8 x, UINT8 y, int big, UINT16 *pix );
inline void metro_vram_w( offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram );
void metro_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_layers( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl );
inline int blt_read( const UINT8 *ROM, const int offs );
void metro_common( );
void draw_tilemap( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 pcode,
int sx, int sy, int wx, int wy, int big, UINT16 *tilemapram, int layer );
}; };

View File

@ -57,4 +57,6 @@ public:
UINT32 screen_update_kikikai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_kikikai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(kikikai_interrupt); INTERRUPT_GEN_MEMBER(kikikai_interrupt);
INTERRUPT_GEN_MEMBER(mexico86_m68705_interrupt); INTERRUPT_GEN_MEMBER(mexico86_m68705_interrupt);
void mcu_simulate( );
void kiki_clogic(int address, int latch);
}; };

View File

@ -41,4 +41,7 @@ public:
DECLARE_DRIVER_INIT(mk3r20); DECLARE_DRIVER_INIT(mk3r20);
DECLARE_MACHINE_RESET(midwunit); DECLARE_MACHINE_RESET(midwunit);
DECLARE_VIDEO_START(midwunit); DECLARE_VIDEO_START(midwunit);
void register_state_saving();
void init_wunit_generic();
void init_mk3_common();
}; };

View File

@ -37,4 +37,5 @@ public:
DECLARE_DRIVER_INIT(revx); DECLARE_DRIVER_INIT(revx);
DECLARE_MACHINE_RESET(midxunit); DECLARE_MACHINE_RESET(midxunit);
DECLARE_VIDEO_START(midxunit); DECLARE_VIDEO_START(midxunit);
void register_state_saving();
}; };

View File

@ -45,4 +45,5 @@ public:
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_mikie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mikie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq); INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
}; };

View File

@ -104,4 +104,7 @@ public:
DECLARE_VIDEO_START(pang); DECLARE_VIDEO_START(pang);
UINT32 screen_update_pang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_pang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(mitchell_irq); TIMER_DEVICE_CALLBACK_MEMBER(mitchell_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void bootleg_decode( );
void configure_banks( );
}; };

View File

@ -30,4 +30,5 @@ public:
virtual void video_start(); virtual void video_start();
UINT32 screen_update_mjkjidai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mjkjidai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq); INTERRUPT_GEN_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
}; };

View File

@ -46,4 +46,5 @@ public:
virtual void machine_start(); virtual void machine_start();
virtual void machine_reset(); virtual void machine_reset();
UINT32 screen_update_momoko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_momoko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void momoko_draw_bg_pri( bitmap_ind16 &bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri );
}; };

View File

@ -33,4 +33,5 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_mrdo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mrdo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
}; };

View File

@ -46,4 +46,6 @@ public:
virtual void machine_reset(); virtual void machine_reset();
UINT32 screen_update_mrflea(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mrflea(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(mrflea_slave_interrupt); TIMER_DEVICE_CALLBACK_MEMBER(mrflea_slave_interrupt);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -26,4 +26,5 @@ public:
virtual void video_start(); virtual void video_start();
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -92,4 +92,8 @@ public:
IRQ_CALLBACK_MEMBER(irq_callback); IRQ_CALLBACK_MEMBER(irq_callback);
void irq_init(); void irq_init();
void irq_raise(int level); void irq_raise(int level);
void update_color(int color);
void draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_pri, const rectangle &cliprect, UINT16 *sprram_top, size_t sprram_size, int gfxnum, int reverseorder);
void draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect,int priority);
void configure_banks();
}; };

View File

@ -74,4 +74,5 @@ public:
DECLARE_MACHINE_RESET(ta7630); DECLARE_MACHINE_RESET(ta7630);
UINT32 screen_update_msisaac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_msisaac(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

@ -31,4 +31,5 @@ public:
virtual void machine_start(); virtual void machine_start();
virtual void video_start(); virtual void video_start();
UINT32 screen_update_mugsmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mugsmash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -49,4 +49,7 @@ public:
UINT32 screen_update_mnchmobl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mnchmobl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(mnchmobl_vblank_irq); INTERRUPT_GEN_MEMBER(mnchmobl_vblank_irq);
INTERRUPT_GEN_MEMBER(mnchmobl_sound_irq); INTERRUPT_GEN_MEMBER(mnchmobl_sound_irq);
void draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -19,4 +19,5 @@ public:
virtual void palette_init(); virtual void palette_init();
UINT32 screen_update_mustache(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mustache(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(mustache_scanline); TIMER_DEVICE_CALLBACK_MEMBER(mustache_scanline);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
}; };

View File

@ -174,6 +174,16 @@ public:
DECLARE_WRITE8_MEMBER(invad2ct_audio_3_w); DECLARE_WRITE8_MEMBER(invad2ct_audio_3_w);
DECLARE_WRITE8_MEMBER(invad2ct_audio_4_w); DECLARE_WRITE8_MEMBER(invad2ct_audio_4_w);
void maze_update_discrete(); void maze_update_discrete();
UINT8 vpos_to_vysnc_chain_counter( int vpos );
int vysnc_chain_counter_to_vpos( UINT8 counter, int vblank );
void mw8080bw_create_interrupt_timer( );
void mw8080bw_start_interrupt_timer( );
UINT8 tornbase_get_cabinet_type();
UINT8 spcenctr_get_trench_width();
UINT8 spcenctr_get_trench_center();
UINT8 spcenctr_get_trench_slope(UINT8 addr );
int invaders_is_cabinet_cocktail();
UINT32 invad2ct_coin_input_r(void *param);
}; };

View File

@ -48,12 +48,11 @@ public:
DECLARE_VIDEO_RESET(mystston); DECLARE_VIDEO_RESET(mystston);
UINT32 screen_update_mystston(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_mystston(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(interrupt_callback); TIMER_CALLBACK_MEMBER(interrupt_callback);
void set_palette();
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip);
void mystston_on_scanline_interrupt();
}; };
/*----------- defined in drivers/mystston.c -----------*/
void mystston_on_scanline_interrupt(running_machine &machine);
/*----------- defined in video/mystston.c -----------*/ /*----------- defined in video/mystston.c -----------*/
MACHINE_CONFIG_EXTERN( mystston_video ); MACHINE_CONFIG_EXTERN( mystston_video );

View File

@ -12,15 +12,6 @@
#define VERBOSE 0 #define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0) #define LOG(x) do { if (VERBOSE) logerror x; } while (0)
/*************************************
*
* Function prototypes
*
*************************************/
static void subtract_from_counter(running_machine &machine, int counter, int count);
/************************************* /*************************************
* *
* 6821 PIA declarations * 6821 PIA declarations
@ -131,40 +122,39 @@ MACHINE_START_MEMBER(mcr68_state,mcr68)
} }
static void mcr68_common_init(running_machine &machine) void mcr68_state::mcr68_common_init()
{ {
mcr68_state *state = machine.driver_data<mcr68_state>();
int i; int i;
/* reset the 6840's */ /* reset the 6840's */
state->m_m6840_counter_periods[0] = attotime::from_hz(30); /* clocked by /VBLANK */ m_m6840_counter_periods[0] = attotime::from_hz(30); /* clocked by /VBLANK */
state->m_m6840_counter_periods[1] = attotime::never; /* grounded */ m_m6840_counter_periods[1] = attotime::never; /* grounded */
state->m_m6840_counter_periods[2] = attotime::from_hz(512 * 30); /* clocked by /HSYNC */ m_m6840_counter_periods[2] = attotime::from_hz(512 * 30); /* clocked by /HSYNC */
state->m_m6840_status = 0x00; m_m6840_status = 0x00;
state->m_m6840_status_read_since_int = 0x00; m_m6840_status_read_since_int = 0x00;
state->m_m6840_msb_buffer = state->m_m6840_lsb_buffer = 0; m_m6840_msb_buffer = m_m6840_lsb_buffer = 0;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
struct counter_state *m6840 = &state->m_m6840_state[i]; struct counter_state *m6840 = &m_m6840_state[i];
m6840->control = 0x00; m6840->control = 0x00;
m6840->latch = 0xffff; m6840->latch = 0xffff;
m6840->count = 0xffff; m6840->count = 0xffff;
m6840->timer->enable(false); m6840->timer->enable(false);
m6840->timer_active = 0; m6840->timer_active = 0;
m6840->period = state->m_m6840_counter_periods[i]; m6840->period = m_m6840_counter_periods[i];
} }
/* initialize the clock */ /* initialize the clock */
state->m_m6840_internal_counter_period = attotime::from_hz(machine.device("maincpu")->unscaled_clock() / 10); m_m6840_internal_counter_period = attotime::from_hz(machine().device("maincpu")->unscaled_clock() / 10);
} }
MACHINE_RESET_MEMBER(mcr68_state,mcr68) MACHINE_RESET_MEMBER(mcr68_state,mcr68)
{ {
/* for the most part all MCR/68k games are the same */ /* for the most part all MCR/68k games are the same */
mcr68_common_init(machine()); mcr68_common_init();
m_v493_callback = timer_expired_delegate(FUNC(mcr68_state::mcr68_493_callback),this); m_v493_callback = timer_expired_delegate(FUNC(mcr68_state::mcr68_493_callback),this);
/* vectors are 1 and 2 */ /* vectors are 1 and 2 */
@ -182,7 +172,7 @@ MACHINE_START_MEMBER(mcr68_state,zwackery)
MACHINE_RESET_MEMBER(mcr68_state,zwackery) MACHINE_RESET_MEMBER(mcr68_state,zwackery)
{ {
/* for the most part all MCR/68k games are the same */ /* for the most part all MCR/68k games are the same */
mcr68_common_init(machine()); mcr68_common_init();
m_v493_callback = timer_expired_delegate(FUNC(mcr68_state::zwackery_493_callback),this); m_v493_callback = timer_expired_delegate(FUNC(mcr68_state::zwackery_493_callback),this);
/* vectors are 5 and 6 */ /* vectors are 5 and 6 */
@ -202,7 +192,7 @@ INTERRUPT_GEN_MEMBER(mcr68_state::mcr68_interrupt)
{ {
/* update the 6840 VBLANK clock */ /* update the 6840 VBLANK clock */
if (!m_m6840_state[0].timer_active) if (!m_m6840_state[0].timer_active)
subtract_from_counter(machine(), 0, 1); subtract_from_counter(0, 1);
logerror("--- VBLANK ---\n"); logerror("--- VBLANK ---\n");
@ -220,25 +210,24 @@ INTERRUPT_GEN_MEMBER(mcr68_state::mcr68_interrupt)
* *
*************************************/ *************************************/
static void update_mcr68_interrupts(running_machine &machine) void mcr68_state::update_mcr68_interrupts()
{ {
mcr68_state *state = machine.driver_data<mcr68_state>(); machine().device("maincpu")->execute().set_input_line(m_v493_irq_vector, m_v493_irq_state ? ASSERT_LINE : CLEAR_LINE);
machine.device("maincpu")->execute().set_input_line(state->m_v493_irq_vector, state->m_v493_irq_state ? ASSERT_LINE : CLEAR_LINE); machine().device("maincpu")->execute().set_input_line(m_m6840_irq_vector, m_m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
machine.device("maincpu")->execute().set_input_line(state->m_m6840_irq_vector, state->m_m6840_irq_state ? ASSERT_LINE : CLEAR_LINE);
} }
TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_off_callback) TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_off_callback)
{ {
m_v493_irq_state = 0; m_v493_irq_state = 0;
update_mcr68_interrupts(machine()); update_mcr68_interrupts();
} }
TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_callback) TIMER_CALLBACK_MEMBER(mcr68_state::mcr68_493_callback)
{ {
m_v493_irq_state = 1; m_v493_irq_state = 1;
update_mcr68_interrupts(machine()); update_mcr68_interrupts();
machine().scheduler().timer_set(machine().primary_screen->scan_period(), timer_expired_delegate(FUNC(mcr68_state::mcr68_493_off_callback),this)); machine().scheduler().timer_set(machine().primary_screen->scan_period(), timer_expired_delegate(FUNC(mcr68_state::mcr68_493_off_callback),this));
logerror("--- (INT1) ---\n"); logerror("--- (INT1) ---\n");
} }
@ -279,7 +268,7 @@ WRITE_LINE_MEMBER(mcr68_state::zwackery_pia_irq)
{ {
pia6821_device *pia = machine().device<pia6821_device>("pia0"); pia6821_device *pia = machine().device<pia6821_device>("pia0");
m_v493_irq_state = pia->irq_a_state() | pia->irq_b_state(); m_v493_irq_state = pia->irq_a_state() | pia->irq_b_state();
update_mcr68_interrupts(machine()); update_mcr68_interrupts();
} }
@ -306,24 +295,22 @@ TIMER_CALLBACK_MEMBER(mcr68_state::zwackery_493_callback)
* *
*************************************/ *************************************/
INLINE void update_interrupts(running_machine &machine) inline void mcr68_state::update_interrupts()
{ {
mcr68_state *state = machine.driver_data<mcr68_state>(); m_m6840_status &= ~0x80;
state->m_m6840_status &= ~0x80;
if ((state->m_m6840_status & 0x01) && (state->m_m6840_state[0].control & 0x40)) state->m_m6840_status |= 0x80; if ((m_m6840_status & 0x01) && (m_m6840_state[0].control & 0x40)) m_m6840_status |= 0x80;
if ((state->m_m6840_status & 0x02) && (state->m_m6840_state[1].control & 0x40)) state->m_m6840_status |= 0x80; if ((m_m6840_status & 0x02) && (m_m6840_state[1].control & 0x40)) m_m6840_status |= 0x80;
if ((state->m_m6840_status & 0x04) && (state->m_m6840_state[2].control & 0x40)) state->m_m6840_status |= 0x80; if ((m_m6840_status & 0x04) && (m_m6840_state[2].control & 0x40)) m_m6840_status |= 0x80;
state->m_m6840_irq_state = state->m_m6840_status >> 7; m_m6840_irq_state = m_m6840_status >> 7;
update_mcr68_interrupts(machine); update_mcr68_interrupts();
} }
static void subtract_from_counter(running_machine &machine, int counter, int count) void mcr68_state::subtract_from_counter(int counter, int count)
{ {
mcr68_state *state = machine.driver_data<mcr68_state>(); struct counter_state *m6840 = &m_m6840_state[counter];
struct counter_state *m6840 = &state->m_m6840_state[counter];
/* dual-byte mode */ /* dual-byte mode */
if (m6840->control & 0x04) if (m6840->control & 0x04)
@ -344,9 +331,9 @@ static void subtract_from_counter(running_machine &machine, int counter, int cou
/* if MSB goes less than zero, we've expired */ /* if MSB goes less than zero, we've expired */
if (msb < 0) if (msb < 0)
{ {
state->m_m6840_status |= 1 << counter; m_m6840_status |= 1 << counter;
state->m_m6840_status_read_since_int &= ~(1 << counter); m_m6840_status_read_since_int &= ~(1 << counter);
update_interrupts(machine); update_interrupts();
msb = (m6840->latch >> 8) + 1; msb = (m6840->latch >> 8) + 1;
LOG(("** Counter %d fired\n", counter)); LOG(("** Counter %d fired\n", counter));
} }
@ -371,9 +358,9 @@ static void subtract_from_counter(running_machine &machine, int counter, int cou
word += m6840->latch + 1; word += m6840->latch + 1;
/* we've expired */ /* we've expired */
state->m_m6840_status |= 1 << counter; m_m6840_status |= 1 << counter;
state->m_m6840_status_read_since_int &= ~(1 << counter); m_m6840_status_read_since_int &= ~(1 << counter);
update_interrupts(machine); update_interrupts();
LOG(("** Counter %d fired\n", counter)); LOG(("** Counter %d fired\n", counter));
} }
@ -393,7 +380,7 @@ TIMER_CALLBACK_MEMBER(mcr68_state::counter_fired_callback)
m6840->timer_active = 0; m6840->timer_active = 0;
/* subtract it all from the counter; this will generate an interrupt */ /* subtract it all from the counter; this will generate an interrupt */
subtract_from_counter(machine(), counter, count); subtract_from_counter(counter, count);
} }
@ -508,7 +495,7 @@ WRITE8_MEMBER(mcr68_state::mcr68_6840_w_common)
} }
m_m6840_status = 0; m_m6840_status = 0;
update_interrupts(machine()); update_interrupts();
} }
/* changing the clock source? (needed for Zwackery) */ /* changing the clock source? (needed for Zwackery) */
@ -534,7 +521,7 @@ WRITE8_MEMBER(mcr68_state::mcr68_6840_w_common)
/* clear the interrupt */ /* clear the interrupt */
m_m6840_status &= ~(1 << counter); m_m6840_status &= ~(1 << counter);
update_interrupts(machine()); update_interrupts();
/* reload the count if in an appropriate mode */ /* reload the count if in an appropriate mode */
if (!(m6840->control & 0x10)) if (!(m6840->control & 0x10))
@ -568,7 +555,7 @@ READ16_MEMBER(mcr68_state::mcr68_6840_r_common)
/* clear the interrupt if the status has been read */ /* clear the interrupt if the status has been read */
if (m_m6840_status_read_since_int & (1 << counter)) if (m_m6840_status_read_since_int & (1 << counter))
m_m6840_status &= ~(1 << counter); m_m6840_status &= ~(1 << counter);
update_interrupts(machine()); update_interrupts();
m_m6840_lsb_buffer = result & 0xff; m_m6840_lsb_buffer = result & 0xff;

View File

@ -41,66 +41,65 @@ WRITE8_MEMBER(mexico86_state::mexico86_f008_w)
***************************************************************************/ ***************************************************************************/
static void mcu_simulate( running_machine &machine ) void mexico86_state::mcu_simulate( )
{ {
mexico86_state *state = machine.driver_data<mexico86_state>();
if (!state->m_mcu_initialised) if (!m_mcu_initialised)
{ {
if (state->m_protection_ram[0x01] == 0x00) if (m_protection_ram[0x01] == 0x00)
{ {
logerror("initialising MCU\n"); logerror("initialising MCU\n");
state->m_protection_ram[0x04] = 0xfc; // coin inputs m_protection_ram[0x04] = 0xfc; // coin inputs
state->m_protection_ram[0x02] = 0xff; // player 1 m_protection_ram[0x02] = 0xff; // player 1
state->m_protection_ram[0x03] = 0xff; // player 2 m_protection_ram[0x03] = 0xff; // player 2
state->m_protection_ram[0x1b] = 0xff; // active player m_protection_ram[0x1b] = 0xff; // active player
state->m_protection_ram[0x06] = 0xff; // must be FF otherwise PS4 ERROR m_protection_ram[0x06] = 0xff; // must be FF otherwise PS4 ERROR
state->m_protection_ram[0x07] = 0x03; // must be 03 otherwise PS4 ERROR m_protection_ram[0x07] = 0x03; // must be 03 otherwise PS4 ERROR
state->m_protection_ram[0x00] = 0x00; m_protection_ram[0x00] = 0x00;
state->m_mcu_initialised = 1; m_mcu_initialised = 1;
} }
} }
if (state->m_mcu_initialised) if (m_mcu_initialised)
{ {
int i; int i;
int coin_curr; int coin_curr;
coin_curr = ~machine.root_device().ioport("IN0")->read() & 1; coin_curr = ~machine().root_device().ioport("IN0")->read() & 1;
if (coin_curr && !state->m_coin_last && state->m_protection_ram[0x01] < 9) if (coin_curr && !m_coin_last && m_protection_ram[0x01] < 9)
{ {
state->m_protection_ram[0x01]++; // increase credits counter m_protection_ram[0x01]++; // increase credits counter
state->m_protection_ram[0x0a] = 0x01; // set flag (coin inserted sound is not played otherwise) m_protection_ram[0x0a] = 0x01; // set flag (coin inserted sound is not played otherwise)
} }
state->m_coin_last = coin_curr; m_coin_last = coin_curr;
state->m_protection_ram[0x04] = 0x3c; // coin inputs m_protection_ram[0x04] = 0x3c; // coin inputs
state->m_protection_ram[0x02] = BITSWAP8(machine.root_device().ioport("IN1")->read(), 7,6,5,4,2,3,1,0); // player 1 m_protection_ram[0x02] = BITSWAP8(machine().root_device().ioport("IN1")->read(), 7,6,5,4,2,3,1,0); // player 1
state->m_protection_ram[0x03] = BITSWAP8(machine.root_device().ioport("IN2")->read(), 7,6,5,4,2,3,1,0); // player 2 m_protection_ram[0x03] = BITSWAP8(machine().root_device().ioport("IN2")->read(), 7,6,5,4,2,3,1,0); // player 2
if (state->m_protection_ram[0x19] == 0xaa) // player 2 active if (m_protection_ram[0x19] == 0xaa) // player 2 active
state->m_protection_ram[0x1b] = state->m_protection_ram[0x03]; m_protection_ram[0x1b] = m_protection_ram[0x03];
else else
state->m_protection_ram[0x1b] = state->m_protection_ram[0x02]; m_protection_ram[0x1b] = m_protection_ram[0x02];
for (i = 0; i < 0x10; i += 2) for (i = 0; i < 0x10; i += 2)
state->m_protection_ram[i + 0xb1] = state->m_protection_ram[i + 0xb0]; m_protection_ram[i + 0xb1] = m_protection_ram[i + 0xb0];
for (i = 0; i < 0x0a; i++) for (i = 0; i < 0x0a; i++)
state->m_protection_ram[i + 0xc0] = state->m_protection_ram[i + 0x90] + 1; m_protection_ram[i + 0xc0] = m_protection_ram[i + 0x90] + 1;
if (state->m_protection_ram[0xd1] == 0xff) if (m_protection_ram[0xd1] == 0xff)
{ {
if (state->m_protection_ram[0xd0] > 0 && state->m_protection_ram[0xd0] < 4) if (m_protection_ram[0xd0] > 0 && m_protection_ram[0xd0] < 4)
{ {
state->m_protection_ram[0xd2] = 0x81; m_protection_ram[0xd2] = 0x81;
state->m_protection_ram[0xd0] = 0xff; m_protection_ram[0xd0] = 0xff;
} }
} }
if (state->m_protection_ram[0xe0] > 0 && state->m_protection_ram[0xe0] < 4) if (m_protection_ram[0xe0] > 0 && m_protection_ram[0xe0] < 4)
{ {
static const UINT8 answers[3][16] = static const UINT8 answers[3][16] =
{ {
@ -108,17 +107,17 @@ static void mcu_simulate( running_machine &machine )
{ 0x00,0x04,0x08,0x0C,0x10,0x14,0x18,0x1C,0x20,0x31,0x2B,0x35,0x00,0x00,0x00,0x00 }, { 0x00,0x04,0x08,0x0C,0x10,0x14,0x18,0x1C,0x20,0x31,0x2B,0x35,0x00,0x00,0x00,0x00 },
{ 0x00,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x03,0x0A,0x0B,0x14,0x00,0x00,0x00,0x00 }, { 0x00,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x03,0x0A,0x0B,0x14,0x00,0x00,0x00,0x00 },
}; };
int table = state->m_protection_ram[0xe0] - 1; int table = m_protection_ram[0xe0] - 1;
for (i = 1; i < 0x10; i++) for (i = 1; i < 0x10; i++)
state->m_protection_ram[0xe0 + i] = answers[table][i]; m_protection_ram[0xe0 + i] = answers[table][i];
state->m_protection_ram[0xe0] = 0xff; m_protection_ram[0xe0] = 0xff;
} }
if (state->m_protection_ram[0xf0] > 0 && state->m_protection_ram[0xf0] < 4) if (m_protection_ram[0xf0] > 0 && m_protection_ram[0xf0] < 4)
{ {
state->m_protection_ram[0xf1] = 0xb3; m_protection_ram[0xf1] = 0xb3;
state->m_protection_ram[0xf0] = 0xff; m_protection_ram[0xf0] = 0xff;
} }
@ -126,21 +125,21 @@ static void mcu_simulate( running_machine &machine )
// this should be equivalent to the obfuscated kiki_clogic() below // this should be equivalent to the obfuscated kiki_clogic() below
{ {
static const UINT8 db[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x18,0x00,0x00,0x00,0x00}; static const UINT8 db[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x18,0x00,0x00,0x00,0x00};
UINT16 sy = state->m_protection_ram[0xa0] + ((0x18) >> 1); UINT16 sy = m_protection_ram[0xa0] + ((0x18) >> 1);
UINT16 sx = state->m_protection_ram[0xa1] + ((0x18) >> 1); UINT16 sx = m_protection_ram[0xa1] + ((0x18) >> 1);
for (i = 0; i < 0x38; i += 8) for (i = 0; i < 0x38; i += 8)
{ {
UINT8 hw = db[state->m_protection_ram[0x20 + i] & 0xf]; UINT8 hw = db[m_protection_ram[0x20 + i] & 0xf];
if (hw) if (hw)
{ {
UINT16 xdiff = sx - ((UINT16)state->m_protection_ram[0x20 + i + 6] << 8 | state->m_protection_ram[0x20 + i + 7]); UINT16 xdiff = sx - ((UINT16)m_protection_ram[0x20 + i + 6] << 8 | m_protection_ram[0x20 + i + 7]);
if (xdiff < hw) if (xdiff < hw)
{ {
UINT16 ydiff = sy - ((UINT16)state->m_protection_ram[0x20 + i + 4] << 8 | state->m_protection_ram[0x20 + i + 5]); UINT16 ydiff = sy - ((UINT16)m_protection_ram[0x20 + i + 4] << 8 | m_protection_ram[0x20 + i + 5]);
if (ydiff < hw) if (ydiff < hw)
state->m_protection_ram[0xa2] = 1; // we have a collision m_protection_ram[0xa2] = 1; // we have a collision
} }
} }
} }
@ -152,7 +151,7 @@ static void mcu_simulate( running_machine &machine )
INTERRUPT_GEN_MEMBER(mexico86_state::kikikai_interrupt) INTERRUPT_GEN_MEMBER(mexico86_state::kikikai_interrupt)
{ {
if (m_mcu_running) if (m_mcu_running)
mcu_simulate(machine()); mcu_simulate();
device.execute().set_input_line_vector(0, m_protection_ram[0]); device.execute().set_input_line_vector(0, m_protection_ram[0]);
device.execute().set_input_line(0, HOLD_LINE); device.execute().set_input_line(0, HOLD_LINE);
@ -171,35 +170,34 @@ INTERRUPT_GEN_MEMBER(mexico86_state::kikikai_interrupt)
#define DCWIDTH 0 #define DCWIDTH 0
#define DCHEIGHT 0 #define DCHEIGHT 0
static void kiki_clogic(running_machine &machine, int address, int latch) void mexico86_state::kiki_clogic(int address, int latch)
{ {
mexico86_state *state = machine.driver_data<mexico86_state>();
static const UINT8 db[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x18,0x00,0x00,0x00,0x00}; static const UINT8 db[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x18,0x00,0x00,0x00,0x00};
int sy, sx, hw, i, qptr, diff1, diff2; int sy, sx, hw, i, qptr, diff1, diff2;
if (address != KIKI_CL_TRIGGER) // state->m_queue latched data if (address != KIKI_CL_TRIGGER) // m_queue latched data
{ {
state->m_queue[state->m_qfront++] = latch; m_queue[m_qfront++] = latch;
state->m_qfront &= 0x3f; m_qfront &= 0x3f;
} }
else if (state->m_qstate ^= 1) // scan state->m_queue else if (m_qstate ^= 1) // scan m_queue
{ {
sy = state->m_queue[(state->m_qfront-0x3a)&0x3f] + ((0x18-DCHEIGHT)>>1); sy = m_queue[(m_qfront-0x3a)&0x3f] + ((0x18-DCHEIGHT)>>1);
sx = state->m_queue[(state->m_qfront-0x39)&0x3f] + ((0x18-DCWIDTH)>>1); sx = m_queue[(m_qfront-0x39)&0x3f] + ((0x18-DCWIDTH)>>1);
for (i=0x38; i; i-=8) for (i=0x38; i; i-=8)
{ {
qptr = state->m_qfront - i; qptr = m_qfront - i;
if (!(hw = db[state->m_queue[qptr&0x3f]&0xf])) continue; if (!(hw = db[m_queue[qptr&0x3f]&0xf])) continue;
diff1 = sx - (short)(state->m_queue[(qptr+6)&0x3f]<<8|state->m_queue[(qptr+7)&0x3f]) + DCWIDTH; diff1 = sx - (short)(m_queue[(qptr+6)&0x3f]<<8|m_queue[(qptr+7)&0x3f]) + DCWIDTH;
diff2 = diff1 - (hw + DCWIDTH); diff2 = diff1 - (hw + DCWIDTH);
if ((diff1^diff2)<0) if ((diff1^diff2)<0)
{ {
diff1 = sy - (short)(state->m_queue[(qptr+4)&0x3f]<<8|state->m_queue[(qptr+5)&0x3f]) + DCHEIGHT; diff1 = sy - (short)(m_queue[(qptr+4)&0x3f]<<8|m_queue[(qptr+5)&0x3f]) + DCHEIGHT;
diff2 = diff1 - (hw + DCHEIGHT); diff2 = diff1 - (hw + DCHEIGHT);
if ((diff1^diff2)<0) if ((diff1^diff2)<0)
state->m_protection_ram[KIKI_CL_OUT] = 1; // we have a collision m_protection_ram[KIKI_CL_OUT] = 1; // we have a collision
} }
} }
} }

View File

@ -18,14 +18,13 @@
* *
*************************************/ *************************************/
static void register_state_saving(running_machine &machine) void midwunit_state::register_state_saving()
{ {
midwunit_state *state = machine.driver_data<midwunit_state>(); state_save_register_global(machine(), m_cmos_write_enable);
state_save_register_global(machine, state->m_cmos_write_enable); state_save_register_global_array(machine(), m_iodata);
state_save_register_global_array(machine, state->m_iodata); state_save_register_global_array(machine(), m_ioshuffle);
state_save_register_global_array(machine, state->m_ioshuffle); state_save_register_global_array(machine(), m_uart);
state_save_register_global_array(machine, state->m_uart); state_save_register_global(machine(), m_security_bits);
state_save_register_global(machine, state->m_security_bits);
} }
@ -146,13 +145,13 @@ READ16_MEMBER(midwunit_state::midwunit_io_r)
* *
*************************************/ *************************************/
static void init_wunit_generic(running_machine &machine) void midwunit_state::init_wunit_generic()
{ {
/* register for state saving */ /* register for state saving */
register_state_saving(machine); register_state_saving();
/* init sound */ /* init sound */
dcs_init(machine); dcs_init(machine());
} }
@ -194,39 +193,39 @@ WRITE16_MEMBER(midwunit_state::umk3_palette_hack_w)
/* printf("in=%04X%04X out=%04X%04X\n", m_umk3_palette[3], m_umk3_palette[2], m_umk3_palette[1], m_umk3_palette[0]); */ /* printf("in=%04X%04X out=%04X%04X\n", m_umk3_palette[3], m_umk3_palette[2], m_umk3_palette[1], m_umk3_palette[0]); */
} }
static void init_mk3_common(running_machine &machine) void midwunit_state::init_mk3_common()
{ {
/* common init */ /* common init */
init_wunit_generic(machine); init_wunit_generic();
/* serial prefixes 439, 528 */ /* serial prefixes 439, 528 */
midway_serial_pic_init(machine, 528); midway_serial_pic_init(machine(), 528);
} }
DRIVER_INIT_MEMBER(midwunit_state,mk3) DRIVER_INIT_MEMBER(midwunit_state,mk3)
{ {
init_mk3_common(machine()); init_mk3_common();
} }
DRIVER_INIT_MEMBER(midwunit_state,mk3r20) DRIVER_INIT_MEMBER(midwunit_state,mk3r20)
{ {
init_mk3_common(machine()); init_mk3_common();
} }
DRIVER_INIT_MEMBER(midwunit_state,mk3r10) DRIVER_INIT_MEMBER(midwunit_state,mk3r10)
{ {
init_mk3_common(machine()); init_mk3_common();
} }
DRIVER_INIT_MEMBER(midwunit_state,umk3) DRIVER_INIT_MEMBER(midwunit_state,umk3)
{ {
init_mk3_common(machine()); init_mk3_common();
m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f, write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this)); m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f, write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this));
} }
DRIVER_INIT_MEMBER(midwunit_state,umk3r11) DRIVER_INIT_MEMBER(midwunit_state,umk3r11)
{ {
init_mk3_common(machine()); init_mk3_common();
m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f,write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this)); m_umk3_palette = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0106a060, 0x0106a09f,write16_delegate(FUNC(midwunit_state::umk3_palette_hack_w),this));
} }
@ -236,7 +235,7 @@ DRIVER_INIT_MEMBER(midwunit_state,umk3r11)
DRIVER_INIT_MEMBER(midwunit_state,openice) DRIVER_INIT_MEMBER(midwunit_state,openice)
{ {
/* common init */ /* common init */
init_wunit_generic(machine()); init_wunit_generic();
/* serial prefixes 438, 528 */ /* serial prefixes 438, 528 */
midway_serial_pic_init(machine(), 528); midway_serial_pic_init(machine(), 528);
@ -248,7 +247,7 @@ DRIVER_INIT_MEMBER(midwunit_state,openice)
DRIVER_INIT_MEMBER(midwunit_state,nbahangt) DRIVER_INIT_MEMBER(midwunit_state,nbahangt)
{ {
/* common init */ /* common init */
init_wunit_generic(machine()); init_wunit_generic();
/* serial prefixes 459, 470, 528 */ /* serial prefixes 459, 470, 528 */
midway_serial_pic_init(machine(), 528); midway_serial_pic_init(machine(), 528);
@ -309,7 +308,7 @@ WRITE16_MEMBER(midwunit_state::wwfmania_io_0_w)
DRIVER_INIT_MEMBER(midwunit_state,wwfmania) DRIVER_INIT_MEMBER(midwunit_state,wwfmania)
{ {
/* common init */ /* common init */
init_wunit_generic(machine()); init_wunit_generic();
/* enable I/O shuffling */ /* enable I/O shuffling */
machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01800000, 0x0180000f, write16_delegate(FUNC(midwunit_state::wwfmania_io_0_w),this)); machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01800000, 0x0180000f, write16_delegate(FUNC(midwunit_state::wwfmania_io_0_w),this));
@ -324,7 +323,7 @@ DRIVER_INIT_MEMBER(midwunit_state,wwfmania)
DRIVER_INIT_MEMBER(midwunit_state,rmpgwt) DRIVER_INIT_MEMBER(midwunit_state,rmpgwt)
{ {
/* common init */ /* common init */
init_wunit_generic(machine()); init_wunit_generic();
/* serial prefixes 465, 528 */ /* serial prefixes 465, 528 */
midway_serial_pic_init(machine(), 528); midway_serial_pic_init(machine(), 528);

View File

@ -24,15 +24,14 @@ static void midxunit_dcs_output_full(running_machine &machine, int state);
* *
*************************************/ *************************************/
static void register_state_saving(running_machine &machine) void midxunit_state::register_state_saving()
{ {
midxunit_state *state = machine.driver_data<midxunit_state>(); state_save_register_global(machine(), m_cmos_write_enable);
state_save_register_global(machine, state->m_cmos_write_enable); state_save_register_global_array(machine(), m_iodata);
state_save_register_global_array(machine, state->m_iodata); state_save_register_global_array(machine(), m_ioshuffle);
state_save_register_global_array(machine, state->m_ioshuffle); state_save_register_global(machine(), m_analog_port);
state_save_register_global(machine, state->m_analog_port); state_save_register_global_array(machine(), m_uart);
state_save_register_global_array(machine, state->m_uart); state_save_register_global(machine(), m_security_bits);
state_save_register_global(machine, state->m_security_bits);
} }
@ -292,7 +291,7 @@ WRITE16_MEMBER(midxunit_state::midxunit_uart_w)
DRIVER_INIT_MEMBER(midxunit_state,revx) DRIVER_INIT_MEMBER(midxunit_state,revx)
{ {
/* register for state saving */ /* register for state saving */
register_state_saving(machine()); register_state_saving();
/* init sound */ /* init sound */
dcs_init(machine()); dcs_init(machine());

View File

@ -13,7 +13,7 @@
* *
*************************************/ *************************************/
static UINT8 vpos_to_vysnc_chain_counter( int vpos ) UINT8 mw8080bw_state::vpos_to_vysnc_chain_counter( int vpos )
{ {
/* convert from a vertical position to the actual values on the vertical sync counters */ /* convert from a vertical position to the actual values on the vertical sync counters */
UINT8 counter; UINT8 counter;
@ -28,7 +28,7 @@ static UINT8 vpos_to_vysnc_chain_counter( int vpos )
} }
static int vysnc_chain_counter_to_vpos( UINT8 counter, int vblank ) int mw8080bw_state::vysnc_chain_counter_to_vpos( UINT8 counter, int vblank )
{ {
/* convert from the vertical sync counters to an actual vertical position */ /* convert from the vertical sync counters to an actual vertical position */
int vpos; int vpos;
@ -71,18 +71,16 @@ TIMER_CALLBACK_MEMBER(mw8080bw_state::mw8080bw_interrupt_callback)
} }
static void mw8080bw_create_interrupt_timer( running_machine &machine ) void mw8080bw_state::mw8080bw_create_interrupt_timer( )
{ {
mw8080bw_state *state = machine.driver_data<mw8080bw_state>(); m_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::mw8080bw_interrupt_callback),this));
state->m_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mw8080bw_state::mw8080bw_interrupt_callback),state));
} }
static void mw8080bw_start_interrupt_timer( running_machine &machine ) void mw8080bw_state::mw8080bw_start_interrupt_timer( )
{ {
mw8080bw_state *state = machine.driver_data<mw8080bw_state>();
int vpos = vysnc_chain_counter_to_vpos(MW8080BW_INT_TRIGGER_COUNT_1, MW8080BW_INT_TRIGGER_VBLANK_1); int vpos = vysnc_chain_counter_to_vpos(MW8080BW_INT_TRIGGER_COUNT_1, MW8080BW_INT_TRIGGER_VBLANK_1);
state->m_interrupt_timer->adjust(machine.primary_screen->time_until_pos(vpos)); m_interrupt_timer->adjust(machine().primary_screen->time_until_pos(vpos));
} }
@ -95,7 +93,7 @@ static void mw8080bw_start_interrupt_timer( running_machine &machine )
MACHINE_START_MEMBER(mw8080bw_state,mw8080bw) MACHINE_START_MEMBER(mw8080bw_state,mw8080bw)
{ {
mw8080bw_create_interrupt_timer(machine()); mw8080bw_create_interrupt_timer();
m_samples = machine().device<samples_device>("samples"); m_samples = machine().device<samples_device>("samples");
m_samples1 = machine().device<samples_device>("samples1"); m_samples1 = machine().device<samples_device>("samples1");
@ -115,5 +113,5 @@ MACHINE_START_MEMBER(mw8080bw_state,mw8080bw)
MACHINE_RESET_MEMBER(mw8080bw_state,mw8080bw) MACHINE_RESET_MEMBER(mw8080bw_state,mw8080bw)
{ {
mw8080bw_start_interrupt_timer(machine()); mw8080bw_start_interrupt_timer();
} }

View File

@ -84,11 +84,10 @@ WRITE8_MEMBER(m10_state::m15_chargen_w)
} }
INLINE void plot_pixel_m10( running_machine &machine, bitmap_ind16 &bm, int x, int y, int col ) inline void m10_state::plot_pixel_m10( bitmap_ind16 &bm, int x, int y, int col )
{ {
m10_state *state = machine.driver_data<m10_state>();
if (!state->m_flip) if (!m_flip)
bm.pix16(y, x) = col; bm.pix16(y, x) = col;
else else
bm.pix16((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND) + 6, bm.pix16((IREMM10_VBSTART - 1) - (y - IREMM10_VBEND) + 6,
@ -145,7 +144,7 @@ UINT32 m10_state::screen_update_m10(screen_device &screen, bitmap_ind16 &bitmap,
int y; int y;
for (y = IREMM10_VBEND; y < IREMM10_VBSTART; y++) for (y = IREMM10_VBEND; y < IREMM10_VBSTART; y++)
plot_pixel_m10(machine(), bitmap, 16, y, 1); plot_pixel_m10(bitmap, 16, y, 1);
} }
for (offs = m_videoram.bytes() - 1; offs >= 0; offs--) for (offs = m_videoram.bytes() - 1; offs >= 0; offs--)

View File

@ -146,12 +146,11 @@ void m107_state::video_start()
/*****************************************************************************/ /*****************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void m107_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m107_state *state = machine.driver_data<m107_state>(); UINT16 *spriteram = m_buffered_spriteram;
UINT16 *spriteram = state->m_buffered_spriteram;
int offs; int offs;
UINT8 *rom = state->memregion("user1")->base(); UINT8 *rom = memregion("user1")->base();
for (offs = 0;offs < 0x800;offs += 4) for (offs = 0;offs < 0x800;offs += 4)
{ {
@ -176,7 +175,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
fy=(spriteram[offs+2]>>8)&0x2; fy=(spriteram[offs+2]>>8)&0x2;
y_multi=(spriteram[offs+0]>>11)&0x3; y_multi=(spriteram[offs+0]>>11)&0x3;
if (state->m_spritesystem == 0) if (m_spritesystem == 0)
{ {
y_multi=1 << y_multi; /* 1, 2, 4 or 8 */ y_multi=1 << y_multi; /* 1, 2, 4 or 8 */
@ -185,20 +184,20 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
for (i=0; i<y_multi; i++) for (i=0; i<y_multi; i++)
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite + s_ptr, sprite + s_ptr,
colour, colour,
fx,fy, fx,fy,
x,y-i*16, x,y-i*16,
machine.priority_bitmap,pri_mask,0); machine().priority_bitmap,pri_mask,0);
/* wrap-around y */ /* wrap-around y */
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite + s_ptr, sprite + s_ptr,
colour, colour,
fx,fy, fx,fy,
x,(y-i*16) - 0x200, x,(y-i*16) - 0x200,
machine.priority_bitmap,pri_mask,0); machine().priority_bitmap,pri_mask,0);
if (fy) s_ptr++; else s_ptr--; if (fy) s_ptr++; else s_ptr--;
} }
@ -242,20 +241,20 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
if (!ffy) sprite+=y_multi-1; if (!ffy) sprite+=y_multi-1;
for (i=0; i<y_multi; i++) for (i=0; i<y_multi; i++)
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite+(ffy?i:-i), sprite+(ffy?i:-i),
colour, colour,
ffx,ffy, ffx,ffy,
(x+xdisp)&0x1ff,(y-ydisp-16*i)&0x1ff, (x+xdisp)&0x1ff,(y-ydisp-16*i)&0x1ff,
machine.priority_bitmap,pri_mask,0); machine().priority_bitmap,pri_mask,0);
/* wrap-around y */ /* wrap-around y */
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite+(ffy?i:-i), sprite+(ffy?i:-i),
colour, colour,
ffx,ffy, ffx,ffy,
(x+xdisp)&0x1ff,((y-ydisp-16*i)&0x1ff)-0x200, (x+xdisp)&0x1ff,((y-ydisp-16*i)&0x1ff)-0x200,
machine.priority_bitmap,pri_mask,0); machine().priority_bitmap,pri_mask,0);
} }
if (rom[rom_offs+1]&0x80) break; /* end of block */ if (rom[rom_offs+1]&0x80) break; /* end of block */
@ -269,9 +268,8 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
/*****************************************************************************/ /*****************************************************************************/
static void m107_update_scroll_positions(running_machine &machine) void m107_state::m107_update_scroll_positions()
{ {
m107_state *state = machine.driver_data<m107_state>();
int laynum; int laynum;
int i; int i;
@ -283,14 +281,14 @@ static void m107_update_scroll_positions(running_machine &machine)
for (laynum = 0; laynum < 4; laynum++) for (laynum = 0; laynum < 4; laynum++)
{ {
pf_layer_info *layer = &state->m_pf_layer[laynum]; pf_layer_info *layer = &m_pf_layer[laynum];
int scrolly = state->m_control[0 + 2 * laynum]; int scrolly = m_control[0 + 2 * laynum];
int scrollx = state->m_control[1 + 2 * laynum]; int scrollx = m_control[1 + 2 * laynum];
if (state->m_control[0x08 + laynum] & 0x01) //used by World PK Soccer goal scrolling and Fire Barrel sea wave effect (stage 2) / canyon parallax effect (stage 6) if (m_control[0x08 + laynum] & 0x01) //used by World PK Soccer goal scrolling and Fire Barrel sea wave effect (stage 2) / canyon parallax effect (stage 6)
{ {
const UINT16 *scrolldata = state->m_vram_data + (0xe000 + 0x200 * laynum) / 2; const UINT16 *scrolldata = m_vram_data + (0xe000 + 0x200 * laynum) / 2;
layer->tmap->set_scroll_rows(512); layer->tmap->set_scroll_rows(512);
for (i = 0; i < 512; i++) for (i = 0; i < 512; i++)
@ -309,55 +307,53 @@ static void m107_update_scroll_positions(running_machine &machine)
/*****************************************************************************/ /*****************************************************************************/
static void m107_tilemap_draw(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int laynum, int category,int opaque) void m107_state::m107_tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int laynum, int category,int opaque)
{ {
m107_state *state = machine.driver_data<m107_state>();
int line; int line;
rectangle clip; rectangle clip;
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
clip = visarea; clip = visarea;
if (state->m_control[0x08 + laynum] & 0x02) if (m_control[0x08 + laynum] & 0x02)
{ {
for (line = cliprect.min_y; line <= cliprect.max_y;line++) for (line = cliprect.min_y; line <= cliprect.max_y;line++)
{ {
const UINT16 *scrolldata = state->m_vram_data + (0xe800 + 0x200 * laynum) / 2; const UINT16 *scrolldata = m_vram_data + (0xe800 + 0x200 * laynum) / 2;
clip.min_y = clip.max_y = line; clip.min_y = clip.max_y = line;
state->m_pf_layer[laynum].tmap->set_scrollx(0, state->m_control[1 + 2 * laynum]); m_pf_layer[laynum].tmap->set_scrollx(0, m_control[1 + 2 * laynum]);
state->m_pf_layer[laynum].tmap->set_scrolly(0, (state->m_control[0 + 2 * laynum] + scrolldata[line])); m_pf_layer[laynum].tmap->set_scrolly(0, (m_control[0 + 2 * laynum] + scrolldata[line]));
state->m_pf_layer[laynum].tmap->draw(bitmap, clip, category | opaque, category); m_pf_layer[laynum].tmap->draw(bitmap, clip, category | opaque, category);
} }
} }
else else
state->m_pf_layer[laynum].tmap->draw(bitmap, cliprect, category | opaque, category); m_pf_layer[laynum].tmap->draw(bitmap, cliprect, category | opaque, category);
} }
static void m107_screenrefresh(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void m107_state::m107_screenrefresh(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m107_state *state = machine.driver_data<m107_state>(); machine().priority_bitmap.fill(0, cliprect);
machine.priority_bitmap.fill(0, cliprect);
if ((~state->m_control[0x0b] >> 7) & 1) if ((~m_control[0x0b] >> 7) & 1)
{ {
m107_tilemap_draw(machine, bitmap, cliprect, 3, 0,0); m107_tilemap_draw(bitmap, cliprect, 3, 0,0);
m107_tilemap_draw(machine, bitmap, cliprect, 3, 1,0); m107_tilemap_draw(bitmap, cliprect, 3, 1,0);
} }
else else
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
/* note: the opaque flag is used if layer 3 is disabled, noticeable in World PK Soccer title and gameplay screens */ /* note: the opaque flag is used if layer 3 is disabled, noticeable in World PK Soccer title and gameplay screens */
m107_tilemap_draw(machine, bitmap, cliprect, 2, 0,(((state->m_control[0x0b] >> 7) & 1) ? TILEMAP_DRAW_OPAQUE : 0)); m107_tilemap_draw(bitmap, cliprect, 2, 0,(((m_control[0x0b] >> 7) & 1) ? TILEMAP_DRAW_OPAQUE : 0));
m107_tilemap_draw(machine, bitmap, cliprect, 1, 0,0); m107_tilemap_draw(bitmap, cliprect, 1, 0,0);
m107_tilemap_draw(machine, bitmap, cliprect, 0, 0,0); m107_tilemap_draw(bitmap, cliprect, 0, 0,0);
m107_tilemap_draw(machine, bitmap, cliprect, 2, 1,0); m107_tilemap_draw(bitmap, cliprect, 2, 1,0);
m107_tilemap_draw(machine, bitmap, cliprect, 1, 1,0); m107_tilemap_draw(bitmap, cliprect, 1, 1,0);
m107_tilemap_draw(machine, bitmap, cliprect, 0, 1,0); m107_tilemap_draw(bitmap, cliprect, 0, 1,0);
if(state->m_sprite_display) if(m_sprite_display)
draw_sprites(machine, bitmap, cliprect); draw_sprites(bitmap, cliprect);
/* This hardware probably has more priority values - but I haven't found /* This hardware probably has more priority values - but I haven't found
any used yet */ any used yet */
@ -382,7 +378,7 @@ WRITE16_MEMBER(m107_state::m107_spritebuffer_w)
UINT32 m107_state::screen_update_m107(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m107_state::screen_update_m107(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m107_update_scroll_positions(machine()); m107_update_scroll_positions();
m107_screenrefresh(machine(), bitmap, cliprect); m107_screenrefresh(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -290,14 +290,13 @@ WRITE8_MEMBER(m52_state::alpha1v_flipscreen_w)
* *
*************************************/ *************************************/
void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image) void m52_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image)
{ {
rectangle rect; rectangle rect;
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
m52_state *state = machine.driver_data<m52_state>();
if (state->flip_screen()) if (flip_screen())
{ {
xpos = 127 - xpos; xpos = 127 - xpos;
ypos = 255 - ypos - BGHEIGHT; ypos = 255 - ypos - BGHEIGHT;
@ -309,25 +308,25 @@ void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const recta
ypos = ypos + (22 - 8); ypos = ypos + (22 - 8);
drawgfx_transpen(bitmap, cliprect, drawgfx_transpen(bitmap, cliprect,
machine.gfx[image], machine().gfx[image],
0, 0, 0, 0,
state->flip_screen(), flip_screen(),
state->flip_screen(), flip_screen(),
xpos, xpos,
ypos, 0); ypos, 0);
drawgfx_transpen(bitmap, cliprect, drawgfx_transpen(bitmap, cliprect,
machine.gfx[image], machine().gfx[image],
0, 0, 0, 0,
state->flip_screen(), flip_screen(),
state->flip_screen(), flip_screen(),
xpos - 256, xpos - 256,
ypos, 0); ypos, 0);
rect.min_x = visarea.min_x; rect.min_x = visarea.min_x;
rect.max_x = visarea.max_x; rect.max_x = visarea.max_x;
if (state->flip_screen()) if (flip_screen())
{ {
rect.min_y = ypos - BGHEIGHT; rect.min_y = ypos - BGHEIGHT;
rect.max_y = ypos - 1; rect.max_y = ypos - 1;
@ -338,7 +337,7 @@ void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const recta
rect.max_y = ypos + 2 * BGHEIGHT - 1; rect.max_y = ypos + 2 * BGHEIGHT - 1;
} }
bitmap.fill(machine.gfx[image]->colorbase() + 3, rect); bitmap.fill(machine().gfx[image]->colorbase() + 3, rect);
} }
@ -358,13 +357,13 @@ UINT32 m52_state::screen_update_m52(screen_device &screen, bitmap_ind16 &bitmap,
if (!(m_bgcontrol & 0x20)) if (!(m_bgcontrol & 0x20))
{ {
if (!(m_bgcontrol & 0x10)) if (!(m_bgcontrol & 0x10))
draw_background(machine(), bitmap, cliprect, m_bg2xpos, m_bg2ypos, 2); /* distant mountains */ draw_background(bitmap, cliprect, m_bg2xpos, m_bg2ypos, 2); /* distant mountains */
if (!(m_bgcontrol & 0x02)) if (!(m_bgcontrol & 0x02))
draw_background(machine(), bitmap, cliprect, m_bg1xpos, m_bg1ypos, 3); /* hills */ draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 3); /* hills */
if (!(m_bgcontrol & 0x04)) if (!(m_bgcontrol & 0x04))
draw_background(machine(), bitmap, cliprect, m_bg1xpos, m_bg1ypos, 4); /* cityscape */ draw_background(bitmap, cliprect, m_bg1xpos, m_bg1ypos, 4); /* cityscape */
} }
m_bg_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); m_bg_tilemap->set_flip(flip_screen() ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);

View File

@ -170,22 +170,21 @@ WRITE8_MEMBER(m57_state::m57_flipscreen_w)
* *
*************************************/ *************************************/
static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void m57_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m57_state *state = machine.driver_data<m57_state>();
int y,x; int y,x;
INT16 scrolly; INT16 scrolly;
// from 64 to 127: not wrapped // from 64 to 127: not wrapped
for (y = 64; y < 128; y++) for (y = 64; y < 128; y++)
state->m_bg_tilemap->set_scrollx(y, state->m_scrollram[0x40]); m_bg_tilemap->set_scrollx(y, m_scrollram[0x40]);
state->m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
// from 128 to 255: wrapped // from 128 to 255: wrapped
for (y = 128; y <= cliprect.max_y; y++) for (y = 128; y <= cliprect.max_y; y++)
{ {
scrolly = state->m_scrollram[y] + (state->m_scrollram[y + 0x100] << 8); scrolly = m_scrollram[y] + (m_scrollram[y + 0x100] << 8);
if (scrolly >= 0) if (scrolly >= 0)
{ {
@ -214,17 +213,16 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, cons
* *
*************************************/ *************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void m57_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m57_state *state = machine.driver_data<m57_state>();
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)
{ {
UINT8 attributes = state->m_spriteram[offs + 1]; UINT8 attributes = m_spriteram[offs + 1];
int sx = state->m_spriteram[offs + 3]; int sx = m_spriteram[offs + 3];
int sy = ((224 - state->m_spriteram[offs + 0] - 32) & 0xff) + 32; int sy = ((224 - m_spriteram[offs + 0] - 32) & 0xff) + 32;
int code = state->m_spriteram[offs + 2]; int code = m_spriteram[offs + 2];
int color = attributes & 0x1f; int color = attributes & 0x1f;
int flipy = attributes & 0x80; int flipy = attributes & 0x80;
int flipx = attributes & 0x40; int flipx = attributes & 0x40;
@ -235,7 +233,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
if (code & 0x80) bank += 1; if (code & 0x80) bank += 1;
if (attributes & 0x20) bank += 2; if (attributes & 0x20) bank += 2;
if (state->m_flipscreen) if (m_flipscreen)
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 224 - sy; sy = 224 - sy;
@ -243,12 +241,12 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transmask(bitmap, cliprect, machine.gfx[1 + bank], drawgfx_transmask(bitmap, cliprect, machine().gfx[1 + bank],
tile_number, tile_number,
color, color,
flipx, flipy, flipx, flipy,
sx, sy, sx, sy,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 256 + 15)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 256 + 15));
} }
} }
@ -262,7 +260,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
UINT32 m57_state::screen_update_m57(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m57_state::screen_update_m57(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
draw_background(machine(), bitmap, cliprect); draw_background(bitmap, cliprect);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -209,25 +209,24 @@ WRITE8_MEMBER(m58_state::yard_flipscreen_w)
* *
*************************************/ *************************************/
#define DRAW_SPRITE(code, sy) drawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 512)); #define DRAW_SPRITE(code, sy) drawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy, colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 512));
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void m58_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
m58_state *state = machine.driver_data<m58_state>();
int offs; int offs;
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{ {
int attr = state->m_spriteram[offs + 1]; int attr = m_spriteram[offs + 1];
int bank = (attr & 0x20) >> 5; int bank = (attr & 0x20) >> 5;
int code1 = state->m_spriteram[offs + 2] & 0xbf; int code1 = m_spriteram[offs + 2] & 0xbf;
int code2 = 0; int code2 = 0;
int color = attr & 0x1f; int color = attr & 0x1f;
int flipx = attr & 0x40; int flipx = attr & 0x40;
int flipy = attr & 0x80; int flipy = attr & 0x80;
int sx = state->m_spriteram[offs + 3]; int sx = m_spriteram[offs + 3];
int sy1 = 233 - state->m_spriteram[offs]; int sy1 = 233 - m_spriteram[offs];
int sy2 = 0; int sy2 = 0;
if (flipy) if (flipy)
@ -240,7 +239,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
code2 = code1 + 0x40; code2 = code1 + 0x40;
} }
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy2 = 192 - sy1; sy2 = 192 - sy1;
@ -266,24 +265,23 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
* *
*************************************/ *************************************/
static void draw_panel( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void m58_state::draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
m58_state *state = machine.driver_data<m58_state>();
if (!*state->m_yard_score_panel_disabled) if (!*m_yard_score_panel_disabled)
{ {
const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1); const rectangle clippanel(26*8, 32*8-1, 1*8, 31*8-1);
const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1); const rectangle clippanelflip(0*8, 6*8-1, 1*8, 31*8-1);
rectangle clip = state->flip_screen() ? clippanelflip : clippanel; rectangle clip = flip_screen() ? clippanelflip : clippanel;
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
int sx = state->flip_screen() ? cliprect.min_x - 8 : cliprect.max_x + 1 - SCROLL_PANEL_WIDTH; int sx = flip_screen() ? cliprect.min_x - 8 : cliprect.max_x + 1 - SCROLL_PANEL_WIDTH;
int yoffs = state->flip_screen() ? -40 : -16; int yoffs = flip_screen() ? -40 : -16;
clip.min_y += visarea.min_y + yoffs; clip.min_y += visarea.min_y + yoffs;
clip.max_y += visarea.max_y + yoffs; clip.max_y += visarea.max_y + yoffs;
clip &= cliprect; clip &= cliprect;
copybitmap(bitmap, *state->m_scroll_panel_bitmap, state->flip_screen(), state->flip_screen(), copybitmap(bitmap, *m_scroll_panel_bitmap, flip_screen(), flip_screen(),
sx, visarea.min_y + yoffs, clip); sx, visarea.min_y + yoffs, clip);
} }
} }
@ -302,7 +300,7 @@ UINT32 m58_state::screen_update_yard(screen_device &screen, bitmap_ind16 &bitmap
m_bg_tilemap->set_scrolly(0, *m_yard_scroll_y_low); m_bg_tilemap->set_scrolly(0, *m_yard_scroll_y_low);
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);
draw_panel(machine(), bitmap, cliprect); draw_panel(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -180,7 +180,7 @@ static const res_net_decode_info spelunk2_sprite_decode_info =
}; };
static void m62_amplify_contrast(palette_t *palette, UINT32 numcolors) void m62_state::m62_amplify_contrast(palette_t *palette, UINT32 numcolors)
{ {
// m62 palette is very dark, so amplify default contrast // m62 palette is very dark, so amplify default contrast
UINT32 i, ymax=1; UINT32 i, ymax=1;
@ -283,18 +283,17 @@ PALETTE_INIT_MEMBER(m62_state,spelunk2)
} }
static void register_savestate( running_machine &machine ) void m62_state::register_savestate( )
{ {
m62_state *state = machine.driver_data<m62_state>();
state->save_item(NAME(state->m_flipscreen)); save_item(NAME(m_flipscreen));
state->save_item(NAME(state->m_m62_background_hscroll)); save_item(NAME(m_m62_background_hscroll));
state->save_item(NAME(state->m_m62_background_vscroll)); save_item(NAME(m_m62_background_vscroll));
state->save_item(NAME(state->m_kidniki_background_bank)); save_item(NAME(m_kidniki_background_bank));
state->save_item(NAME(state->m_kidniki_text_vscroll)); save_item(NAME(m_kidniki_text_vscroll));
state->save_item(NAME(state->m_ldrun3_topbottom_mask)); save_item(NAME(m_ldrun3_topbottom_mask));
state->save_item(NAME(state->m_spelunkr_palbank)); save_item(NAME(m_spelunkr_palbank));
} }
@ -346,25 +345,24 @@ WRITE8_MEMBER(m62_state::m62_textram_w)
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int colormask, int prioritymask, int priority ) void m62_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int colormask, int prioritymask, int priority )
{ {
m62_state *state = machine.driver_data<m62_state>();
int offs; int offs;
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 8) for (offs = 0; offs < m_spriteram.bytes(); offs += 8)
{ {
int i, incr, code, col, flipx, flipy, sx, sy; int i, incr, code, col, flipx, flipy, sx, sy;
if ((state->m_spriteram[offs] & prioritymask) == priority) if ((m_spriteram[offs] & prioritymask) == priority)
{ {
code = state->m_spriteram[offs + 4] + ((state->m_spriteram[offs + 5] & 0x07) << 8); code = m_spriteram[offs + 4] + ((m_spriteram[offs + 5] & 0x07) << 8);
col = state->m_spriteram[offs + 0] & colormask; col = m_spriteram[offs + 0] & colormask;
sx = 256 * (state->m_spriteram[offs + 7] & 1) + state->m_spriteram[offs + 6], sx = 256 * (m_spriteram[offs + 7] & 1) + m_spriteram[offs + 6],
sy = 256 + 128 - 15 - (256 * (state->m_spriteram[offs + 3] & 1) + state->m_spriteram[offs + 2]), sy = 256 + 128 - 15 - (256 * (m_spriteram[offs + 3] & 1) + m_spriteram[offs + 2]),
flipx = state->m_spriteram[offs + 5] & 0x40; flipx = m_spriteram[offs + 5] & 0x40;
flipy = state->m_spriteram[offs + 5] & 0x80; flipy = m_spriteram[offs + 5] & 0x80;
i = state->m_sprite_height_prom[(code >> 5) & 0x1f]; i = m_sprite_height_prom[(code >> 5) & 0x1f];
if (i == 1) /* double height */ if (i == 1) /* double height */
{ {
code &= ~1; code &= ~1;
@ -377,7 +375,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
sy -= 3*16; sy -= 3*16;
} }
if (state->m_flipscreen) if (m_flipscreen)
{ {
sx = 496 - sx; sx = 496 - sx;
sy = 242 - i*16 - sy; /* sprites are slightly misplaced by the hardware */ sy = 242 - i*16 - sy; /* sprites are slightly misplaced by the hardware */
@ -394,7 +392,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
do do
{ {
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + i * incr,col, code + i * incr,col,
flipx,flipy, flipx,flipy,
sx,sy + 16 * i,0); sx,sy + 16 * i,0);
@ -405,30 +403,28 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
} }
} }
static void m62_start( running_machine &machine, tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 ) void m62_state::m62_start( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
{ {
m62_state *state = machine.driver_data<m62_state>(); m_bg_tilemap = &machine().tilemap().create(tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
state->m_bg_tilemap = &machine.tilemap().create(tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
register_savestate(machine); register_savestate();
if (rows != 0) if (rows != 0)
state->m_bg_tilemap->set_scroll_rows(rows); m_bg_tilemap->set_scroll_rows(rows);
if (cols != 0) if (cols != 0)
state->m_bg_tilemap->set_scroll_cols(cols); m_bg_tilemap->set_scroll_cols(cols);
} }
static void m62_textlayer( running_machine &machine, tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 ) void m62_state::m62_textlayer( tilemap_get_info_delegate tile_get_info, int rows, int cols, int x1, int y1, int x2, int y2 )
{ {
m62_state *state = machine.driver_data<m62_state>(); m_fg_tilemap = &machine().tilemap().create(tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
state->m_fg_tilemap = &machine.tilemap().create(tile_get_info, TILEMAP_SCAN_ROWS, x1, y1, x2, y2);
if (rows != 0) if (rows != 0)
state->m_fg_tilemap->set_scroll_rows(rows); m_fg_tilemap->set_scroll_rows(rows);
if (cols != 0) if (cols != 0)
state->m_fg_tilemap->set_scroll_cols(cols); m_fg_tilemap->set_scroll_cols(cols);
} }
WRITE8_MEMBER(m62_state::kungfum_tileram_w) WRITE8_MEMBER(m62_state::kungfum_tileram_w)
@ -460,7 +456,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_kungfum_bg_tile_info)
VIDEO_START_MEMBER(m62_state,kungfum) VIDEO_START_MEMBER(m62_state,kungfum)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_kungfum_bg_tile_info),this), 32, 0, 8, 8, 64, 32); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_kungfum_bg_tile_info),this), 32, 0, 8, 8, 64, 32);
} }
UINT32 m62_state::screen_update_kungfum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m62_state::screen_update_kungfum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -475,7 +471,7 @@ UINT32 m62_state::screen_update_kungfum(screen_device &screen, bitmap_ind16 &bit
m_bg_tilemap->set_scrollx(i, m_m62_background_hscroll); m_bg_tilemap->set_scrollx(i, m_m62_background_hscroll);
} }
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
m_bg_tilemap->draw(bitmap, cliprect, 1, 0); m_bg_tilemap->draw(bitmap, cliprect, 1, 0);
return 0; return 0;
} }
@ -502,7 +498,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_ldrun_bg_tile_info)
void m62_state::video_start() void m62_state::video_start()
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_ldrun_bg_tile_info),this), 1, 1, 8, 8, 64, 32); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_ldrun_bg_tile_info),this), 1, 1, 8, 8, 64, 32);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */ m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */ m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
} }
@ -513,9 +509,9 @@ UINT32 m62_state::screen_update_ldrun(screen_device &screen, bitmap_ind16 &bitma
m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll); m_bg_tilemap->set_scrolly(0, m_m62_background_vscroll);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0x0f, 0x10, 0x00); draw_sprites(bitmap, cliprect, 0x0f, 0x10, 0x00);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x0f, 0x10, 0x10); draw_sprites(bitmap, cliprect, 0x0f, 0x10, 0x10);
return 0; return 0;
} }
@ -540,7 +536,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_ldrun2_bg_tile_info)
VIDEO_START_MEMBER(m62_state,ldrun2) VIDEO_START_MEMBER(m62_state,ldrun2)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_ldrun2_bg_tile_info),this), 1, 1, 8, 8, 64, 32); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_ldrun2_bg_tile_info),this), 1, 1, 8, 8, 64, 32);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */ m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */ m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
} }
@ -602,8 +598,8 @@ TILE_GET_INFO_MEMBER(m62_state::get_battroad_fg_tile_info)
VIDEO_START_MEMBER(m62_state,battroad) VIDEO_START_MEMBER(m62_state,battroad)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_battroad_bg_tile_info),this), 1, 1, 8, 8, 64, 32); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_battroad_bg_tile_info),this), 1, 1, 8, 8, 64, 32);
m62_textlayer(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_battroad_fg_tile_info),this), 1, 1, 8, 8, 32, 32); m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_battroad_fg_tile_info),this), 1, 1, 8, 8, 32, 32);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */ m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */ m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
} }
@ -617,9 +613,9 @@ UINT32 m62_state::screen_update_battroad(screen_device &screen, bitmap_ind16 &bi
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0x0f, 0x10, 0x00); draw_sprites(bitmap, cliprect, 0x0f, 0x10, 0x00);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x0f, 0x10, 0x10); draw_sprites(bitmap, cliprect, 0x0f, 0x10, 0x10);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -638,7 +634,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_ldrun4_bg_tile_info)
VIDEO_START_MEMBER(m62_state,ldrun4) VIDEO_START_MEMBER(m62_state,ldrun4)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_ldrun4_bg_tile_info),this), 1, 0, 8, 8, 64, 32); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_ldrun4_bg_tile_info),this), 1, 0, 8, 8, 64, 32);
} }
UINT32 m62_state::screen_update_ldrun4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m62_state::screen_update_ldrun4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -646,7 +642,7 @@ UINT32 m62_state::screen_update_ldrun4(screen_device &screen, bitmap_ind16 &bitm
m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll - 2); m_bg_tilemap->set_scrollx(0, m_m62_background_hscroll - 2);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
return 0; return 0;
} }
@ -677,8 +673,8 @@ TILE_GET_INFO_MEMBER(m62_state::get_lotlot_fg_tile_info)
VIDEO_START_MEMBER(m62_state,lotlot) VIDEO_START_MEMBER(m62_state,lotlot)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_lotlot_bg_tile_info),this), 1, 1, 12, 10, 32, 64); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_lotlot_bg_tile_info),this), 1, 1, 12, 10, 32, 64);
m62_textlayer(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_lotlot_fg_tile_info),this), 1, 1, 12, 10, 32, 64); m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_lotlot_fg_tile_info),this), 1, 1, 12, 10, 32, 64);
} }
UINT32 m62_state::screen_update_lotlot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m62_state::screen_update_lotlot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -691,7 +687,7 @@ UINT32 m62_state::screen_update_lotlot(screen_device &screen, bitmap_ind16 &bitm
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
return 0; return 0;
} }
@ -740,9 +736,9 @@ VIDEO_START_MEMBER(m62_state,kidniki)
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */ m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */ m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
register_savestate(machine()); register_savestate();
m62_textlayer(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_kidniki_fg_tile_info),this), 1, 1, 12, 8, 32, 64); m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_kidniki_fg_tile_info),this), 1, 1, 12, 8, 32, 64);
} }
UINT32 m62_state::screen_update_kidniki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m62_state::screen_update_kidniki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -753,7 +749,7 @@ UINT32 m62_state::screen_update_kidniki(screen_device &screen, bitmap_ind16 &bit
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg_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;
@ -791,8 +787,8 @@ TILE_GET_INFO_MEMBER(m62_state::get_spelunkr_fg_tile_info)
VIDEO_START_MEMBER(m62_state,spelunkr) VIDEO_START_MEMBER(m62_state,spelunkr)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_bg_tile_info),this), 1, 1, 8, 8, 64, 64); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_bg_tile_info),this), 1, 1, 8, 8, 64, 64);
m62_textlayer(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_fg_tile_info),this), 1, 1, 12, 8, 32, 32); m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_fg_tile_info),this), 1, 1, 12, 8, 32, 32);
} }
UINT32 m62_state::screen_update_spelunkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m62_state::screen_update_spelunkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -804,7 +800,7 @@ UINT32 m62_state::screen_update_spelunkr(screen_device &screen, bitmap_ind16 &bi
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -833,8 +829,8 @@ TILE_GET_INFO_MEMBER(m62_state::get_spelunk2_bg_tile_info)
VIDEO_START_MEMBER(m62_state,spelunk2) VIDEO_START_MEMBER(m62_state,spelunk2)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_spelunk2_bg_tile_info),this), 1, 1, 8, 8, 64, 64); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_spelunk2_bg_tile_info),this), 1, 1, 8, 8, 64, 64);
m62_textlayer(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_fg_tile_info),this), 1, 1, 12, 8, 32, 32); m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_spelunkr_fg_tile_info),this), 1, 1, 12, 8, 32, 32);
} }
UINT32 m62_state::screen_update_spelunk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 m62_state::screen_update_spelunk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -846,7 +842,7 @@ UINT32 m62_state::screen_update_spelunk2(screen_device &screen, bitmap_ind16 &bi
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }
@ -876,8 +872,8 @@ TILE_GET_INFO_MEMBER(m62_state::get_youjyudn_fg_tile_info)
VIDEO_START_MEMBER(m62_state,youjyudn) VIDEO_START_MEMBER(m62_state,youjyudn)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_youjyudn_bg_tile_info),this), 1, 0, 8, 16, 64, 16); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_youjyudn_bg_tile_info),this), 1, 0, 8, 16, 64, 16);
m62_textlayer(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_youjyudn_fg_tile_info),this), 1, 1, 12, 8, 32, 32); m62_textlayer(tilemap_get_info_delegate(FUNC(m62_state::get_youjyudn_fg_tile_info),this), 1, 1, 12, 8, 32, 32);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */ m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */ m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
} }
@ -890,7 +886,7 @@ UINT32 m62_state::screen_update_youjyudn(screen_device &screen, bitmap_ind16 &bi
m_fg_tilemap->set_transparent_pen(0); m_fg_tilemap->set_transparent_pen(0);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg_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;
@ -918,7 +914,7 @@ TILE_GET_INFO_MEMBER(m62_state::get_horizon_bg_tile_info)
VIDEO_START_MEMBER(m62_state,horizon) VIDEO_START_MEMBER(m62_state,horizon)
{ {
m62_start(machine(), tilemap_get_info_delegate(FUNC(m62_state::get_horizon_bg_tile_info),this), 32, 0, 8, 8, 64, 32); m62_start(tilemap_get_info_delegate(FUNC(m62_state::get_horizon_bg_tile_info),this), 32, 0, 8, 8, 64, 32);
m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */ m_bg_tilemap->set_transmask(0, 0xffff, 0x0000); /* split type 0 is totally transparent in front half */
m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */ m_bg_tilemap->set_transmask(1, 0x0001, 0xfffe); /* split type 1 has pen 0 transparent in front half */
} }
@ -931,7 +927,7 @@ UINT32 m62_state::screen_update_horizon(screen_device &screen, bitmap_ind16 &bit
m_bg_tilemap->set_scrollx(i, m_scrollram[i << 1] | (m_scrollram[(i << 1) | 1] << 8)); m_bg_tilemap->set_scrollx(i, m_scrollram[i << 1] | (m_scrollram[(i << 1) | 1] << 8));
} }
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
draw_sprites(machine(), bitmap, cliprect, 0x1f, 0x00, 0x00); draw_sprites(bitmap, cliprect, 0x1f, 0x00, 0x00);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
return 0; return 0;
} }

View File

@ -8,7 +8,7 @@
***************************************************************************/ ***************************************************************************/
INLINE void m72_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum) inline void m72_state::m72_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum)
{ {
int code,attr,color,pri; int code,attr,color,pri;
@ -23,7 +23,7 @@ INLINE void m72_get_tile_info(running_machine &machine,tile_data &tileinfo,int t
else pri = 0; else pri = 0;
/* color & 0x10 is used in bchopper and hharry, more priority? */ /* color & 0x10 is used in bchopper and hharry, more priority? */
SET_TILE_INFO( SET_TILE_INFO_MEMBER(
gfxnum, gfxnum,
code + ((attr & 0x3f) << 8), code + ((attr & 0x3f) << 8),
color & 0x0f, color & 0x0f,
@ -31,7 +31,7 @@ INLINE void m72_get_tile_info(running_machine &machine,tile_data &tileinfo,int t
tileinfo.group = pri; tileinfo.group = pri;
} }
INLINE void rtype2_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum) inline void m72_state::rtype2_get_tile_info(tile_data &tileinfo,int tile_index,const UINT16 *vram,int gfxnum)
{ {
int code,attr,color,pri; int code,attr,color,pri;
@ -48,7 +48,7 @@ INLINE void rtype2_get_tile_info(running_machine &machine,tile_data &tileinfo,in
/* (vram[tile_index+2] & 0x10) is used by majtitle on the green, but it's not clear for what */ /* (vram[tile_index+2] & 0x10) is used by majtitle on the green, but it's not clear for what */
/* (vram[tile_index+3] & 0xfe) are used as well */ /* (vram[tile_index+3] & 0xfe) are used as well */
SET_TILE_INFO( SET_TILE_INFO_MEMBER(
gfxnum, gfxnum,
code, code,
color & 0x0f, color & 0x0f,
@ -59,27 +59,27 @@ INLINE void rtype2_get_tile_info(running_machine &machine,tile_data &tileinfo,in
TILE_GET_INFO_MEMBER(m72_state::m72_get_bg_tile_info) TILE_GET_INFO_MEMBER(m72_state::m72_get_bg_tile_info)
{ {
m72_get_tile_info(machine(),tileinfo,tile_index,m_videoram2,2); m72_get_tile_info(tileinfo,tile_index,m_videoram2,2);
} }
TILE_GET_INFO_MEMBER(m72_state::m72_get_fg_tile_info) TILE_GET_INFO_MEMBER(m72_state::m72_get_fg_tile_info)
{ {
m72_get_tile_info(machine(),tileinfo,tile_index,m_videoram1,1); m72_get_tile_info(tileinfo,tile_index,m_videoram1,1);
} }
TILE_GET_INFO_MEMBER(m72_state::hharry_get_bg_tile_info) TILE_GET_INFO_MEMBER(m72_state::hharry_get_bg_tile_info)
{ {
m72_get_tile_info(machine(),tileinfo,tile_index,m_videoram2,1); m72_get_tile_info(tileinfo,tile_index,m_videoram2,1);
} }
TILE_GET_INFO_MEMBER(m72_state::rtype2_get_bg_tile_info) TILE_GET_INFO_MEMBER(m72_state::rtype2_get_bg_tile_info)
{ {
rtype2_get_tile_info(machine(),tileinfo,tile_index,m_videoram2,1); rtype2_get_tile_info(tileinfo,tile_index,m_videoram2,1);
} }
TILE_GET_INFO_MEMBER(m72_state::rtype2_get_fg_tile_info) TILE_GET_INFO_MEMBER(m72_state::rtype2_get_fg_tile_info)
{ {
rtype2_get_tile_info(machine(),tileinfo,tile_index,m_videoram1,1); rtype2_get_tile_info(tileinfo,tile_index,m_videoram1,1);
} }
@ -96,16 +96,15 @@ TILEMAP_MAPPER_MEMBER(m72_state::majtitle_scan_rows)
***************************************************************************/ ***************************************************************************/
static void register_savestate(running_machine &machine) void m72_state::register_savestate()
{ {
m72_state *state = machine.driver_data<m72_state>(); save_item(NAME(m_raster_irq_position));
state->save_item(NAME(state->m_raster_irq_position)); save_item(NAME(m_video_off));
state->save_item(NAME(state->m_video_off)); save_item(NAME(m_scrollx1));
state->save_item(NAME(state->m_scrollx1)); save_item(NAME(m_scrolly1));
state->save_item(NAME(state->m_scrolly1)); save_item(NAME(m_scrollx2));
state->save_item(NAME(state->m_scrollx2)); save_item(NAME(m_scrolly2));
state->save_item(NAME(state->m_scrolly2)); save_pointer(NAME(m_buffered_spriteram), m_spriteram.bytes()/2);
state->save_pointer(NAME(state->m_buffered_spriteram), state->m_spriteram.bytes()/2);
} }
@ -136,7 +135,7 @@ VIDEO_START_MEMBER(m72_state,m72)
m_bg_tilemap->set_scrolldx(0,0); m_bg_tilemap->set_scrolldx(0,0);
m_bg_tilemap->set_scrolldy(-128,-128); m_bg_tilemap->set_scrolldy(-128,-128);
register_savestate(machine()); register_savestate();
} }
VIDEO_START_MEMBER(m72_state,xmultipl) VIDEO_START_MEMBER(m72_state,xmultipl)
@ -171,7 +170,7 @@ VIDEO_START_MEMBER(m72_state,rtype2)
m_bg_tilemap->set_scrolldx(4,0); m_bg_tilemap->set_scrolldx(4,0);
m_bg_tilemap->set_scrolldy(-128,16); m_bg_tilemap->set_scrolldy(-128,16);
register_savestate(machine()); register_savestate();
} }
VIDEO_START_MEMBER(m72_state,poundfor) VIDEO_START_MEMBER(m72_state,poundfor)
@ -221,7 +220,7 @@ VIDEO_START_MEMBER(m72_state,majtitle)
m_bg_tilemap->set_scrolldx(4,0); m_bg_tilemap->set_scrolldx(4,0);
m_bg_tilemap->set_scrolldy(-128,-128); m_bg_tilemap->set_scrolldy(-128,-128);
register_savestate(machine()); register_savestate();
} }
VIDEO_START_MEMBER(m72_state,hharry) VIDEO_START_MEMBER(m72_state,hharry)
@ -247,7 +246,7 @@ VIDEO_START_MEMBER(m72_state,hharry)
m_bg_tilemap->set_scrolldx(6,0); m_bg_tilemap->set_scrolldx(6,0);
m_bg_tilemap->set_scrolldy(-128,16); m_bg_tilemap->set_scrolldy(-128,16);
register_savestate(machine()); register_savestate();
} }
@ -273,9 +272,9 @@ READ16_MEMBER(m72_state::m72_palette2_r)
return m_generic_paletteram2_16[offset] | 0xffe0; /* only D0-D4 are connected */ return m_generic_paletteram2_16[offset] | 0xffe0; /* only D0-D4 are connected */
} }
INLINE void changecolor(running_machine &machine,int color,int r,int g,int b) inline void m72_state::changecolor(int color,int r,int g,int b)
{ {
palette_set_color_rgb(machine,color,pal5bit(r),pal5bit(g),pal5bit(b)); palette_set_color_rgb(machine(),color,pal5bit(r),pal5bit(g),pal5bit(b));
} }
WRITE16_MEMBER(m72_state::m72_palette1_w) WRITE16_MEMBER(m72_state::m72_palette1_w)
@ -285,8 +284,7 @@ WRITE16_MEMBER(m72_state::m72_palette1_w)
COMBINE_DATA(&m_generic_paletteram_16[offset]); COMBINE_DATA(&m_generic_paletteram_16[offset]);
offset &= 0x0ff; offset &= 0x0ff;
changecolor(machine(), changecolor(offset,
offset,
m_generic_paletteram_16[offset + 0x000], m_generic_paletteram_16[offset + 0x000],
m_generic_paletteram_16[offset + 0x200], m_generic_paletteram_16[offset + 0x200],
m_generic_paletteram_16[offset + 0x400]); m_generic_paletteram_16[offset + 0x400]);
@ -299,8 +297,7 @@ WRITE16_MEMBER(m72_state::m72_palette2_w)
COMBINE_DATA(&m_generic_paletteram2_16[offset]); COMBINE_DATA(&m_generic_paletteram2_16[offset]);
offset &= 0x0ff; offset &= 0x0ff;
changecolor(machine(), changecolor(offset + 256,
offset + 256,
m_generic_paletteram2_16[offset + 0x000], m_generic_paletteram2_16[offset + 0x000],
m_generic_paletteram2_16[offset + 0x200], m_generic_paletteram2_16[offset + 0x200],
m_generic_paletteram2_16[offset + 0x400]); m_generic_paletteram2_16[offset + 0x400]);
@ -415,14 +412,13 @@ WRITE16_MEMBER(m72_state::majtitle_gfx_ctrl_w)
***************************************************************************/ ***************************************************************************/
static void m72_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void m72_state::m72_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
m72_state *state = machine.driver_data<m72_state>(); UINT16 *spriteram = m_buffered_spriteram;
UINT16 *spriteram = state->m_buffered_spriteram;
int offs; int offs;
offs = 0; offs = 0;
while (offs < state->m_spriteram.bytes()/2) while (offs < m_spriteram.bytes()/2)
{ {
int code,color,sx,sy,flipx,flipy,w,h,x,y; int code,color,sx,sy,flipx,flipy,w,h,x,y;
@ -438,7 +434,7 @@ static void m72_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,cons
h = 1 << ((spriteram[offs+2] & 0x3000) >> 12); h = 1 << ((spriteram[offs+2] & 0x3000) >> 12);
sy -= 16 * h; sy -= 16 * h;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 512 - 16*w - sx; sx = 512 - 16*w - sx;
sy = 284 - 16*h - sy; sy = 284 - 16*h - sy;
@ -457,7 +453,7 @@ static void m72_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,cons
if (flipy) c += h-1-y; if (flipy) c += h-1-y;
else c += y; else c += y;
drawgfx_transpen(bitmap,cliprect,machine.gfx[0], drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
c, c,
color, color,
flipx,flipy, flipx,flipy,
@ -469,13 +465,12 @@ static void m72_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,cons
} }
} }
static void majtitle_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void m72_state::majtitle_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
m72_state *state = machine.driver_data<m72_state>(); UINT16 *spriteram16_2 = m_spriteram2;
UINT16 *spriteram16_2 = state->m_spriteram2;
int offs; int offs;
for (offs = 0;offs < state->m_spriteram.bytes();offs += 4) for (offs = 0;offs < m_spriteram.bytes();offs += 4)
{ {
int code,color,sx,sy,flipx,flipy,w,h,x,y; int code,color,sx,sy,flipx,flipy,w,h,x,y;
@ -491,7 +486,7 @@ static void majtitle_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12); h = 1 << ((spriteram16_2[offs+2] & 0x3000) >> 12);
sy -= 16 * h; sy -= 16 * h;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 512 - 16*w - sx; sx = 512 - 16*w - sx;
sy = 256 - 16*h - sy; sy = 256 - 16*h - sy;
@ -510,7 +505,7 @@ static void majtitle_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
if (flipy) c += h-1-y; if (flipy) c += h-1-y;
else c += y; else c += y;
drawgfx_transpen(bitmap,cliprect,machine.gfx[2], drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
c, c,
color, color,
flipx,flipy, flipx,flipy,
@ -536,7 +531,7 @@ UINT32 m72_state::screen_update_m72(screen_device &screen, bitmap_ind16 &bitmap,
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
m72_draw_sprites(machine(), bitmap,cliprect); m72_draw_sprites(bitmap,cliprect);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
return 0; return 0;
@ -572,8 +567,8 @@ UINT32 m72_state::screen_update_majtitle(screen_device &screen, bitmap_ind16 &bi
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1,0);
majtitle_draw_sprites(machine(), bitmap,cliprect); majtitle_draw_sprites(bitmap,cliprect);
m72_draw_sprites(machine(), bitmap,cliprect); m72_draw_sprites(bitmap,cliprect);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0); m_fg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0,0);
return 0; return 0;

View File

@ -30,15 +30,14 @@
#include "includes/m90.h" #include "includes/m90.h"
INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int layer,int page_mask) inline void m90_state::get_tile_info(tile_data &tileinfo,int tile_index,int layer,int page_mask)
{ {
m90_state *state = machine.driver_data<m90_state>();
int tile,color; int tile,color;
tile_index = 2*tile_index + ((state->m_video_control_data[5+layer] & page_mask) * 0x2000); tile_index = 2*tile_index + ((m_video_control_data[5+layer] & page_mask) * 0x2000);
tile=state->m_video_data[tile_index]; tile=m_video_data[tile_index];
color=state->m_video_data[tile_index+1]; color=m_video_data[tile_index+1];
SET_TILE_INFO( SET_TILE_INFO_MEMBER(
0, 0,
tile, tile,
color&0xf, color&0xf,
@ -46,15 +45,14 @@ INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_
tileinfo.category = (color & 0x30) ? 1 : 0; tileinfo.category = (color & 0x30) ? 1 : 0;
} }
INLINE void bomblord_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int layer) inline void m90_state::bomblord_get_tile_info(tile_data &tileinfo,int tile_index,int layer)
{ {
m90_state *state = machine.driver_data<m90_state>();
int tile,color; int tile,color;
tile_index = 2*tile_index + (layer * 0x2000); tile_index = 2*tile_index + (layer * 0x2000);
tile=state->m_video_data[tile_index]; tile=m_video_data[tile_index];
color=state->m_video_data[tile_index+1]; color=m_video_data[tile_index+1];
SET_TILE_INFO( SET_TILE_INFO_MEMBER(
0, 0,
tile, tile,
color&0xf, color&0xf,
@ -62,15 +60,14 @@ INLINE void bomblord_get_tile_info(running_machine &machine,tile_data &tileinfo,
tileinfo.category = (color & 0x30) ? 1 : 0; tileinfo.category = (color & 0x30) ? 1 : 0;
} }
INLINE void dynablsb_get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,int layer) inline void m90_state::dynablsb_get_tile_info(tile_data &tileinfo,int tile_index,int layer)
{ {
m90_state *state = machine.driver_data<m90_state>();
int tile,color; int tile,color;
tile_index = 2*tile_index + (layer * 0x2000); tile_index = 2*tile_index + (layer * 0x2000);
tile=state->m_video_data[tile_index]; tile=m_video_data[tile_index];
color=state->m_video_data[tile_index+1]; color=m_video_data[tile_index+1];
SET_TILE_INFO( SET_TILE_INFO_MEMBER(
0, 0,
tile, tile,
color&0xf, color&0xf,
@ -78,20 +75,20 @@ INLINE void dynablsb_get_tile_info(running_machine &machine,tile_data &tileinfo,
tileinfo.category = (color & 0x30) ? 1 : 0; tileinfo.category = (color & 0x30) ? 1 : 0;
} }
TILE_GET_INFO_MEMBER(m90_state::get_pf1_tile_info){ get_tile_info(machine(),tileinfo,tile_index,0,0x3); } TILE_GET_INFO_MEMBER(m90_state::get_pf1_tile_info){ get_tile_info(tileinfo,tile_index,0,0x3); }
TILE_GET_INFO_MEMBER(m90_state::get_pf1w_tile_info){ get_tile_info(machine(),tileinfo,tile_index,0,0x2); } TILE_GET_INFO_MEMBER(m90_state::get_pf1w_tile_info){ get_tile_info(tileinfo,tile_index,0,0x2); }
TILE_GET_INFO_MEMBER(m90_state::get_pf2_tile_info){ get_tile_info(machine(),tileinfo,tile_index,1,0x3); } TILE_GET_INFO_MEMBER(m90_state::get_pf2_tile_info){ get_tile_info(tileinfo,tile_index,1,0x3); }
TILE_GET_INFO_MEMBER(m90_state::get_pf2w_tile_info){ get_tile_info(machine(),tileinfo,tile_index,1,0x2); } TILE_GET_INFO_MEMBER(m90_state::get_pf2w_tile_info){ get_tile_info(tileinfo,tile_index,1,0x2); }
TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf1_tile_info){ bomblord_get_tile_info(machine(),tileinfo,tile_index,0); } TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf1_tile_info){ bomblord_get_tile_info(tileinfo,tile_index,0); }
TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf1w_tile_info){ bomblord_get_tile_info(machine(),tileinfo,tile_index,0); } TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf1w_tile_info){ bomblord_get_tile_info(tileinfo,tile_index,0); }
TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf2_tile_info){ bomblord_get_tile_info(machine(),tileinfo,tile_index,2); } TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf2_tile_info){ bomblord_get_tile_info(tileinfo,tile_index,2); }
TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf2w_tile_info){ bomblord_get_tile_info(machine(),tileinfo,tile_index,2); } TILE_GET_INFO_MEMBER(m90_state::bomblord_get_pf2w_tile_info){ bomblord_get_tile_info(tileinfo,tile_index,2); }
TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf1_tile_info){ dynablsb_get_tile_info(machine(),tileinfo,tile_index,0); } TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf1_tile_info){ dynablsb_get_tile_info(tileinfo,tile_index,0); }
TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf1w_tile_info){ dynablsb_get_tile_info(machine(),tileinfo,tile_index,0); } TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf1w_tile_info){ dynablsb_get_tile_info(tileinfo,tile_index,0); }
TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf2_tile_info){ dynablsb_get_tile_info(machine(),tileinfo,tile_index,2); } TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf2_tile_info){ dynablsb_get_tile_info(tileinfo,tile_index,2); }
TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf2w_tile_info){ dynablsb_get_tile_info(machine(),tileinfo,tile_index,2); } TILE_GET_INFO_MEMBER(m90_state::dynablsb_get_pf2w_tile_info){ dynablsb_get_tile_info(tileinfo,tile_index,2); }
void m90_state::video_start() void m90_state::video_start()
{ {
@ -136,10 +133,9 @@ VIDEO_START_MEMBER(m90_state,dynablsb)
state_save_register_global_array(machine(), m_video_control_data); state_save_register_global_array(machine(), m_video_control_data);
} }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void m90_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
m90_state *state = machine.driver_data<m90_state>(); UINT16 *spriteram = m_video_data + 0xee00/2;;
UINT16 *spriteram = state->m_video_data + 0xee00/2;;
int offs; int offs;
for (offs = 0x1f2/2; offs >= 0; offs -= 3) for (offs = 0x1f2/2; offs >= 0; offs -= 3)
@ -163,42 +159,41 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
for (i = 0;i < y_multi;i++) for (i = 0;i < y_multi;i++)
if (state->m_video_control_data[7] & 0x01) if (m_video_control_data[7] & 0x01)
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite + (fy ? y_multi-1 - i : i), sprite + (fy ? y_multi-1 - i : i),
colour, colour,
fx,fy, fx,fy,
x,y+i*16, x,y+i*16,
machine.priority_bitmap, machine().priority_bitmap,
(colour & 0x08) ? 0x00 : 0x02,0); (colour & 0x08) ? 0x00 : 0x02,0);
else if (state->m_video_control_data[7] & 0x02) else if (m_video_control_data[7] & 0x02)
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite + (fy ? y_multi-1 - i : i), sprite + (fy ? y_multi-1 - i : i),
colour, colour,
fx,fy, fx,fy,
x,y+i*16, x,y+i*16,
machine.priority_bitmap, machine().priority_bitmap,
((colour & 0x0c)==0x0c) ? 0x00 : 0x02,0); ((colour & 0x0c)==0x0c) ? 0x00 : 0x02,0);
else else
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite + (fy ? y_multi-1 - i : i), sprite + (fy ? y_multi-1 - i : i),
colour, colour,
fx,fy, fx,fy,
x,y+i*16, x,y+i*16,
machine.priority_bitmap, machine().priority_bitmap,
0x02,0); 0x02,0);
} }
} }
static void bomblord_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void m90_state::bomblord_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
m90_state *state = machine.driver_data<m90_state>(); UINT16 *spriteram16 = m_spriteram;
UINT16 *spriteram16 = state->m_spriteram;
int offs = 0, last_sprite = 0; int offs = 0, last_sprite = 0;
int x,y,sprite,colour,fx,fy; int x,y,sprite,colour,fx,fy;
while ((offs < state->m_spriteram.bytes()/2) & (spriteram16[offs+0] != 0x8000)) while ((offs < m_spriteram.bytes()/2) & (spriteram16[offs+0] != 0x8000))
{ {
last_sprite = offs; last_sprite = offs;
offs += 4; offs += 4;
@ -220,24 +215,23 @@ static void bomblord_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
fx = (spriteram16[offs+3] >> 8) & 0x02; fx = (spriteram16[offs+3] >> 8) & 0x02;
fy = (spriteram16[offs+2] >> 8) & 0x80; fy = (spriteram16[offs+2] >> 8) & 0x80;
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite, sprite,
colour, colour,
fx,fy, fx,fy,
x,y, x,y,
machine.priority_bitmap, machine().priority_bitmap,
(colour & 0x08) ? 0x00 : 0x02,0); (colour & 0x08) ? 0x00 : 0x02,0);
} }
} }
static void dynablsb_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void m90_state::dynablsb_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
m90_state *state = machine.driver_data<m90_state>(); UINT16 *spriteram16 = m_spriteram;
UINT16 *spriteram16 = state->m_spriteram;
int offs = 0, last_sprite = 0; int offs = 0, last_sprite = 0;
int x,y,sprite,colour,fx,fy; int x,y,sprite,colour,fx,fy;
while ((offs < state->m_spriteram.bytes()/2) & (spriteram16[offs+0] != 0xffff)) while ((offs < m_spriteram.bytes()/2) & (spriteram16[offs+0] != 0xffff))
{ {
last_sprite = offs; last_sprite = offs;
offs += 4; offs += 4;
@ -259,12 +253,12 @@ static void dynablsb_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap
fx = (spriteram16[offs+3] >> 8) & 0x02; fx = (spriteram16[offs+3] >> 8) & 0x02;
fy = (spriteram16[offs+2] >> 8) & 0x80; fy = (spriteram16[offs+2] >> 8) & 0x80;
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
sprite, sprite,
colour, colour,
fx,fy, fx,fy,
x,y, x,y,
machine.priority_bitmap, machine().priority_bitmap,
(colour & 0x08) ? 0x00 : 0x02,0); (colour & 0x08) ? 0x00 : 0x02,0);
} }
} }
@ -274,7 +268,7 @@ WRITE16_MEMBER(m90_state::m90_video_control_w)
COMBINE_DATA(&m_video_control_data[offset]); COMBINE_DATA(&m_video_control_data[offset]);
} }
static void markdirty(tilemap_t *tmap,int page,offs_t offset) void m90_state::markdirty(tilemap_t *tmap,int page,offs_t offset)
{ {
offset -= page * 0x2000; offset -= page * 0x2000;
@ -447,7 +441,7 @@ UINT32 m90_state::screen_update_m90(screen_device &screen, bitmap_ind16 &bitmap,
} }
} }
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
} else { } else {
bitmap.fill(get_black_pen(machine()), cliprect); bitmap.fill(get_black_pen(machine()), cliprect);
@ -503,7 +497,7 @@ UINT32 m90_state::screen_update_bomblord(screen_device &screen, bitmap_ind16 &bi
m_pf1_layer->draw(bitmap, cliprect, 1,1); m_pf1_layer->draw(bitmap, cliprect, 1,1);
} }
bomblord_draw_sprites(machine(),bitmap,cliprect); bomblord_draw_sprites(bitmap,cliprect);
return 0; return 0;
} }
@ -545,7 +539,7 @@ UINT32 m90_state::screen_update_dynablsb(screen_device &screen, bitmap_ind16 &bi
m_pf2_layer->draw(bitmap, cliprect, 1,1); m_pf2_layer->draw(bitmap, cliprect, 1,1);
} }
dynablsb_draw_sprites(machine(),bitmap,cliprect); dynablsb_draw_sprites(bitmap,cliprect);
return 0; return 0;
} }

View File

@ -48,7 +48,7 @@ TIMER_CALLBACK_MEMBER(m92_state::spritebuffer_callback)
{ {
m_sprite_buffer_busy = 1; m_sprite_buffer_busy = 1;
if (m_game_kludge!=2) /* Major Title 2 doesn't like this interrupt!? */ if (m_game_kludge!=2) /* Major Title 2 doesn't like this interrupt!? */
m92_sprite_interrupt(machine()); m92_sprite_interrupt();
} }
WRITE16_MEMBER(m92_state::m92_spritecontrol_w) WRITE16_MEMBER(m92_state::m92_spritecontrol_w)
@ -308,15 +308,14 @@ VIDEO_START_MEMBER(m92_state,ppan)
/*****************************************************************************/ /*****************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void m92_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m92_state *state = machine.driver_data<m92_state>(); UINT16 *source = m_spriteram->buffer();
UINT16 *source = state->m_spriteram->buffer();
int offs, layer; int offs, layer;
for (layer = 0; layer < 8; layer++) for (layer = 0; layer < 8; layer++)
{ {
for (offs = 0; offs < state->m_sprite_list; ) for (offs = 0; offs < m_sprite_list; )
{ {
int x = source[offs+3] & 0x1ff; int x = source[offs+3] & 0x1ff;
int y = source[offs+0] & 0x1ff; int y = source[offs+0] & 0x1ff;
@ -345,31 +344,31 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
for (row = 0; row < numrows; row++) for (row = 0; row < numrows; row++)
{ {
if (state->flip_screen()) if (flip_screen())
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, !flipx, !flipy, code + s_ptr, color, !flipx, !flipy,
464 - x, 240 - (y - row * 16), 464 - x, 240 - (y - row * 16),
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
// wrap around x // wrap around x
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, !flipx, !flipy, code + s_ptr, color, !flipx, !flipy,
464 - x + 512, 240 - (y - row * 16), 464 - x + 512, 240 - (y - row * 16),
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
} }
else else
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, flipx, flipy, code + s_ptr, color, flipx, flipy,
x, y - row * 16, x, y - row * 16,
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
// wrap around x // wrap around x
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, flipx, flipy, code + s_ptr, color, flipx, flipy,
x - 512, y - row * 16, x - 512, y - row * 16,
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
} }
if (flipy) s_ptr++; if (flipy) s_ptr++;
else s_ptr--; else s_ptr--;
@ -382,15 +381,14 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
} }
// This needs a lot of work... // This needs a lot of work...
static void ppan_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void m92_state::ppan_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m92_state *state = machine.driver_data<m92_state>(); UINT16 *source = m_spriteram->live(); // sprite buffer control is never triggered
UINT16 *source = state->m_spriteram->live(); // sprite buffer control is never triggered
int offs, layer; int offs, layer;
for (layer = 0; layer < 8; layer++) for (layer = 0; layer < 8; layer++)
{ {
for (offs = 0; offs < state->m_sprite_list; ) for (offs = 0; offs < m_sprite_list; )
{ {
int x = source[offs+3] & 0x1ff; int x = source[offs+3] & 0x1ff;
int y = source[offs+0] & 0x1ff; int y = source[offs+0] & 0x1ff;
@ -420,31 +418,31 @@ static void ppan_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, co
for (row = 0; row < numrows; row++) for (row = 0; row < numrows; row++)
{ {
if (state->flip_screen()) if (flip_screen())
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, !flipx, !flipy, code + s_ptr, color, !flipx, !flipy,
464 - x, 240 - (y - row * 16), 464 - x, 240 - (y - row * 16),
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
// wrap around x // wrap around x
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, !flipx, !flipy, code + s_ptr, color, !flipx, !flipy,
464 - x + 512, 240 - (y - row * 16), 464 - x + 512, 240 - (y - row * 16),
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
} }
else else
{ {
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, flipx, flipy, code + s_ptr, color, flipx, flipy,
x, y - row * 16, x, y - row * 16,
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
// wrap around x // wrap around x
pdrawgfx_transpen(bitmap,cliprect,machine.gfx[1], pdrawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code + s_ptr, color, flipx, flipy, code + s_ptr, color, flipx, flipy,
x - 512, y - row * 16, x - 512, y - row * 16,
machine.priority_bitmap, pri, 0); machine().priority_bitmap, pri, 0);
} }
if (flipy) s_ptr++; if (flipy) s_ptr++;
else s_ptr--; else s_ptr--;
@ -458,9 +456,8 @@ static void ppan_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, co
/*****************************************************************************/ /*****************************************************************************/
static void m92_update_scroll_positions(running_machine &machine) void m92_state::m92_update_scroll_positions()
{ {
m92_state *state = machine.driver_data<m92_state>();
int laynum; int laynum;
int i; int i;
@ -477,11 +474,11 @@ static void m92_update_scroll_positions(running_machine &machine)
for (laynum = 0; laynum < 3; laynum++) for (laynum = 0; laynum < 3; laynum++)
{ {
pf_layer_info *layer = &state->m_pf_layer[laynum]; pf_layer_info *layer = &m_pf_layer[laynum];
if (state->m_pf_master_control[laynum] & 0x40) if (m_pf_master_control[laynum] & 0x40)
{ {
const UINT16 *scrolldata = state->m_vram_data + (0xf400 + 0x400 * laynum) / 2; const UINT16 *scrolldata = m_vram_data + (0xf400 + 0x400 * laynum) / 2;
layer->tmap->set_scroll_rows(512); layer->tmap->set_scroll_rows(512);
layer->wide_tmap->set_scroll_rows(512); layer->wide_tmap->set_scroll_rows(512);
@ -506,27 +503,26 @@ static void m92_update_scroll_positions(running_machine &machine)
/*****************************************************************************/ /*****************************************************************************/
static void m92_draw_tiles(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void m92_state::m92_draw_tiles(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
m92_state *state = machine.driver_data<m92_state>();
if ((~state->m_pf_master_control[2] >> 4) & 1) if ((~m_pf_master_control[2] >> 4) & 1)
{ {
state->m_pf_layer[2].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_pf_layer[2].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
state->m_pf_layer[2].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_pf_layer[2].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
state->m_pf_layer[2].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); m_pf_layer[2].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
state->m_pf_layer[2].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); m_pf_layer[2].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
} }
state->m_pf_layer[1].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_pf_layer[1].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
state->m_pf_layer[1].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_pf_layer[1].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
state->m_pf_layer[1].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); m_pf_layer[1].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
state->m_pf_layer[1].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); m_pf_layer[1].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
state->m_pf_layer[0].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_pf_layer[0].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
state->m_pf_layer[0].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0); m_pf_layer[0].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
state->m_pf_layer[0].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); m_pf_layer[0].wide_tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
state->m_pf_layer[0].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1); m_pf_layer[0].tmap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 1);
} }
@ -534,10 +530,10 @@ UINT32 m92_state::screen_update_m92(screen_device &screen, bitmap_ind16 &bitmap,
{ {
machine().priority_bitmap.fill(0, cliprect); machine().priority_bitmap.fill(0, cliprect);
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
m92_update_scroll_positions(machine()); m92_update_scroll_positions();
m92_draw_tiles(machine(), bitmap, cliprect); m92_draw_tiles(bitmap, cliprect);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
/* Flipscreen appears hardwired to the dipswitch - strange */ /* Flipscreen appears hardwired to the dipswitch - strange */
if (machine().root_device().ioport("DSW")->read() & 0x100) if (machine().root_device().ioport("DSW")->read() & 0x100)
@ -551,10 +547,10 @@ UINT32 m92_state::screen_update_ppan(screen_device &screen, bitmap_ind16 &bitmap
{ {
machine().priority_bitmap.fill(0, cliprect); machine().priority_bitmap.fill(0, cliprect);
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
m92_update_scroll_positions(machine()); m92_update_scroll_positions();
m92_draw_tiles(machine(), bitmap, cliprect); m92_draw_tiles(bitmap, cliprect);
ppan_draw_sprites(machine(), bitmap, cliprect); ppan_draw_sprites(bitmap, cliprect);
/* Flipscreen appears hardwired to the dipswitch - strange */ /* Flipscreen appears hardwired to the dipswitch - strange */
if (machine().root_device().ioport("DSW")->read() & 0x100) if (machine().root_device().ioport("DSW")->read() & 0x100)

View File

@ -159,13 +159,12 @@ void macrossp_state::video_start()
static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority ) void macrossp_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority )
{ {
macrossp_state *state = machine.driver_data<macrossp_state>(); gfx_element *gfx = machine().gfx[0];
gfx_element *gfx = machine.gfx[0]; // UINT32 *source = m_spriteram;
// UINT32 *source = state->m_spriteram; UINT32 *source = m_spriteram_old2; /* buffers by two frames */
UINT32 *source = state->m_spriteram_old2; /* buffers by two frames */ UINT32 *finish = source + m_spriteram.bytes() / 4;
UINT32 *finish = source + state->m_spriteram.bytes() / 4;
while (source < finish) while (source < finish)
{ {
@ -217,7 +216,7 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
break; break;
default: default:
col = machine.rand(); col = machine().rand();
break; break;
} }
@ -305,9 +304,8 @@ static void draw_sprites(running_machine &machine, bitmap_rgb32 &bitmap, const r
} }
static void draw_layer( running_machine &machine, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer ) void macrossp_state::draw_layer( bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer )
{ {
macrossp_state *state = machine.driver_data<macrossp_state>();
tilemap_t *tm; tilemap_t *tm;
UINT32 *vr; UINT32 *vr;
@ -315,18 +313,18 @@ static void draw_layer( running_machine &machine, bitmap_rgb32 &bitmap, const re
{ {
case 0: case 0:
default: default:
tm = state->m_scra_tilemap; tm = m_scra_tilemap;
vr = state->m_scra_videoregs; vr = m_scra_videoregs;
break; break;
case 1: case 1:
tm = state->m_scrb_tilemap; tm = m_scrb_tilemap;
vr = state->m_scrb_videoregs; vr = m_scrb_videoregs;
break; break;
case 2: case 2:
tm = state->m_scrc_tilemap; tm = m_scrc_tilemap;
vr = state->m_scrc_videoregs; vr = m_scrc_videoregs;
break; break;
} }
@ -357,7 +355,7 @@ static void draw_layer( running_machine &machine, bitmap_rgb32 &bitmap, const re
} }
/* useful function to sort the three tile layers by priority order */ /* useful function to sort the three tile layers by priority order */
static void sortlayers(int *layer,int *pri) void macrossp_state::sortlayers(int *layer,int *pri)
{ {
#define SWAP(a,b) \ #define SWAP(a,b) \
if (pri[a] >= pri[b]) \ if (pri[a] >= pri[b]) \
@ -387,13 +385,13 @@ UINT32 macrossp_state::screen_update_macrossp(screen_device &screen, bitmap_rgb3
sortlayers(layers, layerpri); sortlayers(layers, layerpri);
draw_layer(machine(), bitmap, cliprect, layers[0]); draw_layer(bitmap, cliprect, layers[0]);
draw_sprites(machine(), bitmap, cliprect, 0); draw_sprites(bitmap, cliprect, 0);
draw_layer(machine(), bitmap, cliprect, layers[1]); draw_layer(bitmap, cliprect, layers[1]);
draw_sprites(machine(), bitmap, cliprect, 1); draw_sprites(bitmap, cliprect, 1);
draw_layer(machine(), bitmap, cliprect, layers[2]); draw_layer(bitmap, cliprect, layers[2]);
draw_sprites(machine(), bitmap, cliprect, 2); draw_sprites(bitmap, cliprect, 2);
draw_sprites(machine(), bitmap, cliprect, 3); draw_sprites(bitmap, cliprect, 3);
m_text_tilemap->draw(bitmap, cliprect, 0, 0); m_text_tilemap->draw(bitmap, cliprect, 0, 0);
#if 0 #if 0

View File

@ -65,7 +65,7 @@ PALETTE_INIT_MEMBER(madalien_state,madalien)
} }
INLINE int scan_helper(int col, int row, int section) inline int madalien_state::scan_helper(int col, int row, int section)
{ {
return (section << 8) | ((~col & 0x0f) << 3) | row; return (section << 8) | ((~col & 0x0f) << 3) | row;
} }
@ -159,9 +159,8 @@ VIDEO_START_MEMBER(madalien_state,madalien)
} }
static void draw_edges(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int scroll_mode) void madalien_state::draw_edges(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int scroll_mode)
{ {
madalien_state *state = machine.driver_data<madalien_state>();
rectangle clip_edge1; rectangle clip_edge1;
rectangle clip_edge2; rectangle clip_edge2;
@ -170,45 +169,44 @@ static void draw_edges(running_machine &machine, bitmap_ind16 &bitmap, const rec
if (flip) if (flip)
{ {
clip_edge1.min_y = *state->m_edge1_pos | 0x80; clip_edge1.min_y = *m_edge1_pos | 0x80;
clip_edge2.max_y = (*state->m_edge2_pos & 0x7f) ^ 0x7f; clip_edge2.max_y = (*m_edge2_pos & 0x7f) ^ 0x7f;
} }
else else
{ {
clip_edge1.max_y = (*state->m_edge1_pos & 0x7f) ^ 0x7f; clip_edge1.max_y = (*m_edge1_pos & 0x7f) ^ 0x7f;
clip_edge2.min_y = *state->m_edge2_pos | 0x80; clip_edge2.min_y = *m_edge2_pos | 0x80;
} }
clip_edge1 &= cliprect; clip_edge1 &= cliprect;
clip_edge2 &= cliprect; clip_edge2 &= cliprect;
state->m_tilemap_edge1[scroll_mode]->mark_all_dirty(); m_tilemap_edge1[scroll_mode]->mark_all_dirty();
state->m_tilemap_edge2[scroll_mode]->mark_all_dirty(); m_tilemap_edge2[scroll_mode]->mark_all_dirty();
state->m_tilemap_edge1[scroll_mode]->set_flip(flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); m_tilemap_edge1[scroll_mode]->set_flip(flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
state->m_tilemap_edge1[scroll_mode]->set_scrollx(0, -(*state->m_scroll & 0xfc)); m_tilemap_edge1[scroll_mode]->set_scrollx(0, -(*m_scroll & 0xfc));
state->m_tilemap_edge1[scroll_mode]->set_scrolly(0, *state->m_edge1_pos & 0x7f); m_tilemap_edge1[scroll_mode]->set_scrolly(0, *m_edge1_pos & 0x7f);
state->m_tilemap_edge2[scroll_mode]->set_flip(flip ? TILEMAP_FLIPX : TILEMAP_FLIPY); m_tilemap_edge2[scroll_mode]->set_flip(flip ? TILEMAP_FLIPX : TILEMAP_FLIPY);
state->m_tilemap_edge2[scroll_mode]->set_scrollx(0, -(*state->m_scroll & 0xfc)); m_tilemap_edge2[scroll_mode]->set_scrollx(0, -(*m_scroll & 0xfc));
state->m_tilemap_edge2[scroll_mode]->set_scrolly(0, *state->m_edge2_pos & 0x7f); m_tilemap_edge2[scroll_mode]->set_scrolly(0, *m_edge2_pos & 0x7f);
state->m_tilemap_edge1[scroll_mode]->draw(bitmap, clip_edge1, 0, 0); m_tilemap_edge1[scroll_mode]->draw(bitmap, clip_edge1, 0, 0);
state->m_tilemap_edge2[scroll_mode]->draw(bitmap, clip_edge2, 0, 0); m_tilemap_edge2[scroll_mode]->draw(bitmap, clip_edge2, 0, 0);
} }
static void draw_headlight(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip) void madalien_state::draw_headlight(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip)
{ {
madalien_state *state = machine.driver_data<madalien_state>(); if (BIT(*m_video_flags, 0))
if (BIT(*state->m_video_flags, 0))
{ {
UINT8 y; UINT8 y;
for (y = 0; y < 0x80; y++) for (y = 0; y < 0x80; y++)
{ {
UINT8 x; UINT8 x;
UINT8 hy = y - *state->m_headlight_pos; UINT8 hy = y - *m_headlight_pos;
if (flip) if (flip)
hy = ~hy; hy = ~hy;
@ -226,7 +224,7 @@ static void draw_headlight(running_machine &machine, bitmap_ind16 &bitmap, const
if ((hx < cliprect.min_x) || (hx > cliprect.max_x)) if ((hx < cliprect.min_x) || (hx > cliprect.max_x))
continue; continue;
if (state->m_headlight_bitmap->pix16(y, x) != 0) if (m_headlight_bitmap->pix16(y, x) != 0)
bitmap.pix16(hy, hx) |= 8; bitmap.pix16(hy, hx) |= 8;
} }
} }
@ -234,11 +232,10 @@ static void draw_headlight(running_machine &machine, bitmap_ind16 &bitmap, const
} }
static void draw_foreground(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip) void madalien_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int flip)
{ {
madalien_state *state = machine.driver_data<madalien_state>(); m_tilemap_fg->set_flip(flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0);
state->m_tilemap_fg->set_flip(flip ? TILEMAP_FLIPX | TILEMAP_FLIPY : 0); m_tilemap_fg->draw(bitmap, cliprect, 0, 0);
state->m_tilemap_fg->draw(bitmap, cliprect, 0, 0);
} }
@ -263,8 +260,8 @@ UINT32 madalien_state::screen_update_madalien(screen_device &screen, bitmap_ind1
int scroll_mode = *m_scroll & 3; int scroll_mode = *m_scroll & 3;
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
draw_edges(machine(), bitmap, cliprect, flip, scroll_mode); draw_edges(bitmap, cliprect, flip, scroll_mode);
draw_foreground(machine(), bitmap, cliprect, flip); draw_foreground(bitmap, cliprect, flip);
/* highlight section A (outside of tunnels). /* highlight section A (outside of tunnels).
* also, bit 1 of the video_flags register (6A) is * also, bit 1 of the video_flags register (6A) is
@ -298,7 +295,7 @@ UINT32 madalien_state::screen_update_madalien(screen_device &screen, bitmap_ind1
bitmap.pix16(y, x) |= 8; bitmap.pix16(y, x) |= 8;
} }
draw_headlight(machine(), bitmap, cliprect, flip); draw_headlight(bitmap, cliprect, flip);
return 0; return 0;
} }

View File

@ -117,12 +117,11 @@ WRITE8_MEMBER(mainsnk_state::mainsnk_bgram_w)
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly ) void mainsnk_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly )
{ {
mainsnk_state *state = machine.driver_data<mainsnk_state>(); gfx_element *gfx = machine().gfx[1];
gfx_element *gfx = machine.gfx[1];
const UINT8 *source, *finish; const UINT8 *source, *finish;
source = state->m_spriteram; source = m_spriteram;
finish = source + 25*4; finish = source + 25*4;
while( source<finish ) while( source<finish )
@ -141,7 +140,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
sx = 288-16 - sx; sx = 288-16 - sx;
sy += 8; sy += 8;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 288-16 - sx; sx = 288-16 - sx;
sy = 224-16 - sy; sy = 224-16 - sy;
@ -163,7 +162,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
UINT32 mainsnk_state::screen_update_mainsnk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 mainsnk_state::screen_update_mainsnk(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, 0, 0); draw_sprites(bitmap, cliprect, 0, 0);
m_tx_tilemap->draw(bitmap, cliprect, 0, 0); m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;

View File

@ -387,9 +387,8 @@ WRITE8_MEMBER(mappy_state::mappy_scroll_w)
***************************************************************************/ ***************************************************************************/
static void mappy_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base) void mappy_state::mappy_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base)
{ {
mappy_state *state = machine.driver_data<mappy_state>();
UINT8 *spriteram = spriteram_base + 0x780; UINT8 *spriteram = spriteram_base + 0x780;
UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_2 = spriteram + 0x800;
UINT8 *spriteram_3 = spriteram_2 + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800;
@ -422,7 +421,7 @@ static void mappy_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, c
sy -= 16 * sizey; sy -= 16 * sizey;
sy = (sy & 0xff) - 32; // fix wraparound sy = (sy & 0xff) - 32; // fix wraparound
if (state->flip_screen()) if (flip_screen())
{ {
flipx ^= 1; flipx ^= 1;
flipy ^= 1; flipy ^= 1;
@ -434,12 +433,12 @@ static void mappy_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, c
{ {
for (x = 0;x <= sizex;x++) for (x = 0;x <= sizex;x++)
{ {
drawgfx_transmask(bitmap,cliprect,machine.gfx[1], drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
color, color,
flipx,flipy, flipx,flipy,
sx + 16*x,sy + 16*y, sx + 16*x,sy + 16*y,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 15)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 15));
} }
} }
} }
@ -468,9 +467,8 @@ spriteram_3
1 -------x X position MSB 1 -------x X position MSB
*/ */
static void phozon_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base) void mappy_state::phozon_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *spriteram_base)
{ {
mappy_state *state = machine.driver_data<mappy_state>();
UINT8 *spriteram = spriteram_base + 0x780; UINT8 *spriteram = spriteram_base + 0x780;
UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_2 = spriteram + 0x800;
UINT8 *spriteram_3 = spriteram_2 + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800;
@ -502,7 +500,7 @@ static void phozon_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,
sy -= 8 * sizey; sy -= 8 * sizey;
sy = (sy & 0xff) - 32; // fix wraparound sy = (sy & 0xff) - 32; // fix wraparound
if (state->flip_screen()) if (flip_screen())
{ {
flipx ^= 1; flipx ^= 1;
flipy ^= 1; flipy ^= 1;
@ -514,12 +512,12 @@ static void phozon_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,
{ {
for (x = 0;x <= sizex;x++) for (x = 0;x <= sizex;x++)
{ {
drawgfx_transmask(bitmap,cliprect,machine.gfx[1], drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)], sprite + gfx_offs[y ^ (sizey * flipy)][x ^ (sizex * flipx)],
color, color,
flipx,flipy, flipx,flipy,
sx + 8*x,sy + 8*y, sx + 8*x,sy + 8*y,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], color, 31)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], color, 31));
} }
} }
} }
@ -535,7 +533,7 @@ UINT32 mappy_state::screen_update_superpac(screen_device &screen, bitmap_ind16 &
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
sprite_bitmap.fill(15, cliprect); sprite_bitmap.fill(15, cliprect);
mappy_draw_sprites(machine(),sprite_bitmap,cliprect,m_spriteram); mappy_draw_sprites(sprite_bitmap,cliprect,m_spriteram);
copybitmap_trans(bitmap,sprite_bitmap,0,0,0,0,cliprect,15); copybitmap_trans(bitmap,sprite_bitmap,0,0,0,0,cliprect,15);
/* Redraw the high priority characters */ /* Redraw the high priority characters */
@ -562,7 +560,7 @@ UINT32 mappy_state::screen_update_phozon(screen_device &screen, bitmap_ind16 &bi
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
phozon_draw_sprites(machine(),bitmap,cliprect,m_spriteram); phozon_draw_sprites(bitmap,cliprect,m_spriteram);
/* Redraw the high priority characters */ /* Redraw the high priority characters */
m_bg_tilemap->draw(bitmap, cliprect, 1,0); m_bg_tilemap->draw(bitmap, cliprect, 1,0);
@ -578,7 +576,7 @@ UINT32 mappy_state::screen_update_mappy(screen_device &screen, bitmap_ind16 &bit
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
mappy_draw_sprites(machine(),bitmap,cliprect,m_spriteram); mappy_draw_sprites(bitmap,cliprect,m_spriteram);
/* Redraw the high priority characters */ /* Redraw the high priority characters */
m_bg_tilemap->draw(bitmap, cliprect, 1,0); m_bg_tilemap->draw(bitmap, cliprect, 1,0);

View File

@ -150,16 +150,15 @@ WRITE8_MEMBER(marineb_state::marineb_flipscreen_y_w)
* *
*************************************/ *************************************/
static void set_tilemap_scrolly( running_machine &machine, int cols ) void marineb_state::set_tilemap_scrolly( int cols )
{ {
marineb_state *state = machine.driver_data<marineb_state>();
int col; int col;
for (col = 0; col < cols; col++) for (col = 0; col < cols; col++)
state->m_bg_tilemap->set_scrolly(col, state->m_column_scroll); m_bg_tilemap->set_scrolly(col, m_column_scroll);
for (; col < 32; col++) for (; col < 32; col++)
state->m_bg_tilemap->set_scrolly(col, 0); m_bg_tilemap->set_scrolly(col, 0);
} }
@ -167,7 +166,7 @@ UINT32 marineb_state::screen_update_marineb(screen_device &screen, bitmap_ind16
{ {
int offs; int offs;
set_tilemap_scrolly(machine(), 24); set_tilemap_scrolly(24);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the sprites */ /* draw the sprites */
@ -228,7 +227,7 @@ UINT32 marineb_state::screen_update_changes(screen_device &screen, bitmap_ind16
{ {
int offs, sx, sy, code, col, flipx, flipy; int offs, sx, sy, code, col, flipx, flipy;
set_tilemap_scrolly(machine(), 26); set_tilemap_scrolly(26);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the small sprites */ /* draw the small sprites */
@ -306,7 +305,7 @@ UINT32 marineb_state::screen_update_springer(screen_device &screen, bitmap_ind16
{ {
int offs; int offs;
set_tilemap_scrolly(machine(), 0); set_tilemap_scrolly(0);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the sprites */ /* draw the sprites */
@ -365,7 +364,7 @@ UINT32 marineb_state::screen_update_hoccer(screen_device &screen, bitmap_ind16 &
{ {
int offs; int offs;
set_tilemap_scrolly(machine(), 0); set_tilemap_scrolly(0);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the sprites */ /* draw the sprites */
@ -408,7 +407,7 @@ UINT32 marineb_state::screen_update_hopprobo(screen_device &screen, bitmap_ind16
{ {
int offs; int offs;
set_tilemap_scrolly(machine(), 0); set_tilemap_scrolly(0);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the sprites */ /* draw the sprites */

View File

@ -149,47 +149,46 @@ void mario_state::video_start()
* confirmed on mametests.org as being present on real PCB as well. * confirmed on mametests.org as being present on real PCB as well.
*/ */
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void mario_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
/* TODO: draw_sprites should adopt the scanline logic from dkong.c /* TODO: draw_sprites should adopt the scanline logic from dkong.c
* The schematics have the same logic for sprite buffering. * The schematics have the same logic for sprite buffering.
*/ */
mario_state *state = machine.driver_data<mario_state>();
int offs; int offs;
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{ {
if (state->m_spriteram[offs]) if (m_spriteram[offs])
{ {
int x, y; int x, y;
// from schematics .... // from schematics ....
y = (state->m_spriteram[offs] + (state->m_flip ? 0xF7 : 0xF9) + 1) & 0xFF; y = (m_spriteram[offs] + (m_flip ? 0xF7 : 0xF9) + 1) & 0xFF;
x = state->m_spriteram[offs+3]; x = m_spriteram[offs+3];
// sprite will be drawn if (y + scanline) & 0xF0 = 0xF0 // sprite will be drawn if (y + scanline) & 0xF0 = 0xF0
y = 240 - y; /* logical screen position */ y = 240 - y; /* logical screen position */
y = y ^ (state->m_flip ? 0xFF : 0x00); /* physical screen location */ y = y ^ (m_flip ? 0xFF : 0x00); /* physical screen location */
x = x ^ (state->m_flip ? 0xFF : 0x00); /* physical screen location */ x = x ^ (m_flip ? 0xFF : 0x00); /* physical screen location */
if (state->m_flip) if (m_flip)
{ {
y -= 14; y -= 14;
x -= 7; x -= 7;
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
state->m_spriteram[offs + 2], m_spriteram[offs + 2],
(state->m_spriteram[offs + 1] & 0x0f) + 16 * state->m_palette_bank + 32 * state->m_monitor, (m_spriteram[offs + 1] & 0x0f) + 16 * m_palette_bank + 32 * m_monitor,
!(state->m_spriteram[offs + 1] & 0x80),!(state->m_spriteram[offs + 1] & 0x40), !(m_spriteram[offs + 1] & 0x80),!(m_spriteram[offs + 1] & 0x40),
x, y,0); x, y,0);
} }
else else
{ {
y += 1; y += 1;
x -= 8; x -= 8;
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
state->m_spriteram[offs + 2], m_spriteram[offs + 2],
(state->m_spriteram[offs + 1] & 0x0f) + 16 * state->m_palette_bank + 32 * state->m_monitor, (m_spriteram[offs + 1] & 0x0f) + 16 * m_palette_bank + 32 * m_monitor,
(state->m_spriteram[offs + 1] & 0x80),(state->m_spriteram[offs + 1] & 0x40), (m_spriteram[offs + 1] & 0x80),(m_spriteram[offs + 1] & 0x40),
x, y,0); x, y,0);
} }
} }
@ -211,7 +210,7 @@ UINT32 mario_state::screen_update_mario(screen_device &screen, bitmap_ind16 &bit
m_bg_tilemap->set_scrolly(0, m_gfx_scroll - (m_flip ? 8 : 0)); m_bg_tilemap->set_scrolly(0, m_gfx_scroll - (m_flip ? 8 : 0));
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

@ -71,10 +71,9 @@ void markham_state::video_start()
m_bg_tilemap->set_scroll_rows(32); m_bg_tilemap->set_scroll_rows(32);
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void markham_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
markham_state *state = machine.driver_data<markham_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = 0x60; offs < 0x100; offs += 4) for (offs = 0x60; offs < 0x100; offs += 4)
@ -82,15 +81,15 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int chr = spriteram[offs + 1]; int chr = spriteram[offs + 1];
int col = spriteram[offs + 2]; int col = spriteram[offs + 2];
int fx = state->flip_screen(); int fx = flip_screen();
int fy = state->flip_screen(); int fy = flip_screen();
int x = spriteram[offs + 3]; int x = spriteram[offs + 3];
int y = spriteram[offs + 0]; int y = spriteram[offs + 0];
int px, py; int px, py;
col &= 0x3f ; col &= 0x3f ;
if (state->flip_screen() == 0) if (flip_screen() == 0)
{ {
px = x - 2; px = x - 2;
py = 240 - y; py = 240 - y;
@ -106,12 +105,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if (px > 248) if (px > 248)
px = px - 256; px = px - 256;
drawgfx_transmask(bitmap,cliprect,machine.gfx[1], drawgfx_transmask(bitmap,cliprect,machine().gfx[1],
chr, chr,
col, col,
fx,fy, fx,fy,
px,py, px,py,
colortable_get_transpen_mask(machine.colortable, machine.gfx[1], col, 0)); colortable_get_transpen_mask(machine().colortable, machine().gfx[1], col, 0));
} }
} }
@ -128,6 +127,6 @@ UINT32 markham_state::screen_update_markham(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;
} }

View File

@ -46,28 +46,27 @@ WRITE16_MEMBER(mcatadv_state::mcatadv_videoram2_w)
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mcatadv_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
mcatadv_state *state = machine.driver_data<mcatadv_state>(); UINT16 *source = m_spriteram_old;
UINT16 *source = state->m_spriteram_old; UINT16 *finish = source + (m_spriteram.bytes() / 2) /2;
UINT16 *finish = source + (state->m_spriteram.bytes() / 2) /2; int global_x = m_vidregs[0] - 0x184;
int global_x = state->m_vidregs[0] - 0x184; int global_y = m_vidregs[1] - 0x1f1;
int global_y = state->m_vidregs[1] - 0x1f1;
UINT16 *destline; UINT16 *destline;
UINT8 *priline; UINT8 *priline;
UINT8 *sprdata = state->memregion("gfx1")->base(); UINT8 *sprdata = memregion("gfx1")->base();
int sprmask = state->memregion("gfx1")->bytes()-1; int sprmask = memregion("gfx1")->bytes()-1;
int xstart, xend, xinc; int xstart, xend, xinc;
int ystart, yend, yinc; int ystart, yend, yinc;
if (state->m_vidregs_old[2] == 0x0001) /* Double Buffered */ if (m_vidregs_old[2] == 0x0001) /* Double Buffered */
{ {
source += (state->m_spriteram.bytes() / 2) / 2; source += (m_spriteram.bytes() / 2) / 2;
finish += (state->m_spriteram.bytes() / 2) / 2; finish += (m_spriteram.bytes() / 2) / 2;
} }
else if (state->m_vidregs_old[2]) /* I suppose it's possible that there is 4 banks, haven't seen it used though */ else if (m_vidregs_old[2]) /* I suppose it's possible that there is 4 banks, haven't seen it used though */
{ {
logerror("Spritebank != 0/1\n"); logerror("Spritebank != 0/1\n");
} }
@ -94,11 +93,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if (y & 0x200) y-=0x400; if (y & 0x200) y-=0x400;
#if 0 // For Flipscreen/Cocktail #if 0 // For Flipscreen/Cocktail
if(state->m_vidregs[0] & 0x8000) if(m_vidregs[0] & 0x8000)
{ {
flipx = !flipx; flipx = !flipx;
} }
if(state->m_vidregs[1] & 0x8000) if(m_vidregs[1] & 0x8000)
{ {
flipy = !flipy; flipy = !flipy;
} }
@ -118,7 +117,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if ((drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y)) if ((drawypos >= cliprect.min_y) && (drawypos <= cliprect.max_y))
{ {
destline = &bitmap.pix16(drawypos); destline = &bitmap.pix16(drawypos);
priline = &machine.priority_bitmap.pix8(drawypos); priline = &machine().priority_bitmap.pix8(drawypos);
for (xcnt = xstart; xcnt != xend; xcnt += xinc) for (xcnt = xstart; xcnt != xend; xcnt += xinc)
{ {
@ -152,7 +151,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
} }
} }
static void mcatadv_draw_tilemap_part( UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap_t* current_tilemap, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mcatadv_state::mcatadv_draw_tilemap_part( UINT16* current_scroll, UINT16* current_videoram1, int i, tilemap_t* current_tilemap, bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
int flip; int flip;
UINT32 drawline; UINT32 drawline;
@ -240,7 +239,7 @@ UINT32 mcatadv_state::screen_update_mcatadv(screen_device &screen, bitmap_ind16
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
if (!machine().input().code_pressed(KEYCODE_E)) if (!machine().input().code_pressed(KEYCODE_E))
#endif #endif
draw_sprites (machine(), bitmap, cliprect); draw_sprites (bitmap, cliprect);
g_profiler.stop(); g_profiler.stop();
return 0; return 0;
} }

View File

@ -130,13 +130,13 @@ VIDEO_START_MEMBER(mcr_state,mcr)
* *
*************************************/ *************************************/
static void mcr_set_color(running_machine &machine, int index, int data) void mcr_state::mcr_set_color(int index, int data)
{ {
palette_set_color_rgb(machine, index, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3)); palette_set_color_rgb(machine(), index, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3));
} }
static void journey_set_color(running_machine &machine, int index, int data) void mcr_state::journey_set_color(int index, int data)
{ {
/* 3 bits each, RGB */ /* 3 bits each, RGB */
int r = (data >> 6) & 7; int r = (data >> 6) & 7;
@ -149,7 +149,7 @@ static void journey_set_color(running_machine &machine, int index, int data)
b = (b << 5) | (b << 1); b = (b << 5) | (b << 1);
/* set the BG color */ /* set the BG color */
palette_set_color(machine, index, MAKE_RGB(r, g, b)); palette_set_color(machine(), index, MAKE_RGB(r, g, b));
/* if this is an odd entry in the upper palette bank, the hardware */ /* if this is an odd entry in the upper palette bank, the hardware */
/* hard-codes a low 1 bit -- this is used for better grayscales */ /* hard-codes a low 1 bit -- this is used for better grayscales */
@ -161,7 +161,7 @@ static void journey_set_color(running_machine &machine, int index, int data)
} }
/* set the FG color */ /* set the FG color */
palette_set_color(machine, index + 64, MAKE_RGB(r, g, b)); palette_set_color(machine(), index + 64, MAKE_RGB(r, g, b));
} }
@ -169,7 +169,7 @@ WRITE8_MEMBER(mcr_state::mcr_91490_paletteram_w)
{ {
m_generic_paletteram_8[offset] = data; m_generic_paletteram_8[offset] = data;
offset &= 0x7f; offset &= 0x7f;
mcr_set_color(machine(), (offset / 2) & 0x3f, data | ((offset & 1) << 8)); mcr_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8));
} }
@ -198,9 +198,9 @@ WRITE8_MEMBER(mcr_state::mcr_90010_videoram_w)
if ((offset & 0x780) == 0x780) if ((offset & 0x780) == 0x780)
{ {
if (mcr_cpu_board != 91475) if (mcr_cpu_board != 91475)
mcr_set_color(machine(), (offset / 2) & 0x3f, data | ((offset & 1) << 8)); mcr_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8));
else else
journey_set_color(machine(), (offset / 2) & 0x3f, data | ((offset & 1) << 8)); journey_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8));
} }
} }
@ -224,7 +224,7 @@ WRITE8_MEMBER(mcr_state::twotiger_videoram_w)
/* palette RAM is mapped into the upper 0x80 bytes here */ /* palette RAM is mapped into the upper 0x80 bytes here */
if ((effoffs & 0x780) == 0x780) if ((effoffs & 0x780) == 0x780)
mcr_set_color(machine(), ((offset & 0x400) >> 5) | ((offset >> 1) & 0x1f), data | ((offset & 1) << 8)); mcr_set_color(((offset & 0x400) >> 5) | ((offset >> 1) & 0x1f), data | ((offset & 1) << 8));
} }
@ -247,15 +247,14 @@ WRITE8_MEMBER(mcr_state::mcr_91490_videoram_w)
* *
*************************************/ *************************************/
static void render_sprites_91399(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void mcr_state::render_sprites_91399(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
mcr_state *state = machine.driver_data<mcr_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram; gfx_element *gfx = machine().gfx[1];
gfx_element *gfx = machine.gfx[1];
int offs; int offs;
/* render the sprites into the bitmap, ORing together */ /* render the sprites into the bitmap, ORing together */
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{ {
int code, x, y, sx, sy, hflip, vflip; int code, x, y, sx, sy, hflip, vflip;
@ -287,7 +286,7 @@ static void render_sprites_91399(running_machine &machine, bitmap_ind16 &bitmap,
{ {
const UINT8 *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); const UINT8 *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip);
UINT16 *dst = &bitmap.pix16(sy); UINT16 *dst = &bitmap.pix16(sy);
UINT8 *pri = &machine.priority_bitmap.pix8(sy); UINT8 *pri = &machine().priority_bitmap.pix8(sy);
/* loop over columns */ /* loop over columns */
for (x = 0; x < 32; x++) for (x = 0; x < 32; x++)
@ -320,15 +319,14 @@ static void render_sprites_91399(running_machine &machine, bitmap_ind16 &bitmap,
* *
*************************************/ *************************************/
static void render_sprites_91464(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int sprmask, int colormask) void mcr_state::render_sprites_91464(bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int sprmask, int colormask)
{ {
mcr_state *state = machine.driver_data<mcr_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram; gfx_element *gfx = machine().gfx[1];
gfx_element *gfx = machine.gfx[1];
int offs; int offs;
/* render the sprites into the bitmap, working from topmost to bottommost */ /* render the sprites into the bitmap, working from topmost to bottommost */
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{ {
int code, color, x, y, sx, sy, hflip, vflip; int code, color, x, y, sx, sy, hflip, vflip;
@ -359,7 +357,7 @@ static void render_sprites_91464(running_machine &machine, bitmap_ind16 &bitmap,
{ {
const UINT8 *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip); const UINT8 *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip);
UINT16 *dst = &bitmap.pix16(sy); UINT16 *dst = &bitmap.pix16(sy);
UINT8 *pri = &machine.priority_bitmap.pix8(sy); UINT8 *pri = &machine().priority_bitmap.pix8(sy);
/* loop over columns */ /* loop over columns */
for (x = 0; x < 32; x++) for (x = 0; x < 32; x++)
@ -411,18 +409,18 @@ UINT32 mcr_state::screen_update_mcr(screen_device &screen, bitmap_ind16 &bitmap,
switch (mcr_sprite_board) switch (mcr_sprite_board)
{ {
case 91399: case 91399:
render_sprites_91399(machine(), bitmap, cliprect); render_sprites_91399(bitmap, cliprect);
break; break;
case 91464: case 91464:
if (mcr_cpu_board == 91442) if (mcr_cpu_board == 91442)
render_sprites_91464(machine(), bitmap, cliprect, 0x00, 0x30, 0x00); render_sprites_91464(bitmap, cliprect, 0x00, 0x30, 0x00);
else if (mcr_cpu_board == 91475) else if (mcr_cpu_board == 91475)
render_sprites_91464(machine(), bitmap, cliprect, 0x00, 0x30, 0x40); render_sprites_91464(bitmap, cliprect, 0x00, 0x30, 0x40);
else if (mcr_cpu_board == 91490) else if (mcr_cpu_board == 91490)
render_sprites_91464(machine(), bitmap, cliprect, 0x00, 0x30, 0x00); render_sprites_91464(bitmap, cliprect, 0x00, 0x30, 0x00);
else if (mcr_cpu_board == 91721) else if (mcr_cpu_board == 91721)
render_sprites_91464(machine(), bitmap, cliprect, 0x00, 0x30, 0x00); render_sprites_91464(bitmap, cliprect, 0x00, 0x30, 0x00);
break; break;
} }
return 0; return 0;

View File

@ -194,16 +194,15 @@ WRITE8_MEMBER(mcr3_state::spyhunt_scroll_value_w)
* *
*************************************/ *************************************/
static void mcr3_update_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int code_xor, int dx, int dy) void mcr3_state::mcr3_update_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int code_xor, int dx, int dy)
{ {
mcr3_state *state = machine.driver_data<mcr3_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
machine.priority_bitmap.fill(1, cliprect); machine().priority_bitmap.fill(1, cliprect);
/* loop over sprite RAM */ /* loop over sprite RAM */
for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4) for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{ {
int code, color, flipx, flipy, sx, sy, flags; int code, color, flipx, flipy, sx, sy, flags;
@ -241,22 +240,22 @@ static void mcr3_update_sprites(running_machine &machine, bitmap_ind16 &bitmap,
if (!mcr_cocktail_flip) if (!mcr_cocktail_flip)
{ {
/* first draw the sprite, visible */ /* first draw the sprite, visible */
pdrawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, pdrawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy,
machine.priority_bitmap, 0x00, 0x0101); machine().priority_bitmap, 0x00, 0x0101);
/* then draw the mask, behind the background but obscuring following sprites */ /* then draw the mask, behind the background but obscuring following sprites */
pdrawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, sx, sy, pdrawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy,
machine.priority_bitmap, 0x02, 0xfeff); machine().priority_bitmap, 0x02, 0xfeff);
} }
else else
{ {
/* first draw the sprite, visible */ /* first draw the sprite, visible */
pdrawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, !flipx, !flipy, 480 - sx, 452 - sy, pdrawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, !flipx, !flipy, 480 - sx, 452 - sy,
machine.priority_bitmap, 0x00, 0x0101); machine().priority_bitmap, 0x00, 0x0101);
/* then draw the mask, behind the background but obscuring following sprites */ /* then draw the mask, behind the background but obscuring following sprites */
pdrawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, !flipx, !flipy, 480 - sx, 452 - sy, pdrawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, !flipx, !flipy, 480 - sx, 452 - sy,
machine.priority_bitmap, 0x02, 0xfeff); machine().priority_bitmap, 0x02, 0xfeff);
} }
} }
} }
@ -278,7 +277,7 @@ UINT32 mcr3_state::screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitma
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the sprites */ /* draw the sprites */
mcr3_update_sprites(machine(), bitmap, cliprect, 0x03, 0, 0, 0); mcr3_update_sprites(bitmap, cliprect, 0x03, 0, 0, 0);
return 0; return 0;
} }
@ -292,7 +291,7 @@ UINT32 mcr3_state::screen_update_spyhunt(screen_device &screen, bitmap_ind16 &bi
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the sprites */ /* draw the sprites */
mcr3_update_sprites(machine(), bitmap, cliprect, m_spyhunt_sprite_color_mask, 0, -12, 0); mcr3_update_sprites(bitmap, cliprect, m_spyhunt_sprite_color_mask, 0, -12, 0);
/* render any characters on top */ /* render any characters on top */
m_alpha_tilemap->draw(bitmap, cliprect, 0, 0); m_alpha_tilemap->draw(bitmap, cliprect, 0, 0);

View File

@ -195,22 +195,21 @@ WRITE16_MEMBER(mcr68_state::zwackery_spriteram_w)
* *
*************************************/ *************************************/
static void mcr68_update_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) void mcr68_state::mcr68_update_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
{ {
mcr68_state *state = machine.driver_data<mcr68_state>(); rectangle sprite_clip = machine().primary_screen->visible_area();
rectangle sprite_clip = machine.primary_screen->visible_area(); UINT16 *spriteram = m_spriteram;
UINT16 *spriteram = state->m_spriteram;
int offs; int offs;
/* adjust for clipping */ /* adjust for clipping */
sprite_clip.min_x += state->m_sprite_clip; sprite_clip.min_x += m_sprite_clip;
sprite_clip.max_x -= state->m_sprite_clip; sprite_clip.max_x -= m_sprite_clip;
sprite_clip &= cliprect; sprite_clip &= cliprect;
machine.priority_bitmap.fill(1, sprite_clip); machine().priority_bitmap.fill(1, sprite_clip);
/* loop over sprite RAM */ /* loop over sprite RAM */
for (offs = state->m_spriteram.bytes() / 2 - 4;offs >= 0;offs -= 4) for (offs = m_spriteram.bytes() / 2 - 4;offs >= 0;offs -= 4)
{ {
int code, color, flipx, flipy, x, y, flags; int code, color, flipx, flipy, x, y, flags;
@ -229,7 +228,7 @@ static void mcr68_update_sprites(running_machine &machine, bitmap_ind16 &bitmap,
color = ~flags & 0x03; color = ~flags & 0x03;
flipx = flags & 0x10; flipx = flags & 0x10;
flipy = flags & 0x20; flipy = flags & 0x20;
x = LOW_BYTE(spriteram[offs + 3]) * 2 + state->m_sprite_xoffset; x = LOW_BYTE(spriteram[offs + 3]) * 2 + m_sprite_xoffset;
y = (241 - LOW_BYTE(spriteram[offs])) * 2; y = (241 - LOW_BYTE(spriteram[offs])) * 2;
/* allow sprites to clip off the left side */ /* allow sprites to clip off the left side */
@ -239,26 +238,25 @@ static void mcr68_update_sprites(running_machine &machine, bitmap_ind16 &bitmap,
The color 8 is used to cover over other sprites. */ The color 8 is used to cover over other sprites. */
/* first draw the sprite, visible */ /* first draw the sprite, visible */
pdrawgfx_transmask(bitmap, sprite_clip, machine.gfx[1], code, color, flipx, flipy, x, y, pdrawgfx_transmask(bitmap, sprite_clip, machine().gfx[1], code, color, flipx, flipy, x, y,
machine.priority_bitmap, 0x00, 0x0101); machine().priority_bitmap, 0x00, 0x0101);
/* then draw the mask, behind the background but obscuring following sprites */ /* then draw the mask, behind the background but obscuring following sprites */
pdrawgfx_transmask(bitmap, sprite_clip, machine.gfx[1], code, color, flipx, flipy, x, y, pdrawgfx_transmask(bitmap, sprite_clip, machine().gfx[1], code, color, flipx, flipy, x, y,
machine.priority_bitmap, 0x02, 0xfeff); machine().priority_bitmap, 0x02, 0xfeff);
} }
} }
static void zwackery_update_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority) void mcr68_state::zwackery_update_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority)
{ {
mcr68_state *state = machine.driver_data<mcr68_state>(); UINT16 *spriteram = m_spriteram;
UINT16 *spriteram = state->m_spriteram;
int offs; int offs;
machine.priority_bitmap.fill(1, cliprect); machine().priority_bitmap.fill(1, cliprect);
/* loop over sprite RAM */ /* loop over sprite RAM */
for (offs = state->m_spriteram.bytes() / 2 - 4;offs >= 0;offs -= 4) for (offs = m_spriteram.bytes() / 2 - 4;offs >= 0;offs -= 4)
{ {
int code, color, flipx, flipy, x, y, flags; int code, color, flipx, flipy, x, y, flags;
@ -297,12 +295,12 @@ static void zwackery_update_sprites(running_machine &machine, bitmap_ind16 &bitm
The color 8 is used to cover over other sprites. */ The color 8 is used to cover over other sprites. */
/* first draw the sprite, visible */ /* first draw the sprite, visible */
pdrawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, x, y, pdrawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, x, y,
machine.priority_bitmap, 0x00, 0x0101); machine().priority_bitmap, 0x00, 0x0101);
/* then draw the mask, behind the background but obscuring following sprites */ /* then draw the mask, behind the background but obscuring following sprites */
pdrawgfx_transmask(bitmap, cliprect, machine.gfx[1], code, color, flipx, flipy, x, y, pdrawgfx_transmask(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, x, y,
machine.priority_bitmap, 0x02, 0xfeff); machine().priority_bitmap, 0x02, 0xfeff);
} }
} }
@ -320,13 +318,13 @@ UINT32 mcr68_state::screen_update_mcr68(screen_device &screen, bitmap_ind16 &bit
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES, 0);
/* draw the low-priority sprites */ /* draw the low-priority sprites */
mcr68_update_sprites(machine(), bitmap, cliprect, 0); mcr68_update_sprites(bitmap, cliprect, 0);
/* redraw tiles with priority over sprites */ /* redraw tiles with priority over sprites */
m_bg_tilemap->draw(bitmap, cliprect, 1, 0); m_bg_tilemap->draw(bitmap, cliprect, 1, 0);
/* draw the high-priority sprites */ /* draw the high-priority sprites */
mcr68_update_sprites(machine(), bitmap, cliprect, 1); mcr68_update_sprites(bitmap, cliprect, 1);
return 0; return 0;
} }
@ -337,12 +335,12 @@ UINT32 mcr68_state::screen_update_zwackery(screen_device &screen, bitmap_ind16 &
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
/* draw the low-priority sprites */ /* draw the low-priority sprites */
zwackery_update_sprites(machine(), bitmap, cliprect, 0); zwackery_update_sprites(bitmap, cliprect, 0);
/* redraw tiles with priority over sprites */ /* redraw tiles with priority over sprites */
m_fg_tilemap->draw(bitmap, cliprect, 1, 0); m_fg_tilemap->draw(bitmap, cliprect, 1, 0);
/* draw the high-priority sprites */ /* draw the high-priority sprites */
zwackery_update_sprites(machine(), bitmap, cliprect, 1); zwackery_update_sprites(bitmap, cliprect, 1);
return 0; return 0;
} }

View File

@ -74,10 +74,9 @@ WRITE8_MEMBER(meadows_state::meadows_spriteram_w)
* *
*************************************/ *************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &clip) void meadows_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip)
{ {
meadows_state *state = machine.driver_data<meadows_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int i; int i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -89,7 +88,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
int bank = i; /* that fixes it for now :-/ */ int bank = i; /* that fixes it for now :-/ */
int flip = spriteram[i+8] >> 5; /* bit #5 flip vertical flag */ int flip = spriteram[i+8] >> 5; /* bit #5 flip vertical flag */
drawgfx_transpen(bitmap, clip, machine.gfx[bank + 1], code, 0, flip, 0, x, y, 0); drawgfx_transpen(bitmap, clip, machine().gfx[bank + 1], code, 0, flip, 0, x, y, 0);
} }
} }
@ -108,6 +107,6 @@ UINT32 meadows_state::screen_update_meadows(screen_device &screen, bitmap_ind16
/* draw the sprites */ /* draw the sprites */
if (machine().gfx[1]) if (machine().gfx[1])
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -194,9 +194,6 @@ actual code sent to the hardware.
#include "emu.h" #include "emu.h"
#include "includes/megasys1.h" #include "includes/megasys1.h"
static void create_tilemaps(running_machine &machine);
#ifdef MAME_DEBUG #ifdef MAME_DEBUG
#define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\ #define SHOW_WRITE_ERROR(_format_,_offset_,_data_)\
@ -231,7 +228,7 @@ VIDEO_START_MEMBER(megasys1_state,megasys1)
m_buffer2_objectram = auto_alloc_array(machine(), UINT16, 0x2000); m_buffer2_objectram = auto_alloc_array(machine(), UINT16, 0x2000);
m_buffer2_spriteram16 = auto_alloc_array(machine(), UINT16, 0x2000); m_buffer2_spriteram16 = auto_alloc_array(machine(), UINT16, 0x2000);
create_tilemaps(machine()); create_tilemaps();
m_tmap[0] = m_tilemap[0][0][0]; m_tmap[0] = m_tilemap[0][0][0];
m_tmap[1] = m_tilemap[1][0][0]; m_tmap[1] = m_tilemap[1][0][0];
m_tmap[2] = m_tilemap[2][0][0]; m_tmap[2] = m_tilemap[2][0][0];
@ -290,29 +287,28 @@ VIDEO_START_MEMBER(megasys1_state,megasys1)
#define TILES_PER_PAGE_Y (0x20) #define TILES_PER_PAGE_Y (0x20)
#define TILES_PER_PAGE (TILES_PER_PAGE_X * TILES_PER_PAGE_Y) #define TILES_PER_PAGE (TILES_PER_PAGE_X * TILES_PER_PAGE_Y)
INLINE void scrollram_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int which) inline void megasys1_state::scrollram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int which)
{ {
megasys1_state *state = space.machine().driver_data<megasys1_state>(); COMBINE_DATA(&m_scrollram[which][offset]);
COMBINE_DATA(&state->m_scrollram[which][offset]); if (offset < 0x40000/2 && m_tmap[which])
if (offset < 0x40000/2 && state->m_tmap[which])
{ {
if (state->m_scroll_flag[which] & 0x10) /* tiles are 8x8 */ if (m_scroll_flag[which] & 0x10) /* tiles are 8x8 */
{ {
state->m_tmap[which]->mark_tile_dirty(offset ); m_tmap[which]->mark_tile_dirty(offset );
} }
else else
{ {
state->m_tmap[which]->mark_tile_dirty(offset*4 + 0); m_tmap[which]->mark_tile_dirty(offset*4 + 0);
state->m_tmap[which]->mark_tile_dirty(offset*4 + 1); m_tmap[which]->mark_tile_dirty(offset*4 + 1);
state->m_tmap[which]->mark_tile_dirty(offset*4 + 2); m_tmap[which]->mark_tile_dirty(offset*4 + 2);
state->m_tmap[which]->mark_tile_dirty(offset*4 + 3); m_tmap[which]->mark_tile_dirty(offset*4 + 3);
} }
} }
} }
WRITE16_MEMBER(megasys1_state::megasys1_scrollram_0_w){ scrollram_w(space, offset, data, mem_mask, 0); } WRITE16_MEMBER(megasys1_state::megasys1_scrollram_0_w){ scrollram_w(offset, data, mem_mask, 0); }
WRITE16_MEMBER(megasys1_state::megasys1_scrollram_1_w){ scrollram_w(space, offset, data, mem_mask, 1); } WRITE16_MEMBER(megasys1_state::megasys1_scrollram_1_w){ scrollram_w(offset, data, mem_mask, 1); }
WRITE16_MEMBER(megasys1_state::megasys1_scrollram_2_w){ scrollram_w(space, offset, data, mem_mask, 2); } WRITE16_MEMBER(megasys1_state::megasys1_scrollram_2_w){ scrollram_w(offset, data, mem_mask, 2); }
@ -362,38 +358,37 @@ TILE_GET_INFO_MEMBER(megasys1_state::megasys1_get_scroll_tile_info_16x16)
SET_TILE_INFO_MEMBER(tmap, (code & 0xfff) * m_16x16_scroll_factor[tmap] + (tile_index & 3), code >> (16 - m_bits_per_color_code), 0); SET_TILE_INFO_MEMBER(tmap, (code & 0xfff) * m_16x16_scroll_factor[tmap] + (tile_index & 3), code >> (16 - m_bits_per_color_code), 0);
} }
static void create_tilemaps(running_machine &machine) void megasys1_state::create_tilemaps()
{ {
megasys1_state *state = machine.driver_data<megasys1_state>();
int layer, i; int layer, i;
for (layer = 0; layer < 3; layer++) for (layer = 0; layer < 3; layer++)
{ {
/* 16x16 tilemaps */ /* 16x16 tilemaps */
state->m_tilemap[layer][0][0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),state), m_tilemap[layer][0][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),this),
8,8, TILES_PER_PAGE_X * 16, TILES_PER_PAGE_Y * 2); 8,8, TILES_PER_PAGE_X * 16, TILES_PER_PAGE_Y * 2);
state->m_tilemap[layer][0][1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),state), m_tilemap[layer][0][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),this),
8,8, TILES_PER_PAGE_X * 8, TILES_PER_PAGE_Y * 4); 8,8, TILES_PER_PAGE_X * 8, TILES_PER_PAGE_Y * 4);
state->m_tilemap[layer][0][2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),state), m_tilemap[layer][0][2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),this),
8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 8); 8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 8);
state->m_tilemap[layer][0][3] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),state), m_tilemap[layer][0][3] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_16x16),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_16x16),this),
8,8, TILES_PER_PAGE_X * 2, TILES_PER_PAGE_Y * 16); 8,8, TILES_PER_PAGE_X * 2, TILES_PER_PAGE_Y * 16);
/* 8x8 tilemaps */ /* 8x8 tilemaps */
state->m_tilemap[layer][1][0] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),state), m_tilemap[layer][1][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),this),
8,8, TILES_PER_PAGE_X * 8, TILES_PER_PAGE_Y * 1); 8,8, TILES_PER_PAGE_X * 8, TILES_PER_PAGE_Y * 1);
state->m_tilemap[layer][1][1] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),state), m_tilemap[layer][1][1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),this),
8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 2); 8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 2);
state->m_tilemap[layer][1][2] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),state), m_tilemap[layer][1][2] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),this),
8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 2); 8,8, TILES_PER_PAGE_X * 4, TILES_PER_PAGE_Y * 2);
state->m_tilemap[layer][1][3] = &machine.tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),state), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),state), m_tilemap[layer][1][3] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(megasys1_state::megasys1_get_scroll_tile_info_8x8),this), tilemap_mapper_delegate(FUNC(megasys1_state::megasys1_scan_8x8),this),
8,8, TILES_PER_PAGE_X * 2, TILES_PER_PAGE_Y * 4); 8,8, TILES_PER_PAGE_X * 2, TILES_PER_PAGE_Y * 4);
/* set user data and transparency */ /* set user data and transparency */
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
{ {
state->m_tilemap[layer][i/4][i%4]->set_user_data((void *)(FPTR)layer); m_tilemap[layer][i/4][i%4]->set_user_data((void *)(FPTR)layer);
state->m_tilemap[layer][i/4][i%4]->set_transparent_pen(15); m_tilemap[layer][i/4][i%4]->set_transparent_pen(15);
} }
} }
} }
@ -560,25 +555,24 @@ WRITE16_MEMBER(megasys1_state::megasys1_vregs_D_w)
0C Y position 0C Y position
0E Code */ 0E Code */
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void megasys1_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
megasys1_state *state = machine.driver_data<megasys1_state>();
int color,code,sx,sy,flipx,flipy,attr,sprite,offs,color_mask; int color,code,sx,sy,flipx,flipy,attr,sprite,offs,color_mask;
/* objram: 0x100*4 entries spritedata: 0x80 entries */ /* objram: 0x100*4 entries spritedata: 0x80 entries */
/* sprite order is from first in Sprite Data RAM (frontmost) to last */ /* sprite order is from first in Sprite Data RAM (frontmost) to last */
if (state->m_hardware_type_z == 0) /* standard sprite hardware */ if (m_hardware_type_z == 0) /* standard sprite hardware */
{ {
color_mask = (state->m_sprite_flag & 0x100) ? 0x07 : 0x0f; color_mask = (m_sprite_flag & 0x100) ? 0x07 : 0x0f;
for (offs = (0x800-8)/2;offs >= 0;offs -= 8/2) for (offs = (0x800-8)/2;offs >= 0;offs -= 8/2)
{ {
for (sprite = 0; sprite < 4 ; sprite ++) for (sprite = 0; sprite < 4 ; sprite ++)
{ {
UINT16 *objectdata = &state->m_buffer2_objectram[offs + (0x800/2) * sprite]; UINT16 *objectdata = &m_buffer2_objectram[offs + (0x800/2) * sprite];
UINT16 *spritedata = &state->m_buffer2_spriteram16[ (objectdata[ 0 ] & 0x7f) * 0x10/2]; UINT16 *spritedata = &m_buffer2_spriteram16[ (objectdata[ 0 ] & 0x7f) * 0x10/2];
attr = spritedata[ 8/2 ]; attr = spritedata[ 8/2 ];
if (((attr & 0xc0)>>6) != sprite) continue; // flipping if (((attr & 0xc0)>>6) != sprite) continue; // flipping
@ -593,7 +587,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
flipx = attr & 0x40; flipx = attr & 0x40;
flipy = attr & 0x80; flipy = attr & 0x80;
if (state->m_screen_flag & 1) if (m_screen_flag & 1)
{ {
flipx = !flipx; flipy = !flipy; flipx = !flipx; flipy = !flipy;
sx = 240-sx; sy = 240-sy; sx = 240-sx; sy = 240-sy;
@ -604,19 +598,19 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
color = (attr & color_mask); color = (attr & color_mask);
pdrawgfx_transpen(bitmap,cliprect, pdrawgfx_transpen(bitmap,cliprect,
machine.gfx[3], machine().gfx[3],
(code & 0xfff ) + ((state->m_sprite_bank & 1) << 12), (code & 0xfff ) + ((m_sprite_bank & 1) << 12),
color, color,
flipx, flipy, flipx, flipy,
sx, sy, sx, sy,
machine.priority_bitmap, machine().priority_bitmap,
(attr & 0x08) ? 0x0c : 0x0a,15); (attr & 0x08) ? 0x0c : 0x0a,15);
} /* sprite */ } /* sprite */
} /* offs */ } /* offs */
} /* non Z hw */ } /* non Z hw */
else else
{ {
UINT16 *spriteram16 = state->m_spriteram; UINT16 *spriteram16 = m_spriteram;
/* MS1-Z just draws Sprite Data, and in reverse order */ /* MS1-Z just draws Sprite Data, and in reverse order */
@ -638,19 +632,19 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
flipx = attr & 0x40; flipx = attr & 0x40;
flipy = attr & 0x80; flipy = attr & 0x80;
if (state->m_screen_flag & 1) if (m_screen_flag & 1)
{ {
flipx = !flipx; flipy = !flipy; flipx = !flipx; flipy = !flipy;
sx = 240-sx; sy = 240-sy; sx = 240-sx; sy = 240-sy;
} }
pdrawgfx_transpen(bitmap,cliprect, pdrawgfx_transpen(bitmap,cliprect,
machine.gfx[2], machine().gfx[2],
code, code,
color, color,
flipx, flipy, flipx, flipy,
sx, sy, sx, sy,
machine.priority_bitmap, machine().priority_bitmap,
(attr & 0x08) ? 0x0c : 0x0a,15); (attr & 0x08) ? 0x0c : 0x0a,15);
} /* sprite */ } /* sprite */
} /* Z hw */ } /* Z hw */
@ -1008,7 +1002,7 @@ UINT32 megasys1_state::screen_update_megasys1(screen_device &screen, bitmap_ind1
} }
if (active_layers & 0x08) if (active_layers & 0x08)
draw_sprites(machine(),bitmap,cliprect); draw_sprites(bitmap,cliprect);
return 0; return 0;
} }

View File

@ -178,16 +178,15 @@ void mermaid_state::video_start()
machine().primary_screen->register_screen_bitmap(m_helper2); machine().primary_screen->register_screen_bitmap(m_helper2);
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mermaid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
const rectangle spritevisiblearea(0 * 8, 26 * 8 - 1, 2 * 8, 30 * 8 - 1); const rectangle spritevisiblearea(0 * 8, 26 * 8 - 1, 2 * 8, 30 * 8 - 1);
const rectangle flip_spritevisiblearea(6 * 8, 31 * 8 - 1, 2 * 8, 30 * 8 - 1); const rectangle flip_spritevisiblearea(6 * 8, 31 * 8 - 1, 2 * 8, 30 * 8 - 1);
mermaid_state *state = machine.driver_data<mermaid_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 attr = spriteram[offs + 2]; int attr = spriteram[offs + 2];
int bank = (attr & 0x30) >> 4; int bank = (attr & 0x30) >> 4;
@ -200,23 +199,23 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
if (sx >= 0xf0) sx -= 256; if (sx >= 0xf0) sx -= 256;
code |= state->m_rougien_gfxbank1 * 0x2800; code |= m_rougien_gfxbank1 * 0x2800;
code |= state->m_rougien_gfxbank2 * 0x2400; code |= m_rougien_gfxbank2 * 0x2400;
if (state->flip_screen_x()) if (flip_screen_x())
{ {
flipx = !flipx; flipx = !flipx;
sx = 240 - sx; sx = 240 - sx;
} }
if (state->flip_screen_y()) if (flip_screen_y())
{ {
flipy = !flipy; flipy = !flipy;
sy = 240 - sy; sy = 240 - sy;
} }
drawgfx_transpen(bitmap, (state->flip_screen_x() ? flip_spritevisiblearea : spritevisiblearea), drawgfx_transpen(bitmap, (flip_screen_x() ? flip_spritevisiblearea : spritevisiblearea),
machine.gfx[1], code, color, flipx, flipy, sx, sy, 0); machine().gfx[1], code, color, flipx, flipy, sx, sy, 0);
} }
} }
@ -224,13 +223,12 @@ UINT32 mermaid_state::screen_update_mermaid(screen_device &screen, bitmap_ind16
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }
static UINT8 collision_check( running_machine &machine, rectangle& rect ) UINT8 mermaid_state::collision_check( rectangle& rect )
{ {
mermaid_state *state = machine.driver_data<mermaid_state>();
UINT8 data = 0; UINT8 data = 0;
int x; int x;
@ -239,8 +237,8 @@ static UINT8 collision_check( running_machine &machine, rectangle& rect )
for (y = rect.min_y; y <= rect.max_y; y++) for (y = rect.min_y; y <= rect.max_y; y++)
for (x = rect.min_x; x <= rect.max_x; x++) for (x = rect.min_x; x <= rect.max_x; x++)
{ {
UINT16 a = colortable_entry_get_value(machine.colortable, state->m_helper.pix16(y, x)) & 0x3f; UINT16 a = colortable_entry_get_value(machine().colortable, m_helper.pix16(y, x)) & 0x3f;
UINT16 b = colortable_entry_get_value(machine.colortable, state->m_helper2.pix16(y, x)) & 0x3f; UINT16 b = colortable_entry_get_value(machine().colortable, m_helper2.pix16(y, x)) & 0x3f;
if (b) if (b)
if (a) if (a)
@ -314,7 +312,7 @@ void mermaid_state::screen_eof_mermaid(screen_device &screen, bool state)
drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0); drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit2 |= collision_check(machine(), rect); m_coll_bit2 |= collision_check(rect);
// check collision sprite - foreground // check collision sprite - foreground
@ -325,7 +323,7 @@ void mermaid_state::screen_eof_mermaid(screen_device &screen, bool state)
drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0); drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit1 |= collision_check(machine(), rect); m_coll_bit1 |= collision_check(rect);
// check collision sprite - sprite // check collision sprite - sprite
@ -366,7 +364,7 @@ void mermaid_state::screen_eof_mermaid(screen_device &screen, bool state)
drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0); drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit0 |= collision_check(machine(), rect); m_coll_bit0 |= collision_check(rect);
} }
// check for bit 3 (sprite-sprite) // check for bit 3 (sprite-sprite)
@ -447,7 +445,7 @@ void mermaid_state::screen_eof_mermaid(screen_device &screen, bool state)
drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0); drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit3 |= collision_check(machine(), rect); m_coll_bit3 |= collision_check(rect);
} }
// check for bit 6 // check for bit 6
@ -528,7 +526,7 @@ void mermaid_state::screen_eof_mermaid(screen_device &screen, bool state)
drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0); drawgfx_transpen(m_helper2, rect, machine().gfx[1], code, 0, flipx, flipy, sx, sy, 0);
m_coll_bit6 |= collision_check(machine(), rect); m_coll_bit6 |= collision_check(rect);
} }
} }
} }

View File

@ -163,14 +163,13 @@ void metlclsh_state::video_start()
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void metlclsh_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
metlclsh_state *state = machine.driver_data<metlclsh_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram; gfx_element *gfx = machine().gfx[0];
gfx_element *gfx = machine.gfx[0];
int offs; int offs;
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{ {
int attr, code, color, sx, sy, flipx, flipy, wrapy, sizey; int attr, code, color, sx, sy, flipx, flipy, wrapy, sizey;
@ -190,7 +189,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
sy = 240 - spriteram[offs + 2]; sy = 240 - spriteram[offs + 2];
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; flipx = !flipx; sx = 240 - sx; flipx = !flipx;
sy = 240 - sy; flipy = !flipy; if (sizey) sy += 16; sy = 240 - sy; flipy = !flipy; if (sizey) sy += 16;
@ -244,7 +243,7 @@ UINT32 metlclsh_state::screen_update_metlclsh(screen_device &screen, bitmap_ind1
m_bg_tilemap->set_scrollx(0, m_scrollx[1] + ((m_scrollx[0] & 0x02) << 7) ); m_bg_tilemap->set_scrollx(0, m_scrollx[1] + ((m_scrollx[0] & 0x02) << 7) );
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
} }
draw_sprites(machine(), bitmap, cliprect); // sprites draw_sprites(bitmap, cliprect); // sprites
m_fg_tilemap->draw(bitmap, cliprect, 2, 0); // high priority tiles of foreground m_fg_tilemap->draw(bitmap, cliprect, 2, 0); // high priority tiles of foreground
// popmessage("%02X", m_scrollx[0]); // popmessage("%02X", m_scrollx[0]);

View File

@ -139,15 +139,14 @@ TILEMAP_MAPPER_MEMBER(metro_state::tilemap_scan_gstrik2)
/* This looks up a single pixel in a tile, given the tile code. /* This looks up a single pixel in a tile, given the tile code.
The Metro hardware has an indirection table, which is used here. The Metro hardware has an indirection table, which is used here.
Returns if to draw the pixel or not, pixel colour is placed in pix */ Returns if to draw the pixel or not, pixel colour is placed in pix */
INLINE UINT8 get_tile_pix( running_machine &machine, UINT16 code, UINT8 x, UINT8 y, int big, UINT16 *pix ) inline UINT8 metro_state::get_tile_pix( UINT16 code, UINT8 x, UINT8 y, int big, UINT16 *pix )
{ {
metro_state *state = machine.driver_data<metro_state>();
int table_index; int table_index;
UINT32 tile; UINT32 tile;
// Use code as an index into the tiles set table // Use code as an index into the tiles set table
table_index = ((code & 0x1ff0) >> 4) * 2; table_index = ((code & 0x1ff0) >> 4) * 2;
tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1]; tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
if (code & 0x8000) // Special: draw a tile of a single color (i.e. not from the gfx ROMs) if (code & 0x8000) // Special: draw a tile of a single color (i.e. not from the gfx ROMs)
{ {
@ -158,9 +157,9 @@ INLINE UINT8 get_tile_pix( running_machine &machine, UINT16 code, UINT8 x, UINT8
else else
return 0; return 0;
} }
else if (((tile & 0x00f00000) == 0x00f00000) && (state->m_support_8bpp)) /* draw tile as 8bpp (e.g. balcube bg) */ else if (((tile & 0x00f00000) == 0x00f00000) && (m_support_8bpp)) /* draw tile as 8bpp (e.g. balcube bg) */
{ {
gfx_element *gfx1 = machine.gfx[big?3:1]; gfx_element *gfx1 = machine().gfx[big?3:1];
UINT32 tile2 = big ? ((tile & 0xfffff) + 8*(code & 0xf)) : UINT32 tile2 = big ? ((tile & 0xfffff) + 8*(code & 0xf)) :
((tile & 0xfffff) + 2*(code & 0xf)); ((tile & 0xfffff) + 2*(code & 0xf));
const UINT8* data; const UINT8* data;
@ -192,7 +191,7 @@ INLINE UINT8 get_tile_pix( running_machine &machine, UINT16 code, UINT8 x, UINT8
} }
else else
{ {
gfx_element *gfx1 = machine.gfx[big?2:0]; gfx_element *gfx1 = machine().gfx[big?2:0];
UINT32 tile2 = big ? ((tile & 0xfffff) + 4*(code & 0xf)) : UINT32 tile2 = big ? ((tile & 0xfffff) + 4*(code & 0xf)) :
((tile & 0xfffff) + (code & 0xf)); ((tile & 0xfffff) + (code & 0xf));
const UINT8* data; const UINT8* data;
@ -228,14 +227,14 @@ INLINE UINT8 get_tile_pix( running_machine &machine, UINT16 code, UINT8 x, UINT8
} }
INLINE void metro_vram_w( running_machine &machine, offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram ) inline void metro_state::metro_vram_w( offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram )
{ {
COMBINE_DATA(&vram[offset]); COMBINE_DATA(&vram[offset]);
} }
WRITE16_MEMBER(metro_state::metro_vram_0_w){ metro_vram_w(machine(), offset, data, mem_mask, 0, m_vram_0); } WRITE16_MEMBER(metro_state::metro_vram_0_w){ metro_vram_w(offset, data, mem_mask, 0, m_vram_0); }
WRITE16_MEMBER(metro_state::metro_vram_1_w){ metro_vram_w(machine(), offset, data, mem_mask, 1, m_vram_1); } WRITE16_MEMBER(metro_state::metro_vram_1_w){ metro_vram_w(offset, data, mem_mask, 1, m_vram_1); }
WRITE16_MEMBER(metro_state::metro_vram_2_w){ metro_vram_w(machine(), offset, data, mem_mask, 2, m_vram_2); } WRITE16_MEMBER(metro_state::metro_vram_2_w){ metro_vram_w(offset, data, mem_mask, 2, m_vram_2); }
@ -408,20 +407,19 @@ VIDEO_START_MEMBER(metro_state,gstrik2)
***************************************************************************/ ***************************************************************************/
void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void metro_state::metro_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
metro_state *state = machine.driver_data<metro_state>(); UINT8 *base_gfx4 = m_expanded_gfx1;
UINT8 *base_gfx4 = state->m_expanded_gfx1; UINT8 *base_gfx8 = memregion("gfx1")->base();
UINT8 *base_gfx8 = state->memregion("gfx1")->base(); UINT32 gfx_size = memregion("gfx1")->bytes();
UINT32 gfx_size = state->memregion("gfx1")->bytes();
int max_x = machine.primary_screen->width(); int max_x = machine().primary_screen->width();
int max_y = machine.primary_screen->height(); int max_y = machine().primary_screen->height();
int max_sprites = state->m_spriteram.bytes() / 8; int max_sprites = m_spriteram.bytes() / 8;
int sprites = state->m_videoregs[0x00/2] % max_sprites; int sprites = m_videoregs[0x00/2] % max_sprites;
int color_start = (state->m_videoregs[0x08/2] & 0x0f) << 4; int color_start = (m_videoregs[0x08/2] & 0x0f) << 4;
int i, j, pri; int i, j, pri;
static const int primask[4] = { 0x0000, 0xff00, 0xff00 | 0xf0f0, 0xff00 | 0xf0f0 | 0xcccc }; static const int primask[4] = { 0x0000, 0xff00, 0xff00 | 0xf0f0, 0xff00 | 0xf0f0 | 0xcccc };
@ -434,12 +432,12 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
for (i = 0; i < 0x20; i++) for (i = 0; i < 0x20; i++)
{ {
if (!(state->m_videoregs[0x02/2] & 0x8000)) if (!(m_videoregs[0x02/2] & 0x8000))
{ {
src = state->m_spriteram + (sprites - 1) * (8 / 2); src = m_spriteram + (sprites - 1) * (8 / 2);
inc = -(8 / 2); inc = -(8 / 2);
} else { } else {
src = state->m_spriteram; src = m_spriteram;
inc = (8 / 2); inc = (8 / 2);
} }
@ -467,12 +465,12 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
continue; continue;
} }
pri = (state->m_videoregs[0x02/2] & 0x0300) >> 8; pri = (m_videoregs[0x02/2] & 0x0300) >> 8;
if (!(state->m_videoregs[0x02/2] & 0x8000)) if (!(m_videoregs[0x02/2] & 0x8000))
{ {
if (curr_pri > (state->m_videoregs[0x02/2] & 0x1f)) if (curr_pri > (m_videoregs[0x02/2] & 0x1f))
pri = (state->m_videoregs[0x02/2] & 0x0c00) >> 10; pri = (m_videoregs[0x02/2] & 0x0c00) >> 10;
} }
y = src[1]; y = src[1];
@ -485,27 +483,27 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8); zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8);
x = (x & 0x07ff) - state->m_sprite_xoffs; x = (x & 0x07ff) - m_sprite_xoffs;
y = (y & 0x03ff) - state->m_sprite_yoffs; y = (y & 0x03ff) - m_sprite_yoffs;
width = (((attr >> 11) & 0x7) + 1) * 8; width = (((attr >> 11) & 0x7) + 1) * 8;
height = (((attr >> 8) & 0x7) + 1) * 8; height = (((attr >> 8) & 0x7) + 1) * 8;
UINT32 gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code); UINT32 gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code);
if (state->m_flip_screen) if (m_flip_screen)
{ {
flipx = !flipx; x = max_x - x - width; flipx = !flipx; x = max_x - x - width;
flipy = !flipy; y = max_y - y - height; flipy = !flipy; y = max_y - y - height;
} }
if (state->m_support_8bpp && color == 0xf) /* 8bpp */ if (m_support_8bpp && color == 0xf) /* 8bpp */
{ {
/* Bounds checking */ /* Bounds checking */
if ((gfxstart + width * height - 1) >= gfx_size) if ((gfxstart + width * height - 1) >= gfx_size)
continue; continue;
gfx_element gfx(machine, base_gfx8 + gfxstart, width, height, width, 0, 256); gfx_element gfx(machine(), base_gfx8 + gfxstart, width, height, width, 0, 256);
pdrawgfxzoom_transpen( bitmap,cliprect, &gfx, pdrawgfxzoom_transpen( bitmap,cliprect, &gfx,
0, 0,
@ -513,7 +511,7 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
flipx, flipy, flipx, flipy,
x, y, x, y,
zoom, zoom, zoom, zoom,
machine.priority_bitmap,primask[pri], 255); machine().priority_bitmap,primask[pri], 255);
} }
else else
{ {
@ -521,7 +519,7 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
if ((gfxstart + width / 2 * height - 1) >= gfx_size) if ((gfxstart + width / 2 * height - 1) >= gfx_size)
continue; continue;
gfx_element gfx(machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16); gfx_element gfx(machine(), base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
pdrawgfxzoom_transpen( bitmap,cliprect, &gfx, pdrawgfxzoom_transpen( bitmap,cliprect, &gfx,
0, 0,
@ -529,7 +527,7 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
flipx, flipy, flipx, flipy,
x, y, x, y,
zoom, zoom, zoom, zoom,
machine.priority_bitmap,primask[pri], 15); machine().priority_bitmap,primask[pri], 15);
} }
#if 0 #if 0
{ /* Display priority + zoom on each sprite */ { /* Display priority + zoom on each sprite */
@ -555,13 +553,12 @@ void metro_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const r
// Copy a 'window' from the large 2048x2048 (or 4096x4096 for 16x16 tiles) tilemap // Copy a 'window' from the large 2048x2048 (or 4096x4096 for 16x16 tiles) tilemap
static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 pcode, void metro_state::draw_tilemap( bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 flags, UINT32 pcode,
int sx, int sy, int wx, int wy, int big, UINT16 *tilemapram, int layer ) int sx, int sy, int wx, int wy, int big, UINT16 *tilemapram, int layer )
{ {
metro_state *state = machine.driver_data<metro_state>();
int y; int y;
bitmap_ind8 &priority_bitmap = machine.priority_bitmap; bitmap_ind8 &priority_bitmap = machine().priority_bitmap;
int width = big ? 4096 : 2048; int width = big ? 4096 : 2048;
int height = big ? 4096 : 2048; int height = big ? 4096 : 2048;
@ -572,7 +569,7 @@ static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const
int windowwidth = width >> 2; int windowwidth = width >> 2;
int windowheight = height >> 3; int windowheight = height >> 3;
sx += state->m_tilemap_scrolldx[layer] * (state->m_flip_screen ? 1 : -1); sx += m_tilemap_scrolldx[layer] * (m_flip_screen ? 1 : -1);
for (y = 0; y < scrheight; y++) for (y = 0; y < scrheight; y++)
{ {
@ -583,7 +580,7 @@ static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const
int srcline = (wy+scrolly)&(height-1); int srcline = (wy+scrolly)&(height-1);
int srctilerow = srcline >> (big ? 4 : 3); int srctilerow = srcline >> (big ? 4 : 3);
if (!state->m_flip_screen) if (!m_flip_screen)
{ {
dst = &bitmap.pix16(y); dst = &bitmap.pix16(y);
priority_baseaddr = &priority_bitmap.pix8(y); priority_baseaddr = &priority_bitmap.pix8(y);
@ -598,7 +595,7 @@ static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const
UINT16 dat = 0; UINT16 dat = 0;
UINT16 tile = tilemapram[tileoffs]; UINT16 tile = tilemapram[tileoffs];
UINT8 draw = get_tile_pix(machine, tile, big ? (srccol&0xf) : (srccol&0x7), big ? (srcline&0xf) : (srcline&0x7), big, &dat); UINT8 draw = get_tile_pix(tile, big ? (srccol&0xf) : (srccol&0x7), big ? (srcline&0xf) : (srcline&0x7), big, &dat);
if (draw) if (draw)
{ {
@ -622,7 +619,7 @@ static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const
UINT16 dat = 0; UINT16 dat = 0;
UINT16 tile = tilemapram[tileoffs]; UINT16 tile = tilemapram[tileoffs];
UINT8 draw = get_tile_pix(machine, tile, big ? (srccol&0xf) : (srccol&0x7), big ? (srcline&0xf) : (srcline&0x7), big, &dat); UINT8 draw = get_tile_pix(tile, big ? (srccol&0xf) : (srccol&0x7), big ? (srcline&0xf) : (srcline&0x7), big, &dat);
if (draw) if (draw)
{ {
@ -636,10 +633,9 @@ static void draw_tilemap( running_machine &machine, bitmap_ind16 &bitmap, const
// Draw all the layers that match the given priority // Draw all the layers that match the given priority
static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl ) void metro_state::draw_layers( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl )
{ {
metro_state *state = machine.driver_data<metro_state>(); UINT16 layers_pri = m_videoregs[0x10 / 2];
UINT16 layers_pri = state->m_videoregs[0x10 / 2];
int layer; int layer;
// Draw all the layers with priority == pri // Draw all the layers with priority == pri
@ -648,8 +644,8 @@ static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const r
if (pri == ((layers_pri >> (layer * 2)) & 3)) if (pri == ((layers_pri >> (layer * 2)) & 3))
{ {
// Scroll and Window values // Scroll and Window values
UINT16 sy = state->m_scroll[layer * 2 + 0]; UINT16 sx = state->m_scroll[layer * 2 + 1]; UINT16 sy = m_scroll[layer * 2 + 0]; UINT16 sx = m_scroll[layer * 2 + 1];
UINT16 wy = state->m_window[layer * 2 + 0]; UINT16 wx = state->m_window[layer * 2 + 1]; UINT16 wy = m_window[layer * 2 + 0]; UINT16 wx = m_window[layer * 2 + 1];
if (BIT(layers_ctrl, layer)) // for debug if (BIT(layers_ctrl, layer)) // for debug
{ {
@ -657,14 +653,14 @@ static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const r
switch (layer) switch (layer)
{ {
case 0: tilemapram = state->m_vram_0; break; case 0: tilemapram = m_vram_0; break;
case 1: tilemapram = state->m_vram_1; break; case 1: tilemapram = m_vram_1; break;
case 2: tilemapram = state->m_vram_2; break; case 2: tilemapram = m_vram_2; break;
} }
int big = state->m_support_16x16 && (*state->m_screenctrl & (0x0020 << layer)); int big = m_support_16x16 && (*m_screenctrl & (0x0020 << layer));
draw_tilemap(machine, bitmap, cliprect, 0, 1 << (3 - pri), sx, sy, wx, wy, big, tilemapram, layer); draw_tilemap(bitmap, cliprect, 0, 1 << (3 - pri), sx, sy, wx, wy, big, tilemapram, layer);
} }
} }
} }
@ -723,10 +719,10 @@ if (machine().input().code_pressed(KEYCODE_Z))
k053936_zoom_draw(m_k053936, bitmap, cliprect, m_k053936_tilemap, 0, 0, 1); k053936_zoom_draw(m_k053936, bitmap, cliprect, m_k053936_tilemap, 0, 0, 1);
for (pri = 3; pri >= 0; pri--) for (pri = 3; pri >= 0; pri--)
draw_layers(machine(), bitmap, cliprect, pri, layers_ctrl); draw_layers(bitmap, cliprect, pri, layers_ctrl);
if (layers_ctrl & 0x08) if (layers_ctrl & 0x08)
metro_draw_sprites(machine(), bitmap, cliprect); metro_draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -138,30 +138,29 @@ void mikie_state::video_start()
m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(mikie_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(mikie_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
} }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) void mikie_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
mikie_state *state = machine.driver_data<mikie_state>(); UINT8 *spriteram = m_spriteram;
UINT8 *spriteram = state->m_spriteram;
int offs; int offs;
for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
{ {
int gfxbank = (spriteram[offs + 2] & 0x40) ? 2 : 1; int gfxbank = (spriteram[offs + 2] & 0x40) ? 2 : 1;
int code = (spriteram[offs + 2] & 0x3f) + ((spriteram[offs + 2] & 0x80) >> 1) + ((spriteram[offs] & 0x40) << 1); int code = (spriteram[offs + 2] & 0x3f) + ((spriteram[offs + 2] & 0x80) >> 1) + ((spriteram[offs] & 0x40) << 1);
int color = (spriteram[offs] & 0x0f) + 16 * state->m_palettebank; int color = (spriteram[offs] & 0x0f) + 16 * m_palettebank;
int sx = spriteram[offs + 3]; int sx = spriteram[offs + 3];
int sy = 244 - spriteram[offs + 1]; int sy = 244 - spriteram[offs + 1];
int flipx = ~spriteram[offs] & 0x10; int flipx = ~spriteram[offs] & 0x10;
int flipy = spriteram[offs] & 0x20; int flipy = spriteram[offs] & 0x20;
if (state->flip_screen()) if (flip_screen())
{ {
sy = 242 - sy; sy = 242 - sy;
flipy = !flipy; flipy = !flipy;
} }
drawgfx_transpen(bitmap, cliprect, drawgfx_transpen(bitmap, cliprect,
machine.gfx[gfxbank], machine().gfx[gfxbank],
code, color, code, color,
flipx,flipy, flipx,flipy,
sx,sy, 0); sx,sy, 0);
@ -171,7 +170,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
UINT32 mikie_state::screen_update_mikie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 mikie_state::screen_update_mikie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(0), 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(0), 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1), 0); m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_CATEGORY(1), 0);
return 0; return 0;
} }

View File

@ -270,30 +270,29 @@ READ8_MEMBER(mitchell_state::mgakuen_paletteram_r)
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mitchell_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
mitchell_state *state = machine.driver_data<mitchell_state>();
int offs, sx, sy; int offs, sx, sy;
/* the last entry is not a sprite, we skip it otherwise spang shows a bubble */ /* the last entry is not a sprite, we skip it otherwise spang shows a bubble */
/* moving diagonally across the screen */ /* moving diagonally across the screen */
for (offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20) for (offs = 0x1000 - 0x40; offs >= 0; offs -= 0x20)
{ {
int code = state->m_objram[offs]; int code = m_objram[offs];
int attr = state->m_objram[offs + 1]; int attr = m_objram[offs + 1];
int color = attr & 0x0f; int color = attr & 0x0f;
sx = state->m_objram[offs + 3] + ((attr & 0x10) << 4); sx = m_objram[offs + 3] + ((attr & 0x10) << 4);
sy = ((state->m_objram[offs + 2] + 8) & 0xff) - 8; sy = ((m_objram[offs + 2] + 8) & 0xff) - 8;
code += (attr & 0xe0) << 3; code += (attr & 0xe0) << 3;
if (state->m_flipscreen) if (m_flipscreen)
{ {
sx = 496 - sx; sx = 496 - sx;
sy = 240 - sy; sy = 240 - sy;
} }
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
color, color,
state->m_flipscreen, state->m_flipscreen, m_flipscreen, m_flipscreen,
sx,sy,15); sx,sy,15);
} }
} }
@ -302,6 +301,6 @@ UINT32 mitchell_state::screen_update_pang(screen_device &screen, bitmap_ind16 &b
{ {
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); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -81,12 +81,11 @@ WRITE8_MEMBER(mjkjidai_state::mjkjidai_ctrl_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect) void mjkjidai_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
{ {
mjkjidai_state *state = machine.driver_data<mjkjidai_state>(); UINT8 *spriteram = m_spriteram1;
UINT8 *spriteram = state->m_spriteram1; UINT8 *spriteram_2 = m_spriteram2;
UINT8 *spriteram_2 = state->m_spriteram2; UINT8 *spriteram_3 = m_spriteram3;
UINT8 *spriteram_3 = state->m_spriteram3;
int offs; int offs;
for (offs = 0x20-2;offs >= 0;offs -= 2) for (offs = 0x20-2;offs >= 0;offs -= 2)
@ -102,7 +101,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
sx += (spriteram_2[offs] & 0x20) >> 5; // not sure about this sx += (spriteram_2[offs] & 0x20) >> 5; // not sure about this
if (state->flip_screen()) if (flip_screen())
{ {
sx = 496 - sx; sx = 496 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -113,7 +112,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const re
sx += 16; sx += 16;
sy += 1; sy += 1;
drawgfx_transpen(bitmap,cliprect,machine.gfx[1], drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
code, code,
color, color,
flipx,flipy, flipx,flipy,
@ -130,7 +129,7 @@ UINT32 mjkjidai_state::screen_update_mjkjidai(screen_device &screen, bitmap_ind1
else else
{ {
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

@ -66,12 +66,12 @@ WRITE8_MEMBER(momoko_state::momoko_flipscreen_w)
/****************************************************************************/ /****************************************************************************/
static void momoko_draw_bg_pri( running_machine &machine, bitmap_ind16 &bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri ) void momoko_state::momoko_draw_bg_pri( bitmap_ind16 &bitmap, int chr, int col, int flipx, int flipy, int x, int y, int pri )
{ {
int xx, sx, sy, px, py, dot; int xx, sx, sy, px, py, dot;
UINT32 gfxadr; UINT32 gfxadr;
UINT8 d0, d1; UINT8 d0, d1;
UINT8 *BG_GFX = machine.root_device().memregion("gfx2")->base(); UINT8 *BG_GFX = machine().root_device().memregion("gfx2")->base();
for (sy = 0; sy < 8; sy++) for (sy = 0; sy < 8; sy++)
{ {
@ -210,7 +210,7 @@ UINT32 momoko_state::screen_update_momoko(screen_device &screen, bitmap_ind16 &b
{ {
col = col & 0x0f; col = col & 0x0f;
chr = chr + m_bg_select * 512; chr = chr + m_bg_select * 512;
momoko_draw_bg_pri(machine(), bitmap, chr, col, flip, flip, px, py, pri); momoko_draw_bg_pri(bitmap, chr, col, flip, flip, px, py, pri);
} }
} }
} }

View File

@ -233,17 +233,16 @@ WRITE8_MEMBER(mrdo_state::mrdo_flipscreen_w)
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect ) void mrdo_state::draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
{ {
mrdo_state *state = machine.driver_data<mrdo_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)
{ {
if (spriteram[offs + 1] != 0) if (spriteram[offs + 1] != 0)
{ {
drawgfx_transpen(bitmap, cliprect, machine.gfx[2], drawgfx_transpen(bitmap, cliprect, machine().gfx[2],
spriteram[offs], spriteram[offs + 2] & 0x0f, spriteram[offs], spriteram[offs + 2] & 0x0f,
spriteram[offs + 2] & 0x10, spriteram[offs + 2] & 0x20, spriteram[offs + 2] & 0x10, spriteram[offs + 2] & 0x20,
spriteram[offs + 3], 256 - spriteram[offs + 1], 0); spriteram[offs + 3], 256 - spriteram[offs + 1], 0);
@ -256,6 +255,6 @@ UINT32 mrdo_state::screen_update_mrdo(screen_device &screen, bitmap_ind16 &bitma
bitmap.fill(0, cliprect); bitmap.fill(0, cliprect);
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -39,13 +39,12 @@ WRITE8_MEMBER(mrflea_state::mrflea_spriteram_w)
m_spriteram[offset] = data; m_spriteram[offset] = data;
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mrflea_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
mrflea_state *state = machine.driver_data<mrflea_state>(); gfx_element *gfx = machine().gfx[0];
gfx_element *gfx = machine.gfx[0]; const UINT8 *source = m_spriteram;
const UINT8 *source = state->m_spriteram;
const UINT8 *finish = source + 0x100; const UINT8 *finish = source + 0x100;
rectangle clip = machine.primary_screen->visible_area(); rectangle clip = machine().primary_screen->visible_area();
clip.max_x -= 24; clip.max_x -= 24;
clip.min_x += 16; clip.min_x += 16;
@ -70,18 +69,17 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
} }
} }
static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mrflea_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
mrflea_state *state = machine.driver_data<mrflea_state>(); const UINT8 *source = m_videoram;
const UINT8 *source = state->m_videoram; gfx_element *gfx = machine().gfx[1];
gfx_element *gfx = machine.gfx[1];
int sx, sy; int sx, sy;
int base = 0; int base = 0;
if (BIT(state->m_gfx_bank, 2)) if (BIT(m_gfx_bank, 2))
base |= 0x400; base |= 0x400;
if (BIT(state->m_gfx_bank, 4)) if (BIT(m_gfx_bank, 4))
base |= 0x200; base |= 0x200;
for (sy = 0; sy < 256; sy += 8) for (sy = 0; sy < 256; sy += 8)
@ -102,7 +100,7 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con
UINT32 mrflea_state::screen_update_mrflea(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 mrflea_state::screen_update_mrflea(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
draw_background(machine(), bitmap, cliprect); draw_background(bitmap, cliprect);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -107,9 +107,8 @@ void mrjong_state::video_start()
/* /*
Note: First 0x40 entries in the videoram are actually spriteram Note: First 0x40 entries in the videoram are actually spriteram
*/ */
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mrjong_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
mrjong_state *state = machine.driver_data<mrjong_state>();
int offs; int offs;
for (offs = (0x40 - 4); offs >= 0; offs -= 4) for (offs = (0x40 - 4); offs >= 0; offs -= 4)
@ -119,14 +118,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int sx, sy; int sx, sy;
int flipx, flipy; int flipx, flipy;
sprt = (((state->m_videoram[offs + 1] >> 2) & 0x3f) | ((state->m_videoram[offs + 3] & 0x20) << 1)); sprt = (((m_videoram[offs + 1] >> 2) & 0x3f) | ((m_videoram[offs + 3] & 0x20) << 1));
flipx = (state->m_videoram[offs + 1] & 0x01) >> 0; flipx = (m_videoram[offs + 1] & 0x01) >> 0;
flipy = (state->m_videoram[offs + 1] & 0x02) >> 1; flipy = (m_videoram[offs + 1] & 0x02) >> 1;
color = (state->m_videoram[offs + 3] & 0x1f); color = (m_videoram[offs + 3] & 0x1f);
sx = 224 - state->m_videoram[offs + 2]; sx = 224 - m_videoram[offs + 2];
sy = state->m_videoram[offs + 0]; sy = m_videoram[offs + 0];
if (state->flip_screen()) if (flip_screen())
{ {
sx = 208 - sx; sx = 208 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -134,7 +133,7 @@ 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],
sprt, sprt,
color, color,
flipx, flipy, flipx, flipy,
@ -145,6 +144,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
UINT32 mrjong_state::screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 mrjong_state::screen_update_mrjong(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

@ -119,9 +119,8 @@ VIDEO_START_MEMBER(ms32_state,f1superb)
/********** PALETTE WRITES **********/ /********** PALETTE WRITES **********/
static void update_color(running_machine &machine, int color) void ms32_state::update_color(int color)
{ {
ms32_state *state = machine.driver_data<ms32_state>();
int r,g,b; int r,g,b;
/* I'm not sure how the brightness should be applied, currently I'm only /* I'm not sure how the brightness should be applied, currently I'm only
@ -130,18 +129,18 @@ static void update_color(running_machine &machine, int color)
*/ */
if (~color & 0x4000) if (~color & 0x4000)
{ {
r = ((state->m_palram_16[color*2] & 0xff00) >>8 ) * state->m_brt_r / 0x100; r = ((m_palram_16[color*2] & 0xff00) >>8 ) * m_brt_r / 0x100;
g = ((state->m_palram_16[color*2] & 0x00ff) >>0 ) * state->m_brt_g / 0x100; g = ((m_palram_16[color*2] & 0x00ff) >>0 ) * m_brt_g / 0x100;
b = ((state->m_palram_16[color*2+1] & 0x00ff) >>0 ) * state->m_brt_b / 0x100; b = ((m_palram_16[color*2+1] & 0x00ff) >>0 ) * m_brt_b / 0x100;
} }
else else
{ {
r = ((state->m_palram_16[color*2] & 0xff00) >>8 ); r = ((m_palram_16[color*2] & 0xff00) >>8 );
g = ((state->m_palram_16[color*2] & 0x00ff) >>0 ); g = ((m_palram_16[color*2] & 0x00ff) >>0 );
b = ((state->m_palram_16[color*2+1] & 0x00ff) >>0 ); b = ((m_palram_16[color*2+1] & 0x00ff) >>0 );
} }
palette_set_color(machine,color,MAKE_RGB(r,g,b)); palette_set_color(machine(),color,MAKE_RGB(r,g,b));
} }
WRITE32_MEMBER(ms32_state::ms32_brightness_w) WRITE32_MEMBER(ms32_state::ms32_brightness_w)
@ -194,14 +193,14 @@ WRITE32_MEMBER(ms32_state::ms32_gfxctrl_w)
/* SPRITES based on tetrisp2 for now, readd priority bits later */ /* SPRITES based on tetrisp2 for now, readd priority bits later */
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_pri, const rectangle &cliprect, UINT16 *sprram_top, size_t sprram_size, int gfxnum, int reverseorder) void ms32_state::draw_sprites(bitmap_ind16 &bitmap, bitmap_ind8 &bitmap_pri, const rectangle &cliprect, UINT16 *sprram_top, size_t sprram_size, int gfxnum, int reverseorder)
{ {
int tx, ty, sx, sy, flipx, flipy; int tx, ty, sx, sy, flipx, flipy;
int xsize, ysize; int xsize, ysize;
int code, attr, color, size; int code, attr, color, size;
int pri; int pri;
int xzoom, yzoom; int xzoom, yzoom;
gfx_element *gfx = machine.gfx[gfxnum]; gfx_element *gfx = machine().gfx[gfxnum];
UINT16 *source = sprram_top; UINT16 *source = sprram_top;
UINT16 *finish = sprram_top + (sprram_size - 0x10) / 2; UINT16 *finish = sprram_top + (sprram_size - 0x10) / 2;
@ -264,12 +263,11 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, bitmap_
} }
static void draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect,int priority) void ms32_state::draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect,int priority)
{ {
ms32_state *state = machine.driver_data<ms32_state>();
/* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */ /* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */
if (state->m_roz_ctrl[0x5c/4] & 1) /* "super" mode */ if (m_roz_ctrl[0x5c/4] & 1) /* "super" mode */
{ {
rectangle my_clip; rectangle my_clip;
int y,maxy; int y,maxy;
@ -282,21 +280,21 @@ static void draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const recta
while (y <= maxy) while (y <= maxy)
{ {
UINT16 *lineaddr = state->m_lineram_16 + 8 * (y & 0xff); UINT16 *lineaddr = m_lineram_16 + 8 * (y & 0xff);
int start2x = (lineaddr[0x00/4] & 0xffff) | ((lineaddr[0x04/4] & 3) << 16); int start2x = (lineaddr[0x00/4] & 0xffff) | ((lineaddr[0x04/4] & 3) << 16);
int start2y = (lineaddr[0x08/4] & 0xffff) | ((lineaddr[0x0c/4] & 3) << 16); int start2y = (lineaddr[0x08/4] & 0xffff) | ((lineaddr[0x0c/4] & 3) << 16);
int incxx = (lineaddr[0x10/4] & 0xffff) | ((lineaddr[0x14/4] & 1) << 16); int incxx = (lineaddr[0x10/4] & 0xffff) | ((lineaddr[0x14/4] & 1) << 16);
int incxy = (lineaddr[0x18/4] & 0xffff) | ((lineaddr[0x1c/4] & 1) << 16); int incxy = (lineaddr[0x18/4] & 0xffff) | ((lineaddr[0x1c/4] & 1) << 16);
int startx = (state->m_roz_ctrl[0x00/4] & 0xffff) | ((state->m_roz_ctrl[0x04/4] & 3) << 16); int startx = (m_roz_ctrl[0x00/4] & 0xffff) | ((m_roz_ctrl[0x04/4] & 3) << 16);
int starty = (state->m_roz_ctrl[0x08/4] & 0xffff) | ((state->m_roz_ctrl[0x0c/4] & 3) << 16); int starty = (m_roz_ctrl[0x08/4] & 0xffff) | ((m_roz_ctrl[0x0c/4] & 3) << 16);
int offsx = state->m_roz_ctrl[0x30/4]; int offsx = m_roz_ctrl[0x30/4];
int offsy = state->m_roz_ctrl[0x34/4]; int offsy = m_roz_ctrl[0x34/4];
my_clip.min_y = my_clip.max_y = y; my_clip.min_y = my_clip.max_y = y;
offsx += (state->m_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1... offsx += (m_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1...
offsy += (state->m_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1... offsy += (m_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1...
/* extend sign */ /* extend sign */
if (start2x & 0x20000) start2x |= ~0x3ffff; if (start2x & 0x20000) start2x |= ~0x3ffff;
@ -306,7 +304,7 @@ static void draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const recta
if (incxx & 0x10000) incxx |= ~0x1ffff; if (incxx & 0x10000) incxx |= ~0x1ffff;
if (incxy & 0x10000) incxy |= ~0x1ffff; if (incxy & 0x10000) incxy |= ~0x1ffff;
state->m_roz_tilemap->draw_roz(bitmap, my_clip, m_roz_tilemap->draw_roz(bitmap, my_clip,
(start2x+startx+offsx)<<16, (start2y+starty+offsy)<<16, (start2x+startx+offsx)<<16, (start2y+starty+offsy)<<16,
incxx<<8, incxy<<8, 0, 0, incxx<<8, incxy<<8, 0, 0,
1, // Wrap 1, // Wrap
@ -317,17 +315,17 @@ static void draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const recta
} }
else /* "simple" mode */ else /* "simple" mode */
{ {
int startx = (state->m_roz_ctrl[0x00/4] & 0xffff) | ((state->m_roz_ctrl[0x04/4] & 3) << 16); int startx = (m_roz_ctrl[0x00/4] & 0xffff) | ((m_roz_ctrl[0x04/4] & 3) << 16);
int starty = (state->m_roz_ctrl[0x08/4] & 0xffff) | ((state->m_roz_ctrl[0x0c/4] & 3) << 16); int starty = (m_roz_ctrl[0x08/4] & 0xffff) | ((m_roz_ctrl[0x0c/4] & 3) << 16);
int incxx = (state->m_roz_ctrl[0x10/4] & 0xffff) | ((state->m_roz_ctrl[0x14/4] & 1) << 16); int incxx = (m_roz_ctrl[0x10/4] & 0xffff) | ((m_roz_ctrl[0x14/4] & 1) << 16);
int incxy = (state->m_roz_ctrl[0x18/4] & 0xffff) | ((state->m_roz_ctrl[0x1c/4] & 1) << 16); int incxy = (m_roz_ctrl[0x18/4] & 0xffff) | ((m_roz_ctrl[0x1c/4] & 1) << 16);
int incyy = (state->m_roz_ctrl[0x20/4] & 0xffff) | ((state->m_roz_ctrl[0x24/4] & 1) << 16); int incyy = (m_roz_ctrl[0x20/4] & 0xffff) | ((m_roz_ctrl[0x24/4] & 1) << 16);
int incyx = (state->m_roz_ctrl[0x28/4] & 0xffff) | ((state->m_roz_ctrl[0x2c/4] & 1) << 16); int incyx = (m_roz_ctrl[0x28/4] & 0xffff) | ((m_roz_ctrl[0x2c/4] & 1) << 16);
int offsx = state->m_roz_ctrl[0x30/4]; int offsx = m_roz_ctrl[0x30/4];
int offsy = state->m_roz_ctrl[0x34/4]; int offsy = m_roz_ctrl[0x34/4];
offsx += (state->m_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1... offsx += (m_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1...
offsy += (state->m_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1... offsy += (m_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1...
/* extend sign */ /* extend sign */
if (startx & 0x20000) startx |= ~0x3ffff; if (startx & 0x20000) startx |= ~0x3ffff;
@ -337,7 +335,7 @@ static void draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const recta
if (incyy & 0x10000) incyy |= ~0x1ffff; if (incyy & 0x10000) incyy |= ~0x1ffff;
if (incyx & 0x10000) incyx |= ~0x1ffff; if (incyx & 0x10000) incyx |= ~0x1ffff;
state->m_roz_tilemap->draw_roz(bitmap, cliprect, m_roz_tilemap->draw_roz(bitmap, cliprect,
(startx+offsx)<<16, (starty+offsy)<<16, (startx+offsx)<<16, (starty+offsy)<<16,
incxx<<8, incxy<<8, incyx<<8, incyy<<8, incxx<<8, incxy<<8, incyx<<8, incyy<<8,
1, // Wrap 1, // Wrap
@ -365,7 +363,7 @@ UINT32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitma
int i; int i;
for (i = 0;i < 0x10000;i++) // colors 0x3000-0x3fff are not used for (i = 0;i < 0x10000;i++) // colors 0x3000-0x3fff are not used
update_color(machine(), i); update_color(i);
scrollx = m_tx_scroll[0x00/4] + m_tx_scroll[0x08/4] + 0x18; scrollx = m_tx_scroll[0x00/4] + m_tx_scroll[0x08/4] + 0x18;
scrolly = m_tx_scroll[0x0c/4] + m_tx_scroll[0x14/4]; scrolly = m_tx_scroll[0x0c/4] + m_tx_scroll[0x14/4];
@ -392,7 +390,7 @@ UINT32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitma
m_temp_bitmap_sprites.fill(0, cliprect); m_temp_bitmap_sprites.fill(0, cliprect);
m_temp_bitmap_sprites_pri.fill(0, cliprect); m_temp_bitmap_sprites_pri.fill(0, cliprect);
draw_sprites(machine(), m_temp_bitmap_sprites, m_temp_bitmap_sprites_pri, cliprect, m_sprram_16, 0x20000, 0, m_reverse_sprite_order); draw_sprites(m_temp_bitmap_sprites, m_temp_bitmap_sprites_pri, cliprect, m_sprram_16, 0x20000, 0, m_reverse_sprite_order);
@ -415,7 +413,7 @@ UINT32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitma
rot_pri++; rot_pri++;
if (rot_pri == 0) if (rot_pri == 0)
draw_roz(machine(), m_temp_bitmap_tilemaps, cliprect, 1 << 1); draw_roz(m_temp_bitmap_tilemaps, cliprect, 1 << 1);
else if (scr_pri == 0) else if (scr_pri == 0)
if (m_tilemaplayoutcontrol&1) if (m_tilemaplayoutcontrol&1)
{ {
@ -429,7 +427,7 @@ UINT32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitma
m_tx_tilemap->draw(m_temp_bitmap_tilemaps, cliprect, 0, 1 << 2); m_tx_tilemap->draw(m_temp_bitmap_tilemaps, cliprect, 0, 1 << 2);
if (rot_pri == 1) if (rot_pri == 1)
draw_roz(machine(), m_temp_bitmap_tilemaps, cliprect, 1 << 1); draw_roz(m_temp_bitmap_tilemaps, cliprect, 1 << 1);
else if (scr_pri == 1) else if (scr_pri == 1)
if (m_tilemaplayoutcontrol&1) if (m_tilemaplayoutcontrol&1)
{ {
@ -443,7 +441,7 @@ UINT32 ms32_state::screen_update_ms32(screen_device &screen, bitmap_rgb32 &bitma
m_tx_tilemap->draw(m_temp_bitmap_tilemaps, cliprect, 0, 1 << 2); m_tx_tilemap->draw(m_temp_bitmap_tilemaps, cliprect, 0, 1 << 2);
if (rot_pri == 2) if (rot_pri == 2)
draw_roz(machine(), m_temp_bitmap_tilemaps, cliprect, 1 << 1); draw_roz(m_temp_bitmap_tilemaps, cliprect, 1 << 1);
else if (scr_pri == 2) else if (scr_pri == 2)
if (m_tilemaplayoutcontrol&1) if (m_tilemaplayoutcontrol&1)
{ {

View File

@ -147,11 +147,10 @@ WRITE8_MEMBER(msisaac_state::msisaac_fg_videoram_w)
Display refresh Display refresh
***************************************************************************/ ***************************************************************************/
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void msisaac_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
msisaac_state *state = machine.driver_data<msisaac_state>(); const UINT8 *source = m_spriteram + 32 * 4 - 4;
const UINT8 *source = state->m_spriteram + 32 * 4 - 4; const UINT8 *finish = m_spriteram; /* ? */
const UINT8 *finish = state->m_spriteram; /* ? */
while (source >= finish) while (source >= finish)
{ {
@ -164,12 +163,12 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
int flipx = (attributes & 0x1); int flipx = (attributes & 0x1);
int flipy = (attributes & 0x2); int flipy = (attributes & 0x2);
gfx_element *gfx = machine.gfx[2]; gfx_element *gfx = machine().gfx[2];
if (attributes & 4) if (attributes & 4)
{ {
//color = rand() & 15; //color = rand() & 15;
gfx = machine.gfx[3]; gfx = machine().gfx[3];
} }
if (attributes & 8) /* double size sprite */ if (attributes & 8) /* double size sprite */
@ -234,7 +233,7 @@ UINT32 msisaac_state::screen_update_msisaac(screen_device &screen, bitmap_ind16
{ {
m_bg_tilemap->draw(bitmap, cliprect, 0, 0); m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
m_bg2_tilemap->draw(bitmap, cliprect, 0, 0); m_bg2_tilemap->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
m_fg_tilemap->draw(bitmap, cliprect, 0, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
return 0; return 0;
} }

View File

@ -3,7 +3,7 @@
#include "emu.h" #include "emu.h"
#include "includes/mugsmash.h" #include "includes/mugsmash.h"
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mugsmash_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
/* Each Sprite takes 16 bytes, 5 used? */ /* Each Sprite takes 16 bytes, 5 used? */
@ -24,10 +24,9 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
*/ */
mugsmash_state *state = machine.driver_data<mugsmash_state>(); const UINT16 *source = m_spriteram;
const UINT16 *source = state->m_spriteram;
const UINT16 *finish = source + 0x2000; const UINT16 *finish = source + 0x2000;
gfx_element *gfx = machine.gfx[0]; gfx_element *gfx = machine().gfx[0];
while (source < finish) while (source < finish)
{ {
@ -142,6 +141,6 @@ UINT32 mugsmash_state::screen_update_mugsmash(screen_device &screen, bitmap_ind1
{ {
m_tilemap2->draw(bitmap, cliprect, 0, 0); m_tilemap2->draw(bitmap, cliprect, 0, 0);
m_tilemap1->draw(bitmap, cliprect, 0, 0); m_tilemap1->draw(bitmap, cliprect, 0, 0);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -46,16 +46,15 @@ void munchmo_state::video_start()
m_tmpbitmap = auto_bitmap_ind16_alloc(machine(), 512, 512); m_tmpbitmap = auto_bitmap_ind16_alloc(machine(), 512, 512);
} }
static void draw_status( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void munchmo_state::draw_status( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
munchmo_state *state = machine.driver_data<munchmo_state>(); gfx_element *gfx = machine().gfx[0];
gfx_element *gfx = machine.gfx[0];
int row; int row;
for (row = 0; row < 4; row++) for (row = 0; row < 4; row++)
{ {
int sy, sx = (row & 1) * 8; int sy, sx = (row & 1) * 8;
const UINT8 *source = state->m_status_vram + (~row & 1) * 32; const UINT8 *source = m_status_vram + (~row & 1) * 32;
if (row <= 1) if (row <= 1)
{ {
source += 2 * 32; source += 2 * 32;
@ -74,31 +73,30 @@ static void draw_status( running_machine &machine, bitmap_ind16 &bitmap, const r
} }
} }
static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void munchmo_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
/* /*
ROM B1.2C contains 256 tilemaps defining 4x4 configurations of ROM B1.2C contains 256 tilemaps defining 4x4 configurations of
the tiles in ROM B2.2B the tiles in ROM B2.2B
*/ */
munchmo_state *state = machine.driver_data<munchmo_state>(); UINT8 *rom = memregion("gfx2")->base();
UINT8 *rom = state->memregion("gfx2")->base(); gfx_element *gfx = machine().gfx[1];
gfx_element *gfx = machine.gfx[1];
int offs; int offs;
for (offs = 0; offs < 0x100; offs++) for (offs = 0; offs < 0x100; offs++)
{ {
int sy = (offs % 16) * 32; int sy = (offs % 16) * 32;
int sx = (offs / 16) * 32; int sx = (offs / 16) * 32;
int tile_number = state->m_videoram[offs]; int tile_number = m_videoram[offs];
int row, col; int row, col;
for (row = 0; row < 4; row++) for (row = 0; row < 4; row++)
{ {
for (col = 0; col < 4; col++) for (col = 0; col < 4; col++)
{ {
drawgfx_opaque(*state->m_tmpbitmap, state->m_tmpbitmap->cliprect(), gfx, drawgfx_opaque(*m_tmpbitmap, m_tmpbitmap->cliprect(), gfx,
rom[col + tile_number * 4 + row * 0x400], rom[col + tile_number * 4 + row * 0x400],
state->m_palette_bank, m_palette_bank,
0,0, /* flip */ 0,0, /* flip */
sx + col * 8, sy + row * 8 ); sx + col * 8, sy + row * 8 );
} }
@ -106,32 +104,31 @@ static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, con
} }
{ {
int scrollx = -(state->m_vreg[6] *2 + (state->m_vreg[7] >> 7)) - 64 - 128 - 16; int scrollx = -(m_vreg[6] *2 + (m_vreg[7] >> 7)) - 64 - 128 - 16;
int scrolly = 0; int scrolly = 0;
copyscrollbitmap(bitmap, *state->m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect); copyscrollbitmap(bitmap, *m_tmpbitmap, 1, &scrollx, 1, &scrolly, cliprect);
} }
} }
static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void munchmo_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
munchmo_state *state = machine.driver_data<munchmo_state>(); int scroll = m_vreg[6];
int scroll = state->m_vreg[6]; int flags = m_vreg[7]; /* XB?????? */
int flags = state->m_vreg[7]; /* XB?????? */
int xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0); int xadjust = - 128 - 16 - ((flags & 0x80) ? 1 : 0);
int bank = (flags & 0x40) ? 1 : 0; int bank = (flags & 0x40) ? 1 : 0;
gfx_element *gfx = machine.gfx[2 + bank]; gfx_element *gfx = machine().gfx[2 + bank];
int color_base = state->m_palette_bank * 4 + 3; int color_base = m_palette_bank * 4 + 3;
int i, j; int i, j;
int firstsprite = state->m_vreg[4] & 0x3f; int firstsprite = m_vreg[4] & 0x3f;
for (i = firstsprite; i < firstsprite + 0x40; i++) for (i = firstsprite; i < firstsprite + 0x40; i++)
{ {
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
{ {
int offs = (j << 6) | (i & 0x3f); int offs = (j << 6) | (i & 0x3f);
int tile_number = state->m_sprite_tile[offs]; /* ETTTTTTT */ int tile_number = m_sprite_tile[offs]; /* ETTTTTTT */
int attributes = state->m_sprite_attr[offs]; /* XYYYYYCC */ int attributes = m_sprite_attr[offs]; /* XYYYYYCC */
int sx = state->m_sprite_xpos[offs]; /* XXXXXXX? */ int sx = m_sprite_xpos[offs]; /* XXXXXXX? */
int sy = (offs >> 6) << 5; /* Y YY------ */ int sy = (offs >> 6) << 5; /* Y YY------ */
sy += (attributes >> 2) & 0x1f; sy += (attributes >> 2) & 0x1f;
if( attributes & 0x80 ) if( attributes & 0x80 )
@ -150,8 +147,8 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const
UINT32 munchmo_state::screen_update_mnchmobl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 munchmo_state::screen_update_mnchmobl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{ {
draw_background(machine(), bitmap, cliprect); draw_background(bitmap, cliprect);
draw_sprites(machine(), bitmap, cliprect); draw_sprites(bitmap, cliprect);
draw_status(machine(), bitmap, cliprect); draw_status(bitmap, cliprect);
return 0; return 0;
} }

View File

@ -96,16 +96,15 @@ void mustache_state::video_start()
m_bg_tilemap->set_scroll_rows(4); m_bg_tilemap->set_scroll_rows(4);
} }
static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) void mustache_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect )
{ {
mustache_state *state = machine.driver_data<mustache_state>();
rectangle clip = cliprect; rectangle clip = cliprect;
gfx_element *gfx = machine.gfx[1]; gfx_element *gfx = machine().gfx[1];
const rectangle &visarea = machine.primary_screen->visible_area(); const rectangle &visarea = machine().primary_screen->visible_area();
UINT8 *spriteram = state->m_spriteram; UINT8 *spriteram = m_spriteram;
int offs; int offs;
for (offs = 0;offs < state->m_spriteram.bytes();offs += 4) for (offs = 0;offs < m_spriteram.bytes();offs += 4)
{ {
int sy = 240-spriteram[offs]; int sy = 240-spriteram[offs];
int sx = 240-spriteram[offs+3]; int sx = 240-spriteram[offs+3];
@ -117,15 +116,15 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
code+=(attr&0x0c)<<6; code+=(attr&0x0c)<<6;
if ((state->m_control_byte & 0xa)) if ((m_control_byte & 0xa))
clip.max_y = visarea.max_y; clip.max_y = visarea.max_y;
else else
if (state->flip_screen()) if (flip_screen())
clip.min_y = visarea.min_y + 56; clip.min_y = visarea.min_y + 56;
else else
clip.max_y = visarea.max_y - 56; clip.max_y = visarea.max_y - 56;
if (state->flip_screen()) if (flip_screen())
{ {
sx = 240 - sx; sx = 240 - sx;
sy = 240 - sy; sy = 240 - sy;
@ -134,7 +133,7 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
drawgfx_transpen(bitmap,clip,gfx, drawgfx_transpen(bitmap,clip,gfx,
code, code,
color, color,
state->flip_screen(),state->flip_screen(), flip_screen(),flip_screen(),
sx,sy,0); sx,sy,0);
} }
} }
@ -142,6 +141,6 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r
UINT32 mustache_state::screen_update_mustache(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) UINT32 mustache_state::screen_update_mustache(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;
} }

Some files were not shown because too many files have changed in this diff Show More