Previous 199869 Revisions Next

r20822 Friday 8th February, 2013 at 07:43:09 UTC by Miodrag Milanović
Modernization of drivers part 4 (no whatsnew)
[src/mame/drivers]equites.c esd16.c exidy.c exidy440.c exprraid.c
[src/mame/includes]epos.h eprom.h equites.h esd16.h espial.h exedexes.h exerion.h exidy.h exidy440.h exprraid.h
[src/mame/video]epos.c eprom.c equites.c espial.c exedexes.c exerion.c exidy.c exidy440.c exprraid.c

trunk/src/mame/drivers/exprraid.c
r20821r20822
795795ROM_END
796796
797797
798static void exprraid_gfx_expand(running_machine &machine)
798void exprraid_state::exprraid_gfx_expand()
799799{
800800   /* Expand the background rom so we can use regular decode routines */
801801
802   UINT8   *gfx = machine.root_device().memregion("gfx3")->base();
802   UINT8   *gfx = machine().root_device().memregion("gfx3")->base();
803803   int offs = 0x10000 - 0x1000;
804804   int i;
805805
r20821r20822
830830   rom[0xfff3] = rom[0xfffe];
831831   rom[0xfff2] = rom[0xffff];
832832
833   exprraid_gfx_expand(machine());
833   exprraid_gfx_expand();
834834}
835835
836836DRIVER_INIT_MEMBER(exprraid_state,exprraid)
837837{
838   exprraid_gfx_expand(machine());
838   exprraid_gfx_expand();
839839}
840840
841841DRIVER_INIT_MEMBER(exprraid_state,wexpressb2)
842842{
843843   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(exprraid_state::vblank_r),this));
844   exprraid_gfx_expand(machine());
844   exprraid_gfx_expand();
845845}
846846
847847DRIVER_INIT_MEMBER(exprraid_state,wexpressb3)
848848{
849849   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xFFC0, 0xFFC0, read8_delegate(FUNC(exprraid_state::vblank_r),this));
850   exprraid_gfx_expand(machine());
850   exprraid_gfx_expand();
851851}
852852
853853
trunk/src/mame/drivers/equites.c
r20821r20822
534534}
535535
536536
537static void equites_update_dac( running_machine &machine )
537void equites_state::equites_update_dac(  )
538538{
539   equites_state *state = machine.driver_data<equites_state>();
540539
541540   // there is only one latch, which is used to drive two DAC channels.
542541   // When the channel is enabled in the 4066, it goes to a series of
r20821r20822
544543   // then it's disabled again.
545544   // Note that PB0 goes through three filters while PB1 only goes through one.
546545
547   if (state->m_eq8155_port_b & 1)
548      state->m_dac_1->write_signed8(state->m_dac_latch);
546   if (m_eq8155_port_b & 1)
547      m_dac_1->write_signed8(m_dac_latch);
549548
550   if (state->m_eq8155_port_b & 2)
551      state->m_dac_2->write_signed8(state->m_dac_latch);
549   if (m_eq8155_port_b & 2)
550      m_dac_2->write_signed8(m_dac_latch);
552551}
553552
554553WRITE8_MEMBER(equites_state::equites_dac_latch_w)
555554{
556555   m_dac_latch = data << 2;
557   equites_update_dac(machine());
556   equites_update_dac();
558557}
559558
560559WRITE8_MEMBER(equites_state::equites_8155_portb_w)
561560{
562561   m_eq8155_port_b = data;
563   equites_update_dac(machine());
562   equites_update_dac();
564563}
565564
566565WRITE_LINE_MEMBER(equites_state::equites_msm5232_gate)
r20821r20822
18471846/******************************************************************************/
18481847// Initializations
18491848
1850static void unpack_block( running_machine &machine, const char *region, int offset, int size )
1849void equites_state::unpack_block( const char *region, int offset, int size )
18511850{
1852   UINT8 *rom = machine.root_device().memregion(region)->base();
1851   UINT8 *rom = machine().root_device().memregion(region)->base();
18531852   int i;
18541853
18551854   for (i = 0; i < size; ++i)
r20821r20822
18591858   }
18601859}
18611860
1862static void unpack_region( running_machine &machine, const char *region )
1861void equites_state::unpack_region( const char *region )
18631862{
1864   unpack_block(machine, region, 0x0000, 0x2000);
1865   unpack_block(machine, region, 0x4000, 0x2000);
1863   unpack_block(region, 0x0000, 0x2000);
1864   unpack_block(region, 0x4000, 0x2000);
18661865}
18671866
18681867
18691868DRIVER_INIT_MEMBER(equites_state,equites)
18701869{
1871   unpack_region(machine(), "gfx2");
1872   unpack_region(machine(), "gfx3");
1870   unpack_region("gfx2");
1871   unpack_region("gfx3");
18731872}
18741873
18751874DRIVER_INIT_MEMBER(equites_state,bullfgtr)
18761875{
1877   unpack_region(machine(), "gfx2");
1878   unpack_region(machine(), "gfx3");
1876   unpack_region("gfx2");
1877   unpack_region("gfx3");
18791878}
18801879
18811880DRIVER_INIT_MEMBER(equites_state,kouyakyu)
18821881{
1883   unpack_region(machine(), "gfx2");
1884   unpack_region(machine(), "gfx3");
1882   unpack_region("gfx2");
1883   unpack_region("gfx3");
18851884}
18861885
18871886DRIVER_INIT_MEMBER(equites_state,gekisou)
18881887{
1889   unpack_region(machine(), "gfx2");
1890   unpack_region(machine(), "gfx3");
1888   unpack_region("gfx2");
1889   unpack_region("gfx3");
18911890
18921891   // install special handlers for unknown device (protection?)
18931892   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x580000, 0x580001, write16_delegate(FUNC(equites_state::gekisou_unknown_0_w),this));
r20821r20822
18961895
18971896DRIVER_INIT_MEMBER(equites_state,splndrbt)
18981897{
1899   unpack_region(machine(), "gfx3");
1898   unpack_region("gfx3");
19001899}
19011900
19021901DRIVER_INIT_MEMBER(equites_state,hvoltage)
19031902{
1904   unpack_region(machine(), "gfx3");
1903   unpack_region("gfx3");
19051904
19061905#if HVOLTAGE_DEBUG
19071906   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x000038, 0x000039, read16_delegate(FUNC(equites_state::hvoltage_debug_r),this));
trunk/src/mame/drivers/esd16.c
r20821r20822
595595   m_tilemap0_color = 0;
596596}
597597
598static UINT16 hedpanic_pri_callback(UINT16 x)
598UINT16 esd16_state::hedpanic_pri_callback(UINT16 x)
599599{
600600   if (x & 0x8000)
601601      return 0xfffe; // under "tilemap 1"
r20821r20822
627627   MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0)
628628   decospr_device::set_gfx_region(*device, 0);
629629   decospr_device::set_is_bootleg(*device, true);
630   decospr_device::set_pri_callback(*device, hedpanic_pri_callback);
630   decospr_device::set_pri_callback(*device, esd16_state::hedpanic_pri_callback);
631631   decospr_device::set_flipallx(*device, 1);
632632
633633   MCFG_GFXDECODE(esd16)
trunk/src/mame/drivers/exidy440.c
r20821r20822
294294 *
295295 *************************************/
296296
297void exidy440_bank_select(running_machine &machine, UINT8 bank)
297void exidy440_state::exidy440_bank_select(UINT8 bank)
298298{
299   exidy440_state *state = machine.driver_data<exidy440_state>();
300299   /* for the showdown case, bank 0 is a PLD */
301   if (state->m_showdown_bank_data[0] != NULL)
300   if (m_showdown_bank_data[0] != NULL)
302301   {
303      if (bank == 0 && state->m_bank != 0)
304         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),state));
305      else if (bank != 0 && state->m_bank == 0)
306         machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank1");
302      if (bank == 0 && m_bank != 0)
303         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),this));
304      else if (bank != 0 && m_bank == 0)
305         machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank1");
307306   }
308307
309308   /* select the bank and update the bank pointer */
310   state->m_bank = bank;
311   state->membank("bank1")->set_base(&machine.root_device().memregion("maincpu")->base()[0x10000 + state->m_bank * 0x4000]);
309   m_bank = bank;
310   membank("bank1")->set_base(&machine().root_device().memregion("maincpu")->base()[0x10000 + m_bank * 0x4000]);
312311}
313312
314313
r20821r20822
452451void exidy440_state::machine_reset()
453452{
454453   m_bank = 0xff;
455   exidy440_bank_select(machine(), 0);
454   exidy440_bank_select(0);
456455}
457456
458457
trunk/src/mame/drivers/exidy.c
r20821r20822
14321432
14331433DRIVER_INIT_MEMBER(exidy_state,sidetrac)
14341434{
1435   exidy_video_config(machine(), 0x00, 0x00, FALSE);
1435   exidy_video_config(0x00, 0x00, FALSE);
14361436
14371437   /* hard-coded palette controlled via 8x3 DIP switches on the board */
14381438   m_color_latch[2] = 0xf8;
r20821r20822
14431443
14441444DRIVER_INIT_MEMBER(exidy_state,targ)
14451445{
1446   exidy_video_config(machine(), 0x00, 0x00, FALSE);
1446   exidy_video_config(0x00, 0x00, FALSE);
14471447
14481448   /* hard-coded palette controlled via 8x3 DIP switches on the board */
14491449   m_color_latch[2] = 0x5c;
r20821r20822
14541454
14551455DRIVER_INIT_MEMBER(exidy_state,spectar)
14561456{
1457   exidy_video_config(machine(), 0x00, 0x00, FALSE);
1457   exidy_video_config(0x00, 0x00, FALSE);
14581458
14591459   /* hard-coded palette controlled via 8x3 DIP switches on the board */
14601460   m_color_latch[2] = 0x58;
r20821r20822
14641464
14651465DRIVER_INIT_MEMBER(exidy_state,rallys)
14661466{
1467   exidy_video_config(machine(), 0x00, 0x00, FALSE);
1467   exidy_video_config(0x00, 0x00, FALSE);
14681468
14691469   /* hard-coded palette controlled via 8x3 DIP switches on the board */
14701470   m_color_latch[2] = 0x58;
r20821r20822
14741474
14751475DRIVER_INIT_MEMBER(exidy_state,phantoma)
14761476{
1477   exidy_video_config(machine(), 0x00, 0x00, FALSE);
1477   exidy_video_config(0x00, 0x00, FALSE);
14781478
14791479   /* hard-coded palette controlled via 8x3 DIP switches on the board */
14801480   m_color_latch[2] = 0x58;
r20821r20822
14891489
14901490DRIVER_INIT_MEMBER(exidy_state,mtrap)
14911491{
1492   exidy_video_config(machine(), 0x14, 0x00, FALSE);
1492   exidy_video_config(0x14, 0x00, FALSE);
14931493}
14941494
14951495
14961496DRIVER_INIT_MEMBER(exidy_state,venture)
14971497{
1498   exidy_video_config(machine(), 0x04, 0x04, FALSE);
1498   exidy_video_config(0x04, 0x04, FALSE);
14991499}
15001500
15011501
15021502DRIVER_INIT_MEMBER(exidy_state,teetert)
15031503{
1504   exidy_video_config(machine(), 0x0c, 0x0c, FALSE);
1504   exidy_video_config(0x0c, 0x0c, FALSE);
15051505}
15061506
15071507
15081508DRIVER_INIT_MEMBER(exidy_state,pepper2)
15091509{
1510   exidy_video_config(machine(), 0x14, 0x04, TRUE);
1510   exidy_video_config(0x14, 0x04, TRUE);
15111511}
15121512
15131513
r20821r20822
15151515{
15161516   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
15171517
1518   exidy_video_config(machine(), 0x04, 0x04, TRUE);
1518   exidy_video_config(0x04, 0x04, TRUE);
15191519
15201520   /* reset the ROM bank */
15211521   fax_bank_select_w(space,0,0);
trunk/src/mame/includes/exidy440.h
r20821r20822
7373   TIMER_CALLBACK_MEMBER(delayed_sound_command_w);
7474   TIMER_CALLBACK_MEMBER(beam_firq_callback);
7575   TIMER_CALLBACK_MEMBER(collide_firq_callback);
76   void exidy440_update_firq();
77   void exidy440_bank_select(UINT8 bank);
7678};
7779
7880
trunk/src/mame/includes/esd16.h
r20821r20822
6767   virtual void machine_reset();
6868   virtual void video_start();
6969   UINT32 screen_update_hedpanic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
70   static UINT16 hedpanic_pri_callback(UINT16 x);
7071};
trunk/src/mame/includes/exprraid.h
r20821r20822
5555   virtual void video_start();
5656   UINT32 screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5757   INTERRUPT_GEN_MEMBER(exprraid_interrupt);
58   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
59   void exprraid_gfx_expand();
5860};
trunk/src/mame/includes/exedexes.h
r20821r20822
5050   virtual void palette_init();
5151   UINT32 screen_update_exedexes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5252   TIMER_DEVICE_CALLBACK_MEMBER(exedexes_scanline);
53   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
5354};
trunk/src/mame/includes/epos.h
r20821r20822
2727   DECLARE_MACHINE_START(epos);
2828   DECLARE_MACHINE_START(dealer);
2929   UINT32 screen_update_epos(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
30   void get_pens( pen_t *pens );
3031};
trunk/src/mame/includes/exidy.h
r20821r20822
7070   UINT32 screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7171   INTERRUPT_GEN_MEMBER(exidy_vblank_interrupt);
7272   TIMER_CALLBACK_MEMBER(collision_irq_callback);
73   void exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp);
74   inline void latch_condition(int collision);
75   inline void set_1_color(int index, int which);
76   void set_colors();
77   void draw_background();
78   inline int sprite_1_enabled();
79   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
80   void check_collision();
7381};
7482
7583/*----------- defined in video/exidy.c -----------*/
trunk/src/mame/includes/espial.h
r20821r20822
5454   UINT32 screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5555   INTERRUPT_GEN_MEMBER(espial_sound_nmi_gen);
5656   TIMER_DEVICE_CALLBACK_MEMBER(espial_scanline);
57   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
5758};
trunk/src/mame/includes/equites.h
r20821r20822
111111   TIMER_DEVICE_CALLBACK_MEMBER(equites_scanline);
112112   TIMER_DEVICE_CALLBACK_MEMBER(splndrbt_scanline);
113113   DECLARE_WRITE_LINE_MEMBER(equites_msm5232_gate);
114   void equites_draw_sprites_block( bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int end );
115   void equites_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
116   void splndrbt_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
117   void splndrbt_copy_bg( bitmap_ind16 &dst_bitmap, const rectangle &cliprect );
118   void equites_update_dac(  );
119   void unpack_block( const char *region, int offset, int size );
120   void unpack_region( const char *region );
114121};
trunk/src/mame/includes/eprom.h
r20821r20822
3535   DECLARE_VIDEO_START(guts);
3636   UINT32 screen_update_eprom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3737   UINT32 screen_update_guts(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
38   void update_palette();
3839};
3940
4041/*----------- defined in video/eprom.c -----------*/
trunk/src/mame/includes/exerion.h
r20821r20822
6262   virtual void video_start();
6363   virtual void palette_init();
6464   UINT32 screen_update_exerion(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
65   void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect);
6566};
trunk/src/mame/video/eprom.c
r20821r20822
1515 *
1616 *************************************/
1717
18static void update_palette(running_machine &machine)
18void eprom_state::update_palette()
1919{
20   eprom_state *state = machine.driver_data<eprom_state>();
2120   int color;
2221
2322   for (color = 0; color < 0x800; ++color)
2423   {
2524      int i, r, g, b;
26      UINT16 const data = state->m_generic_paletteram_16[color];
25      UINT16 const data = m_generic_paletteram_16[color];
2726
2827      /* FIXME this is only a very crude approximation of the palette output.
2928       * The circuit involves a dozen transistors and probably has an output
r20821r20822
3130       * This is, however, good enough to match the video and description
3231       * of MAMETesters bug #02677.
3332       */
34      i = (((data >> 12) & 15) + 1) * (4 - state->m_screen_intensity);
33      i = (((data >> 12) & 15) + 1) * (4 - m_screen_intensity);
3534      if (i < 0)
3635         i = 0;
3736
r20821r20822
3938      g = ((data >> 4) & 15) * i / 4;
4039      b = ((data >> 0) & 15) * i / 4;
4140
42      palette_set_color_rgb(machine, color, r, g, b);
41      palette_set_color_rgb(machine(), color, r, g, b);
4342   }
4443}
4544
r20821r20822
239238      return 0;
240239   }
241240
242   update_palette(machine());
241   update_palette();
243242
244243   /* draw the playfield */
245244   m_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
r20821r20822
393392      return 0;
394393   }
395394
396   update_palette(machine());
395   update_palette();
397396
398397   /* draw the playfield */
399398   m_playfield_tilemap->draw(bitmap, cliprect, 0, 0);
trunk/src/mame/video/espial.c
r20821r20822
152152 *
153153 *************************************/
154154
155static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
155void espial_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
156156{
157   espial_state *state = machine.driver_data<espial_state>();
158157   int offs;
159158
160159   /* Note that it is important to draw them exactly in this */
r20821r20822
164163      int sx, sy, code, color, flipx, flipy;
165164
166165
167      sx = state->m_spriteram_1[offs + 16];
168      sy = state->m_spriteram_2[offs];
169      code = state->m_spriteram_1[offs] >> 1;
170      color = state->m_spriteram_2[offs + 16];
171      flipx = state->m_spriteram_3[offs] & 0x04;
172      flipy = state->m_spriteram_3[offs] & 0x08;
166      sx = m_spriteram_1[offs + 16];
167      sy = m_spriteram_2[offs];
168      code = m_spriteram_1[offs] >> 1;
169      color = m_spriteram_2[offs + 16];
170      flipx = m_spriteram_3[offs] & 0x04;
171      flipy = m_spriteram_3[offs] & 0x08;
173172
174      if (state->m_flipscreen)
173      if (m_flipscreen)
175174      {
176175         flipx = !flipx;
177176         flipy = !flipy;
r20821r20822
181180         sy = 240 - sy;
182181      }
183182
184      if (state->m_spriteram_1[offs] & 1) /* double height */
183      if (m_spriteram_1[offs] & 1) /* double height */
185184      {
186         if (state->m_flipscreen)
185         if (m_flipscreen)
187186         {
188            drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
187            drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
189188                  code,color,
190189                  flipx,flipy,
191190                  sx,sy + 16,0);
192            drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
191            drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
193192                  code + 1,
194193                  color,
195194                  flipx,flipy,
r20821r20822
197196         }
198197         else
199198         {
200            drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
199            drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
201200                  code,color,
202201                  flipx,flipy,
203202                  sx,sy - 16,0);
204            drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
203            drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
205204                  code + 1,color,
206205                  flipx,flipy,
207206                  sx,sy,0);
r20821r20822
209208      }
210209      else
211210      {
212         drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
211         drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
213212               code,color,
214213               flipx,flipy,
215214               sx,sy,0);
r20821r20822
221220UINT32 espial_state::screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
222221{
223222   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
224   draw_sprites(machine(), bitmap, cliprect);
223   draw_sprites(bitmap, cliprect);
225224   return 0;
226225}
trunk/src/mame/video/exidy440.c
r20821r20822
2525
2626#define SPRITE_COUNT        (0x28)
2727
28
29/* function prototypes */
30static void exidy440_update_firq(running_machine &machine);
31
32
33
3428/*************************************
3529 *
3630 *  Initialize the video system
r20821r20822
135129{
136130   /* clear the FIRQ on a read here */
137131   m_firq_beam = 0;
138   exidy440_update_firq(machine());
132   exidy440_update_firq();
139133
140134   /* according to the schems, this value is only latched on an FIRQ
141135    * caused by collision or beam */
r20821r20822
182176   int oldvis = m_palettebank_vis;
183177
184178   /* extract the various bits */
185   exidy440_bank_select(machine(), data >> 4);
179   exidy440_bank_select(data >> 4);
186180   m_firq_enable = (data >> 3) & 1;
187181   m_firq_select = (data >> 2) & 1;
188182   m_palettebank_io = (data >> 1) & 1;
189183   m_palettebank_vis = data & 1;
190184
191185   /* update the FIRQ in case we enabled something */
192   exidy440_update_firq(machine());
186   exidy440_update_firq();
193187
194188   /* if we're swapping palettes, change all the colors */
195189   if (oldvis != m_palettebank_vis)
r20821r20822
212206{
213207   /* clear the VBLANK FIRQ on a write here */
214208   m_firq_vblank = 0;
215   exidy440_update_firq(machine());
209   exidy440_update_firq();
216210}
217211
218212
r20821r20822
223217 *
224218 *************************************/
225219
226static void exidy440_update_firq(running_machine &machine)
220void exidy440_state::exidy440_update_firq()
227221{
228   exidy440_state *state = machine.driver_data<exidy440_state>();
229   if (state->m_firq_vblank || (state->m_firq_enable && state->m_firq_beam))
230      machine.device("maincpu")->execute().set_input_line(1, ASSERT_LINE);
222   if (m_firq_vblank || (m_firq_enable && m_firq_beam))
223      machine().device("maincpu")->execute().set_input_line(1, ASSERT_LINE);
231224   else
232      machine.device("maincpu")->execute().set_input_line(1, CLEAR_LINE);
225      machine().device("maincpu")->execute().set_input_line(1, CLEAR_LINE);
233226}
234227
235228
r20821r20822
237230{
238231   /* set the FIRQ line on a VBLANK */
239232   m_firq_vblank = 1;
240   exidy440_update_firq(machine());
233   exidy440_update_firq();
241234}
242235
243236
r20821r20822
254247   if (m_firq_select && m_firq_enable)
255248   {
256249      m_firq_beam = 1;
257      exidy440_update_firq(machine());
250      exidy440_update_firq();
258251   }
259252
260253   /* round the x value to the nearest byte */
r20821r20822
271264   if (!m_firq_select && m_firq_enable)
272265   {
273266      m_firq_beam = 1;
274      exidy440_update_firq(machine());
267      exidy440_update_firq();
275268   }
276269
277270   /* round the x value to the nearest byte */
trunk/src/mame/video/exprraid.c
r20821r20822
8787   m_fg_tilemap->set_transparent_pen(0);
8888}
8989
90static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
90void exprraid_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
9191{
92   exprraid_state *state = machine.driver_data<exprraid_state>();
9392   int offs;
9493
95   for (offs = 0; offs < state->m_spriteram.bytes(); offs += 4)
94   for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
9695   {
97      int attr = state->m_spriteram[offs + 1];
98      int code = state->m_spriteram[offs + 3] + ((attr & 0xe0) << 3);
96      int attr = m_spriteram[offs + 1];
97      int code = m_spriteram[offs + 3] + ((attr & 0xe0) << 3);
9998      int color = (attr & 0x03) + ((attr & 0x08) >> 1);
10099      int flipx = (attr & 0x04);
101100      int flipy = 0;
102      int sx = ((248 - state->m_spriteram[offs + 2]) & 0xff) - 8;
103      int sy = state->m_spriteram[offs];
101      int sx = ((248 - m_spriteram[offs + 2]) & 0xff) - 8;
102      int sy = m_spriteram[offs];
104103
105      if (state->flip_screen())
104      if (flip_screen())
106105      {
107106         sx = 240 - sx;
108107         sy = 240 - sy;
r20821r20822
110109         flipy = !flipy;
111110      }
112111
113      drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
112      drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
114113         code, color,
115114         flipx, flipy,
116115         sx, sy, 0);
r20821r20822
119118
120119      if (attr & 0x10)
121120      {
122         drawgfx_transpen(bitmap,cliprect, machine.gfx[1],
121         drawgfx_transpen(bitmap,cliprect, machine().gfx[1],
123122            code + 1, color,
124123            flipx, flipy,
125            sx, sy + (state->flip_screen() ? -16 : 16), 0);
124            sx, sy + (flip_screen() ? -16 : 16), 0);
126125      }
127126   }
128127}
r20821r20822
130129UINT32 exprraid_state::screen_update_exprraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
131130{
132131   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
133   draw_sprites(machine(), bitmap, cliprect);
132   draw_sprites(bitmap, cliprect);
134133   m_bg_tilemap->draw(bitmap, cliprect, 1, 0);
135134   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
136135   return 0;
trunk/src/mame/video/epos.c
r20821r20822
2222
2323***************************************************************************/
2424
25static void get_pens( running_machine &machine, pen_t *pens )
25void epos_state::get_pens( pen_t *pens )
2626{
2727   offs_t i;
28   const UINT8 *prom = machine.root_device().memregion("proms")->base();
29   int len = machine.root_device().memregion("proms")->bytes();
28   const UINT8 *prom = machine().root_device().memregion("proms")->base();
29   int len = machine().root_device().memregion("proms")->bytes();
3030
3131   for (i = 0; i < len; i++)
3232   {
r20821r20822
7676   pen_t pens[0x20];
7777   offs_t offs;
7878
79   get_pens(machine(), pens);
79   get_pens(pens);
8080
8181   for (offs = 0; offs < m_videoram.bytes(); offs++)
8282   {
trunk/src/mame/video/equites.c
r20821r20822
244244 *
245245 *************************************/
246246
247static void equites_draw_sprites_block( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int end )
247void equites_state::equites_draw_sprites_block( bitmap_ind16 &bitmap, const rectangle &cliprect, int start, int end )
248248{
249   equites_state *state = machine.driver_data<equites_state>();
250249   int offs;
251250
252251   for (offs = end - 2; offs >= start; offs -= 2)
253252   {
254      int attr = state->m_spriteram[offs + 1];
253      int attr = m_spriteram[offs + 1];
255254      if (!(attr & 0x800))    // disable or x MSB?
256255      {
257256         int tile = attr & 0x1ff;
258257         int fx = ~attr & 0x400;
259258         int fy = ~attr & 0x200;
260259         int color = (~attr & 0xf000) >> 12;
261         int sx = (state->m_spriteram[offs] & 0xff00) >> 8;
262         int sy = (state->m_spriteram[offs] & 0x00ff);
263         int transmask = colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0);
260         int sx = (m_spriteram[offs] & 0xff00) >> 8;
261         int sy = (m_spriteram[offs] & 0x00ff);
262         int transmask = colortable_get_transpen_mask(machine().colortable, machine().gfx[2], color, 0);
264263
265         if (state->flip_screen())
264         if (flip_screen())
266265         {
267266            sx = 240 - sx;
268267            sy = 240 - sy;
r20821r20822
276275         // sprites are 16x14 centered in a 16x16 square, so skip the first line
277276         sy += 1;
278277
279         drawgfx_transmask(bitmap,cliprect, machine.gfx[2],
278         drawgfx_transmask(bitmap,cliprect, machine().gfx[2],
280279               tile,
281280               color,
282281               fx, fy,
r20821r20822
285284   }
286285}
287286
288static void equites_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
287void equites_state::equites_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
289288{
290289   // note that we draw the sprites in three blocks; in each blocks, sprites at
291290   // a lower address have priority. This gives good priorities in gekisou.
292   equites_draw_sprites_block(machine, bitmap, cliprect, 0x000/2, 0x060/2);
293   equites_draw_sprites_block(machine, bitmap, cliprect, 0x0e0/2, 0x100/2);
294   equites_draw_sprites_block(machine, bitmap, cliprect, 0x1a4/2, 0x200/2);
291   equites_draw_sprites_block(bitmap, cliprect, 0x000/2, 0x060/2);
292   equites_draw_sprites_block(bitmap, cliprect, 0x0e0/2, 0x100/2);
293   equites_draw_sprites_block(bitmap, cliprect, 0x1a4/2, 0x200/2);
295294}
296295
297296
r20821r20822
31831703020303 03030303 03030303 03030303
319318*/
320319
321static void splndrbt_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
320void equites_state::splndrbt_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
322321{
323   equites_state *state = machine.driver_data<equites_state>();
324   const UINT8 * const xrom = state->memregion("user2")->base();
322   const UINT8 * const xrom = memregion("user2")->base();
325323   const UINT8 * const yrom = xrom + 0x100;
326   gfx_element* gfx = machine.gfx[2];
324   gfx_element* gfx = machine().gfx[2];
327325   int offs;
328326
329327   // note that sprites are actually 30x30, contained in 32x32 squares. The outer edge is not used.
330328
331329   for (offs = 0x3f; offs < 0x6f; offs += 2)   // 24 sprites
332330   {
333      int data = state->m_spriteram[offs];
331      int data = m_spriteram[offs];
334332      int fx = (data & 0x2000) >> 13;
335333      int fy = (data & 0x1000) >> 12;
336334      int tile = data & 0x007f;
337335      int scaley = (data & 0x0f00) >> 8;
338      int data2 = state->m_spriteram[offs + 1];
336      int data2 = m_spriteram[offs + 1];
339337      int color = (data2 & 0x1f00) >> 8;
340338      int sx = data2 & 0x00ff;
341      int sy = state->m_spriteram_2[offs + 0] & 0x00ff;
342      int scalex = state->m_spriteram_2[offs + 1] & 0x000f;
343      int transmask = colortable_get_transpen_mask(machine.colortable, gfx, color, 0);
339      int sy = m_spriteram_2[offs + 0] & 0x00ff;
340      int scalex = m_spriteram_2[offs + 1] & 0x000f;
341      int transmask = colortable_get_transpen_mask(machine().colortable, gfx, color, 0);
344342
345343//      const UINT8 * const xromline = xrom + (scalex << 4);
346344      const UINT8 * const yromline = yrom + (scaley << 4) + (15 - scaley);
347345      const UINT8* const srcgfx = gfx->get_data(tile);
348      const pen_t *paldata = &machine.pens[gfx->colorbase() + gfx->granularity() * color];
346      const pen_t *paldata = &machine().pens[gfx->colorbase() + gfx->granularity() * color];
349347      int x,yy;
350348
351349      sy += 16;
352350
353      if (state->flip_screen())
351      if (flip_screen())
354352      {
355353         // sx NOT inverted
356354         fx = fx ^ 1;
r20821r20822
394392}
395393
396394
397static void splndrbt_copy_bg( running_machine &machine, bitmap_ind16 &dst_bitmap, const rectangle &cliprect )
395void equites_state::splndrbt_copy_bg( bitmap_ind16 &dst_bitmap, const rectangle &cliprect )
398396{
399   equites_state *state = machine.driver_data<equites_state>();
400   bitmap_ind16 &src_bitmap = state->m_bg_tilemap->pixmap();
401   bitmap_ind8 &flags_bitmap = state->m_bg_tilemap->flagsmap();
402   const UINT8 * const xrom = state->memregion("user1")->base();
397   bitmap_ind16 &src_bitmap = m_bg_tilemap->pixmap();
398   bitmap_ind8 &flags_bitmap = m_bg_tilemap->flagsmap();
399   const UINT8 * const xrom = memregion("user1")->base();
403400   const UINT8 * const yrom = xrom + 0x2000;
404   int scroll_x = state->m_splndrbt_bg_scrollx;
405   int scroll_y = state->m_splndrbt_bg_scrolly;
406   int const dinvert = state->flip_screen() ? 0xff : 0x00;
401   int scroll_x = m_splndrbt_bg_scrollx;
402   int scroll_y = m_splndrbt_bg_scrolly;
403   int const dinvert = flip_screen() ? 0xff : 0x00;
407404   int src_y = 0;
408405   int dst_y;
409406
410   if (state->flip_screen())
407   if (flip_screen())
411408   {
412409      scroll_x = -scroll_x - 8;
413410      scroll_y = -scroll_y;
r20821r20822
455452
456453   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
457454
458   equites_draw_sprites(machine(), bitmap, cliprect);
455   equites_draw_sprites(bitmap, cliprect);
459456
460457   m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
461458
r20821r20822
466463{
467464   bitmap.fill(m_bgcolor, cliprect);
468465
469   splndrbt_copy_bg(machine(), bitmap, cliprect);
466   splndrbt_copy_bg(bitmap, cliprect);
470467
471468   if (m_fg_char_bank)
472469      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
473470
474   splndrbt_draw_sprites(machine(), bitmap, cliprect);
471   splndrbt_draw_sprites(bitmap, cliprect);
475472
476473   if (!m_fg_char_bank)
477474      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
trunk/src/mame/video/exerion.c
r20821r20822
231231 *
232232 *************************************/
233233
234static void draw_background( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
234void exerion_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect)
235235{
236   exerion_state *state = machine.driver_data<exerion_state>();
237236   int x, y;
238237
239238   /* loop over all visible scanlines */
240239   for (y = cliprect.min_y; y <= cliprect.max_y; y++)
241240   {
242      UINT16 *src0 = &state->m_background_gfx[0][state->m_background_latches[1] * 256];
243      UINT16 *src1 = &state->m_background_gfx[1][state->m_background_latches[3] * 256];
244      UINT16 *src2 = &state->m_background_gfx[2][state->m_background_latches[5] * 256];
245      UINT16 *src3 = &state->m_background_gfx[3][state->m_background_latches[7] * 256];
246      int xoffs0 = state->m_background_latches[0];
247      int xoffs1 = state->m_background_latches[2];
248      int xoffs2 = state->m_background_latches[4];
249      int xoffs3 = state->m_background_latches[6];
250      int start0 = state->m_background_latches[8] & 0x0f;
251      int start1 = state->m_background_latches[9] & 0x0f;
252      int start2 = state->m_background_latches[10] & 0x0f;
253      int start3 = state->m_background_latches[11] & 0x0f;
254      int stop0 = state->m_background_latches[8] >> 4;
255      int stop1 = state->m_background_latches[9] >> 4;
256      int stop2 = state->m_background_latches[10] >> 4;
257      int stop3 = state->m_background_latches[11] >> 4;
258      UINT8 *mixer = &state->m_background_mixer[(state->m_background_latches[12] << 4) & 0xf0];
241      UINT16 *src0 = &m_background_gfx[0][m_background_latches[1] * 256];
242      UINT16 *src1 = &m_background_gfx[1][m_background_latches[3] * 256];
243      UINT16 *src2 = &m_background_gfx[2][m_background_latches[5] * 256];
244      UINT16 *src3 = &m_background_gfx[3][m_background_latches[7] * 256];
245      int xoffs0 = m_background_latches[0];
246      int xoffs1 = m_background_latches[2];
247      int xoffs2 = m_background_latches[4];
248      int xoffs3 = m_background_latches[6];
249      int start0 = m_background_latches[8] & 0x0f;
250      int start1 = m_background_latches[9] & 0x0f;
251      int start2 = m_background_latches[10] & 0x0f;
252      int start3 = m_background_latches[11] & 0x0f;
253      int stop0 = m_background_latches[8] >> 4;
254      int stop1 = m_background_latches[9] >> 4;
255      int stop2 = m_background_latches[10] >> 4;
256      int stop3 = m_background_latches[11] >> 4;
257      UINT8 *mixer = &m_background_mixer[(m_background_latches[12] << 4) & 0xf0];
259258      UINT16 scanline[VISIBLE_X_MAX];
260      pen_t pen_base = 0x200 + ((state->m_background_latches[12] >> 4) << 4);
259      pen_t pen_base = 0x200 + ((m_background_latches[12] >> 4) << 4);
261260
262261      /* the cocktail flip flag controls whether we count up or down in X */
263      if (!state->m_cocktail_flip)
262      if (!m_cocktail_flip)
264263      {
265264         /* skip processing anything that's not visible */
266265         for (x = BACKGROUND_X_START; x < cliprect.min_x; x++)
r20821r20822
352351   int sx, sy, offs, i;
353352
354353   /* draw background */
355   draw_background(machine(), bitmap, cliprect);
354   draw_background(bitmap, cliprect);
356355
357356   /* draw sprites */
358357   for (i = 0; i < m_spriteram.bytes(); i += 4)
trunk/src/mame/video/exedexes.c
r20821r20822
174174   colortable_configure_tilemap_groups(machine().colortable, m_tx_tilemap, machine().gfx[0], 0xcf);
175175}
176176
177static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
177void exedexes_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority )
178178{
179   exedexes_state *state = machine.driver_data<exedexes_state>();
180   UINT8 *buffered_spriteram = state->m_spriteram->buffer();
179   UINT8 *buffered_spriteram = m_spriteram->buffer();
181180   int offs;
182181
183   if (!state->m_objon)
182   if (!m_objon)
184183      return;
185184
186185   priority = priority ? 0x40 : 0x00;
187186
188   for (offs = state->m_spriteram->bytes() - 32;offs >= 0;offs -= 32)
187   for (offs = m_spriteram->bytes() - 32;offs >= 0;offs -= 32)
189188   {
190189      if ((buffered_spriteram[offs + 1] & 0x40) == priority)
191190      {
r20821r20822
198197         sx = buffered_spriteram[offs + 3] - ((buffered_spriteram[offs + 1] & 0x80) << 1);
199198         sy = buffered_spriteram[offs + 2];
200199
201         drawgfx_transpen(bitmap,cliprect,machine.gfx[3],
200         drawgfx_transpen(bitmap,cliprect,machine().gfx[3],
202201               code,
203202               color,
204203               flipx,flipy,
r20821r20822
217216   else
218217      bitmap.fill(0, cliprect);
219218
220   draw_sprites(machine(), bitmap, cliprect, 1);
219   draw_sprites(bitmap, cliprect, 1);
221220
222221   if (m_sc1on)
223222   {
r20821r20822
226225      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
227226   }
228227
229   draw_sprites(machine(), bitmap, cliprect, 0);
228   draw_sprites(bitmap, cliprect, 0);
230229
231230   if (m_chon)
232231      m_tx_tilemap->draw(bitmap, cliprect, 0, 0);
trunk/src/mame/video/exidy.c
r20821r20822
1515 *
1616 *************************************/
1717
18void exidy_video_config(running_machine &machine, UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp)
18void exidy_state::exidy_video_config(UINT8 _collision_mask, UINT8 _collision_invert, int _is_2bpp)
1919{
20   exidy_state *state = machine.driver_data<exidy_state>();
21   state->m_collision_mask   = _collision_mask;
22   state->m_collision_invert = _collision_invert;
23   state->m_is_2bpp             = _is_2bpp;
20   m_collision_mask   = _collision_mask;
21   m_collision_invert = _collision_invert;
22   m_is_2bpp             = _is_2bpp;
2423}
2524
2625
r20821r20822
5655 *
5756 *************************************/
5857
59INLINE void latch_condition(running_machine &machine, int collision)
58inline void exidy_state::latch_condition(int collision)
6059{
61   exidy_state *state = machine.driver_data<exidy_state>();
62   collision ^= state->m_collision_invert;
63   state->m_int_condition = (state->ioport("INTSOURCE")->read() & ~0x1c) | (collision & state->m_collision_mask);
60   collision ^= m_collision_invert;
61   m_int_condition = (ioport("INTSOURCE")->read() & ~0x1c) | (collision & m_collision_mask);
6462}
6563
6664
6765INTERRUPT_GEN_MEMBER(exidy_state::exidy_vblank_interrupt)
6866{
6967   /* latch the current condition */
70   latch_condition(machine(), 0);
68   latch_condition(0);
7169   m_int_condition &= ~0x80;
7270
7371   /* set the IRQ line */
r20821r20822
9391 *
9492 *************************************/
9593
96INLINE void set_1_color(running_machine &machine, int index, int which)
94inline void exidy_state::set_1_color(int index, int which)
9795{
98   exidy_state *state = machine.driver_data<exidy_state>();
99   palette_set_color_rgb(machine, index,
100                     pal1bit(state->m_color_latch[2] >> which),
101                     pal1bit(state->m_color_latch[1] >> which),
102                     pal1bit(state->m_color_latch[0] >> which));
96   palette_set_color_rgb(machine(), index,
97                     pal1bit(m_color_latch[2] >> which),
98                     pal1bit(m_color_latch[1] >> which),
99                     pal1bit(m_color_latch[0] >> which));
103100}
104101
105static void set_colors(running_machine &machine)
102void exidy_state::set_colors()
106103{
107104   /* motion object 1 */
108   set_1_color(machine, 0, 0);
109   set_1_color(machine, 1, 7);
105   set_1_color(0, 0);
106   set_1_color(1, 7);
110107
111108   /* motion object 2 */
112   set_1_color(machine, 2, 0);
113   set_1_color(machine, 3, 6);
109   set_1_color(2, 0);
110   set_1_color(3, 6);
114111
115112   /* characters */
116   set_1_color(machine, 4, 4);
117   set_1_color(machine, 5, 3);
118   set_1_color(machine, 6, 2);
119   set_1_color(machine, 7, 1);
113   set_1_color(4, 4);
114   set_1_color(5, 3);
115   set_1_color(6, 2);
116   set_1_color(7, 1);
120117}
121118
122119
r20821r20822
127124 *
128125 *************************************/
129126
130static void draw_background(running_machine &machine)
127void exidy_state::draw_background()
131128{
132   exidy_state *state = machine.driver_data<exidy_state>();
133129   offs_t offs;
134130
135131   pen_t off_pen = 0;
r20821r20822
140136      pen_t on_pen_1, on_pen_2;
141137
142138      UINT8 y = offs >> 5 << 3;
143      UINT8 code = state->m_videoram[offs];
139      UINT8 code = m_videoram[offs];
144140
145      if (state->m_is_2bpp)
141      if (m_is_2bpp)
146142      {
147143         on_pen_1 = 4 + ((code >> 6) & 0x02);
148144         on_pen_2 = 5 + ((code >> 6) & 0x02);
r20821r20822
158154         int i;
159155         UINT8 x = offs << 3;
160156
161         if (state->m_is_2bpp)
157         if (m_is_2bpp)
162158         {
163            UINT8 data1 = state->m_characterram[0x000 | (code << 3) | cy];
164            UINT8 data2 = state->m_characterram[0x800 | (code << 3) | cy];
159            UINT8 data1 = m_characterram[0x000 | (code << 3) | cy];
160            UINT8 data2 = m_characterram[0x800 | (code << 3) | cy];
165161
166162            for (i = 0; i < 8; i++)
167163            {
168164               if (data1 & 0x80)
169                  state->m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1;
165                  m_background_bitmap.pix16(y, x) = (data2 & 0x80) ? on_pen_2 : on_pen_1;
170166               else
171                  state->m_background_bitmap.pix16(y, x) = off_pen;
167                  m_background_bitmap.pix16(y, x) = off_pen;
172168
173169               x = x + 1;
174170               data1 = data1 << 1;
r20821r20822
178174         /* 1bpp */
179175         else
180176         {
181            UINT8 data = state->m_characterram[(code << 3) | cy];
177            UINT8 data = m_characterram[(code << 3) | cy];
182178
183179            for (i = 0; i < 8; i++)
184180            {
185               state->m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen;
181               m_background_bitmap.pix16(y, x) = (data & 0x80) ? on_pen_1 : off_pen;
186182
187183               x = x + 1;
188184               data = data << 1;
r20821r20822
202198 *
203199 *************************************/
204200
205INLINE int sprite_1_enabled(exidy_state *state)
201inline int exidy_state::sprite_1_enabled()
206202{
207203   /* if the collision_mask is 0x00, then we are on old hardware that always has */
208204   /* sprite 1 enabled regardless */
209   return (!(*state->m_sprite_enable & 0x80) || (*state->m_sprite_enable & 0x10) || (state->m_collision_mask == 0x00));
205   return (!(*m_sprite_enable & 0x80) || (*m_sprite_enable & 0x10) || (m_collision_mask == 0x00));
210206}
211207
212208
213static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
209void exidy_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
214210{
215   exidy_state *state = machine.driver_data<exidy_state>();
216211   /* draw sprite 2 first */
217   int sprite_set_2 = ((*state->m_sprite_enable & 0x40) != 0);
212   int sprite_set_2 = ((*m_sprite_enable & 0x40) != 0);
218213
219   int sx = 236 - *state->m_sprite2_xpos - 4;
220   int sy = 244 - *state->m_sprite2_ypos - 4;
214   int sx = 236 - *m_sprite2_xpos - 4;
215   int sy = 244 - *m_sprite2_ypos - 4;
221216
222   drawgfx_transpen(bitmap, cliprect, machine.gfx[0],
223         ((*state->m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1,
217   drawgfx_transpen(bitmap, cliprect, machine().gfx[0],
218         ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 1,
224219         0, 0, sx, sy, 0);
225220
226221   /* draw sprite 1 next */
227   if (sprite_1_enabled(state))
222   if (sprite_1_enabled())
228223   {
229      int sprite_set_1 = ((*state->m_sprite_enable & 0x20) != 0);
224      int sprite_set_1 = ((*m_sprite_enable & 0x20) != 0);
230225
231      sx = 236 - *state->m_sprite1_xpos - 4;
232      sy = 244 - *state->m_sprite1_ypos - 4;
226      sx = 236 - *m_sprite1_xpos - 4;
227      sy = 244 - *m_sprite1_ypos - 4;
233228
234229      if (sy < 0) sy = 0;
235230
236      drawgfx_transpen(bitmap, cliprect, machine.gfx[0],
237            (*state->m_spriteno & 0x0f) + 16 * sprite_set_1, 0,
231      drawgfx_transpen(bitmap, cliprect, machine().gfx[0],
232            (*m_spriteno & 0x0f) + 16 * sprite_set_1, 0,
238233            0, 0, sx, sy, 0);
239234   }
240235
r20821r20822
263258TIMER_CALLBACK_MEMBER(exidy_state::collision_irq_callback)
264259{
265260   /* latch the collision bits */
266   latch_condition(machine(), param);
261   latch_condition(param);
267262
268263   /* set the IRQ line */
269264   machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
270265}
271266
272267
273static void check_collision(running_machine &machine)
268void exidy_state::check_collision()
274269{
275   exidy_state *state = machine.driver_data<exidy_state>();
276   UINT8 sprite_set_1 = ((*state->m_sprite_enable & 0x20) != 0);
277   UINT8 sprite_set_2 = ((*state->m_sprite_enable & 0x40) != 0);
270   UINT8 sprite_set_1 = ((*m_sprite_enable & 0x20) != 0);
271   UINT8 sprite_set_2 = ((*m_sprite_enable & 0x40) != 0);
278272   const rectangle clip(0, 15, 0, 15);
279273   int org_1_x = 0, org_1_y = 0;
280274   int org_2_x = 0, org_2_y = 0;
r20821r20822
282276   int count = 0;
283277
284278   /* if there is nothing to detect, bail */
285   if (state->m_collision_mask == 0)
279   if (m_collision_mask == 0)
286280      return;
287281
288282   /* draw sprite 1 */
289   state->m_motion_object_1_vid.fill(0xff, clip);
290   if (sprite_1_enabled(state))
283   m_motion_object_1_vid.fill(0xff, clip);
284   if (sprite_1_enabled())
291285   {
292      org_1_x = 236 - *state->m_sprite1_xpos - 4;
293      org_1_y = 244 - *state->m_sprite1_ypos - 4;
294      drawgfx_transpen(state->m_motion_object_1_vid, clip, machine.gfx[0],
295            (*state->m_spriteno & 0x0f) + 16 * sprite_set_1, 0,
286      org_1_x = 236 - *m_sprite1_xpos - 4;
287      org_1_y = 244 - *m_sprite1_ypos - 4;
288      drawgfx_transpen(m_motion_object_1_vid, clip, machine().gfx[0],
289            (*m_spriteno & 0x0f) + 16 * sprite_set_1, 0,
296290            0, 0, 0, 0, 0);
297291   }
298292
299293   /* draw sprite 2 */
300   state->m_motion_object_2_vid.fill(0xff, clip);
301   org_2_x = 236 - *state->m_sprite2_xpos - 4;
302   org_2_y = 244 - *state->m_sprite2_ypos - 4;
303   drawgfx_transpen(state->m_motion_object_2_vid, clip, machine.gfx[0],
304         ((*state->m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
294   m_motion_object_2_vid.fill(0xff, clip);
295   org_2_x = 236 - *m_sprite2_xpos - 4;
296   org_2_y = 244 - *m_sprite2_ypos - 4;
297   drawgfx_transpen(m_motion_object_2_vid, clip, machine().gfx[0],
298         ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
305299         0, 0, 0, 0, 0);
306300
307301   /* draw sprite 2 clipped to sprite 1's location */
308   state->m_motion_object_2_clip.fill(0xff, clip);
309   if (sprite_1_enabled(state))
302   m_motion_object_2_clip.fill(0xff, clip);
303   if (sprite_1_enabled())
310304   {
311305      sx = org_2_x - org_1_x;
312306      sy = org_2_y - org_1_y;
313      drawgfx_transpen(state->m_motion_object_2_clip, clip, machine.gfx[0],
314            ((*state->m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
307      drawgfx_transpen(m_motion_object_2_clip, clip, machine().gfx[0],
308            ((*m_spriteno >> 4) & 0x0f) + 32 + 16 * sprite_set_2, 0,
315309            0, 0, sx, sy, 0);
316310   }
317311
r20821r20822
319313   for (sy = 0; sy < 16; sy++)
320314      for (sx = 0; sx < 16; sx++)
321315      {
322         if (state->m_motion_object_1_vid.pix16(sy, sx) != 0xff)
316         if (m_motion_object_1_vid.pix16(sy, sx) != 0xff)
323317         {
324318            UINT8 current_collision_mask = 0;
325319
326320            /* check for background collision (M1CHAR) */
327            if (state->m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0)
321            if (m_background_bitmap.pix16(org_1_y + sy, org_1_x + sx) != 0)
328322               current_collision_mask |= 0x04;
329323
330324            /* check for motion object collision (M1M2) */
331            if (state->m_motion_object_2_clip.pix16(sy, sx) != 0xff)
325            if (m_motion_object_2_clip.pix16(sy, sx) != 0xff)
332326               current_collision_mask |= 0x10;
333327
334328            /* if we got one, trigger an interrupt */
335            if ((current_collision_mask & state->m_collision_mask) && (count++ < 128))
336               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);
329            if ((current_collision_mask & m_collision_mask) && (count++ < 128))
330               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);
337331         }
338332
339         if (state->m_motion_object_2_vid.pix16(sy, sx) != 0xff)
333         if (m_motion_object_2_vid.pix16(sy, sx) != 0xff)
340334         {
341335            /* check for background collision (M2CHAR) */
342            if (state->m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0)
343               if ((state->m_collision_mask & 0x08) && (count++ < 128))
344                  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);
336            if (m_background_bitmap.pix16(org_2_y + sy, org_2_x + sx) != 0)
337               if ((m_collision_mask & 0x08) && (count++ < 128))
338                  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);
345339         }
346340      }
347341}
r20821r20822
357351UINT32 exidy_state::screen_update_exidy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
358352{
359353   /* refresh the colors from the palette (static or dynamic) */
360   set_colors(machine());
354   set_colors();
361355
362356   /* update the background and draw it */
363   draw_background(machine());
357   draw_background();
364358   copybitmap(bitmap, m_background_bitmap, 0, 0, 0, 0, cliprect);
365359
366360   /* draw the sprites */
367   draw_sprites(machine(), bitmap, cliprect);
361   draw_sprites(bitmap, cliprect);
368362
369363   /* check for collision, this will set the appropriate bits in collision_mask */
370   check_collision(machine());
364   check_collision();
371365
372366   return 0;
373367}

Previous 199869 Revisions Next


© 1997-2024 The MAME Team