From e5011691fdbd979d360b9b8ee82cc9ec8f434095 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 8 Feb 2013 07:43:09 +0000 Subject: [PATCH] Modernization of drivers part 4 (no whatsnew) --- src/mame/drivers/equites.c | 45 +++++----- src/mame/drivers/esd16.c | 4 +- src/mame/drivers/exidy.c | 20 ++--- src/mame/drivers/exidy440.c | 19 ++-- src/mame/drivers/exprraid.c | 12 +-- src/mame/includes/epos.h | 1 + src/mame/includes/eprom.h | 1 + src/mame/includes/equites.h | 7 ++ src/mame/includes/esd16.h | 1 + src/mame/includes/espial.h | 1 + src/mame/includes/exedexes.h | 1 + src/mame/includes/exerion.h | 1 + src/mame/includes/exidy.h | 8 ++ src/mame/includes/exidy440.h | 2 + src/mame/includes/exprraid.h | 2 + src/mame/video/epos.c | 8 +- src/mame/video/eprom.c | 13 ++- src/mame/video/equites.c | 67 +++++++------- src/mame/video/espial.c | 33 ++++--- src/mame/video/exedexes.c | 15 ++-- src/mame/video/exerion.c | 43 +++++---- src/mame/video/exidy.c | 164 +++++++++++++++++------------------ src/mame/video/exidy440.c | 29 +++---- src/mame/video/exprraid.c | 23 +++-- 24 files changed, 261 insertions(+), 259 deletions(-) diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index 8a3fe6dc2dd..4b6a4e394ca 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -534,9 +534,8 @@ WRITE8_MEMBER(equites_state::equites_cymbal_ctrl_w) } -static void equites_update_dac( running_machine &machine ) +void equites_state::equites_update_dac( ) { - equites_state *state = machine.driver_data(); // there is only one latch, which is used to drive two DAC channels. // When the channel is enabled in the 4066, it goes to a series of @@ -544,23 +543,23 @@ static void equites_update_dac( running_machine &machine ) // then it's disabled again. // Note that PB0 goes through three filters while PB1 only goes through one. - if (state->m_eq8155_port_b & 1) - state->m_dac_1->write_signed8(state->m_dac_latch); + if (m_eq8155_port_b & 1) + m_dac_1->write_signed8(m_dac_latch); - if (state->m_eq8155_port_b & 2) - state->m_dac_2->write_signed8(state->m_dac_latch); + if (m_eq8155_port_b & 2) + m_dac_2->write_signed8(m_dac_latch); } WRITE8_MEMBER(equites_state::equites_dac_latch_w) { m_dac_latch = data << 2; - equites_update_dac(machine()); + equites_update_dac(); } WRITE8_MEMBER(equites_state::equites_8155_portb_w) { m_eq8155_port_b = data; - equites_update_dac(machine()); + equites_update_dac(); } WRITE_LINE_MEMBER(equites_state::equites_msm5232_gate) @@ -1847,9 +1846,9 @@ ROM_END /******************************************************************************/ // Initializations -static void unpack_block( running_machine &machine, const char *region, int offset, int size ) +void equites_state::unpack_block( const char *region, int offset, int size ) { - UINT8 *rom = machine.root_device().memregion(region)->base(); + UINT8 *rom = machine().root_device().memregion(region)->base(); int i; for (i = 0; i < size; ++i) @@ -1859,35 +1858,35 @@ static void unpack_block( running_machine &machine, const char *region, int offs } } -static void unpack_region( running_machine &machine, const char *region ) +void equites_state::unpack_region( const char *region ) { - unpack_block(machine, region, 0x0000, 0x2000); - unpack_block(machine, region, 0x4000, 0x2000); + unpack_block(region, 0x0000, 0x2000); + unpack_block(region, 0x4000, 0x2000); } DRIVER_INIT_MEMBER(equites_state,equites) { - unpack_region(machine(), "gfx2"); - unpack_region(machine(), "gfx3"); + unpack_region("gfx2"); + unpack_region("gfx3"); } DRIVER_INIT_MEMBER(equites_state,bullfgtr) { - unpack_region(machine(), "gfx2"); - unpack_region(machine(), "gfx3"); + unpack_region("gfx2"); + unpack_region("gfx3"); } DRIVER_INIT_MEMBER(equites_state,kouyakyu) { - unpack_region(machine(), "gfx2"); - unpack_region(machine(), "gfx3"); + unpack_region("gfx2"); + unpack_region("gfx3"); } DRIVER_INIT_MEMBER(equites_state,gekisou) { - unpack_region(machine(), "gfx2"); - unpack_region(machine(), "gfx3"); + unpack_region("gfx2"); + unpack_region("gfx3"); // install special handlers for unknown device (protection?) machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x580000, 0x580001, write16_delegate(FUNC(equites_state::gekisou_unknown_0_w),this)); @@ -1896,12 +1895,12 @@ DRIVER_INIT_MEMBER(equites_state,gekisou) DRIVER_INIT_MEMBER(equites_state,splndrbt) { - unpack_region(machine(), "gfx3"); + unpack_region("gfx3"); } DRIVER_INIT_MEMBER(equites_state,hvoltage) { - unpack_region(machine(), "gfx3"); + unpack_region("gfx3"); #if HVOLTAGE_DEBUG machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x000038, 0x000039, read16_delegate(FUNC(equites_state::hvoltage_debug_r),this)); diff --git a/src/mame/drivers/esd16.c b/src/mame/drivers/esd16.c index cc98b88b56d..42a5451bc45 100644 --- a/src/mame/drivers/esd16.c +++ b/src/mame/drivers/esd16.c @@ -595,7 +595,7 @@ void esd16_state::machine_reset() m_tilemap0_color = 0; } -static UINT16 hedpanic_pri_callback(UINT16 x) +UINT16 esd16_state::hedpanic_pri_callback(UINT16 x) { if (x & 0x8000) return 0xfffe; // under "tilemap 1" @@ -627,7 +627,7 @@ static MACHINE_CONFIG_START( esd16, esd16_state ) MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) decospr_device::set_gfx_region(*device, 0); decospr_device::set_is_bootleg(*device, true); - decospr_device::set_pri_callback(*device, hedpanic_pri_callback); + decospr_device::set_pri_callback(*device, esd16_state::hedpanic_pri_callback); decospr_device::set_flipallx(*device, 1); MCFG_GFXDECODE(esd16) diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c index e4d476717e2..33c269bc048 100644 --- a/src/mame/drivers/exidy.c +++ b/src/mame/drivers/exidy.c @@ -1432,7 +1432,7 @@ ROM_END DRIVER_INIT_MEMBER(exidy_state,sidetrac) { - exidy_video_config(machine(), 0x00, 0x00, FALSE); + exidy_video_config(0x00, 0x00, FALSE); /* hard-coded palette controlled via 8x3 DIP switches on the board */ m_color_latch[2] = 0xf8; @@ -1443,7 +1443,7 @@ DRIVER_INIT_MEMBER(exidy_state,sidetrac) DRIVER_INIT_MEMBER(exidy_state,targ) { - exidy_video_config(machine(), 0x00, 0x00, FALSE); + exidy_video_config(0x00, 0x00, FALSE); /* hard-coded palette controlled via 8x3 DIP switches on the board */ m_color_latch[2] = 0x5c; @@ -1454,7 +1454,7 @@ DRIVER_INIT_MEMBER(exidy_state,targ) DRIVER_INIT_MEMBER(exidy_state,spectar) { - exidy_video_config(machine(), 0x00, 0x00, FALSE); + exidy_video_config(0x00, 0x00, FALSE); /* hard-coded palette controlled via 8x3 DIP switches on the board */ m_color_latch[2] = 0x58; @@ -1464,7 +1464,7 @@ DRIVER_INIT_MEMBER(exidy_state,spectar) DRIVER_INIT_MEMBER(exidy_state,rallys) { - exidy_video_config(machine(), 0x00, 0x00, FALSE); + exidy_video_config(0x00, 0x00, FALSE); /* hard-coded palette controlled via 8x3 DIP switches on the board */ m_color_latch[2] = 0x58; @@ -1474,7 +1474,7 @@ DRIVER_INIT_MEMBER(exidy_state,rallys) DRIVER_INIT_MEMBER(exidy_state,phantoma) { - exidy_video_config(machine(), 0x00, 0x00, FALSE); + exidy_video_config(0x00, 0x00, FALSE); /* hard-coded palette controlled via 8x3 DIP switches on the board */ m_color_latch[2] = 0x58; @@ -1489,25 +1489,25 @@ DRIVER_INIT_MEMBER(exidy_state,phantoma) DRIVER_INIT_MEMBER(exidy_state,mtrap) { - exidy_video_config(machine(), 0x14, 0x00, FALSE); + exidy_video_config(0x14, 0x00, FALSE); } DRIVER_INIT_MEMBER(exidy_state,venture) { - exidy_video_config(machine(), 0x04, 0x04, FALSE); + exidy_video_config(0x04, 0x04, FALSE); } DRIVER_INIT_MEMBER(exidy_state,teetert) { - exidy_video_config(machine(), 0x0c, 0x0c, FALSE); + exidy_video_config(0x0c, 0x0c, FALSE); } DRIVER_INIT_MEMBER(exidy_state,pepper2) { - exidy_video_config(machine(), 0x14, 0x04, TRUE); + exidy_video_config(0x14, 0x04, TRUE); } @@ -1515,7 +1515,7 @@ DRIVER_INIT_MEMBER(exidy_state,fax) { address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); - exidy_video_config(machine(), 0x04, 0x04, TRUE); + exidy_video_config(0x04, 0x04, TRUE); /* reset the ROM bank */ fax_bank_select_w(space,0,0); diff --git a/src/mame/drivers/exidy440.c b/src/mame/drivers/exidy440.c index b059718b639..fc7b93a207e 100644 --- a/src/mame/drivers/exidy440.c +++ b/src/mame/drivers/exidy440.c @@ -294,21 +294,20 @@ CUSTOM_INPUT_MEMBER(exidy440_state::hitnmiss_button1_r) * *************************************/ -void exidy440_bank_select(running_machine &machine, UINT8 bank) +void exidy440_state::exidy440_bank_select(UINT8 bank) { - exidy440_state *state = machine.driver_data(); /* for the showdown case, bank 0 is a PLD */ - if (state->m_showdown_bank_data[0] != NULL) + if (m_showdown_bank_data[0] != NULL) { - if (bank == 0 && state->m_bank != 0) - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),state)); - else if (bank != 0 && state->m_bank == 0) - machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank1"); + if (bank == 0 && m_bank != 0) + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),this)); + else if (bank != 0 && m_bank == 0) + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank1"); } /* select the bank and update the bank pointer */ - state->m_bank = bank; - state->membank("bank1")->set_base(&machine.root_device().memregion("maincpu")->base()[0x10000 + state->m_bank * 0x4000]); + m_bank = bank; + membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + m_bank * 0x4000]); } @@ -452,7 +451,7 @@ void exidy440_state::machine_start() void exidy440_state::machine_reset() { m_bank = 0xff; - exidy440_bank_select(machine(), 0); + exidy440_bank_select(0); } diff --git a/src/mame/drivers/exprraid.c b/src/mame/drivers/exprraid.c index 58091a2205d..90b30aa1f50 100644 --- a/src/mame/drivers/exprraid.c +++ b/src/mame/drivers/exprraid.c @@ -795,11 +795,11 @@ ROM_START( wexpressb3 ) ROM_END -static void exprraid_gfx_expand(running_machine &machine) +void exprraid_state::exprraid_gfx_expand() { /* Expand the background rom so we can use regular decode routines */ - UINT8 *gfx = machine.root_device().memregion("gfx3")->base(); + UINT8 *gfx = machine().root_device().memregion("gfx3")->base(); int offs = 0x10000 - 0x1000; int i; @@ -830,24 +830,24 @@ DRIVER_INIT_MEMBER(exprraid_state,wexpressb) rom[0xfff3] = rom[0xfffe]; rom[0xfff2] = rom[0xffff]; - exprraid_gfx_expand(machine()); + exprraid_gfx_expand(); } DRIVER_INIT_MEMBER(exprraid_state,exprraid) { - exprraid_gfx_expand(machine()); + exprraid_gfx_expand(); } DRIVER_INIT_MEMBER(exprraid_state,wexpressb2) { machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(exprraid_state::vblank_r),this)); - exprraid_gfx_expand(machine()); + exprraid_gfx_expand(); } DRIVER_INIT_MEMBER(exprraid_state,wexpressb3) { machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xFFC0, 0xFFC0, read8_delegate(FUNC(exprraid_state::vblank_r),this)); - exprraid_gfx_expand(machine()); + exprraid_gfx_expand(); } diff --git a/src/mame/includes/epos.h b/src/mame/includes/epos.h index 02a8358e509..612fe5461c1 100644 --- a/src/mame/includes/epos.h +++ b/src/mame/includes/epos.h @@ -27,4 +27,5 @@ public: DECLARE_MACHINE_START(epos); DECLARE_MACHINE_START(dealer); UINT32 screen_update_epos(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + void get_pens( pen_t *pens ); }; diff --git a/src/mame/includes/eprom.h b/src/mame/includes/eprom.h index 2c2a792993c..3b8163023ac 100644 --- a/src/mame/includes/eprom.h +++ b/src/mame/includes/eprom.h @@ -35,6 +35,7 @@ public: DECLARE_VIDEO_START(guts); UINT32 screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); UINT32 screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void update_palette(); }; /*----------- defined in video/eprom.c -----------*/ diff --git a/src/mame/includes/equites.h b/src/mame/includes/equites.h index 4b60252a1df..2b4ad798118 100644 --- a/src/mame/includes/equites.h +++ b/src/mame/includes/equites.h @@ -111,4 +111,11 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(equites_scanline); TIMER_DEVICE_CALLBACK_MEMBER(splndrbt_scanline); DECLARE_WRITE_LINE_MEMBER(equites_msm5232_gate); + void equites_draw_sprites_block( bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int end ); + void equites_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void splndrbt_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void splndrbt_copy_bg( bitmap_ind16 &dst_bitmap, const rectangle &cliprect ); + void equites_update_dac( ); + void unpack_block( const char *region, int offset, int size ); + void unpack_region( const char *region ); }; diff --git a/src/mame/includes/esd16.h b/src/mame/includes/esd16.h index 35f08cdb0e4..e14fc2a0d74 100644 --- a/src/mame/includes/esd16.h +++ b/src/mame/includes/esd16.h @@ -67,4 +67,5 @@ public: virtual void machine_reset(); virtual void video_start(); UINT32 screen_update_hedpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + static UINT16 hedpanic_pri_callback(UINT16 x); }; diff --git a/src/mame/includes/espial.h b/src/mame/includes/espial.h index 0bf07e60cdb..49573052877 100644 --- a/src/mame/includes/espial.h +++ b/src/mame/includes/espial.h @@ -54,4 +54,5 @@ public: UINT32 screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(espial_sound_nmi_gen); TIMER_DEVICE_CALLBACK_MEMBER(espial_scanline); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); }; diff --git a/src/mame/includes/exedexes.h b/src/mame/includes/exedexes.h index 5d0388accc9..064bbe5c14c 100644 --- a/src/mame/includes/exedexes.h +++ b/src/mame/includes/exedexes.h @@ -50,4 +50,5 @@ public: virtual void palette_init(); UINT32 screen_update_exedexes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); TIMER_DEVICE_CALLBACK_MEMBER(exedexes_scanline); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ); }; diff --git a/src/mame/includes/exerion.h b/src/mame/includes/exerion.h index 490162634b8..cb03c18cbba 100644 --- a/src/mame/includes/exerion.h +++ b/src/mame/includes/exerion.h @@ -62,4 +62,5 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_exerion(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/includes/exidy.h b/src/mame/includes/exidy.h index aae887c890b..d849e366d49 100644 --- a/src/mame/includes/exidy.h +++ b/src/mame/includes/exidy.h @@ -70,6 +70,14 @@ public: UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt); TIMER_CALLBACK_MEMBER(collision_irq_callback); + void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp); + inline void latch_condition(int collision); + inline void set_1_color(int index, int which); + void set_colors(); + void draw_background(); + inline int sprite_1_enabled(); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); + void check_collision(); }; /*----------- defined in video/exidy.c -----------*/ diff --git a/src/mame/includes/exidy440.h b/src/mame/includes/exidy440.h index d8106601233..7921ba8e222 100644 --- a/src/mame/includes/exidy440.h +++ b/src/mame/includes/exidy440.h @@ -73,6 +73,8 @@ public: TIMER_CALLBACK_MEMBER(delayed_sound_command_w); TIMER_CALLBACK_MEMBER(beam_firq_callback); TIMER_CALLBACK_MEMBER(collide_firq_callback); + void exidy440_update_firq(); + void exidy440_bank_select(UINT8 bank); }; diff --git a/src/mame/includes/exprraid.h b/src/mame/includes/exprraid.h index 08fb86f3da3..4382c8ff90a 100644 --- a/src/mame/includes/exprraid.h +++ b/src/mame/includes/exprraid.h @@ -55,4 +55,6 @@ public: virtual void video_start(); UINT32 screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(exprraid_interrupt); + void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ); + void exprraid_gfx_expand(); }; diff --git a/src/mame/video/epos.c b/src/mame/video/epos.c index 008adcaa1cc..9668867d067 100644 --- a/src/mame/video/epos.c +++ b/src/mame/video/epos.c @@ -22,11 +22,11 @@ ***************************************************************************/ -static void get_pens( running_machine &machine, pen_t *pens ) +void epos_state::get_pens( pen_t *pens ) { offs_t i; - const UINT8 *prom = machine.root_device().memregion("proms")->base(); - int len = machine.root_device().memregion("proms")->bytes(); + const UINT8 *prom = machine().root_device().memregion("proms")->base(); + int len = machine().root_device().memregion("proms")->bytes(); for (i = 0; i < len; i++) { @@ -76,7 +76,7 @@ UINT32 epos_state::screen_update_epos(screen_device &screen, bitmap_rgb32 &bitma pen_t pens[0x20]; offs_t offs; - get_pens(machine(), pens); + get_pens(pens); for (offs = 0; offs < m_videoram.bytes(); offs++) { diff --git a/src/mame/video/eprom.c b/src/mame/video/eprom.c index 5dc629b8b93..b65696f5767 100644 --- a/src/mame/video/eprom.c +++ b/src/mame/video/eprom.c @@ -15,15 +15,14 @@ * *************************************/ -static void update_palette(running_machine &machine) +void eprom_state::update_palette() { - eprom_state *state = machine.driver_data(); int color; for (color = 0; color < 0x800; ++color) { int i, r, g, b; - UINT16 const data = state->m_generic_paletteram_16[color]; + UINT16 const data = m_generic_paletteram_16[color]; /* FIXME this is only a very crude approximation of the palette output. * The circuit involves a dozen transistors and probably has an output @@ -31,7 +30,7 @@ static void update_palette(running_machine &machine) * This is, however, good enough to match the video and description * of MAMETesters bug #02677. */ - i = (((data >> 12) & 15) + 1) * (4 - state->m_screen_intensity); + i = (((data >> 12) & 15) + 1) * (4 - m_screen_intensity); if (i < 0) i = 0; @@ -39,7 +38,7 @@ static void update_palette(running_machine &machine) g = ((data >> 4) & 15) * i / 4; b = ((data >> 0) & 15) * i / 4; - palette_set_color_rgb(machine, color, r, g, b); + palette_set_color_rgb(machine(), color, r, g, b); } } @@ -239,7 +238,7 @@ UINT32 eprom_state::screen_update_eprom(screen_device &screen, bitmap_ind16 &bit return 0; } - update_palette(machine()); + update_palette(); /* draw the playfield */ m_playfield_tilemap->draw(bitmap, cliprect, 0, 0); @@ -393,7 +392,7 @@ UINT32 eprom_state::screen_update_guts(screen_device &screen, bitmap_ind16 &bitm return 0; } - update_palette(machine()); + update_palette(); /* draw the playfield */ m_playfield_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/equites.c b/src/mame/video/equites.c index 4428c7c1a3f..4ba2def60f1 100644 --- a/src/mame/video/equites.c +++ b/src/mame/video/equites.c @@ -244,25 +244,24 @@ WRITE16_MEMBER(equites_state::splndrbt_bg_scrolly_w) * *************************************/ -static void equites_draw_sprites_block( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int end ) +void equites_state::equites_draw_sprites_block( bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int end ) { - equites_state *state = machine.driver_data(); int offs; for (offs = end - 2; offs >= start; offs -= 2) { - int attr = state->m_spriteram[offs + 1]; + int attr = m_spriteram[offs + 1]; if (!(attr & 0x800)) // disable or x MSB? { int tile = attr & 0x1ff; int fx = ~attr & 0x400; int fy = ~attr & 0x200; int color = (~attr & 0xf000) >> 12; - int sx = (state->m_spriteram[offs] & 0xff00) >> 8; - int sy = (state->m_spriteram[offs] & 0x00ff); - int transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0); + int sx = (m_spriteram[offs] & 0xff00) >> 8; + int sy = (m_spriteram[offs] & 0x00ff); + int transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[2], color, 0); - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -276,7 +275,7 @@ static void equites_draw_sprites_block( running_machine &machine, bitmap_ind16 & // sprites are 16x14 centered in a 16x16 square, so skip the first line sy += 1; - drawgfx_transmask(bitmap,cliprect, machine.gfx[2], + drawgfx_transmask(bitmap,cliprect, machine().gfx[2], tile, color, fx, fy, @@ -285,13 +284,13 @@ static void equites_draw_sprites_block( running_machine &machine, bitmap_ind16 & } } -static void equites_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void equites_state::equites_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { // note that we draw the sprites in three blocks; in each blocks, sprites at // a lower address have priority. This gives good priorities in gekisou. - equites_draw_sprites_block(machine, bitmap, cliprect, 0x000/2, 0x060/2); - equites_draw_sprites_block(machine, bitmap, cliprect, 0x0e0/2, 0x100/2); - equites_draw_sprites_block(machine, bitmap, cliprect, 0x1a4/2, 0x200/2); + equites_draw_sprites_block(bitmap, cliprect, 0x000/2, 0x060/2); + equites_draw_sprites_block(bitmap, cliprect, 0x0e0/2, 0x100/2); + equites_draw_sprites_block(bitmap, cliprect, 0x1a4/2, 0x200/2); } @@ -318,39 +317,38 @@ Also, note that sprites are 30x30, not 32x32. 03020303 03030303 03030303 03030303 */ -static void splndrbt_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void equites_state::splndrbt_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - equites_state *state = machine.driver_data(); - const UINT8 * const xrom = state->memregion("user2")->base(); + const UINT8 * const xrom = memregion("user2")->base(); const UINT8 * const yrom = xrom + 0x100; - gfx_element* gfx = machine.gfx[2]; + gfx_element* gfx = machine().gfx[2]; int offs; // note that sprites are actually 30x30, contained in 32x32 squares. The outer edge is not used. for (offs = 0x3f; offs < 0x6f; offs += 2) // 24 sprites { - int data = state->m_spriteram[offs]; + int data = m_spriteram[offs]; int fx = (data & 0x2000) >> 13; int fy = (data & 0x1000) >> 12; int tile = data & 0x007f; int scaley = (data & 0x0f00) >> 8; - int data2 = state->m_spriteram[offs + 1]; + int data2 = m_spriteram[offs + 1]; int color = (data2 & 0x1f00) >> 8; int sx = data2 & 0x00ff; - int sy = state->m_spriteram_2[offs + 0] & 0x00ff; - int scalex = state->m_spriteram_2[offs + 1] & 0x000f; - int transmask = colortable_get_transpen_mask(machine.colortable, gfx, color, 0); + int sy = m_spriteram_2[offs + 0] & 0x00ff; + int scalex = m_spriteram_2[offs + 1] & 0x000f; + int transmask = colortable_get_transpen_mask(machine().colortable, gfx, color, 0); // const UINT8 * const xromline = xrom + (scalex << 4); const UINT8 * const yromline = yrom + (scaley << 4) + (15 - scaley); const UINT8* const srcgfx = gfx->get_data(tile); - const pen_t *paldata = &machine.pens[gfx->colorbase() + gfx->granularity() * color]; + const pen_t *paldata = &machine().pens[gfx->colorbase() + gfx->granularity() * color]; int x,yy; sy += 16; - if (state->flip_screen()) + if (flip_screen()) { // sx NOT inverted fx = fx ^ 1; @@ -394,20 +392,19 @@ static void splndrbt_draw_sprites( running_machine &machine, bitmap_ind16 &bitma } -static void splndrbt_copy_bg( running_machine &machine, bitmap_ind16 &dst_bitmap, const rectangle &cliprect ) +void equites_state::splndrbt_copy_bg( bitmap_ind16 &dst_bitmap, const rectangle &cliprect ) { - equites_state *state = machine.driver_data(); - bitmap_ind16 &src_bitmap = state->m_bg_tilemap->pixmap(); - bitmap_ind8 &flags_bitmap = state->m_bg_tilemap->flagsmap(); - const UINT8 * const xrom = state->memregion("user1")->base(); + bitmap_ind16 &src_bitmap = m_bg_tilemap->pixmap(); + bitmap_ind8 &flags_bitmap = m_bg_tilemap->flagsmap(); + const UINT8 * const xrom = memregion("user1")->base(); const UINT8 * const yrom = xrom + 0x2000; - int scroll_x = state->m_splndrbt_bg_scrollx; - int scroll_y = state->m_splndrbt_bg_scrolly; - int const dinvert = state->flip_screen() ? 0xff : 0x00; + int scroll_x = m_splndrbt_bg_scrollx; + int scroll_y = m_splndrbt_bg_scrolly; + int const dinvert = flip_screen() ? 0xff : 0x00; int src_y = 0; int dst_y; - if (state->flip_screen()) + if (flip_screen()) { scroll_x = -scroll_x - 8; scroll_y = -scroll_y; @@ -455,7 +452,7 @@ UINT32 equites_state::screen_update_equites(screen_device &screen, bitmap_ind16 m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - equites_draw_sprites(machine(), bitmap, cliprect); + equites_draw_sprites(bitmap, cliprect); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); @@ -466,12 +463,12 @@ UINT32 equites_state::screen_update_splndrbt(screen_device &screen, bitmap_ind16 { bitmap.fill(m_bgcolor, cliprect); - splndrbt_copy_bg(machine(), bitmap, cliprect); + splndrbt_copy_bg(bitmap, cliprect); if (m_fg_char_bank) m_fg_tilemap->draw(bitmap, cliprect, 0, 0); - splndrbt_draw_sprites(machine(), bitmap, cliprect); + splndrbt_draw_sprites(bitmap, cliprect); if (!m_fg_char_bank) m_fg_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/espial.c b/src/mame/video/espial.c index ce3fb7e3ef8..b61965a02c8 100644 --- a/src/mame/video/espial.c +++ b/src/mame/video/espial.c @@ -152,9 +152,8 @@ WRITE8_MEMBER(espial_state::espial_flipscreen_w) * *************************************/ -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void espial_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - espial_state *state = machine.driver_data(); int offs; /* Note that it is important to draw them exactly in this */ @@ -164,14 +163,14 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const int sx, sy, code, color, flipx, flipy; - sx = state->m_spriteram_1[offs + 16]; - sy = state->m_spriteram_2[offs]; - code = state->m_spriteram_1[offs] >> 1; - color = state->m_spriteram_2[offs + 16]; - flipx = state->m_spriteram_3[offs] & 0x04; - flipy = state->m_spriteram_3[offs] & 0x08; + sx = m_spriteram_1[offs + 16]; + sy = m_spriteram_2[offs]; + code = m_spriteram_1[offs] >> 1; + color = m_spriteram_2[offs + 16]; + flipx = m_spriteram_3[offs] & 0x04; + flipy = m_spriteram_3[offs] & 0x08; - if (state->m_flipscreen) + if (m_flipscreen) { flipx = !flipx; flipy = !flipy; @@ -181,15 +180,15 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const sy = 240 - sy; } - if (state->m_spriteram_1[offs] & 1) /* double height */ + if (m_spriteram_1[offs] & 1) /* double height */ { - if (state->m_flipscreen) + if (m_flipscreen) { - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code,color, flipx,flipy, sx,sy + 16,0); - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code + 1, color, flipx,flipy, @@ -197,11 +196,11 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } else { - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code,color, flipx,flipy, sx,sy - 16,0); - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code + 1,color, flipx,flipy, sx,sy,0); @@ -209,7 +208,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const } else { - drawgfx_transpen(bitmap,cliprect,machine.gfx[1], + drawgfx_transpen(bitmap,cliprect,machine().gfx[1], code,color, flipx,flipy, sx,sy,0); @@ -221,6 +220,6 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 espial_state::screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); return 0; } diff --git a/src/mame/video/exedexes.c b/src/mame/video/exedexes.c index 4e296ed802a..d4b877f1aad 100644 --- a/src/mame/video/exedexes.c +++ b/src/mame/video/exedexes.c @@ -174,18 +174,17 @@ void exedexes_state::video_start() colortable_configure_tilemap_groups(machine().colortable, m_tx_tilemap, machine().gfx[0], 0xcf); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) +void exedexes_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority ) { - exedexes_state *state = machine.driver_data(); - UINT8 *buffered_spriteram = state->m_spriteram->buffer(); + UINT8 *buffered_spriteram = m_spriteram->buffer(); int offs; - if (!state->m_objon) + if (!m_objon) return; priority = priority ? 0x40 : 0x00; - for (offs = state->m_spriteram->bytes() - 32;offs >= 0;offs -= 32) + for (offs = m_spriteram->bytes() - 32;offs >= 0;offs -= 32) { if ((buffered_spriteram[offs + 1] & 0x40) == priority) { @@ -198,7 +197,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const sx = buffered_spriteram[offs + 3] - ((buffered_spriteram[offs + 1] & 0x80) << 1); sy = buffered_spriteram[offs + 2]; - drawgfx_transpen(bitmap,cliprect,machine.gfx[3], + drawgfx_transpen(bitmap,cliprect,machine().gfx[3], code, color, flipx,flipy, @@ -217,7 +216,7 @@ UINT32 exedexes_state::screen_update_exedexes(screen_device &screen, bitmap_ind1 else bitmap.fill(0, cliprect); - draw_sprites(machine(), bitmap, cliprect, 1); + draw_sprites(bitmap, cliprect, 1); if (m_sc1on) { @@ -226,7 +225,7 @@ UINT32 exedexes_state::screen_update_exedexes(screen_device &screen, bitmap_ind1 m_fg_tilemap->draw(bitmap, cliprect, 0, 0); } - draw_sprites(machine(), bitmap, cliprect, 0); + draw_sprites(bitmap, cliprect, 0); if (m_chon) m_tx_tilemap->draw(bitmap, cliprect, 0, 0); diff --git a/src/mame/video/exerion.c b/src/mame/video/exerion.c index e8426560367..9eae3360a36 100644 --- a/src/mame/video/exerion.c +++ b/src/mame/video/exerion.c @@ -231,36 +231,35 @@ READ8_MEMBER(exerion_state::exerion_video_timing_r) * *************************************/ -static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void exerion_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect) { - exerion_state *state = machine.driver_data(); int x, y; /* loop over all visible scanlines */ for (y = cliprect.min_y; y <= cliprect.max_y; y++) { - UINT16 *src0 = &state->m_background_gfx[0][state->m_background_latches[1] * 256]; - UINT16 *src1 = &state->m_background_gfx[1][state->m_background_latches[3] * 256]; - UINT16 *src2 = &state->m_background_gfx[2][state->m_background_latches[5] * 256]; - UINT16 *src3 = &state->m_background_gfx[3][state->m_background_latches[7] * 256]; - int xoffs0 = state->m_background_latches[0]; - int xoffs1 = state->m_background_latches[2]; - int xoffs2 = state->m_background_latches[4]; - int xoffs3 = state->m_background_latches[6]; - int start0 = state->m_background_latches[8] & 0x0f; - int start1 = state->m_background_latches[9] & 0x0f; - int start2 = state->m_background_latches[10] & 0x0f; - int start3 = state->m_background_latches[11] & 0x0f; - int stop0 = state->m_background_latches[8] >> 4; - int stop1 = state->m_background_latches[9] >> 4; - int stop2 = state->m_background_latches[10] >> 4; - int stop3 = state->m_background_latches[11] >> 4; - UINT8 *mixer = &state->m_background_mixer[(state->m_background_latches[12] << 4) & 0xf0]; + UINT16 *src0 = &m_background_gfx[0][m_background_latches[1] * 256]; + UINT16 *src1 = &m_background_gfx[1][m_background_latches[3] * 256]; + UINT16 *src2 = &m_background_gfx[2][m_background_latches[5] * 256]; + UINT16 *src3 = &m_background_gfx[3][m_background_latches[7] * 256]; + int xoffs0 = m_background_latches[0]; + int xoffs1 = m_background_latches[2]; + int xoffs2 = m_background_latches[4]; + int xoffs3 = m_background_latches[6]; + int start0 = m_background_latches[8] & 0x0f; + int start1 = m_background_latches[9] & 0x0f; + int start2 = m_background_latches[10] & 0x0f; + int start3 = m_background_latches[11] & 0x0f; + int stop0 = m_background_latches[8] >> 4; + int stop1 = m_background_latches[9] >> 4; + int stop2 = m_background_latches[10] >> 4; + int stop3 = m_background_latches[11] >> 4; + UINT8 *mixer = &m_background_mixer[(m_background_latches[12] << 4) & 0xf0]; UINT16 scanline[VISIBLE_X_MAX]; - pen_t pen_base = 0x200 + ((state->m_background_latches[12] >> 4) << 4); + pen_t pen_base = 0x200 + ((m_background_latches[12] >> 4) << 4); /* the cocktail flip flag controls whether we count up or down in X */ - if (!state->m_cocktail_flip) + if (!m_cocktail_flip) { /* skip processing anything that's not visible */ for (x = BACKGROUND_X_START; x < cliprect.min_x; x++) @@ -352,7 +351,7 @@ UINT32 exerion_state::screen_update_exerion(screen_device &screen, bitmap_ind16 int sx, sy, offs, i; /* draw background */ - draw_background(machine(), bitmap, cliprect); + draw_background(bitmap, cliprect); /* draw sprites */ for (i = 0; i < m_spriteram.bytes(); i += 4) diff --git a/src/mame/video/exidy.c b/src/mame/video/exidy.c index ba00d11fc3b..fc0bb36989c 100644 --- a/src/mame/video/exidy.c +++ b/src/mame/video/exidy.c @@ -15,12 +15,11 @@ * *************************************/ -void exidy_video_config(running_machine &machine, UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp) +void exidy_state::exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp) { - exidy_state *state = machine.driver_data(); - state->m_collision_mask = _collision_mask; - state->m_collision_invert = _collision_invert; - state->m_is_2bpp = _is_2bpp; + m_collision_mask = _collision_mask; + m_collision_invert = _collision_invert; + m_is_2bpp = _is_2bpp; } @@ -56,18 +55,17 @@ void exidy_state::video_start() * *************************************/ -INLINE void latch_condition(running_machine &machine, int collision) +inline void exidy_state::latch_condition(int collision) { - exidy_state *state = machine.driver_data(); - collision ^= state->m_collision_invert; - state->m_int_condition = (state->ioport("INTSOURCE")->read() & ~0x1c) | (collision & state->m_collision_mask); + collision ^= m_collision_invert; + m_int_condition = (ioport("INTSOURCE")->read() & ~0x1c) | (collision & m_collision_mask); } INTERRUPT_GEN_MEMBER(exidy_state::exidy_vblank_interrupt) { /* latch the current condition */ - latch_condition(machine(), 0); + latch_condition(0); m_int_condition &= ~0x80; /* set the IRQ line */ @@ -93,30 +91,29 @@ READ8_MEMBER(exidy_state::exidy_interrupt_r) * *************************************/ -INLINE void set_1_color(running_machine &machine, int index, int which) +inline void exidy_state::set_1_color(int index, int which) { - exidy_state *state = machine.driver_data(); - palette_set_color_rgb(machine, index, - pal1bit(state->m_color_latch[2] >> which), - pal1bit(state->m_color_latch[1] >> which), - pal1bit(state->m_color_latch[0] >> which)); + palette_set_color_rgb(machine(), index, + pal1bit(m_color_latch[2] >> which), + pal1bit(m_color_latch[1] >> which), + pal1bit(m_color_latch[0] >> which)); } -static void set_colors(running_machine &machine) +void exidy_state::set_colors() { /* motion object 1 */ - set_1_color(machine, 0, 0); - set_1_color(machine, 1, 7); + set_1_color(0, 0); + set_1_color(1, 7); /* motion object 2 */ - set_1_color(machine, 2, 0); - set_1_color(machine, 3, 6); + set_1_color(2, 0); + set_1_color(3, 6); /* characters */ - set_1_color(machine, 4, 4); - set_1_color(machine, 5, 3); - set_1_color(machine, 6, 2); - set_1_color(machine, 7, 1); + set_1_color(4, 4); + set_1_color(5, 3); + set_1_color(6, 2); + set_1_color(7, 1); } @@ -127,9 +124,8 @@ static void set_colors(running_machine &machine) * *************************************/ -static void draw_background(running_machine &machine) +void exidy_state::draw_background() { - exidy_state *state = machine.driver_data(); offs_t offs; pen_t off_pen = 0; @@ -140,9 +136,9 @@ static void draw_background(running_machine &machine) pen_t on_pen_1, on_pen_2; UINT8 y = offs >> 5 << 3; - UINT8 code = state->m_videoram[offs]; + UINT8 code = m_videoram[offs]; - if (state->m_is_2bpp) + if (m_is_2bpp) { on_pen_1 = 4 + ((code >> 6) & 0x02); on_pen_2 = 5 + ((code >> 6) & 0x02); @@ -158,17 +154,17 @@ static void draw_background(running_machine &machine) int i; UINT8 x = offs << 3; - if (state->m_is_2bpp) + if (m_is_2bpp) { - UINT8 data1 = state->m_characterram[0x000 | (code << 3) | cy]; - UINT8 data2 = state->m_characterram[0x800 | (code << 3) | cy]; + UINT8 data1 = m_characterram[0x000 | (code << 3) | cy]; + UINT8 data2 = m_characterram[0x800 | (code << 3) | cy]; for (i = 0; i < 8; i++) { if (data1 & 0x80) - state->m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; + m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1; else - state->m_background_bitmap.pix16(y, x) = off_pen; + m_background_bitmap.pix16(y, x) = off_pen; x = x + 1; data1 = data1 << 1; @@ -178,11 +174,11 @@ static void draw_background(running_machine &machine) /* 1bpp */ else { - UINT8 data = state->m_characterram[(code << 3) | cy]; + UINT8 data = m_characterram[(code << 3) | cy]; for (i = 0; i < 8; i++) { - state->m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen; + m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen; x = x + 1; data = data << 1; @@ -202,39 +198,38 @@ static void draw_background(running_machine &machine) * *************************************/ -INLINE int sprite_1_enabled(exidy_state *state) +inline int exidy_state::sprite_1_enabled() { /* if the collision_mask is 0x00, then we are on old hardware that always has */ /* sprite 1 enabled regardless */ - return (!(*state->m_sprite_enable & 0x80) || (*state->m_sprite_enable & 0x10) || (state->m_collision_mask == 0x00)); + return (!(*m_sprite_enable & 0x80) || (*m_sprite_enable & 0x10) || (m_collision_mask == 0x00)); } -static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) +void exidy_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - exidy_state *state = machine.driver_data(); /* draw sprite 2 first */ - int sprite_set_2 = ((*state->m_sprite_enable & 0x40) != 0); + int sprite_set_2 = ((*m_sprite_enable & 0x40) != 0); - int sx = 236 - *state->m_sprite2_xpos - 4; - int sy = 244 - *state->m_sprite2_ypos - 4; + int sx = 236 - *m_sprite2_xpos - 4; + int sy = 244 - *m_sprite2_ypos - 4; - drawgfx_transpen(bitmap, cliprect, machine.gfx[0], - ((*state->m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1, + drawgfx_transpen(bitmap, cliprect, machine().gfx[0], + ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1, 0, 0, sx, sy, 0); /* draw sprite 1 next */ - if (sprite_1_enabled(state)) + if (sprite_1_enabled()) { - int sprite_set_1 = ((*state->m_sprite_enable & 0x20) != 0); + int sprite_set_1 = ((*m_sprite_enable & 0x20) != 0); - sx = 236 - *state->m_sprite1_xpos - 4; - sy = 244 - *state->m_sprite1_ypos - 4; + sx = 236 - *m_sprite1_xpos - 4; + sy = 244 - *m_sprite1_ypos - 4; if (sy < 0) sy = 0; - drawgfx_transpen(bitmap, cliprect, machine.gfx[0], - (*state->m_spriteno & 0x0f) + 16 * sprite_set_1, 0, + drawgfx_transpen(bitmap, cliprect, machine().gfx[0], + (*m_spriteno & 0x0f) + 16 * sprite_set_1, 0, 0, 0, sx, sy, 0); } @@ -263,18 +258,17 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const r TIMER_CALLBACK_MEMBER(exidy_state::collision_irq_callback) { /* latch the collision bits */ - latch_condition(machine(), param); + latch_condition(param); /* set the IRQ line */ machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); } -static void check_collision(running_machine &machine) +void exidy_state::check_collision() { - exidy_state *state = machine.driver_data(); - UINT8 sprite_set_1 = ((*state->m_sprite_enable & 0x20) != 0); - UINT8 sprite_set_2 = ((*state->m_sprite_enable & 0x40) != 0); + UINT8 sprite_set_1 = ((*m_sprite_enable & 0x20) != 0); + UINT8 sprite_set_2 = ((*m_sprite_enable & 0x40) != 0); const rectangle clip(0, 15, 0, 15); int org_1_x = 0, org_1_y = 0; int org_2_x = 0, org_2_y = 0; @@ -282,36 +276,36 @@ static void check_collision(running_machine &machine) int count = 0; /* if there is nothing to detect, bail */ - if (state->m_collision_mask == 0) + if (m_collision_mask == 0) return; /* draw sprite 1 */ - state->m_motion_object_1_vid.fill(0xff, clip); - if (sprite_1_enabled(state)) + m_motion_object_1_vid.fill(0xff, clip); + if (sprite_1_enabled()) { - org_1_x = 236 - *state->m_sprite1_xpos - 4; - org_1_y = 244 - *state->m_sprite1_ypos - 4; - drawgfx_transpen(state->m_motion_object_1_vid, clip, machine.gfx[0], - (*state->m_spriteno & 0x0f) + 16 * sprite_set_1, 0, + org_1_x = 236 - *m_sprite1_xpos - 4; + org_1_y = 244 - *m_sprite1_ypos - 4; + drawgfx_transpen(m_motion_object_1_vid, clip, machine().gfx[0], + (*m_spriteno & 0x0f) + 16 * sprite_set_1, 0, 0, 0, 0, 0, 0); } /* draw sprite 2 */ - state->m_motion_object_2_vid.fill(0xff, clip); - org_2_x = 236 - *state->m_sprite2_xpos - 4; - org_2_y = 244 - *state->m_sprite2_ypos - 4; - drawgfx_transpen(state->m_motion_object_2_vid, clip, machine.gfx[0], - ((*state->m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, + m_motion_object_2_vid.fill(0xff, clip); + org_2_x = 236 - *m_sprite2_xpos - 4; + org_2_y = 244 - *m_sprite2_ypos - 4; + drawgfx_transpen(m_motion_object_2_vid, clip, machine().gfx[0], + ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, 0, 0, 0, 0, 0); /* draw sprite 2 clipped to sprite 1's location */ - state->m_motion_object_2_clip.fill(0xff, clip); - if (sprite_1_enabled(state)) + m_motion_object_2_clip.fill(0xff, clip); + if (sprite_1_enabled()) { sx = org_2_x - org_1_x; sy = org_2_y - org_1_y; - drawgfx_transpen(state->m_motion_object_2_clip, clip, machine.gfx[0], - ((*state->m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, + drawgfx_transpen(m_motion_object_2_clip, clip, machine().gfx[0], + ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0, 0, 0, sx, sy, 0); } @@ -319,29 +313,29 @@ static void check_collision(running_machine &machine) for (sy = 0; sy < 16; sy++) for (sx = 0; sx < 16; sx++) { - if (state->m_motion_object_1_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_1_vid.pix16(sy, sx) != 0xff) { UINT8 current_collision_mask = 0; /* check for background collision (M1CHAR) */ - if (state->m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0) + if (m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0) current_collision_mask |= 0x04; /* check for motion object collision (M1M2) */ - if (state->m_motion_object_2_clip.pix16(sy, sx) != 0xff) + if (m_motion_object_2_clip.pix16(sy, sx) != 0xff) current_collision_mask |= 0x10; /* if we got one, trigger an interrupt */ - if ((current_collision_mask & state->m_collision_mask) && (count++ < 128)) - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), timer_expired_delegate(FUNC(exidy_state::collision_irq_callback),state), current_collision_mask); + if ((current_collision_mask & m_collision_mask) && (count++ < 128)) + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(org_1_x + sx, org_1_y + sy), timer_expired_delegate(FUNC(exidy_state::collision_irq_callback),this), current_collision_mask); } - if (state->m_motion_object_2_vid.pix16(sy, sx) != 0xff) + if (m_motion_object_2_vid.pix16(sy, sx) != 0xff) { /* check for background collision (M2CHAR) */ - if (state->m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0) - if ((state->m_collision_mask & 0x08) && (count++ < 128)) - machine.scheduler().timer_set(machine.primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), timer_expired_delegate(FUNC(exidy_state::collision_irq_callback),state), 0x08); + if (m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0) + if ((m_collision_mask & 0x08) && (count++ < 128)) + machine().scheduler().timer_set(machine().primary_screen->time_until_pos(org_2_x + sx, org_2_y + sy), timer_expired_delegate(FUNC(exidy_state::collision_irq_callback),this), 0x08); } } } @@ -357,17 +351,17 @@ static void check_collision(running_machine &machine) UINT32 exidy_state::screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { /* refresh the colors from the palette (static or dynamic) */ - set_colors(machine()); + set_colors(); /* update the background and draw it */ - draw_background(machine()); + draw_background(); copybitmap(bitmap, m_background_bitmap, 0, 0, 0, 0, cliprect); /* draw the sprites */ - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); /* check for collision, this will set the appropriate bits in collision_mask */ - check_collision(machine()); + check_collision(); return 0; } diff --git a/src/mame/video/exidy440.c b/src/mame/video/exidy440.c index c68bbeebe41..38a052ff41f 100644 --- a/src/mame/video/exidy440.c +++ b/src/mame/video/exidy440.c @@ -25,12 +25,6 @@ #define SPRITE_COUNT (0x28) - -/* function prototypes */ -static void exidy440_update_firq(running_machine &machine); - - - /************************************* * * Initialize the video system @@ -135,7 +129,7 @@ READ8_MEMBER(exidy440_state::exidy440_horizontal_pos_r) { /* clear the FIRQ on a read here */ m_firq_beam = 0; - exidy440_update_firq(machine()); + exidy440_update_firq(); /* according to the schems, this value is only latched on an FIRQ * caused by collision or beam */ @@ -182,14 +176,14 @@ WRITE8_MEMBER(exidy440_state::exidy440_control_w) int oldvis = m_palettebank_vis; /* extract the various bits */ - exidy440_bank_select(machine(), data >> 4); + exidy440_bank_select(data >> 4); m_firq_enable = (data >> 3) & 1; m_firq_select = (data >> 2) & 1; m_palettebank_io = (data >> 1) & 1; m_palettebank_vis = data & 1; /* update the FIRQ in case we enabled something */ - exidy440_update_firq(machine()); + exidy440_update_firq(); /* if we're swapping palettes, change all the colors */ if (oldvis != m_palettebank_vis) @@ -212,7 +206,7 @@ WRITE8_MEMBER(exidy440_state::exidy440_interrupt_clear_w) { /* clear the VBLANK FIRQ on a write here */ m_firq_vblank = 0; - exidy440_update_firq(machine()); + exidy440_update_firq(); } @@ -223,13 +217,12 @@ WRITE8_MEMBER(exidy440_state::exidy440_interrupt_clear_w) * *************************************/ -static void exidy440_update_firq(running_machine &machine) +void exidy440_state::exidy440_update_firq() { - exidy440_state *state = machine.driver_data(); - if (state->m_firq_vblank || (state->m_firq_enable && state->m_firq_beam)) - machine.device("maincpu")->execute().set_input_line(1, ASSERT_LINE); + if (m_firq_vblank || (m_firq_enable && m_firq_beam)) + machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE); else - machine.device("maincpu")->execute().set_input_line(1, CLEAR_LINE); + machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE); } @@ -237,7 +230,7 @@ INTERRUPT_GEN_MEMBER(exidy440_state::exidy440_vblank_interrupt) { /* set the FIRQ line on a VBLANK */ m_firq_vblank = 1; - exidy440_update_firq(machine()); + exidy440_update_firq(); } @@ -254,7 +247,7 @@ TIMER_CALLBACK_MEMBER(exidy440_state::beam_firq_callback) if (m_firq_select && m_firq_enable) { m_firq_beam = 1; - exidy440_update_firq(machine()); + exidy440_update_firq(); } /* round the x value to the nearest byte */ @@ -271,7 +264,7 @@ TIMER_CALLBACK_MEMBER(exidy440_state::collide_firq_callback) if (!m_firq_select && m_firq_enable) { m_firq_beam = 1; - exidy440_update_firq(machine()); + exidy440_update_firq(); } /* round the x value to the nearest byte */ diff --git a/src/mame/video/exprraid.c b/src/mame/video/exprraid.c index 7a2e84960c0..3feb6b16c74 100644 --- a/src/mame/video/exprraid.c +++ b/src/mame/video/exprraid.c @@ -87,22 +87,21 @@ void exprraid_state::video_start() m_fg_tilemap->set_transparent_pen(0); } -static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect ) +void exprraid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect ) { - exprraid_state *state = machine.driver_data(); int offs; - for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4) + for (offs = 0; offs < m_spriteram.bytes(); offs += 4) { - int attr = state->m_spriteram[offs + 1]; - int code = state->m_spriteram[offs + 3] + ((attr & 0xe0) << 3); + int attr = m_spriteram[offs + 1]; + int code = m_spriteram[offs + 3] + ((attr & 0xe0) << 3); int color = (attr & 0x03) + ((attr & 0x08) >> 1); int flipx = (attr & 0x04); int flipy = 0; - int sx = ((248 - state->m_spriteram[offs + 2]) & 0xff) - 8; - int sy = state->m_spriteram[offs]; + int sx = ((248 - m_spriteram[offs + 2]) & 0xff) - 8; + int sy = m_spriteram[offs]; - if (state->flip_screen()) + if (flip_screen()) { sx = 240 - sx; sy = 240 - sy; @@ -110,7 +109,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const flipy = !flipy; } - drawgfx_transpen(bitmap, cliprect, machine.gfx[1], + drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, color, flipx, flipy, sx, sy, 0); @@ -119,10 +118,10 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const if (attr & 0x10) { - drawgfx_transpen(bitmap,cliprect, machine.gfx[1], + drawgfx_transpen(bitmap,cliprect, machine().gfx[1], code + 1, color, flipx, flipy, - sx, sy + (state->flip_screen() ? -16 : 16), 0); + sx, sy + (flip_screen() ? -16 : 16), 0); } } } @@ -130,7 +129,7 @@ static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const UINT32 exprraid_state::screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { m_bg_tilemap->draw(bitmap, cliprect, 0, 0); - draw_sprites(machine(), bitmap, cliprect); + draw_sprites(bitmap, cliprect); m_bg_tilemap->draw(bitmap, cliprect, 1, 0); m_fg_tilemap->draw(bitmap, cliprect, 0, 0); return 0;