Previous 199869 Revisions Next

r21024 Wednesday 13th February, 2013 at 10:46:49 UTC by Miodrag Milanović
Modernization of drivers part 20 (no whatsnew)
[src/mame/drivers]vball.c vendetta.c vicdual.c videopin.c volfied.c
[src/mame/includes]undrfire.h unico.h vaportra.h vastar.h vball.h vectrex.h vendetta.h vertigo.h vicdual.h victory.h videopin.h vigilant.h volfied.h vsnes.h vulgus.h
[src/mame/machine]vectrex.c vertigo.c volfied.c vsnes.c
[src/mame/video]undrfire.c unico.c vaportra.c vastar.c vball.c vertigo.c vicdual.c victory.c vigilant.c volfied.c vulgus.c

trunk/src/mame/drivers/vendetta.c
r21023r21024
9999
100100/* prototypes */
101101static KONAMI_SETLINES_CALLBACK( vendetta_banking );
102static void vendetta_video_banking( running_machine &machine, int select );
103102
104103/***************************************************************************
105104
r21023r21024
138137
139138   m_irq_enabled = (data >> 6) & 1;
140139
141   vendetta_video_banking(machine(), data & 1);
140   vendetta_video_banking(data & 1);
142141}
143142
144143/********************************************/
r21023r21024
160159}
161160
162161
163static void vendetta_video_banking( running_machine &machine, int select )
162void vendetta_state::vendetta_video_banking( int select )
164163{
165   vendetta_state *state = machine.driver_data<vendetta_state>();
166   address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM);
164   address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM);
167165
168166   if (select & 1)
169167   {
170      space.install_read_bank(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, "bank4" );
171      space.install_write_handler(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, write8_delegate(FUNC(vendetta_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state) );
172      space.install_legacy_readwrite_handler(*state->m_k053246, state->m_video_banking_base + 0x0000, state->m_video_banking_base + 0x0fff, FUNC(k053247_r), FUNC(k053247_w) );
173      state->membank("bank4")->set_base(state->m_generic_paletteram_8);
168      space.install_read_bank(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, "bank4" );
169      space.install_write_handler(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, write8_delegate(FUNC(vendetta_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), this) );
170      space.install_legacy_readwrite_handler(*m_k053246, m_video_banking_base + 0x0000, m_video_banking_base + 0x0fff, FUNC(k053247_r), FUNC(k053247_w) );
171      membank("bank4")->set_base(m_generic_paletteram_8);
174172   }
175173   else
176174   {
177      space.install_readwrite_handler(state->m_video_banking_base + 0x2000, state->m_video_banking_base + 0x2fff, read8_delegate(FUNC(vendetta_state::vendetta_K052109_r),state), write8_delegate(FUNC(vendetta_state::vendetta_K052109_w),state) );
178      space.install_legacy_readwrite_handler(*state->m_k052109, state->m_video_banking_base + 0x0000, state->m_video_banking_base + 0x0fff, FUNC(k052109_r), FUNC(k052109_w) );
175      space.install_readwrite_handler(m_video_banking_base + 0x2000, m_video_banking_base + 0x2fff, read8_delegate(FUNC(vendetta_state::vendetta_K052109_r),this), write8_delegate(FUNC(vendetta_state::vendetta_K052109_w),this) );
176      space.install_legacy_readwrite_handler(*m_k052109, m_video_banking_base + 0x0000, m_video_banking_base + 0x0fff, FUNC(k052109_r), FUNC(k052109_w) );
179177   }
180178}
181179
r21023r21024
492490   m_irq_enabled = 0;
493491
494492   /* init banks */
495   vendetta_video_banking(machine(), 0);
493   vendetta_video_banking(0);
496494}
497495
498496static MACHINE_CONFIG_START( vendetta, vendetta_state )
trunk/src/mame/drivers/vicdual.c
r21023r21024
135135 *
136136 *************************************/
137137
138static int get_vcounter(running_machine &machine)
138int vicdual_state::get_vcounter()
139139{
140   int vcounter = machine.primary_screen->vpos();
140   int vcounter = machine().primary_screen->vpos();
141141
142142   /* the vertical synch counter gets incremented at the end of HSYNC,
143143      compensate for this */
144   if (machine.primary_screen->hpos() >= VICDUAL_HSEND)
144   if (machine().primary_screen->hpos() >= VICDUAL_HSEND)
145145      vcounter = (vcounter + 1) % VICDUAL_VTOTAL;
146146
147147   return vcounter;
r21023r21024
150150
151151CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_get_64v)
152152{
153   return (get_vcounter(machine()) >> 6) & 0x01;
153   return (get_vcounter() >> 6) & 0x01;
154154}
155155
156156
157157CUSTOM_INPUT_MEMBER(vicdual_state::vicdual_get_vblank_comp)
158158{
159   return (get_vcounter(machine()) < VICDUAL_VBSTART);
159   return (get_vcounter() < VICDUAL_VBSTART);
160160}
161161
162162
r21023r21024
182182#define COLOR_BW_PORT_TAG       "COLOR_BW"
183183
184184
185int vicdual_is_cabinet_color(running_machine &machine)
185int vicdual_state::vicdual_is_cabinet_color()
186186{
187   return (machine.root_device().ioport(COLOR_BW_PORT_TAG)->read_safe(0) & 1) ? 0 : 1;
187   return (machine().root_device().ioport(COLOR_BW_PORT_TAG)->read_safe(0) & 1) ? 0 : 1;
188188}
189189
190190
trunk/src/mame/drivers/vball.c
r21023r21024
9494#define PIXEL_CLOCK     MAIN_CLOCK / 2
9595
9696/* Based on ddragon driver */
97INLINE int scanline_to_vcount(int scanline)
97inline int vball_state::scanline_to_vcount(int scanline)
9898{
9999   int vcount = scanline + 8;
100100   if (vcount < 0x100)
r21023r21024
162162   if (m_gfxset != ((data  & 0x20) ^ 0x20))
163163   {
164164      m_gfxset = (data  & 0x20) ^ 0x20;
165         vb_mark_all_dirty(machine());
165         vb_mark_all_dirty();
166166   }
167167   m_vb_scrolly_hi = (data & 0x40) << 2;
168168}
r21023r21024
188188{
189189   flip_screen_set(~data&1);
190190   m_vb_scrollx_hi = (data & 0x02) << 7;
191   vb_bgprombank_w(machine(), (data >> 2) & 0x07);
192   vb_spprombank_w(machine(), (data >> 5) & 0x07);
191   vb_bgprombank_w((data >> 2) & 0x07);
192   vb_spprombank_w((data >> 5) & 0x07);
193193   //logerror("%04x: vb_scrollx_hi = %d\n", space.device().safe_pcbase(), m_vb_scrollx_hi);
194194}
195195
trunk/src/mame/drivers/videopin.c
r21023r21024
2222
2323
2424
25static void update_plunger(running_machine &machine)
25void videopin_state::update_plunger()
2626{
27   videopin_state *state = machine.driver_data<videopin_state>();
28   UINT8 val = state->ioport("IN2")->read();
27   UINT8 val = ioport("IN2")->read();
2928
30   if (state->m_prev != val)
29   if (m_prev != val)
3130   {
3231      if (val == 0)
3332      {
34         state->m_time_released = machine.time();
33         m_time_released = machine().time();
3534
36         if (!state->m_mask)
37            machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
35         if (!m_mask)
36            machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
3837      }
3938      else
40         state->m_time_pushed = machine.time();
39         m_time_pushed = machine().time();
4140
42      state->m_prev = val;
41      m_prev = val;
4342   }
4443}
4544
r21023r21024
4847{
4948   int scanline = param;
5049
51   update_plunger(machine());
50   update_plunger();
5251
5352   machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
5453
r21023r21024
7271}
7372
7473
75static double calc_plunger_pos(running_machine &machine)
74double videopin_state::calc_plunger_pos()
7675{
77   videopin_state *state = machine.driver_data<videopin_state>();
78   return (machine.time().as_double() - state->m_time_released.as_double()) * (state->m_time_released.as_double() - state->m_time_pushed.as_double() + 0.2);
76   return (machine().time().as_double() - m_time_released.as_double()) * (m_time_released.as_double() - m_time_pushed.as_double() + 0.2);
7977}
8078
8179
8280READ8_MEMBER(videopin_state::videopin_misc_r)
8381{
84   double plunger = calc_plunger_pos(machine());
82   double plunger = calc_plunger_pos();
8583
8684   // The plunger of the ball shooter has a black piece of
8785   // plastic (flag) attached to it. When the plunger flag passes
trunk/src/mame/drivers/volfied.c
r21023r21024
233233
234234void volfied_state::machine_start()
235235{
236   volfied_cchip_init(machine());
236   volfied_cchip_init();
237237
238238   m_maincpu = machine().device<cpu_device>("maincpu");
239239   m_audiocpu = machine().device<cpu_device>("audiocpu");
r21023r21024
242242
243243void volfied_state::machine_reset()
244244{
245   volfied_cchip_reset(machine());
245   volfied_cchip_reset();
246246}
247247
248248static const pc090oj_interface volfied_pc090oj_intf =
trunk/src/mame/machine/vectrex.c
r21023r21024
4848static const double unknown_game_angles[3] = {0,0.16666666, 0.33333333};
4949
5050
51static int vectrex_verify_cart(char *data)
51int vectrex_state::vectrex_verify_cart(char *data)
5252{
5353   /* Verify the file is accepted by the Vectrex bios */
5454   if (!memcmp(data,"g GCE", 5))
trunk/src/mame/machine/vsnes.c
r21023r21024
163163 *
164164 *************************************/
165165
166static void v_set_videorom_bank( running_machine& machine, int start, int count, int vrom_start_bank )
166void vsnes_state::v_set_videorom_bank(  int start, int count, int vrom_start_bank )
167167{
168   vsnes_state *state = machine.driver_data<vsnes_state>();
169168   int i;
170169
171170   assert(start + count <= 8);
172171
173   vrom_start_bank &= (state->m_vrom_banks - 1);
174   assert(vrom_start_bank + count <= state->m_vrom_banks);
172   vrom_start_bank &= (m_vrom_banks - 1);
173   assert(vrom_start_bank + count <= m_vrom_banks);
175174
176175   /* bank_size_in_kb is used to determine how large the "bank" parameter is */
177176   /* count determines the size of the area mapped */
178177   for (i = 0; i < count; i++)
179178   {
180      state->membank(chr_banknames[i + start])->set_entry(vrom_start_bank + i);
179      membank(chr_banknames[i + start])->set_entry(vrom_start_bank + i);
181180   }
182181}
183182
r21023r21024
210209         ppu1_space.install_read_bank(0x0400 * i, 0x0400 * i + 0x03ff, chr_banknames[i]);
211210         membank(chr_banknames[i])->configure_entries(0, m_vrom_banks, m_vrom[0], 0x400);
212211      }
213      v_set_videorom_bank(machine(), 0, 8, 0);
212      v_set_videorom_bank(0, 8, 0);
214213   }
215214   else
216215   {
r21023r21024
325324WRITE8_MEMBER(vsnes_state::vsnormal_vrom_banking)
326325{
327326   /* switch vrom */
328   v_set_videorom_bank(machine(), 0, 8, (data & 4) ? 8 : 0);
327   v_set_videorom_bank(0, 8, (data & 4) ? 8 : 0);
329328
330329   /* bit 1 ( data & 2 ) enables writes to extra ram, we ignore it */
331330
r21023r21024
349348   if (m_do_vrom_bank)
350349   {
351350      /* switch vrom */
352      v_set_videorom_bank(machine(), 0, 8, (data & 4) ? 8 : 0);
351      v_set_videorom_bank(0, 8, (data & 4) ? 8 : 0);
353352   }
354353
355354   /* here we do things a little different */
r21023r21024
415414      break;
416415
417416      case 6: /* vrom bank 0 */
418         v_set_videorom_bank(machine(), 0, 4, data * 4);
417         v_set_videorom_bank(0, 4, data * 4);
419418      break;
420419
421420      case 7: /* vrom bank 1 */
422         v_set_videorom_bank(machine(), 4, 4, data * 4);
421         v_set_videorom_bank(4, 4, data * 4);
423422      break;
424423   }
425424}
r21023r21024
539538
540539         case 1: /* video rom banking - bank 0 - 4k or 8k */
541540            if (!m_vram)
542               v_set_videorom_bank(machine(), 0, (m_vrom4k) ? 4 : 8, m_drmario_shiftreg * 4);
541               v_set_videorom_bank(0, (m_vrom4k) ? 4 : 8, m_drmario_shiftreg * 4);
543542         break;
544543
545544         case 2: /* video rom banking - bank 1 - 4k only */
546545            if (m_vrom4k && !m_vram)
547               v_set_videorom_bank(machine(), 4, 4, m_drmario_shiftreg * 4);
546               v_set_videorom_bank(4, 4, m_drmario_shiftreg * 4);
548547         break;
549548
550549         case 3: /* program banking */
r21023r21024
621620/**********************************************************************************/
622621
623622
624static void mapper4_set_prg( running_machine &machine )
623void vsnes_state::mapper4_set_prg(  )
625624{
626   vsnes_state *state = machine.driver_data<vsnes_state>();
627   UINT8 *prg = state->memregion("maincpu")->base();
628   UINT8 prg_flip = (state->m_MMC3_cmd & 0x40) ? 2 : 0;
625   UINT8 *prg = memregion("maincpu")->base();
626   UINT8 prg_flip = (m_MMC3_cmd & 0x40) ? 2 : 0;
629627
630   memcpy(&prg[0x8000], &prg[0x2000 * (state->m_MMC3_prg_bank[0 ^ prg_flip] & state->m_MMC3_prg_mask) + 0x10000], 0x2000);
631   memcpy(&prg[0xa000], &prg[0x2000 * (state->m_MMC3_prg_bank[1] & state->m_MMC3_prg_mask) + 0x10000], 0x2000);
632   memcpy(&prg[0xc000], &prg[0x2000 * (state->m_MMC3_prg_bank[2 ^ prg_flip] & state->m_MMC3_prg_mask) + 0x10000], 0x2000);
633   memcpy(&prg[0xe000], &prg[0x2000 * (state->m_MMC3_prg_bank[3] & state->m_MMC3_prg_mask) + 0x10000], 0x2000);
628   memcpy(&prg[0x8000], &prg[0x2000 * (m_MMC3_prg_bank[0 ^ prg_flip] & m_MMC3_prg_mask) + 0x10000], 0x2000);
629   memcpy(&prg[0xa000], &prg[0x2000 * (m_MMC3_prg_bank[1] & m_MMC3_prg_mask) + 0x10000], 0x2000);
630   memcpy(&prg[0xc000], &prg[0x2000 * (m_MMC3_prg_bank[2 ^ prg_flip] & m_MMC3_prg_mask) + 0x10000], 0x2000);
631   memcpy(&prg[0xe000], &prg[0x2000 * (m_MMC3_prg_bank[3] & m_MMC3_prg_mask) + 0x10000], 0x2000);
634632}
635633
636static void mapper4_set_chr( running_machine &machine )
634void vsnes_state::mapper4_set_chr(  )
637635{
638   vsnes_state *state = machine.driver_data<vsnes_state>();
639   UINT8 chr_page = (state->m_MMC3_cmd & 0x80) >> 5;
636   UINT8 chr_page = (m_MMC3_cmd & 0x80) >> 5;
640637
641   v_set_videorom_bank(machine, chr_page ^ 0, 1, state->m_MMC3_chr_bank[0] & ~0x01);
642   v_set_videorom_bank(machine, chr_page ^ 1, 1, state->m_MMC3_chr_bank[0] |  0x01);
643   v_set_videorom_bank(machine, chr_page ^ 2, 1, state->m_MMC3_chr_bank[1] & ~0x01);
644   v_set_videorom_bank(machine, chr_page ^ 3, 1, state->m_MMC3_chr_bank[1] |  0x01);
645   v_set_videorom_bank(machine, chr_page ^ 4, 1, state->m_MMC3_chr_bank[2]);
646   v_set_videorom_bank(machine, chr_page ^ 5, 1, state->m_MMC3_chr_bank[3]);
647   v_set_videorom_bank(machine, chr_page ^ 6, 1, state->m_MMC3_chr_bank[4]);
648   v_set_videorom_bank(machine, chr_page ^ 7, 1, state->m_MMC3_chr_bank[5]);
638   v_set_videorom_bank(chr_page ^ 0, 1, m_MMC3_chr_bank[0] & ~0x01);
639   v_set_videorom_bank(chr_page ^ 1, 1, m_MMC3_chr_bank[0] |  0x01);
640   v_set_videorom_bank(chr_page ^ 2, 1, m_MMC3_chr_bank[1] & ~0x01);
641   v_set_videorom_bank(chr_page ^ 3, 1, m_MMC3_chr_bank[1] |  0x01);
642   v_set_videorom_bank(chr_page ^ 4, 1, m_MMC3_chr_bank[2]);
643   v_set_videorom_bank(chr_page ^ 5, 1, m_MMC3_chr_bank[3]);
644   v_set_videorom_bank(chr_page ^ 6, 1, m_MMC3_chr_bank[4]);
645   v_set_videorom_bank(chr_page ^ 7, 1, m_MMC3_chr_bank[5]);
649646}
650647
651648#define BOTTOM_VISIBLE_SCANLINE 239     /* The bottommost visible scanline */
r21023r21024
684681
685682         /* Has PRG Mode changed? */
686683         if (MMC3_helper & 0x40)
687            mapper4_set_prg(machine());
684            mapper4_set_prg();
688685
689686         /* Has CHR Mode changed? */
690687         if (MMC3_helper & 0x80)
691            mapper4_set_chr(machine());
688            mapper4_set_chr();
692689         break;
693690
694691      case 0x0001: /* $8001 */
r21023r21024
698695            case 0: case 1: // these do not need to be separated: we take care of them in set_chr!
699696            case 2: case 3: case 4: case 5:
700697               m_MMC3_chr_bank[cmd] = data;
701               mapper4_set_chr(machine());
698               mapper4_set_chr();
702699               break;
703700            case 6:
704701            case 7:
705702               m_MMC3_prg_bank[cmd - 6] = data;
706               mapper4_set_prg(machine());
703               mapper4_set_prg();
707704               break;
708705         }
709706         break;
r21023r21024
915912   switch (offset & 0x7000)
916913   {
917914      case 0x0000:
918      v_set_videorom_bank(machine(), 0, 2, data * 2);
915      v_set_videorom_bank(0, 2, data * 2);
919916
920917      break;
921918      case 0x1000:
922      v_set_videorom_bank(machine(), 2, 2, data * 2);
919      v_set_videorom_bank(2, 2, data * 2);
923920
924921      break;
925922      case 0x2000:
926      v_set_videorom_bank(machine(), 4, 2, data * 2);
923      v_set_videorom_bank(4, 2, data * 2);
927924
928925      break;
929926      case 0x3000: /* ok? */
930      v_set_videorom_bank(machine(), 6, 2, data * 2);
927      v_set_videorom_bank(6, 2, data * 2);
931928
932929      break;
933930
trunk/src/mame/machine/volfied.c
r21023r21024
478478 *
479479 *************************************/
480480
481void volfied_cchip_init( running_machine &machine )
481void volfied_state::volfied_cchip_init(  )
482482{
483   volfied_state *state = machine.driver_data<volfied_state>();
484483
485   state->m_cchip_ram = auto_alloc_array_clear(machine, UINT8, 0x400 * 8);
484   m_cchip_ram = auto_alloc_array_clear(machine(), UINT8, 0x400 * 8);
486485
487   state->save_item(NAME(state->m_current_bank));
488   state->save_item(NAME(state->m_current_cmd));
489   state->save_item(NAME(state->m_current_flag));
490   state->save_item(NAME(state->m_cc_port));
491   state->save_pointer(NAME(state->m_cchip_ram), 0x400 * 8);
486   save_item(NAME(m_current_bank));
487   save_item(NAME(m_current_cmd));
488   save_item(NAME(m_current_flag));
489   save_item(NAME(m_cc_port));
490   save_pointer(NAME(m_cchip_ram), 0x400 * 8);
492491}
493492
494void volfied_cchip_reset( running_machine &machine )
493void volfied_state::volfied_cchip_reset(  )
495494{
496   volfied_state *state = machine.driver_data<volfied_state>();
497495
498   state->m_current_bank = 0;
499   state->m_current_flag = 0;
500   state->m_cc_port = 0;
501   state->m_current_cmd = 0;
496   m_current_bank = 0;
497   m_current_flag = 0;
498   m_cc_port = 0;
499   m_current_cmd = 0;
502500}
trunk/src/mame/machine/vertigo.c
r21023r21024
7979}
8080
8181
82static void update_irq_encoder(running_machine &machine, int line, int state)
82void vertigo_state::update_irq_encoder(int line, int state)
8383{
84   vertigo_state *drvstate = machine.driver_data<vertigo_state>();
85   ttl74148_input_line_w(drvstate->m_ttl74148, line, !state);
86   ttl74148_update(drvstate->m_ttl74148);
84   ttl74148_input_line_w(m_ttl74148, line, !state);
85   ttl74148_update(m_ttl74148);
8786}
8887
8988
9089WRITE_LINE_MEMBER(vertigo_state::v_irq4_w)
9190{
92   update_irq_encoder(machine(), INPUT_LINE_IRQ4, state);
93   vertigo_vproc(machine(), machine().device<cpu_device>("maincpu")->attotime_to_cycles(machine().time() - m_irq4_time), state);
91   update_irq_encoder(INPUT_LINE_IRQ4, state);
92   vertigo_vproc(machine().device<cpu_device>("maincpu")->attotime_to_cycles(machine().time() - m_irq4_time), state);
9493   m_irq4_time = machine().time();
9594}
9695
r21023r21024
10099   if (state)
101100      machine().device("audiocpu")->execute().set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
102101
103   update_irq_encoder(machine(), INPUT_LINE_IRQ3, state);
102   update_irq_encoder(INPUT_LINE_IRQ3, state);
104103}
105104
106105
r21023r21024
120119   else
121120      m_adc_result = ioport(adcnames[offset])->read();
122121
123   update_irq_encoder(machine(), INPUT_LINE_IRQ2, ASSERT_LINE);
122   update_irq_encoder(INPUT_LINE_IRQ2, ASSERT_LINE);
124123   return 0;
125124}
126125
127126
128127READ16_MEMBER(vertigo_state::vertigo_io_adc)
129128{
130   update_irq_encoder(machine(), INPUT_LINE_IRQ2, CLEAR_LINE);
129   update_irq_encoder(INPUT_LINE_IRQ2, CLEAR_LINE);
131130   return m_adc_result;
132131}
133132
134133
135134READ16_MEMBER(vertigo_state::vertigo_coin_r)
136135{
137   update_irq_encoder(machine(), INPUT_LINE_IRQ6, CLEAR_LINE);
136   update_irq_encoder(INPUT_LINE_IRQ6, CLEAR_LINE);
138137   return (ioport("COIN")->read());
139138}
140139
r21023r21024
143142{
144143   /* Coin inputs cause IRQ6 */
145144   if ((machine().root_device().ioport("COIN")->read() & 0x7) < 0x7)
146      update_irq_encoder(machine(), INPUT_LINE_IRQ6, ASSERT_LINE);
145      update_irq_encoder(INPUT_LINE_IRQ6, ASSERT_LINE);
147146}
148147
149148
r21023r21024
205204   state_save_register_global(machine(), m_adc_result);
206205   state_save_register_global(machine(), m_irq4_time);
207206
208   vertigo_vproc_init(machine());
207   vertigo_vproc_init();
209208}
210209
211210void vertigo_state::machine_reset()
r21023r21024
218217      ttl74148_input_line_w(m_ttl74148, i, 1);
219218
220219   ttl74148_update(m_ttl74148);
221   vertigo_vproc_reset(machine());
220   vertigo_vproc_reset();
222221
223222   m_irq4_time = machine().time();
224223   m_irq_state = 7;
trunk/src/mame/video/vicdual.c
r21023r21024
138138
139139UINT32 vicdual_state::screen_update_vicdual_bw_or_color(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
140140{
141   if (vicdual_is_cabinet_color(machine()))
141   if (vicdual_is_cabinet_color())
142142      screen_update_vicdual_color(screen, bitmap, cliprect);
143143   else
144144      screen_update_vicdual_bw(screen, bitmap, cliprect);
trunk/src/mame/video/vaportra.c
r21023r21024
2323
2424/******************************************************************************/
2525
26static void update_24bitcol( running_machine &machine, int offset )
26void vaportra_state::update_24bitcol( int offset )
2727{
28   vaportra_state *state = machine.driver_data<vaportra_state>();
2928   UINT8 r, g, b;
3029
31   r = (state->m_generic_paletteram_16[offset] >> 0) & 0xff;
32   g = (state->m_generic_paletteram_16[offset] >> 8) & 0xff;
33   b = (state->m_generic_paletteram2_16[offset] >> 0) & 0xff;
30   r = (m_generic_paletteram_16[offset] >> 0) & 0xff;
31   g = (m_generic_paletteram_16[offset] >> 8) & 0xff;
32   b = (m_generic_paletteram2_16[offset] >> 0) & 0xff;
3433
35   palette_set_color(machine, offset, MAKE_RGB(r,g,b));
34   palette_set_color(machine(), offset, MAKE_RGB(r,g,b));
3635}
3736
3837WRITE16_MEMBER(vaportra_state::vaportra_palette_24bit_rg_w)
3938{
4039   COMBINE_DATA(&m_generic_paletteram_16[offset]);
41   update_24bitcol(machine(), offset);
40   update_24bitcol(offset);
4241}
4342
4443WRITE16_MEMBER(vaportra_state::vaportra_palette_24bit_b_w)
4544{
4645   COMBINE_DATA(&m_generic_paletteram2_16[offset]);
47   update_24bitcol(machine(), offset);
46   update_24bitcol(offset);
4847}
4948
5049/******************************************************************************/
trunk/src/mame/video/victory.c
r21023r21024
2121#define LOG_MICROCODE       0
2222#define LOG_COLLISION       0
2323
24
25/* function prototypes */
26static int command2(running_machine &machine);
27static int command3(running_machine &machine);
28static int command4(running_machine &machine);
29static int command5(running_machine &machine);
30static int command6(running_machine &machine);
31static int command7(running_machine &machine);
32
33
34
3524/*************************************
3625 *
3726 *  Initialize the video system
r21023r21024
7059 *
7160 *************************************/
7261
73static void victory_update_irq(running_machine &machine)
62void victory_state::victory_update_irq()
7463{
75   victory_state *state = machine.driver_data<victory_state>();
76   if (state->m_vblank_irq || state->m_fgcoll || (state->m_bgcoll && (state->m_video_control & 0x20)))
77      machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
64   if (m_vblank_irq || m_fgcoll || (m_bgcoll && (m_video_control & 0x20)))
65      machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE);
7866   else
79      machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE);
67      machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE);
8068}
8169
8270
r21023r21024
8472{
8573   m_vblank_irq = 1;
8674
87   victory_update_irq(machine());
75   victory_update_irq();
8876}
8977
9078
r21023r21024
10189}
10290
10391
104static void set_palette(running_machine &machine)
92void victory_state::set_palette()
10593{
106   victory_state *state = machine.driver_data<victory_state>();
10794   offs_t offs;
10895
10996   for (offs = 0; offs < 0x40; offs++)
11097   {
111      UINT16 data = state->m_paletteram[offs];
98      UINT16 data = m_paletteram[offs];
11299
113      palette_set_color_rgb(machine, offs, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3));
100      palette_set_color_rgb(machine(), offs, pal3bit(data >> 6), pal3bit(data >> 0), pal3bit(data >> 3));
114101   }
115102}
116103
r21023r21024
138125         if (m_fgcoll)
139126         {
140127            m_fgcoll = 0;
141            victory_update_irq(machine());
128            victory_update_irq();
142129         }
143130         if (LOG_COLLISION) logerror("%04X:5CLFIQ read = %02X\n", space.device().safe_pcbase(), result);
144131         return result;
r21023r21024
153140         if (m_bgcoll)
154141         {
155142            m_bgcoll = 0;
156            victory_update_irq(machine());
143            victory_update_irq();
157144         }
158145         if (LOG_COLLISION) logerror("%04X:5BACKY read = %02X\n", space.device().safe_pcbase(), result);
159146         return result;
r21023r21024
204191         if (micro.cmdlo == 5)
205192         {
206193            if (LOG_MICROCODE) logerror("  Command 5 triggered by write to IH\n");
207            command5(machine());
194            command5();
208195         }
209196         break;
210197
r21023r21024
219206         else if (micro.cmdlo == 6)
220207         {
221208            if (LOG_MICROCODE) logerror("  Command 6 triggered\n");
222            command6(machine());
209            command6();
223210         }
224211         break;
225212
r21023r21024
234221         if (micro.cmdlo == 3)
235222         {
236223            if (LOG_MICROCODE) logerror(" Command 3 triggered by write to X\n");
237            command3(machine());
224            command3();
238225         }
239226         break;
240227
r21023r21024
244231         if (micro.cmdlo == 4)
245232         {
246233            if (LOG_MICROCODE) logerror("  Command 4 triggered by write to Y\n");
247            command4(machine());
234            command4();
248235         }
249236         break;
250237
r21023r21024
259246         if (micro.cmdlo == 2)
260247         {
261248            if (LOG_MICROCODE) logerror("  Command 2 triggered by write to B\n");
262            command2(machine());
249            command2();
263250         }
264251         else if (micro.cmdlo == 7)
265252         {
266253            if (LOG_MICROCODE) logerror("  Command 7 triggered by write to B\n");
267            command7(machine());
254            command7();
268255         }
269256         break;
270257
r21023r21024
293280      case 0x0b:  /* CLRVIRQ */
294281         if (LOG_MICROCODE) logerror("%04X:CLRVIRQ write = %02X\n", space.device().safe_pcbase(), data);
295282         m_vblank_irq = 0;
296         victory_update_irq(machine());
283         victory_update_irq();
297284         break;
298285
299286      default:
r21023r21024
525512 *
526513 *************************************/
527514
528static int command2(running_machine &machine)
515int victory_state::command2()
529516{
530   victory_state *state = machine.driver_data<victory_state>();
531   struct micro_t &micro = state->m_micro;
517   struct micro_t &micro = m_micro;
532518/*
533519    Actual microcode:
534520          02    00                    0   0  ZERORAM, INCI, SWVRAM
r21023r21024
541527   int addr = micro.i++ & 0x3fff;
542528
543529   if (micro.cmd & 0x10)
544      state->m_gram[addr] = micro.g;
530      m_gram[addr] = micro.g;
545531   if (micro.cmd & 0x20)
546      state->m_bram[addr] = micro.b;
532      m_bram[addr] = micro.b;
547533   if (micro.cmd & 0x40)
548      state->m_rram[addr] = micro.r;
534      m_rram[addr] = micro.r;
549535
550536   count_states(micro, 3);
551537   return 0;
r21023r21024
559545 *
560546 *************************************/
561547
562static int command3(running_machine &machine)
548int victory_state::command3()
563549{
564   victory_state *state = machine.driver_data<victory_state>();
565   struct micro_t &micro = state->m_micro;
550   struct micro_t &micro = m_micro;
566551/*
567552    Actual microcode:
568553          03    1C                    2   0  SLOADLH, SXFERY
r21023r21024
601586         UINT8 src;
602587
603588         /* non-collision-detect case */
604         if (!(micro.cmd & 0x08) || state->m_fgcoll)
589         if (!(micro.cmd & 0x08) || m_fgcoll)
605590         {
606591            if (micro.cmd & 0x10)
607592            {
608               src = state->m_gram[srcoffs];
609               state->m_gram[dstoffs + 0] ^= src >> shift;
610               state->m_gram[dstoffs + 1] ^= src << nshift;
593               src = m_gram[srcoffs];
594               m_gram[dstoffs + 0] ^= src >> shift;
595               m_gram[dstoffs + 1] ^= src << nshift;
611596            }
612597            if (micro.cmd & 0x20)
613598            {
614               src = state->m_bram[srcoffs];
615               state->m_bram[dstoffs + 0] ^= src >> shift;
616               state->m_bram[dstoffs + 1] ^= src << nshift;
599               src = m_bram[srcoffs];
600               m_bram[dstoffs + 0] ^= src >> shift;
601               m_bram[dstoffs + 1] ^= src << nshift;
617602            }
618603            if (micro.cmd & 0x40)
619604            {
620               src = state->m_rram[srcoffs];
621               state->m_rram[dstoffs + 0] ^= src >> shift;
622               state->m_rram[dstoffs + 1] ^= src << nshift;
605               src = m_rram[srcoffs];
606               m_rram[dstoffs + 0] ^= src >> shift;
607               m_rram[dstoffs + 1] ^= src << nshift;
623608            }
624609         }
625610
r21023r21024
628613         {
629614            if (micro.cmd & 0x10)
630615            {
631               src = state->m_gram[srcoffs];
632               if ((state->m_gram[dstoffs + 0] & (src >> shift)) | (state->m_gram[dstoffs + 1] & (src << nshift)))
633                  state->m_fgcoll = 1, state->m_fgcollx = micro.xp, state->m_fgcolly = sy - 1;
634               state->m_gram[dstoffs + 0] ^= src >> shift;
635               state->m_gram[dstoffs + 1] ^= src << nshift;
616               src = m_gram[srcoffs];
617               if ((m_gram[dstoffs + 0] & (src >> shift)) | (m_gram[dstoffs + 1] & (src << nshift)))
618                  m_fgcoll = 1, m_fgcollx = micro.xp, m_fgcolly = sy - 1;
619               m_gram[dstoffs + 0] ^= src >> shift;
620               m_gram[dstoffs + 1] ^= src << nshift;
636621            }
637622            if (micro.cmd & 0x20)
638623            {
639               src = state->m_bram[srcoffs];
640               if ((state->m_bram[dstoffs + 0] & (src >> shift)) | (state->m_bram[dstoffs + 1] & (src << nshift)))
641                  state->m_fgcoll = 1, state->m_fgcollx = micro.xp, state->m_fgcolly = sy - 1;
642               state->m_bram[dstoffs + 0] ^= src >> shift;
643               state->m_bram[dstoffs + 1] ^= src << nshift;
624               src = m_bram[srcoffs];
625               if ((m_bram[dstoffs + 0] & (src >> shift)) | (m_bram[dstoffs + 1] & (src << nshift)))
626                  m_fgcoll = 1, m_fgcollx = micro.xp, m_fgcolly = sy - 1;
627               m_bram[dstoffs + 0] ^= src >> shift;
628               m_bram[dstoffs + 1] ^= src << nshift;
644629            }
645630            if (micro.cmd & 0x40)
646631            {
647               src = state->m_rram[srcoffs];
648               if ((state->m_rram[dstoffs + 0] & (src >> shift)) | (state->m_rram[dstoffs + 1] & (src << nshift)))
649                  state->m_fgcoll = 1, state->m_fgcollx = micro.xp, state->m_fgcolly = sy - 1;
650               state->m_rram[dstoffs + 0] ^= src >> shift;
651               state->m_rram[dstoffs + 1] ^= src << nshift;
632               src = m_rram[srcoffs];
633               if ((m_rram[dstoffs + 0] & (src >> shift)) | (m_rram[dstoffs + 1] & (src << nshift)))
634                  m_fgcoll = 1, m_fgcollx = micro.xp, m_fgcolly = sy - 1;
635               m_rram[dstoffs + 0] ^= src >> shift;
636               m_rram[dstoffs + 1] ^= src << nshift;
652637            }
653            if (state->m_fgcoll) victory_update_irq(machine);
638            if (m_fgcoll) victory_update_irq();
654639         }
655640      }
656641   }
r21023r21024
668653 *
669654 *************************************/
670655
671static int command4(running_machine &machine)
656int victory_state::command4()
672657{
673   victory_state *state = machine.driver_data<victory_state>();
674   struct micro_t &micro = state->m_micro;
658   struct micro_t &micro = m_micro;
675659/*
676660    Actual microcode:
677661          04    1A                    2   0  SLOADPC
r21023r21024
698682   micro.pc = micro.yp << 1;
699683   do
700684   {
701      micro.cmd = state->m_gram[0x2000 + micro.pc];
685      micro.cmd = m_gram[0x2000 + micro.pc];
702686      micro.cmdlo = micro.cmd & 7;
703      micro.i = (state->m_bram[0x2000 + micro.pc] << 8) | state->m_rram[0x2000 + micro.pc];
704      micro.r = state->m_gram[0x2001 + micro.pc];
705      micro.xp = state->m_rram[0x2001 + micro.pc];
706      micro.yp = state->m_bram[0x2001 + micro.pc];
687      micro.i = (m_bram[0x2000 + micro.pc] << 8) | m_rram[0x2000 + micro.pc];
688      micro.r = m_gram[0x2001 + micro.pc];
689      micro.xp = m_rram[0x2001 + micro.pc];
690      micro.yp = m_bram[0x2001 + micro.pc];
707691      if (LOG_MICROCODE) logerror("PC=%03X  CMD=%02X I=%04X R=%02X X=%02X Y=%02X\n", micro.pc, micro.cmd, micro.i, micro.r, micro.xp, micro.yp);
708692      micro.pc = (micro.pc + 2) & 0x1ff;
709693
r21023r21024
711695      {
712696         case 0:                                             break;
713697         case 1:                                             break;
714         case 2: keep_going = command2(machine);                 break;
715         case 3: keep_going = command3(machine);             break;
698         case 2: keep_going = command2();                 break;
699         case 3: keep_going = command3();             break;
716700         case 4: micro.pc = micro.yp << 1; keep_going = 1;   break;
717         case 5: keep_going = command5(machine);             break;
718         case 6: keep_going = command6(machine);                 break;
719         case 7: keep_going = command7(machine);             break;
701         case 5: keep_going = command5();             break;
702         case 6: keep_going = command6();                 break;
703         case 7: keep_going = command7();             break;
720704      }
721705   } while (keep_going);
722706
r21023r21024
733717 *
734718 *************************************/
735719
736static int command5(running_machine &machine)
720int victory_state::command5()
737721{
738   victory_state *state = machine.driver_data<victory_state>();
739   struct micro_t &micro = state->m_micro;
722   struct micro_t &micro = m_micro;
740723/*
741724    Actual microcode:
742725          05    0A                    1   0  SXFERY, ADD128+SACCCLEAR, SACCCLK
r21023r21024
790773   int c;
791774
792775   /* non-collision-detect case */
793   if (!(micro.cmd & 0x08) || state->m_fgcoll)
776   if (!(micro.cmd & 0x08) || m_fgcoll)
794777   {
795778      for (c = micro.i & 0xff; c < 0x100; c++)
796779      {
r21023r21024
798781         int shift = x & 7;
799782         int nshift = 8 - shift;
800783
801         state->m_gram[addr + 0] ^= micro.g >> shift;
802         state->m_gram[addr + 1] ^= micro.g << nshift;
803         state->m_bram[addr + 0] ^= micro.b >> shift;
804         state->m_bram[addr + 1] ^= micro.b << nshift;
805         state->m_rram[addr + 0] ^= micro.r >> shift;
806         state->m_rram[addr + 1] ^= micro.r << nshift;
784         m_gram[addr + 0] ^= micro.g >> shift;
785         m_gram[addr + 1] ^= micro.g << nshift;
786         m_bram[addr + 0] ^= micro.b >> shift;
787         m_bram[addr + 1] ^= micro.b << nshift;
788         m_rram[addr + 0] ^= micro.r >> shift;
789         m_rram[addr + 1] ^= micro.r << nshift;
807790
808791         acc += i;
809792         if (acc & 0x100)
r21023r21024
829812         int shift = x & 7;
830813         int nshift = 8 - shift;
831814
832         if ((state->m_gram[addr + 0] & (micro.g >> shift)) | (state->m_gram[addr + 1] & (micro.g << nshift)) |
833            (state->m_bram[addr + 0] & (micro.b >> shift)) | (state->m_bram[addr + 1] & (micro.b << nshift)) |
834            (state->m_rram[addr + 0] & (micro.r >> shift)) | (state->m_rram[addr + 1] & (micro.r << nshift)))
835            state->m_fgcoll = 1, state->m_fgcollx = x, state->m_fgcolly = y;
815         if ((m_gram[addr + 0] & (micro.g >> shift)) | (m_gram[addr + 1] & (micro.g << nshift)) |
816            (m_bram[addr + 0] & (micro.b >> shift)) | (m_bram[addr + 1] & (micro.b << nshift)) |
817            (m_rram[addr + 0] & (micro.r >> shift)) | (m_rram[addr + 1] & (micro.r << nshift)))
818            m_fgcoll = 1, m_fgcollx = x, m_fgcolly = y;
836819
837         state->m_gram[addr + 0] ^= micro.g >> shift;
838         state->m_gram[addr + 1] ^= micro.g << nshift;
839         state->m_bram[addr + 0] ^= micro.b >> shift;
840         state->m_bram[addr + 1] ^= micro.b << nshift;
841         state->m_rram[addr + 0] ^= micro.r >> shift;
842         state->m_rram[addr + 1] ^= micro.r << nshift;
820         m_gram[addr + 0] ^= micro.g >> shift;
821         m_gram[addr + 1] ^= micro.g << nshift;
822         m_bram[addr + 0] ^= micro.b >> shift;
823         m_bram[addr + 1] ^= micro.b << nshift;
824         m_rram[addr + 0] ^= micro.r >> shift;
825         m_rram[addr + 1] ^= micro.r << nshift;
843826
844827         acc += i;
845828         if (acc & 0x100)
r21023r21024
854837         }
855838         acc &= 0xff;
856839      }
857      if (state->m_fgcoll) victory_update_irq(machine);
840      if (m_fgcoll) victory_update_irq();
858841   }
859842
860843   micro.xp = x;
r21023r21024
872855 *
873856 *************************************/
874857
875static int command6(running_machine &machine)
858int victory_state::command6()
876859{
877   victory_state *state = machine.driver_data<victory_state>();
878   struct micro_t &micro = state->m_micro;
860   struct micro_t &micro = m_micro;
879861/*
880862    Actual microcode:
881863          06    0C                    0   0  SLOADLH, SLOADPC
r21023r21024
903885      micro.pc &= 0x1ff;
904886
905887      if (micro.cmd & 0x10)
906         state->m_gram[daddr] = state->m_gram[saddr];
888         m_gram[daddr] = m_gram[saddr];
907889      if (micro.cmd & 0x20)
908         state->m_bram[daddr] = state->m_bram[saddr];
890         m_bram[daddr] = m_bram[saddr];
909891      if (micro.cmd & 0x40)
910         state->m_rram[daddr] = state->m_rram[saddr];
892         m_rram[daddr] = m_rram[saddr];
911893   }
912894
913895   count_states(micro, 3 + 2 * (64 - (micro.r & 31) * 2));
r21023r21024
923905 *
924906 *************************************/
925907
926static int command7(running_machine &machine)
908int victory_state::command7()
927909{
928   victory_state *state = machine.driver_data<victory_state>();
929   struct micro_t &micro = state->m_micro;
910   struct micro_t &micro = m_micro;
930911/*
931912    Actual microcode:
932913          07    08                    1   0  SXFERY, SXFERX+INCX
r21023r21024
945926   int nshift = 8 - shift;
946927
947928   /* non-collision-detect case */
948   if (!(micro.cmd & 0x08) || state->m_fgcoll)
929   if (!(micro.cmd & 0x08) || m_fgcoll)
949930   {
950931      if (micro.cmd & 0x10)
951932      {
952         state->m_gram[addr + 0] ^= micro.g >> shift;
953         state->m_gram[addr + 1] ^= micro.g << nshift;
933         m_gram[addr + 0] ^= micro.g >> shift;
934         m_gram[addr + 1] ^= micro.g << nshift;
954935      }
955936      if (micro.cmd & 0x20)
956937      {
957         state->m_bram[addr + 0] ^= micro.b >> shift;
958         state->m_bram[addr + 1] ^= micro.b << nshift;
938         m_bram[addr + 0] ^= micro.b >> shift;
939         m_bram[addr + 1] ^= micro.b << nshift;
959940      }
960941      if (micro.cmd & 0x40)
961942      {
962         state->m_rram[addr + 0] ^= micro.r >> shift;
963         state->m_rram[addr + 1] ^= micro.r << nshift;
943         m_rram[addr + 0] ^= micro.r >> shift;
944         m_rram[addr + 1] ^= micro.r << nshift;
964945      }
965946   }
966947
r21023r21024
969950   {
970951      if (micro.cmd & 0x10)
971952      {
972         if ((state->m_gram[addr + 0] & (micro.g >> shift)) | (state->m_gram[addr + 1] & (micro.g << nshift)))
973            state->m_fgcoll = 1, state->m_fgcollx = micro.xp + 8, state->m_fgcolly = micro.yp;
974         state->m_gram[addr + 0] ^= micro.g >> shift;
975         state->m_gram[addr + 1] ^= micro.g << nshift;
953         if ((m_gram[addr + 0] & (micro.g >> shift)) | (m_gram[addr + 1] & (micro.g << nshift)))
954            m_fgcoll = 1, m_fgcollx = micro.xp + 8, m_fgcolly = micro.yp;
955         m_gram[addr + 0] ^= micro.g >> shift;
956         m_gram[addr + 1] ^= micro.g << nshift;
976957      }
977958      if (micro.cmd & 0x20)
978959      {
979         if ((state->m_bram[addr + 0] & (micro.b >> shift)) | (state->m_bram[addr + 1] & (micro.b << nshift)))
980            state->m_fgcoll = 1, state->m_fgcollx = micro.xp + 8, state->m_fgcolly = micro.yp;
981         state->m_bram[addr + 0] ^= micro.b >> shift;
982         state->m_bram[addr + 1] ^= micro.b << nshift;
960         if ((m_bram[addr + 0] & (micro.b >> shift)) | (m_bram[addr + 1] & (micro.b << nshift)))
961            m_fgcoll = 1, m_fgcollx = micro.xp + 8, m_fgcolly = micro.yp;
962         m_bram[addr + 0] ^= micro.b >> shift;
963         m_bram[addr + 1] ^= micro.b << nshift;
983964      }
984965      if (micro.cmd & 0x40)
985966      {
986         if ((state->m_rram[addr + 0] & (micro.r >> shift)) | (state->m_rram[addr + 1] & (micro.r << nshift)))
987            state->m_fgcoll = 1, state->m_fgcollx = micro.xp + 8, state->m_fgcolly = micro.yp;
988         state->m_rram[addr + 0] ^= micro.r >> shift;
989         state->m_rram[addr + 1] ^= micro.r << nshift;
967         if ((m_rram[addr + 0] & (micro.r >> shift)) | (m_rram[addr + 1] & (micro.r << nshift)))
968            m_fgcoll = 1, m_fgcollx = micro.xp + 8, m_fgcolly = micro.yp;
969         m_rram[addr + 0] ^= micro.r >> shift;
970         m_rram[addr + 1] ^= micro.r << nshift;
990971      }
991      if (state->m_fgcoll) victory_update_irq(machine);
972      if (m_fgcoll) victory_update_irq();
992973   }
993974
994975   count_states(micro, 4);
r21023r21024
1003984 *
1004985 *************************************/
1005986
1006static void update_background(running_machine &machine)
987void victory_state::update_background()
1007988{
1008   victory_state *state = machine.driver_data<victory_state>();
1009989   int x, y, row, offs;
1010990
1011991   for (y = offs = 0; y < 32; y++)
1012992      for (x = 0; x < 32; x++, offs++)
1013993      {
1014         int code = state->m_videoram[offs];
994         int code = m_videoram[offs];
1015995
1016996         for (row = 0; row < 8; row++)
1017997         {
1018            UINT8 pix2 = state->m_charram[0x0000 + 8 * code + row];
1019            UINT8 pix1 = state->m_charram[0x0800 + 8 * code + row];
1020            UINT8 pix0 = state->m_charram[0x1000 + 8 * code + row];
1021            UINT8 *dst = &state->m_bgbitmap[(y * 8 + row) * 256 + x * 8];
998            UINT8 pix2 = m_charram[0x0000 + 8 * code + row];
999            UINT8 pix1 = m_charram[0x0800 + 8 * code + row];
1000            UINT8 pix0 = m_charram[0x1000 + 8 * code + row];
1001            UINT8 *dst = &m_bgbitmap[(y * 8 + row) * 256 + x * 8];
10221002
10231003            *dst++ = ((pix2 & 0x80) >> 5) | ((pix1 & 0x80) >> 6) | ((pix0 & 0x80) >> 7);
10241004            *dst++ = ((pix2 & 0x40) >> 4) | ((pix1 & 0x40) >> 5) | ((pix0 & 0x40) >> 6);
r21023r21024
10391019 *
10401020 *************************************/
10411021
1042static void update_foreground(running_machine &machine)
1022void victory_state::update_foreground()
10431023{
1044   victory_state *state = machine.driver_data<victory_state>();
10451024   int x, y;
10461025
10471026   for (y = 0; y < 256; y++)
10481027   {
1049      UINT8 *dst = &state->m_fgbitmap[y * 256];
1028      UINT8 *dst = &m_fgbitmap[y * 256];
10501029
10511030      /* assemble the RGB bits for each 8-pixel chunk */
10521031      for (x = 0; x < 256; x += 8)
10531032      {
1054         UINT8 g = state->m_gram[y * 32 + x / 8];
1055         UINT8 b = state->m_bram[y * 32 + x / 8];
1056         UINT8 r = state->m_rram[y * 32 + x / 8];
1033         UINT8 g = m_gram[y * 32 + x / 8];
1034         UINT8 b = m_bram[y * 32 + x / 8];
1035         UINT8 r = m_rram[y * 32 + x / 8];
10571036
10581037         *dst++ = ((r & 0x80) >> 5) | ((b & 0x80) >> 6) | ((g & 0x80) >> 7);
10591038         *dst++ = ((r & 0x40) >> 4) | ((b & 0x40) >> 5) | ((g & 0x40) >> 6);
r21023r21024
10731052   m_bgcollx = param & 0xff;
10741053   m_bgcolly = param >> 8;
10751054   m_bgcoll = 1;
1076   victory_update_irq(machine());
1055   victory_update_irq();
10771056}
10781057
10791058
r21023r21024
10911070   int x, y;
10921071
10931072   /* copy the palette from palette RAM */
1094   set_palette(machine());
1073   set_palette();
10951074
10961075   /* update the foreground & background */
1097   update_foreground(machine());
1098   update_background(machine());
1076   update_foreground();
1077   update_background();
10991078
11001079   /* blend the bitmaps and do collision detection */
11011080   for (y = 0; y < 256; y++)
trunk/src/mame/video/vulgus.c
r21023r21024
166166
167167***************************************************************************/
168168
169static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
169void vulgus_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
170170{
171   vulgus_state *state = machine.driver_data<vulgus_state>();
172   UINT8 *spriteram = state->m_spriteram;
171   UINT8 *spriteram = m_spriteram;
173172   int offs;
174173
175174
176   for (offs = state->m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
175   for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
177176   {
178177      int code,i,col,sx,sy,dir;
179178
r21023r21024
183182      sx = spriteram[offs + 3];
184183      sy = spriteram[offs + 2];
185184      dir = 1;
186      if (state->flip_screen())
185      if (flip_screen())
187186      {
188187         sx = 240 - sx;
189188         sy = 240 - sy;
r21023r21024
195194
196195      do
197196      {
198         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
197         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
199198               code + i,
200199               col,
201               state->flip_screen(),state->flip_screen(),
200               flip_screen(),flip_screen(),
202201               sx, sy + 16 * i * dir,15);
203202
204203         /* draw again with wraparound */
205         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
204         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
206205               code + i,
207206               col,
208               state->flip_screen(),state->flip_screen(),
207               flip_screen(),flip_screen(),
209208               sx, sy + 16 * i * dir -  dir * 256,15);
210209         i--;
211210      } while (i >= 0);
r21023r21024
218217   m_bg_tilemap->set_scrolly(0, m_scroll_low[0] + 256 * m_scroll_high[0]);
219218
220219   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
221   draw_sprites(machine(), bitmap,cliprect);
220   draw_sprites(bitmap,cliprect);
222221   m_fg_tilemap->draw(bitmap, cliprect, 0,0);
223222   return 0;
224223}
trunk/src/mame/video/vastar.c
r21023r21024
122122// for Planet Probe more cases appear correct if we draw the list in reverse
123123// order, but it's also possible we should be drawing 2 swapped lists in
124124// forward order instead
125static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
125void vastar_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
126126{
127   vastar_state *state = machine.driver_data<vastar_state>();
128   UINT8 *spriteram = state->m_spriteram1;
129   UINT8 *spriteram_2 = state->m_spriteram2;
130   UINT8 *spriteram_3 = state->m_spriteram3;
127   UINT8 *spriteram = m_spriteram1;
128   UINT8 *spriteram_2 = m_spriteram2;
129   UINT8 *spriteram_3 = m_spriteram3;
131130   int offs;
132131
133132//  for (offs = 0; offs < 0x40; offs += 2)
r21023r21024
145144      flipx = spriteram_3[offs] & 0x02;
146145      flipy = spriteram_3[offs] & 0x01;
147146
148      if (state->flip_screen())
147      if (flip_screen())
149148      {
150149         flipx = !flipx;
151150         flipy = !flipy;
r21023r21024
153152
154153      if (spriteram_2[offs] & 0x08)   /* double width */
155154      {
156         if (!state->flip_screen())
155         if (!flip_screen())
157156            sy = 224 - sy;
158157
159         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
158         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
160159               code/2,
161160               color,
162161               flipx,flipy,
163162               sx,sy,0);
164163         /* redraw with wraparound */
165         drawgfx_transpen(bitmap,cliprect,machine.gfx[2],
164         drawgfx_transpen(bitmap,cliprect,machine().gfx[2],
166165               code/2,
167166               color,
168167               flipx,flipy,
r21023r21024
170169      }
171170      else
172171      {
173         if (!state->flip_screen())
172         if (!flip_screen())
174173            sy = 240 - sy;
175174
176         drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
175         drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
177176               code,
178177               color,
179178               flipx,flipy,
r21023r21024
196195   {
197196   case 0:
198197      m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
199      draw_sprites(machine(), bitmap,cliprect);
198      draw_sprites(bitmap,cliprect);
200199      m_bg2_tilemap->draw(bitmap, cliprect, 0,0);
201200      m_fg_tilemap->draw(bitmap, cliprect, 0,0);
202201      break;
r21023r21024
204203   case 1: // ?? planet probe
205204      m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
206205      m_bg2_tilemap->draw(bitmap, cliprect, 0,0);
207      draw_sprites(machine(), bitmap,cliprect);
206      draw_sprites(bitmap,cliprect);
208207      m_fg_tilemap->draw(bitmap, cliprect, 0,0);
209208      break;
210209
211210   case 2:
212211      m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
213      draw_sprites(machine(), bitmap,cliprect);
212      draw_sprites(bitmap,cliprect);
214213      m_bg1_tilemap->draw(bitmap, cliprect, 0,0);
215214      m_bg2_tilemap->draw(bitmap, cliprect, 0,0);
216215      m_fg_tilemap->draw(bitmap, cliprect, 0,0);
r21023r21024
220219      m_bg1_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE,0);
221220      m_bg2_tilemap->draw(bitmap, cliprect, 0,0);
222221      m_fg_tilemap->draw(bitmap, cliprect, 0,0);
223      draw_sprites(machine(), bitmap,cliprect);
222      draw_sprites(bitmap,cliprect);
224223      break;
225224
226225   default:
trunk/src/mame/video/vigilant.c
r21023r21024
4141 There are three background ROMs, each one contains a 512x256 picture.
4242 Redraw them if the palette changes.
4343 **************************************************************************/
44static void update_background(running_machine &machine)
44void vigilant_state::update_background()
4545{
46   vigilant_state *state = machine.driver_data<vigilant_state>();
4746   int row,col,page;
4847   int charcode;
4948
r21023r21024
5756      {
5857         for( col=0; col<512; col+=32 )
5958         {
60            drawgfx_opaque(*state->m_bg_bitmap,
61                  state->m_bg_bitmap->cliprect(),machine.gfx[2],
59            drawgfx_opaque(*m_bg_bitmap,
60                  m_bg_bitmap->cliprect(),machine().gfx[2],
6261                  charcode,
6362                  row < 128 ? 0 : 1,
6463                  0,0,
r21023r21024
159158 ???
160159 **************************************************************************/
161160
162static void draw_foreground(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int opaque )
161void vigilant_state::draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int opaque )
163162{
164   vigilant_state *state = machine.driver_data<vigilant_state>();
165   UINT8 *videoram = state->m_videoram;
163   UINT8 *videoram = m_videoram;
166164   int offs;
167   int scroll = -(state->m_horiz_scroll_low + state->m_horiz_scroll_high);
165   int scroll = -(m_horiz_scroll_low + m_horiz_scroll_high);
168166
169167
170168   for (offs = 0; offs < 0x1000; offs += 2)
r21023r21024
183181            {
184182               sx = (sx + scroll) & 0x1ff;
185183
186               drawgfx_transmask(bitmap,bottomvisiblearea,machine.gfx[0],
184               drawgfx_transmask(bitmap,bottomvisiblearea,machine().gfx[0],
187185                     tile_number,
188186                     color,
189187                     0,0,
r21023r21024
196194         if (sy >= 48)
197195            sx = (sx + scroll) & 0x1ff;
198196
199         drawgfx_transpen(bitmap,cliprect,machine.gfx[0],
197         drawgfx_transpen(bitmap,cliprect,machine().gfx[0],
200198               tile_number,
201199               color,
202200               0,0,
r21023r21024
208206
209207
210208
211static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
209void vigilant_state::draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect)
212210{
213   vigilant_state *state = machine.driver_data<vigilant_state>();
214   int scrollx = 0x17a + 16*8 - (state->m_rear_horiz_scroll_low + state->m_rear_horiz_scroll_high);
211   int scrollx = 0x17a + 16*8 - (m_rear_horiz_scroll_low + m_rear_horiz_scroll_high);
215212
216213
217   if (state->m_rear_refresh)
214   if (m_rear_refresh)
218215   {
219      update_background(machine);
220      state->m_rear_refresh=0;
216      update_background();
217      m_rear_refresh=0;
221218   }
222219
223   copyscrollbitmap(bitmap,*state->m_bg_bitmap,1,&scrollx,0,0,bottomvisiblearea);
220   copyscrollbitmap(bitmap,*m_bg_bitmap,1,&scrollx,0,0,bottomvisiblearea);
224221}
225222
226223
227static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
224void vigilant_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
228225{
229   vigilant_state *state = machine.driver_data<vigilant_state>();
230   UINT8 *spriteram = state->m_spriteram;
226   UINT8 *spriteram = m_spriteram;
231227   int offs;
232228
233   for (offs = 0;offs < state->m_spriteram.bytes();offs += 8)
229   for (offs = 0;offs < m_spriteram.bytes();offs += 8)
234230   {
235231      int code,color,sx,sy,flipx,flipy,h,y;
236232
r21023r21024
252248         if (flipy) c += h-1-y;
253249         else c += y;
254250
255         drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
251         drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
256252               c,
257253               color,
258254               flipx,flipy,
r21023r21024
281277            sx,sy);
282278   }
283279
284   draw_sprites(machine(),bitmap,cliprect);
280   draw_sprites(bitmap,cliprect);
285281   return 0;
286282}
287283
r21023r21024
310306
311307   if (m_rear_disable)  /* opaque foreground */
312308   {
313      draw_foreground(machine(),bitmap,cliprect,0,1);
314      draw_sprites(machine(),bitmap,bottomvisiblearea);
315      draw_foreground(machine(),bitmap,cliprect,1,0);
309      draw_foreground(bitmap,cliprect,0,1);
310      draw_sprites(bitmap,bottomvisiblearea);
311      draw_foreground(bitmap,cliprect,1,0);
316312   }
317313   else
318314   {
319      draw_background(machine(),bitmap,cliprect);
320      draw_foreground(machine(),bitmap,cliprect,0,0);
321      draw_sprites(machine(),bitmap,bottomvisiblearea);
322      draw_foreground(machine(),bitmap,cliprect,1,0); // priority tiles
315      draw_background(bitmap,cliprect);
316      draw_foreground(bitmap,cliprect,0,0);
317      draw_sprites(bitmap,bottomvisiblearea);
318      draw_foreground(bitmap,cliprect,1,0); // priority tiles
323319   }
324320   return 0;
325321}
trunk/src/mame/video/volfied.c
r21023r21024
6666                SCREEN REFRESH
6767*******************************************************/
6868
69static void refresh_pixel_layer( running_machine &machine, bitmap_ind16 &bitmap )
69void volfied_state::refresh_pixel_layer( bitmap_ind16 &bitmap )
7070{
7171   int x, y;
7272
r21023r21024
9090
9191   *********************************************************/
9292
93   volfied_state *state = machine.driver_data<volfied_state>();
94   UINT16* p = state->m_video_ram;
95   int width = machine.primary_screen->width();
96   int height = machine.primary_screen->height();
93   UINT16* p = m_video_ram;
94   int width = machine().primary_screen->width();
95   int height = machine().primary_screen->height();
9796
98   if (state->m_video_ctrl & 1)
97   if (m_video_ctrl & 1)
9998      p += 0x20000;
10099
101100   for (y = 0; y < height; y++)
r21023r21024
124123UINT32 volfied_state::screen_update_volfied(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
125124{
126125   machine().priority_bitmap.fill(0, cliprect);
127   refresh_pixel_layer(machine(), bitmap);
126   refresh_pixel_layer(bitmap);
128127   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
129128   return 0;
130129}
trunk/src/mame/video/vertigo.c
r21023r21024
117117 *
118118 *************************************/
119119
120void vertigo_vproc_init(running_machine &machine)
120void vertigo_state::vertigo_vproc_init()
121121{
122   vertigo_state *state = machine.driver_data<vertigo_state>();
123   state_save_register_item_array(machine, "vector_proc", NULL, 0, state->m_vs.sram);
124   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vs.ramlatch);
125   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vs.rom_adr);
126   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vs.pc);
127   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vs.ret);
122   state_save_register_item_array(machine(), "vector_proc", NULL, 0, m_vs.sram);
123   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vs.ramlatch);
124   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vs.rom_adr);
125   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vs.pc);
126   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vs.ret);
128127
129   state_save_register_item_array(machine, "vector_proc", NULL, 0, state->m_bsp.ram);
130   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_bsp.d);
131   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_bsp.q);
132   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_bsp.f);
133   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_bsp.y);
128   state_save_register_item_array(machine(), "vector_proc", NULL, 0, m_bsp.ram);
129   state_save_register_item(machine(), "vector_proc", NULL, 0, m_bsp.d);
130   state_save_register_item(machine(), "vector_proc", NULL, 0, m_bsp.q);
131   state_save_register_item(machine(), "vector_proc", NULL, 0, m_bsp.f);
132   state_save_register_item(machine(), "vector_proc", NULL, 0, m_bsp.y);
134133
135   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.sreg);
136   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.l1);
137   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.l2);
138   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.c_v);
139   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.c_h);
140   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.c_l);
141   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.adder_s);
142   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.adder_a);
143   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.color);
144   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.intensity);
145   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.brez);
146   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.vfin);
147   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.hud1);
148   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.hud2);
149   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.vud1);
150   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.vud2);
151   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.hc1);
152   state_save_register_item(machine, "vector_proc", NULL, 0, state->m_vgen.ven);
134   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.sreg);
135   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.l1);
136   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.l2);
137   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.c_v);
138   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.c_h);
139   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.c_l);
140   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.adder_s);
141   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.adder_a);
142   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.color);
143   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.intensity);
144   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.brez);
145   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.vfin);
146   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.hud1);
147   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.hud2);
148   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.vud1);
149   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.vud2);
150   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.hc1);
151   state_save_register_item(machine(), "vector_proc", NULL, 0, m_vgen.ven);
153152}
154153
155154
156void vertigo_vproc_reset(running_machine &machine)
155void vertigo_state::vertigo_vproc_reset()
157156{
158   vertigo_state *state = machine.driver_data<vertigo_state>();
159157   int i;
160158   UINT64 *mcode;
161159
162   state->m_vectorrom = (UINT16 *)state->memregion("user1")->base();
163   mcode = (UINT64 *)state->memregion("proms")->base();
160   m_vectorrom = (UINT16 *)memregion("user1")->base();
161   mcode = (UINT64 *)memregion("proms")->base();
164162
165163   /* Decode microcode */
166164   for (i = 0; i < MC_LENGTH; i++)
167165   {
168      state->m_mc[i].x = (mcode[i] >> 44) & 0x3f;
169      state->m_mc[i].a = (mcode[i] >> 40) & 0xf;
170      state->m_mc[i].b = (mcode[i] >> 36) & 0xf;
171      state->m_mc[i].inst = (mcode[i] >> 27) & 077;
172      state->m_mc[i].dest = (mcode[i] >> 33) & 07;
173      state->m_mc[i].cn = (mcode[i] >> 26) & 0x1;
174      state->m_mc[i].mreq = (mcode[i] >> 25) & 0x1;
175      state->m_mc[i].rwrite = (mcode[i] >> 23) & 0x1;
176      state->m_mc[i].rsel = state->m_mc[i].rwrite & ((mcode[i] >> 24) & 0x1);
177      state->m_mc[i].of =  (mcode[i] >> 20) & 0x7;
178      state->m_mc[i].iif = (mcode[i] >> 18) & 0x3;
179      state->m_mc[i].oa = (mcode[i] >> 16) & 0x3;
180      state->m_mc[i].jpos = (mcode[i] >> 14) & 0x1;
181      state->m_mc[i].jmp = (mcode[i] >> 12) & 0x3;
182      state->m_mc[i].jcon = (mcode[i] >> 9) & 0x7;
183      state->m_mc[i].ma = mcode[i] & 0x1ff;
166      m_mc[i].x = (mcode[i] >> 44) & 0x3f;
167      m_mc[i].a = (mcode[i] >> 40) & 0xf;
168      m_mc[i].b = (mcode[i] >> 36) & 0xf;
169      m_mc[i].inst = (mcode[i] >> 27) & 077;
170      m_mc[i].dest = (mcode[i] >> 33) & 07;
171      m_mc[i].cn = (mcode[i] >> 26) & 0x1;
172      m_mc[i].mreq = (mcode[i] >> 25) & 0x1;
173      m_mc[i].rwrite = (mcode[i] >> 23) & 0x1;
174      m_mc[i].rsel = m_mc[i].rwrite & ((mcode[i] >> 24) & 0x1);
175      m_mc[i].of =  (mcode[i] >> 20) & 0x7;
176      m_mc[i].iif = (mcode[i] >> 18) & 0x3;
177      m_mc[i].oa = (mcode[i] >> 16) & 0x3;
178      m_mc[i].jpos = (mcode[i] >> 14) & 0x1;
179      m_mc[i].jmp = (mcode[i] >> 12) & 0x3;
180      m_mc[i].jcon = (mcode[i] >> 9) & 0x7;
181      m_mc[i].ma = mcode[i] & 0x1ff;
184182   }
185183
186   memset(&state->m_vs, 0, sizeof(state->m_vs));
187   memset(&state->m_bsp, 0, sizeof(state->m_bsp));
188   memset(&state->m_vgen, 0, sizeof(state->m_vgen));
189   state->m_vgen.set_machine(machine);
184   memset(&m_vs, 0, sizeof(m_vs));
185   memset(&m_bsp, 0, sizeof(m_bsp));
186   memset(&m_vgen, 0, sizeof(m_vgen));
187   m_vgen.set_machine(machine());
190188}
191189
192190
r21023r21024
197195 *
198196 ********************************************/
199197
200static void am2901x4 (am2901 *bsp, microcode *mc)
198void vertigo_state::am2901x4 (am2901 *bsp, microcode *mc)
201199{
202200   switch (mc->inst)
203201   {
r21023r21024
324322 *
325323 ********************************************/
326324
327static void vertigo_vgen (vector_generator *vg)
325void vertigo_state::vertigo_vgen (vector_generator *vg)
328326{
329327   if (vg->c_l & 0x800)
330328   {
r21023r21024
383381 *
384382 *************************************/
385383
386void vertigo_vproc(running_machine &machine, int cycles, int irq4)
384void vertigo_state::vertigo_vproc(int cycles, int irq4)
387385{
388   vertigo_state *state = machine.driver_data<vertigo_state>();
389386   int jcond;
390387   microcode *cmc;
391388
r21023r21024
396393   while (cycles--)
397394   {
398395      /* Microcode at current PC */
399      cmc = &state->m_mc[state->m_vs.pc];
396      cmc = &m_mc[m_vs.pc];
400397
401398      /* Load data */
402399      if (cmc->iif == S_RAMDE)
403400      {
404         state->m_bsp.d = state->m_vs.ramlatch;
401         m_bsp.d = m_vs.ramlatch;
405402      }
406403      else if (cmc->iif == S_ROMDE)
407404      {
408         if (state->m_vs.rom_adr < 0x2000)
405         if (m_vs.rom_adr < 0x2000)
409406         {
410            state->m_bsp.d = state->m_vectorram[state->m_vs.rom_adr & 0xfff];
407            m_bsp.d = m_vectorram[m_vs.rom_adr & 0xfff];
411408         }
412409         else
413410         {
414            state->m_bsp.d = state->m_vectorrom[state->m_vs.rom_adr & 0x7fff];
411            m_bsp.d = m_vectorrom[m_vs.rom_adr & 0x7fff];
415412         }
416413      }
417414
r21023r21024
420417      {
421418         if (cmc->rwrite)
422419         {
423            state->m_bsp.d = state->m_vs.sram[cmc->x];
420            m_bsp.d = m_vs.sram[cmc->x];
424421         }
425422         else
426423         {
427424            /* Data can be transferred between vector ROM/RAM
428425               and SRAM without going through the 2901 */
429            state->m_vs.sram[cmc->x] = state->m_bsp.d;
426            m_vs.sram[cmc->x] = m_bsp.d;
430427         }
431428      }
432429
433      am2901x4 (&state->m_bsp, cmc);
430      am2901x4 (&m_bsp, cmc);
434431
435432      /* Store data */
436433      switch (cmc->oa)
437434      {
438435      case S_RAMD:
439         state->m_vs.ramlatch = state->m_bsp.y;
436         m_vs.ramlatch = m_bsp.y;
440437         if (cmc->iif==S_RAMDE && (cmc->rsel == 0) && (cmc->rwrite == 0))
441            state->m_vs.sram[cmc->x] = state->m_vs.ramlatch;
438            m_vs.sram[cmc->x] = m_vs.ramlatch;
442439         break;
443440      case S_ROMA:
444         state->m_vs.rom_adr = state->m_bsp.y;
441         m_vs.rom_adr = m_bsp.y;
445442         break;
446443      case S_SREG:
447444         /* FPOS is shifted into sreg */
448         state->m_vgen.sreg = (state->m_vgen.sreg >> 1) | ((state->m_bsp.f >> 9) & 4);
445         m_vgen.sreg = (m_vgen.sreg >> 1) | ((m_bsp.f >> 9) & 4);
449446         break;
450447      default:
451448         break;
r21023r21024
455452      switch (cmc->of)
456453      {
457454      case 0:
458         state->m_vgen.color = state->m_bsp.y & 0xfff;
455         m_vgen.color = m_bsp.y & 0xfff;
459456         break;
460457      case 1:
461         state->m_vgen.intensity = state->m_bsp.y & 0xff;
458         m_vgen.intensity = m_bsp.y & 0xff;
462459         break;
463460      case 2:
464         state->m_vgen.l1 = state->m_bsp.y & 0xfff;
465         state->m_vgen.adder_s = 0;
466         state->m_vgen.adder_a = state->m_vgen.l2;
467         state->m_vgen.hud1 = state->m_vgen.sreg & 1;
468         state->m_vgen.vud1 = state->m_vgen.sreg & 2;
469         state->m_vgen.hc1  = state->m_vgen.sreg & 4;
470         state->m_vgen.brez = 1;
461         m_vgen.l1 = m_bsp.y & 0xfff;
462         m_vgen.adder_s = 0;
463         m_vgen.adder_a = m_vgen.l2;
464         m_vgen.hud1 = m_vgen.sreg & 1;
465         m_vgen.vud1 = m_vgen.sreg & 2;
466         m_vgen.hc1  = m_vgen.sreg & 4;
467         m_vgen.brez = 1;
471468         break;
472469      case 3:
473         state->m_vgen.l2 = state->m_bsp.y & 0xfff;
474         state->m_vgen.adder_s = (state->m_vgen.adder_s + state->m_vgen.adder_a) & 0xfff;
475         if (state->m_vgen.adder_s & 0x800)
476            state->m_vgen.adder_a = state->m_vgen.l1;
470         m_vgen.l2 = m_bsp.y & 0xfff;
471         m_vgen.adder_s = (m_vgen.adder_s + m_vgen.adder_a) & 0xfff;
472         if (m_vgen.adder_s & 0x800)
473            m_vgen.adder_a = m_vgen.l1;
477474         else
478            state->m_vgen.adder_a = state->m_vgen.l2;
479         state->m_vgen.hud2 = state->m_vgen.sreg & 1;
480         state->m_vgen.vud2 = state->m_vgen.sreg & 2;
475            m_vgen.adder_a = m_vgen.l2;
476         m_vgen.hud2 = m_vgen.sreg & 1;
477         m_vgen.vud2 = m_vgen.sreg & 2;
481478         break;
482479      case 4:
483         state->m_vgen.c_v = state->m_bsp.y & 0xfff;
480         m_vgen.c_v = m_bsp.y & 0xfff;
484481         break;
485482      case 5:
486         state->m_vgen.c_h = state->m_bsp.y & 0xfff;
483         m_vgen.c_h = m_bsp.y & 0xfff;
487484         break;
488485      case 6:
489486         /* Loading the c_l counter starts
490487          * the vector counters if MSB is set
491488          */
492         state->m_vgen.c_l = state->m_bsp.y & 0xfff;
489         m_vgen.c_l = m_bsp.y & 0xfff;
493490         break;
494491      }
495492
496      vertigo_vgen (&state->m_vgen);
493      vertigo_vgen (&m_vgen);
497494
498495      /* Microcode program flow */
499496      switch (cmc->jcon)
500497      {
501498      case S_MSB:
502499         /* ALU most significant bit */
503         jcond = (state->m_bsp.f >> 15) & 1;
500         jcond = (m_bsp.f >> 15) & 1;
504501         break;
505502      case S_FEQ0:
506503         /* ALU is 0 */
507         jcond = (state->m_bsp.f == 0)? 1 : 0;
504         jcond = (m_bsp.f == 0)? 1 : 0;
508505         break;
509506      case S_Y10:
510         jcond = (state->m_bsp.y >> 10) & 1;
507         jcond = (m_bsp.y >> 10) & 1;
511508         break;
512509      case S_VFIN:
513         jcond = state->m_vgen.vfin;
510         jcond = m_vgen.vfin;
514511         break;
515512      case S_FPOS:
516513         /* FPOS is bit 11 */
517         jcond = (state->m_bsp.f >> 11) & 1;
514         jcond = (m_bsp.f >> 11) & 1;
518515         break;
519516      case S_INTL4:
520517         jcond = irq4;
r21023r21024
542539         {
543540         case S_JBK:
544541            /* JBK is the only jump where MA8 is used */
545            state->m_vs.pc = cmc->ma;
542            m_vs.pc = cmc->ma;
546543            break;
547544         case S_CALL:
548545            /* call and store return address */
549            state->m_vs.ret = (state->m_vs.pc + 1) & 0xff;
550            state->m_vs.pc = (state->m_vs.pc & 0x100) | (cmc->ma & 0xff);
546            m_vs.ret = (m_vs.pc + 1) & 0xff;
547            m_vs.pc = (m_vs.pc & 0x100) | (cmc->ma & 0xff);
551548            break;
552549         case S_OPT:
553550            /* OPT is used for microcode jump tables. The first
554551               four address bits are defined by bits 12-15
555552               of 2901 input (D) */
556            state->m_vs.pc = (state->m_vs.pc & 0x100) | (cmc->ma & 0xf0) | ((state->m_bsp.d >> 12) & 0xf);
553            m_vs.pc = (m_vs.pc & 0x100) | (cmc->ma & 0xf0) | ((m_bsp.d >> 12) & 0xf);
557554            break;
558555         case S_RETURN:
559556            /* return from call */
560            state->m_vs.pc = (state->m_vs.pc & 0x100) | state->m_vs.ret;
557            m_vs.pc = (m_vs.pc & 0x100) | m_vs.ret;
561558            break;
562559         }
563560      }
564561      else
565562      {
566         state->m_vs.pc = (state->m_vs.pc & 0x100) | ((state->m_vs.pc + 1) & 0xff);
563         m_vs.pc = (m_vs.pc & 0x100) | ((m_vs.pc + 1) & 0xff);
567564      }
568565   }
569566
trunk/src/mame/video/vball.c
r21023r21024
6666   m_bg_tilemap->mark_tile_dirty(offset);
6767}
6868
69void vb_bgprombank_w( running_machine &machine, int bank )
69void vball_state::vb_bgprombank_w( int bank )
7070{
71   vball_state *state = machine.driver_data<vball_state>();
7271   int i;
7372   UINT8* color_prom;
7473
75   if (bank==state->m_vb_bgprombank) return;
74   if (bank==m_vb_bgprombank) return;
7675
77   color_prom = state->memregion("proms")->base() + bank*0x80;
76   color_prom = memregion("proms")->base() + bank*0x80;
7877   for (i=0;i<128;i++, color_prom++) {
79      palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4),
78      palette_set_color_rgb(machine(),i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4),
8079                  pal4bit(color_prom[0x800] >> 0));
8180   }
82   state->m_vb_bgprombank=bank;
81   m_vb_bgprombank=bank;
8382}
8483
85void vb_spprombank_w( running_machine &machine, int bank )
84void vball_state::vb_spprombank_w( int bank )
8685{
87   vball_state *state = machine.driver_data<vball_state>();
8886
8987   int i;
9088   UINT8* color_prom;
9189
92   if (bank==state->m_vb_spprombank) return;
90   if (bank==m_vb_spprombank) return;
9391
94   color_prom = state->memregion("proms")->base()+0x400 + bank*0x80;
92   color_prom = memregion("proms")->base()+0x400 + bank*0x80;
9593   for (i=128;i<256;i++,color_prom++)  {
96      palette_set_color_rgb(machine,i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4),
94      palette_set_color_rgb(machine(),i,pal4bit(color_prom[0] >> 0),pal4bit(color_prom[0] >> 4),
9795                  pal4bit(color_prom[0x800] >> 0));
9896   }
99   state->m_vb_spprombank=bank;
97   m_vb_spprombank=bank;
10098}
10199
102void vb_mark_all_dirty( running_machine &machine )
100void vball_state::vb_mark_all_dirty(  )
103101{
104   vball_state *state = machine.driver_data<vball_state>();
105   state->m_bg_tilemap->mark_all_dirty();
102   m_bg_tilemap->mark_all_dirty();
106103}
107104
108105#define DRAW_SPRITE( order, sx, sy ) drawgfx_transpen( bitmap, \
109106               cliprect,gfx, \
110107               (which+order),color,flipx,flipy,sx,sy,0);
111108
112static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect)
109void vball_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
113110{
114   vball_state *state = machine.driver_data<vball_state>();
115   gfx_element *gfx = machine.gfx[1];
116   UINT8 *src = state->m_spriteram;
111   gfx_element *gfx = machine().gfx[1];
112   UINT8 *src = m_spriteram;
117113   int i;
118114
119115/*  240-Y    S|X|CLR|WCH WHICH    240-X
120116    xxxxxxxx x|x|xxx|xxx xxxxxxxx xxxxxxxx
121117*/
122   for (i = 0;i < state->m_spriteram.bytes();i += 4)
118   for (i = 0;i < m_spriteram.bytes();i += 4)
123119   {
124120      int attr = src[i+1];
125121      int which = src[i+2]+((attr & 0x07)<<8);
r21023r21024
131127      int flipy = 0;
132128      int dy = -16;
133129
134      if (state->flip_screen())
130      if (flip_screen())
135131      {
136132         sx = 240 - sx;
137133         sy = 240 - sy;
r21023r21024
168164      //logerror("scrollx[%d] = %d\n",i,m_vb_scrollx[i]);
169165   }
170166   m_bg_tilemap->draw(bitmap, cliprect, 0,0);
171   draw_sprites(machine(),bitmap,cliprect);
167   draw_sprites(bitmap,cliprect);
172168   return 0;
173169}
trunk/src/mame/video/unico.c
r21023r21024
217217
218218***************************************************************************/
219219
220static void unico_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
220void unico_state::unico_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
221221{
222   unico_state *state = machine.driver_data<unico_state>();
223   UINT16 *spriteram16 = state->m_spriteram;
222   UINT16 *spriteram16 = m_spriteram;
224223   int offs;
225224
226225   /* Draw them backwards, for pdrawgfx */
227   for ( offs = (state->m_spriteram.bytes()-8)/2; offs >= 0 ; offs -= 8/2 )
226   for ( offs = (m_spriteram.bytes()-8)/2; offs >= 0 ; offs -= 8/2 )
228227   {
229228      int x, startx, endx, incx;
230229
r21023r21024
250249         case 3:     pri_mask = 0x00;            // above all
251250      }
252251
253      sx  +=  state->m_sprites_scrolldx;
254      sy  +=  state->m_sprites_scrolldy;
252      sx  +=  m_sprites_scrolldx;
253      sy  +=  m_sprites_scrolldy;
255254
256255      sx  =   (sx & 0x1ff) - (sx & 0x200);
257256      sy  =   (sy & 0x1ff) - (sy & 0x200);
r21023r21024
261260
262261      for (x = startx ; x != endx ; x += incx)
263262      {
264         pdrawgfx_transpen(  bitmap, cliprect, machine.gfx[0],
263         pdrawgfx_transpen(  bitmap, cliprect, machine().gfx[0],
265264                  code++,
266265                  attr & 0x1f,
267266                  flipx, flipy,
268267                  x, sy,
269                  machine.priority_bitmap,
268                  machine().priority_bitmap,
270269                  pri_mask,0x00   );
271270      }
272271   }
273272}
274273
275static void zeropnt2_draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect)
274void unico_state::zeropnt2_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect)
276275{
277   unico_state *state = machine.driver_data<unico_state>();
278   UINT32 *spriteram32 = reinterpret_cast<UINT32 *>(state->m_spriteram.target());
276   UINT32 *spriteram32 = reinterpret_cast<UINT32 *>(m_spriteram.target());
279277   int offs;
280278
281279   /* Draw them backwards, for pdrawgfx */
282   for ( offs = (state->m_spriteram.bytes()-8)/4; offs >= 0 ; offs -= 8/4 )
280   for ( offs = (m_spriteram.bytes()-8)/4; offs >= 0 ; offs -= 8/4 )
283281   {
284282      int x, startx, endx, incx;
285283
r21023r21024
305303         case 3:     pri_mask = 0x00;            // above all
306304      }
307305
308      sx  +=  state->m_sprites_scrolldx;
309      sy  +=  state->m_sprites_scrolldy;
306      sx  +=  m_sprites_scrolldx;
307      sy  +=  m_sprites_scrolldy;
310308
311309      sx  =   (sx & 0x1ff) - (sx & 0x200);
312310      sy  =   (sy & 0x1ff) - (sy & 0x200);
r21023r21024
316314
317315      for (x = startx ; x != endx ; x += incx)
318316      {
319         pdrawgfx_transpen(  bitmap, cliprect, machine.gfx[0],
317         pdrawgfx_transpen(  bitmap, cliprect, machine().gfx[0],
320318                  code++,
321319                  attr & 0x1f,
322320                  flipx, flipy,
323321                  x, sy,
324                  machine.priority_bitmap,
322                  machine().priority_bitmap,
325323                  pri_mask,0x00   );
326324      }
327325   }
r21023r21024
371369   if (layers_ctrl & 4)    m_tilemap[2]->draw(bitmap, cliprect, 0,4);
372370
373371   /* Sprites are drawn last, using pdrawgfx */
374   if (layers_ctrl & 8)    unico_draw_sprites(screen.machine(), bitmap,cliprect);
372   if (layers_ctrl & 8)    unico_draw_sprites(bitmap,cliprect);
375373
376374   return 0;
377375}
r21023r21024
410408   if (layers_ctrl & 4)    m_tilemap[2]->draw(bitmap, cliprect, 0,4);
411409
412410   /* Sprites are drawn last, using pdrawgfx */
413   if (layers_ctrl & 8)    zeropnt2_draw_sprites(screen.machine(), bitmap,cliprect);
411   if (layers_ctrl & 8)    zeropnt2_draw_sprites(bitmap,cliprect);
414412
415413   return 0;
416414}
trunk/src/mame/video/undrfire.c
r21023r21024
6363
6464***************************************************************/
6565
66static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
66void undrfire_state::draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
6767{
68   undrfire_state *state = machine.driver_data<undrfire_state>();
69   UINT32 *spriteram32 = state->m_spriteram;
70   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
68   UINT32 *spriteram32 = m_spriteram;
69   UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
7170   int offs, data, tilenum, color, flipx, flipy;
7271   int x, y, priority, dblsize, curx, cury;
7372   int sprites_flipscreen = 0;
r21023r21024
7776
7877   /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
7978      while processing sprite ram and then draw them all at the end */
80   struct tempsprite *sprite_ptr = state->m_spritelist;
79   struct tempsprite *sprite_ptr = m_spritelist;
8180
82   for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
81   for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
8382   {
8483      data = spriteram32[offs+0];
8584      flipx =    (data & 0x00800000) >> 23;
r21023r21024
177176            }
178177            else
179178            {
180               drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
179               drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
181180                     sprite_ptr->code,
182181                     sprite_ptr->color,
183182                     sprite_ptr->flipx,sprite_ptr->flipy,
r21023r21024
192191   }
193192
194193   /* this happens only if primsks != NULL */
195   while (sprite_ptr != state->m_spritelist)
194   while (sprite_ptr != m_spritelist)
196195   {
197196      sprite_ptr--;
198197
199      pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
198      pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
200199            sprite_ptr->code,
201200            sprite_ptr->color,
202201            sprite_ptr->flipx,sprite_ptr->flipy,
203202            sprite_ptr->x,sprite_ptr->y,
204203            sprite_ptr->zoomx,sprite_ptr->zoomy,
205            machine.priority_bitmap,sprite_ptr->primask,0);
204            machine().priority_bitmap,sprite_ptr->primask,0);
206205   }
207206}
208207
209208
210static void draw_sprites_cbombers(running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
209void undrfire_state::draw_sprites_cbombers(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs)
211210{
212   undrfire_state *state = machine.driver_data<undrfire_state>();
213   UINT32 *spriteram32 = state->m_spriteram;
214   UINT16 *spritemap = (UINT16 *)state->memregion("user1")->base();
215   UINT8 *spritemapHibit = (UINT8 *)state->memregion("user2")->base();
211   UINT32 *spriteram32 = m_spriteram;
212   UINT16 *spritemap = (UINT16 *)memregion("user1")->base();
213   UINT8 *spritemapHibit = (UINT8 *)memregion("user2")->base();
216214
217215   int offs, data, tilenum, color, flipx, flipy;
218216   int x, y, priority, dblsize, curx, cury;
r21023r21024
223221
224222   /* pdrawgfx() needs us to draw sprites front to back, so we have to build a list
225223      while processing sprite ram and then draw them all at the end */
226   struct tempsprite *sprite_ptr = state->m_spritelist;
224   struct tempsprite *sprite_ptr = m_spritelist;
227225
228   for (offs = (state->m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
226   for (offs = (m_spriteram.bytes()/4-4);offs >= 0;offs -= 4)
229227   {
230228      data = spriteram32[offs+0];
231229      flipx =    (data & 0x00800000) >> 23;
r21023r21024
316314         }
317315         else
318316         {
319            drawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
317            drawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
320318                  sprite_ptr->code,
321319                  sprite_ptr->color,
322320                  sprite_ptr->flipx,sprite_ptr->flipy,
r21023r21024
327325   }
328326
329327   /* this happens only if primsks != NULL */
330   while (sprite_ptr != state->m_spritelist)
328   while (sprite_ptr != m_spritelist)
331329   {
332330      sprite_ptr--;
333331
334      pdrawgfxzoom_transpen(bitmap,cliprect,machine.gfx[sprite_ptr->gfx],
332      pdrawgfxzoom_transpen(bitmap,cliprect,machine().gfx[sprite_ptr->gfx],
335333            sprite_ptr->code,
336334            sprite_ptr->color,
337335            sprite_ptr->flipx,sprite_ptr->flipy,
338336            sprite_ptr->x,sprite_ptr->y,
339337            sprite_ptr->zoomx,sprite_ptr->zoomy,
340            machine.priority_bitmap,sprite_ptr->primask,0);
338            machine().priority_bitmap,sprite_ptr->primask,0);
341339   }
342340}
343341
r21023r21024
448446      if ((tc0480scp_pri_reg_r(tc0480scp, space, 0) & 0x3) == 3)  /* on road levels kludge sprites up 1 priority */
449447      {
450448         static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0};
451         draw_sprites(machine(), bitmap, cliprect, primasks, 44, -574);
449         draw_sprites(bitmap, cliprect, primasks, 44, -574);
452450      }
453451      else
454452      {
455453         static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
456         draw_sprites(machine(), bitmap, cliprect, primasks, 44, -574);
454         draw_sprites(bitmap, cliprect, primasks, 44, -574);
457455      }
458456   }
459457
r21023r21024
591589      if ((tc0480scp_pri_reg_r(tc0480scp, space, 0) & 0x3) == 3)  /* on road levels kludge sprites up 1 priority */
592590      {
593591         static const int primasks[4] = {0xfff0, 0xff00, 0x0, 0x0};
594         draw_sprites_cbombers(machine(), bitmap, cliprect, primasks, 80, -208);
592         draw_sprites_cbombers(bitmap, cliprect, primasks, 80, -208);
595593      }
596594      else
597595      {
598596         static const int primasks[4] = {0xfffc, 0xfff0, 0xff00, 0x0};
599         draw_sprites_cbombers(machine(), bitmap, cliprect, primasks, 80, -208);
597         draw_sprites_cbombers(bitmap, cliprect, primasks, 80, -208);
600598      }
601599   }
602600
trunk/src/mame/includes/vicdual.h
r21023r21024
9090   UINT32 screen_update_vicdual_bw(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
9191   UINT32 screen_update_vicdual_bw_or_color(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
9292   UINT32 screen_update_vicdual_color(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
93   int get_vcounter();
94   int vicdual_is_cabinet_color();
9395};
9496
95/*----------- defined in drivers/vicdual.c -----------*/
9697
97int vicdual_is_cabinet_color(running_machine &machine);
98
9998/*----------- defined in audio/vicdual.c -----------*/
10099
101100MACHINE_CONFIG_EXTERN( frogs_audio );
trunk/src/mame/includes/vigilant.h
r21023r21024
2828   virtual void video_reset();
2929   UINT32 screen_update_vigilant(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3030   UINT32 screen_update_kikcubic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
31   void update_background();
32   void draw_foreground(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int opaque );
33   void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect);
34   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
3135};
trunk/src/mame/includes/videopin.h
r21023r21024
4343   virtual void video_start();
4444   UINT32 screen_update_videopin(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4545   TIMER_CALLBACK_MEMBER(interrupt_callback);
46   void update_plunger();
47   double calc_plunger_pos();
4648};
4749
4850/*----------- defined in audio/videopin.c -----------*/
trunk/src/mame/includes/victory.h
r21023r21024
6464   UINT32 screen_update_victory(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6565   INTERRUPT_GEN_MEMBER(victory_vblank_interrupt);
6666   TIMER_CALLBACK_MEMBER(bgcoll_irq_callback);
67   void victory_update_irq();
68   void set_palette();
69   int command2();
70   int command3();
71   int command4();
72   int command5();
73   int command6();
74   int command7();
75   void update_background();
76   void update_foreground();
6777};
trunk/src/mame/includes/vendetta.h
r21023r21024
4646   UINT32 screen_update_vendetta(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4747   INTERRUPT_GEN_MEMBER(vendetta_irq);
4848   TIMER_CALLBACK_MEMBER(z80_nmi_callback);
49   void vendetta_video_banking( int select );
4950};
5051
5152/*----------- defined in video/vendetta.c -----------*/
trunk/src/mame/includes/vectrex.h
r21023r21024
124124   void vectrex_multiplexer(int mux);
125125   void vectrex_add_point(int x, int y, rgb_t color, int intensity);
126126   void vectrex_add_point_stereo(int x, int y, rgb_t color, int intensity);
127   int vectrex_verify_cart(char *data);
127128};
128129
129130/*---------- defined in video/vectrex.c -----------*/
trunk/src/mame/includes/vball.h
r21023r21024
3333   virtual void video_start();
3434   UINT32 screen_update_vb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3535   TIMER_DEVICE_CALLBACK_MEMBER(vball_scanline);
36   void vb_bgprombank_w( int bank );
37   void vb_spprombank_w( int bank );
38   void vb_mark_all_dirty(  );
39   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
40   inline int scanline_to_vcount(int scanline);
3641};
37
38
39/*----------- defined in video/vball.c -----------*/
40
41void vb_bgprombank_w(running_machine &machine, int bank);
42void vb_spprombank_w(running_machine &machine, int bank);
43void vb_mark_all_dirty(running_machine &machine);
trunk/src/mame/includes/unico.h
r21023r21024
4242   DECLARE_VIDEO_START(zeropnt2);
4343   UINT32 screen_update_unico(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4444   UINT32 screen_update_zeropnt2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
45   void unico_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
46   void zeropnt2_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
4547};
trunk/src/mame/includes/vsnes.h
r21023r21024
101101   DECLARE_PALETTE_INIT(vsdual);
102102   UINT32 screen_update_vsnes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
103103   UINT32 screen_update_vsnes_bottom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
104   void v_set_videorom_bank(  int start, int count, int vrom_start_bank );
105   void mapper4_set_prg(  );
106   void mapper4_set_chr(  );
104107};
105108
106109/*----------- defined in video/vsnes.c -----------*/
trunk/src/mame/includes/undrfire.h
r21023r21024
4747   UINT32 screen_update_cbombers(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4848   INTERRUPT_GEN_MEMBER(undrfire_interrupt);
4949   TIMER_CALLBACK_MEMBER(interrupt5);
50   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
51   void draw_sprites_cbombers(bitmap_ind16 &bitmap,const rectangle &cliprect,const int *primasks,int x_offs,int y_offs);
5052};
trunk/src/mame/includes/vulgus.h
r21023r21024
2727   virtual void palette_init();
2828   UINT32 screen_update_vulgus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
2929   INTERRUPT_GEN_MEMBER(vulgus_vblank_irq);
30   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
3031};
trunk/src/mame/includes/vastar.h
r21023r21024
4242   virtual void video_start();
4343   UINT32 screen_update_vastar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4444   INTERRUPT_GEN_MEMBER(vblank_irq);
45   void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
4546};
trunk/src/mame/includes/vaportra.h
r21023r21024
3838   virtual void machine_start();
3939   virtual void machine_reset();
4040   UINT32 screen_update_vaportra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
41   void update_24bitcol( int offset );
4142};
trunk/src/mame/includes/volfied.h
r21023r21024
4545   virtual void video_start();
4646   UINT32 screen_update_volfied(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4747   TIMER_CALLBACK_MEMBER(volfied_timer_callback);
48   void refresh_pixel_layer( bitmap_ind16 &bitmap );
49   void volfied_cchip_init(  );
50   void volfied_cchip_reset(  );
4851};
4952
5053
51/*----------- defined in machine/volfied.c -----------*/
52void volfied_cchip_init(running_machine &machine);
53void volfied_cchip_reset(running_machine &machine);
trunk/src/mame/includes/vertigo.h
r21023r21024
114114   TIMER_CALLBACK_MEMBER(sound_command_w);
115115   DECLARE_WRITE_LINE_MEMBER(v_irq4_w);
116116   DECLARE_WRITE_LINE_MEMBER(v_irq3_w);
117   void vertigo_vproc_init();
118   void vertigo_vproc_reset();
119   void am2901x4 (am2901 *bsp, microcode *mc);
120   void vertigo_vgen (vector_generator *vg);
121   void vertigo_vproc(int cycles, int irq4);
122   void update_irq_encoder(int line, int state);
117123};
118124
119125/*----------- defined in machine/vertigo.c -----------*/
r21023r21024
122128
123129extern const struct pit8253_config vertigo_pit8254_config;
124130
125/*----------- defined in video/vertigo.c -----------*/
126
127void vertigo_vproc_init(running_machine &machine);
128void vertigo_vproc_reset(running_machine &machine);
129void vertigo_vproc(running_machine &machine, int cycles, int irq4);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team