Previous 199869 Revisions Next

r20827 Friday 8th February, 2013 at 12:49:41 UTC by Miodrag Milanović
Modernization of drivers part 7 (no whatsnew)
[src/mame/drivers]hitme.c hyprduel.c
[src/mame/includes]hcastle.h hexion.h higemaru.h himesiki.h hitme.h hnayayoi.h holeland.h homedata.h homerun.h hyhoo.h hyperspt.h hyprduel.h
[src/mame/video]hcastle.c hexion.c higemaru.c himesiki.c hnayayoi.c holeland.c homedata.c homerun.c hyhoo.c hyperspt.c hyprduel.c

trunk/src/mame/drivers/hitme.c
r20826r20827
126126 *
127127 *************************************/
128128
129static UINT8 read_port_and_t0( running_machine &machine, int port )
129UINT8 hitme_state::read_port_and_t0( int port )
130130{
131   hitme_state *state = machine.driver_data<hitme_state>();
132131   static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
133132
134   UINT8 val = machine.root_device().ioport(portnames[port])->read();
135   if (machine.time() > state->m_timeout_time)
133   UINT8 val = machine().root_device().ioport(portnames[port])->read();
134   if (machine().time() > m_timeout_time)
136135      val ^= 0x80;
137136   return val;
138137}
139138
140139
141static UINT8 read_port_and_t0_and_hblank( running_machine &machine, int port )
140UINT8 hitme_state::read_port_and_t0_and_hblank( int port )
142141{
143   UINT8 val = read_port_and_t0(machine, port);
144   if (machine.primary_screen->hpos() < (machine.primary_screen->width() * 9 / 10))
142   UINT8 val = read_port_and_t0(port);
143   if (machine().primary_screen->hpos() < (machine().primary_screen->width() * 9 / 10))
145144      val ^= 0x04;
146145   return val;
147146}
r20826r20827
149148
150149READ8_MEMBER(hitme_state::hitme_port_0_r)
151150{
152   return read_port_and_t0_and_hblank(machine(), 0);
151   return read_port_and_t0_and_hblank(0);
153152}
154153
155154
156155READ8_MEMBER(hitme_state::hitme_port_1_r)
157156{
158   return read_port_and_t0(machine(), 1);
157   return read_port_and_t0(1);
159158}
160159
161160
162161READ8_MEMBER(hitme_state::hitme_port_2_r)
163162{
164   return read_port_and_t0_and_hblank(machine(), 2);
163   return read_port_and_t0_and_hblank(2);
165164}
166165
167166
168167READ8_MEMBER(hitme_state::hitme_port_3_r)
169168{
170   return read_port_and_t0(machine(), 3);
169   return read_port_and_t0(3);
171170}
172171
173172
trunk/src/mame/drivers/hyprduel.c
r20826r20827
4545                                Interrupts
4646***************************************************************************/
4747
48static void update_irq_state( running_machine &machine )
48void hyprduel_state::update_irq_state(  )
4949{
50   hyprduel_state *state = machine.driver_data<hyprduel_state>();
51   int irq = state->m_requested_int & ~*state->m_irq_enable;
50   int irq = m_requested_int & ~*m_irq_enable;
5251
53   state->m_maincpu->set_input_line(3, (irq & state->m_int_num) ? ASSERT_LINE : CLEAR_LINE);
52   m_maincpu->set_input_line(3, (irq & m_int_num) ? ASSERT_LINE : CLEAR_LINE);
5453}
5554
5655TIMER_CALLBACK_MEMBER(hyprduel_state::vblank_end_callback)
r20826r20827
7372   else
7473      m_requested_int |= 0x12;        /* hsync */
7574
76   update_irq_state(machine());
75   update_irq_state();
7776}
7877
7978READ16_MEMBER(hyprduel_state::hyprduel_irq_cause_r)
r20826r20827
9089      else
9190         m_requested_int &= ~(data & *m_irq_enable);
9291
93      update_irq_state(machine());
92      update_irq_state();
9493   }
9594}
9695
r20826r20827
255254TIMER_CALLBACK_MEMBER(hyprduel_state::hyprduel_blit_done)
256255{
257256   m_requested_int |= 1 << m_blitter_bit;
258   update_irq_state(machine());
257   update_irq_state();
259258}
260259
261INLINE int blt_read( const UINT8 *ROM, const int offs )
260inline int hyprduel_state::blt_read( const UINT8 *ROM, const int offs )
262261{
263262   return ROM[offs];
264263}
trunk/src/mame/includes/hyprduel.h
r20826r20827
9595   TIMER_CALLBACK_MEMBER(hyprduel_blit_done);
9696   TIMER_DEVICE_CALLBACK_MEMBER(hyprduel_interrupt);
9797   void hyprduel_postload();
98   inline void get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram);
99   inline void get_tile_info_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram );
100   inline void get_tile_info_16x16_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram );
101   inline void hyprduel_vram_w( offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram );
102   void alloc_empty_tiles(  );
103   void expand_gfx1(hyprduel_state &state);
104   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
105   void draw_layers( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl );
106   void dirty_tiles( int layer, UINT16 *vram );
107   void update_irq_state(  );
108   inline int blt_read( const UINT8 *ROM, const int offs );
98109};
trunk/src/mame/includes/hyperspt.h
r20826r20827
4444   DECLARE_VIDEO_START(roadf);
4545   UINT32 screen_update_hyperspt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4646   INTERRUPT_GEN_MEMBER(vblank_irq);
47   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
4748};
trunk/src/mame/includes/hnayayoi.h
r20826r20827
3737   virtual void video_start();
3838   DECLARE_VIDEO_START(untoucha);
3939   UINT32 screen_update_hnayayoi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
40   void common_vh_start( int num_pixmaps );
41   void copy_pixel( int x, int y, int pen );
42   void draw_layer_interleaved( bitmap_ind16 &bitmap, const rectangle &cliprect, int left_pixmap, int right_pixmap, int palbase, int transp );
4043};
trunk/src/mame/includes/himesiki.h
r20826r20827
3434   virtual void machine_reset();
3535   virtual void video_start();
3636   UINT32 screen_update_himesiki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
37   void himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
3738};
trunk/src/mame/includes/homerun.h
r20826r20827
5454   virtual void video_start();
5555   UINT32 screen_update_homerun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
5656   DECLARE_WRITE8_MEMBER(homerun_banking_w);
57   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
5758};
trunk/src/mame/includes/hyhoo.h
r20826r20827
2525   virtual void video_start();
2626   UINT32 screen_update_hyhoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
2727   TIMER_CALLBACK_MEMBER(blitter_timer_callback);
28   void hyhoo_gfxdraw();
2829};
trunk/src/mame/includes/holeland.h
r20826r20827
3333   DECLARE_VIDEO_START(crzrally);
3434   UINT32 screen_update_holeland(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3535   UINT32 screen_update_crzrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
36   void holeland_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
37   void crzrally_draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
3638};
trunk/src/mame/includes/higemaru.h
r20826r20827
2828   virtual void palette_init();
2929   UINT32 screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
3030   TIMER_DEVICE_CALLBACK_MEMBER(higemaru_scanline);
31   void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
3132};
trunk/src/mame/includes/hcastle.h
r20826r20827
5656   virtual void video_start();
5757   virtual void palette_init();
5858   UINT32 screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
59   void set_pens();
60   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank );
5961};
trunk/src/mame/includes/hitme.h
r20826r20827
4141   DECLARE_VIDEO_START(barricad);
4242   UINT32 screen_update_hitme(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
4343   UINT32 screen_update_barricad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44   UINT8 read_port_and_t0( int port );
45   UINT8 read_port_and_t0_and_hblank( int port );
4446};
4547
4648
trunk/src/mame/includes/homedata.h
r20826r20827
127127   void screen_eof_homedata(screen_device &screen, bool state);
128128   INTERRUPT_GEN_MEMBER(homedata_irq);
129129   INTERRUPT_GEN_MEMBER(upd7807_irq);
130   void mrokumei_handleblit( address_space &space, int rom_base );
131   void reikaids_handleblit( address_space &space, int rom_base );
132   void pteacher_handleblit( address_space &space, int rom_base );
133   inline void mrokumei_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank );
134   inline void mrokumei_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank );
135   inline void reikaids_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank );
136   inline void pteacher_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank );
137   inline void lemnangl_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxset, int gfxbank );
138   inline void mirderby_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank );
139   inline void mirderby_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank );
130140};
trunk/src/mame/includes/hexion.h
r20826r20827
2424   virtual void video_start();
2525   UINT32 screen_update_hexion(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
2626   TIMER_DEVICE_CALLBACK_MEMBER(hexion_scanline);
27   inline void get_tile_info(tile_data &tileinfo,int tile_index,UINT8 *ram);
2728};
trunk/src/mame/video/homerun.c
r20826r20827
108108}
109109
110110
111static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
111void homerun_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
112112{
113   homerun_state *state = machine.driver_data<homerun_state>();
114   UINT8 *spriteram = state->m_spriteram;
113   UINT8 *spriteram = m_spriteram;
115114   int offs;
116115
117   for (offs = state->m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
116   for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
118117   {
119118      int sx = spriteram[offs + 3];
120119      int sy = spriteram[offs + 0] - 15;
121      int code = (spriteram[offs + 1]) | ((spriteram[offs + 2] & 0x8) << 5) | ((state->m_gfx_ctrl & 3) << 9);
120      int code = (spriteram[offs + 1]) | ((spriteram[offs + 2] & 0x8) << 5) | ((m_gfx_ctrl & 3) << 9);
122121      int color = (spriteram[offs + 2] & 0x07) | 8;
123122      int flipx = (spriteram[offs + 2] & 0x40) >> 6;
124123      int flipy = (spriteram[offs + 2] & 0x80) >> 7;
125124
126      drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
125      drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
127126            code,
128127            color,
129128            flipx,flipy,
130129            sx,sy,0);
131130
132131      // wraparound
133      drawgfx_transpen(bitmap, cliprect, machine.gfx[1],
132      drawgfx_transpen(bitmap, cliprect, machine().gfx[1],
134133            code,
135134            color,
136135            flipx,flipy,
r20826r20827
144143   m_tilemap->set_scrollx(0, m_scrollx);
145144
146145   m_tilemap->draw(bitmap, cliprect, 0, 0);
147   draw_sprites(machine(), bitmap, cliprect);
146   draw_sprites(bitmap, cliprect);
148147
149148   return 0;
150149}
trunk/src/mame/video/hyprduel.c
r20826r20827
103103
104104
105105/* 8x8x4 tiles only */
106INLINE void get_tile_info( running_machine &machine, tile_data &tileinfo, int tile_index, int layer, UINT16 *vram)
106inline void hyprduel_state::get_tile_info( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram)
107107{
108   hyprduel_state *state = machine.driver_data<hyprduel_state>();
109108   UINT16 code;
110109   int table_index;
111110   UINT32 tile;
112111
113112   /* The actual tile index depends on the window */
114   tile_index = ((tile_index / WIN_NX + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
115               ((tile_index % WIN_NX + state->m_window[layer * 2 + 1] / 8) % BIG_NX);
113   tile_index = ((tile_index / WIN_NX + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
114               ((tile_index % WIN_NX + m_window[layer * 2 + 1] / 8) % BIG_NX);
116115
117116   /* Fetch the code */
118117   code = vram[tile_index];
119118
120119   /* Use it as an index into the tiles set table */
121120   table_index = ((code & 0x1ff0) >> 4 ) * 2;
122   tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
121   tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
123122
124123   if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
125124   {
126125      int _code = code & 0x000f;
127      tileinfo.pen_data = state->m_empty_tiles + _code * 16 * 16;
126      tileinfo.pen_data = m_empty_tiles + _code * 16 * 16;
128127      tileinfo.palette_base = ((code & 0x0ff0)) + 0x1000;
129128      tileinfo.flags = 0;
130129      tileinfo.group = 0;
r20826r20827
132131   else
133132   {
134133      tileinfo.group = 0;
135      SET_TILE_INFO(
134      SET_TILE_INFO_MEMBER(
136135            0,
137136            (tile & 0xfffff) + (code & 0xf),
138137            (((tile & 0x0ff00000) >> 20)) + 0x100,
r20826r20827
142141
143142/* 8x8x4 or 8x8x8 tiles. It's the tile's color that decides: if its low 4
144143   bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
145INLINE void get_tile_info_8bit( running_machine &machine, tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
144inline void hyprduel_state::get_tile_info_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
146145{
147   hyprduel_state *state = machine.driver_data<hyprduel_state>();
148146   UINT16 code;
149147   int table_index;
150148   UINT32 tile;
151149
152150   /* The actual tile index depends on the window */
153   tile_index = ((tile_index / WIN_NX + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
154               ((tile_index % WIN_NX + state->m_window[layer * 2 + 1] / 8) % BIG_NX);
151   tile_index = ((tile_index / WIN_NX + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
152               ((tile_index % WIN_NX + m_window[layer * 2 + 1] / 8) % BIG_NX);
155153
156154   /* Fetch the code */
157155   code = vram[tile_index];
158156
159157   /* Use it as an index into the tiles set table */
160158   table_index = ((code & 0x1ff0) >> 4) * 2;
161   tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
159   tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
162160
163161   if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
164162   {
165163      int _code = code & 0x000f;
166      tileinfo.pen_data = state->m_empty_tiles + _code * 16 * 16;
164      tileinfo.pen_data = m_empty_tiles + _code * 16 * 16;
167165      tileinfo.palette_base = ((code & 0x0ff0)) + 0x1000;
168166      tileinfo.flags = 0;
169167      tileinfo.group = 0;
r20826r20827
171169   else if ((tile & 0x00f00000) == 0x00f00000) /* draw tile as 8bpp */
172170   {
173171      tileinfo.group = 1;
174      SET_TILE_INFO(
172      SET_TILE_INFO_MEMBER(
175173            1,
176174            (tile & 0xfffff) + 2*(code & 0xf),
177175            ((tile & 0x0f000000) >> 24) + 0x10,
r20826r20827
180178   else
181179   {
182180      tileinfo.group = 0;
183      SET_TILE_INFO(
181      SET_TILE_INFO_MEMBER(
184182            0,
185183            (tile & 0xfffff) + (code & 0xf),
186184            (((tile & 0x0ff00000) >> 20)) + 0x100,
r20826r20827
190188
191189/* 16x16x4 or 16x16x8 tiles. It's the tile's color that decides: if its low 4
192190   bits are high ($f,$1f,$2f etc) the tile is 8bpp, otherwise it's 4bpp */
193INLINE void get_tile_info_16x16_8bit( running_machine &machine, tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
191inline void hyprduel_state::get_tile_info_16x16_8bit( tile_data &tileinfo, int tile_index, int layer, UINT16 *vram )
194192{
195   hyprduel_state *state = machine.driver_data<hyprduel_state>();
196193   UINT16 code;
197194   int table_index;
198195   UINT32 tile;
199196
200197   /* The actual tile index depends on the window */
201   tile_index = ((tile_index / WIN_NX + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
202               ((tile_index % WIN_NX + state->m_window[layer * 2 + 1] / 8) % BIG_NX);
198   tile_index = ((tile_index / WIN_NX + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX +
199               ((tile_index % WIN_NX + m_window[layer * 2 + 1] / 8) % BIG_NX);
203200
204201   /* Fetch the code */
205202   code = vram[tile_index];
206203
207204   /* Use it as an index into the tiles set table */
208205   table_index = ((code & 0x1ff0) >> 4) * 2;
209   tile = (state->m_tiletable[table_index + 0] << 16) + state->m_tiletable[table_index + 1];
206   tile = (m_tiletable[table_index + 0] << 16) + m_tiletable[table_index + 1];
210207
211208   if (code & 0x8000) /* Special: draw a tile of a single color (i.e. not from the gfx ROMs) */
212209   {
213210      int _code = code & 0x000f;
214      tileinfo.pen_data = state->m_empty_tiles + _code * 16 * 16;
211      tileinfo.pen_data = m_empty_tiles + _code * 16 * 16;
215212      tileinfo.palette_base = ((code & 0x0ff0)) + 0x1000;
216213      tileinfo.flags = 0;
217214      tileinfo.group = 0;
r20826r20827
219216   else if ((tile & 0x00f00000) == 0x00f00000) /* draw tile as 8bpp */
220217   {
221218      tileinfo.group = 1;
222      SET_TILE_INFO(
219      SET_TILE_INFO_MEMBER(
223220            3,
224221            (tile & 0xfffff) + 8*(code & 0xf),
225222            ((tile & 0x0f000000) >> 24) + 0x10,
r20826r20827
228225   else
229226   {
230227      tileinfo.group = 0;
231      SET_TILE_INFO(
228      SET_TILE_INFO_MEMBER(
232229            2,
233230            (tile & 0xfffff) + 4*(code & 0xf),
234231            (((tile & 0x0ff00000) >> 20)) + 0x100,
r20826r20827
237234   }
238235}
239236
240INLINE void hyprduel_vram_w( running_machine &machine, offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram )
237inline void hyprduel_state::hyprduel_vram_w( offs_t offset, UINT16 data, UINT16 mem_mask, int layer, UINT16 *vram )
241238{
242   hyprduel_state *state = machine.driver_data<hyprduel_state>();
243239   COMBINE_DATA(&vram[offset]);
244240   {
245241      /* Account for the window */
246      int col = (offset % BIG_NX) - ((state->m_window[layer * 2 + 1] / 8) % BIG_NX);
247      int row = (offset / BIG_NX) - ((state->m_window[layer * 2 + 0] / 8) % BIG_NY);
242      int col = (offset % BIG_NX) - ((m_window[layer * 2 + 1] / 8) % BIG_NX);
243      int row = (offset / BIG_NX) - ((m_window[layer * 2 + 0] / 8) % BIG_NY);
248244      if (col < -(BIG_NX-WIN_NX))
249245         col += (BIG_NX-WIN_NX) + WIN_NX;
250246      if (row < -(BIG_NY-WIN_NY))
251247         row += (BIG_NY-WIN_NY) + WIN_NY;
252248      if ((col >= 0) && (col < WIN_NX) && (row >= 0) && (row < WIN_NY))
253         state->m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
249         m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
254250   }
255251}
256252
r20826r20827
258254
259255TILE_GET_INFO_MEMBER(hyprduel_state::get_tile_info_0_8bit)
260256{
261   get_tile_info_8bit(machine(), tileinfo, tile_index, 0, m_vram_0);
257   get_tile_info_8bit(tileinfo, tile_index, 0, m_vram_0);
262258}
263259
264260TILE_GET_INFO_MEMBER(hyprduel_state::get_tile_info_1_8bit)
265261{
266   get_tile_info_8bit(machine(), tileinfo, tile_index, 1, m_vram_1);
262   get_tile_info_8bit(tileinfo, tile_index, 1, m_vram_1);
267263}
268264
269265TILE_GET_INFO_MEMBER(hyprduel_state::get_tile_info_2_8bit)
270266{
271   get_tile_info_8bit(machine(), tileinfo, tile_index, 2, m_vram_2);
267   get_tile_info_8bit(tileinfo, tile_index, 2, m_vram_2);
272268}
273269
274270WRITE16_MEMBER(hyprduel_state::hyprduel_vram_0_w)
275271{
276   hyprduel_vram_w(machine(), offset, data, mem_mask, 0, m_vram_0);
272   hyprduel_vram_w(offset, data, mem_mask, 0, m_vram_0);
277273}
278274
279275WRITE16_MEMBER(hyprduel_state::hyprduel_vram_1_w)
280276{
281   hyprduel_vram_w(machine(), offset, data, mem_mask, 1, m_vram_1);
277   hyprduel_vram_w(offset, data, mem_mask, 1, m_vram_1);
282278}
283279
284280WRITE16_MEMBER(hyprduel_state::hyprduel_vram_2_w)
285281{
286   hyprduel_vram_w(machine(), offset, data, mem_mask, 2, m_vram_2);
282   hyprduel_vram_w(offset, data, mem_mask, 2, m_vram_2);
287283}
288284
289285
r20826r20827
311307 the tile's sizes to be known at startup - which we don't!
312308*/
313309
314static void alloc_empty_tiles( running_machine &machine )
310void hyprduel_state::alloc_empty_tiles(  )
315311{
316   hyprduel_state *state = machine.driver_data<hyprduel_state>();
317312   int code,i;
318313
319   state->m_empty_tiles = auto_alloc_array(machine, UINT8, 16*16*16);
320   state->save_pointer(NAME(state->m_empty_tiles), 16*16*16);
314   m_empty_tiles = auto_alloc_array(machine(), UINT8, 16*16*16);
315   save_pointer(NAME(m_empty_tiles), 16*16*16);
321316
322317   for (code = 0; code < 0x10; code++)
323318      for (i = 0; i < 16 * 16; i++)
324         state->m_empty_tiles[16 * 16 * code + i] = code;
319         m_empty_tiles[16 * 16 * code + i] = code;
325320}
326321
327322
r20826r20827
342337}
343338
344339
345static void expand_gfx1(hyprduel_state &state)
340void hyprduel_state::expand_gfx1(hyprduel_state &state)
346341{
347342   UINT8 *base_gfx = state.machine().root_device().memregion("gfx1")->base();
348343   UINT32 length = 2 * state.machine().root_device().memregion("gfx1")->bytes();
r20826r20827
358353VIDEO_START_MEMBER(hyprduel_state,common_14220)
359354{
360355   expand_gfx1(*this);
361   alloc_empty_tiles(machine());
356   alloc_empty_tiles();
362357   m_tiletable_old = auto_alloc_array(machine(), UINT16, m_tiletable.bytes() / 2);
363358   m_dirtyindex = auto_alloc_array(machine(), UINT8, m_tiletable.bytes() / 4);
364359
r20826r20827
459454
460455/* Draw sprites */
461456
462static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
457void hyprduel_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
463458{
464   hyprduel_state *state = machine.driver_data<hyprduel_state>();
465   UINT8 *base_gfx4 = state->m_expanded_gfx1;
466   UINT8 *base_gfx8 = state->memregion("gfx1")->base();
467   UINT32 gfx_size = state->memregion("gfx1")->bytes();
459   UINT8 *base_gfx4 = m_expanded_gfx1;
460   UINT8 *base_gfx8 = memregion("gfx1")->base();
461   UINT32 gfx_size = memregion("gfx1")->bytes();
468462
469   int max_x = machine.primary_screen->width();
470   int max_y = machine.primary_screen->height();
463   int max_x = machine().primary_screen->width();
464   int max_y = machine().primary_screen->height();
471465
472   int max_sprites = state->m_spriteram.bytes() / 8;
473   int sprites = state->m_videoregs[0x00 / 2] % max_sprites;
466   int max_sprites = m_spriteram.bytes() / 8;
467   int sprites = m_videoregs[0x00 / 2] % max_sprites;
474468
475   int color_start = ((state->m_videoregs[0x08 / 2] & 0xf) << 4) + 0x100;
469   int color_start = ((m_videoregs[0x08 / 2] & 0xf) << 4) + 0x100;
476470
477471   int i, j, pri;
478472   static const int primask[4] = { 0x0000, 0xff00, 0xff00|0xf0f0, 0xff00|0xf0f0|0xcccc };
r20826r20827
485479
486480   for (i = 0; i < 0x20; i++)
487481   {
488      if (!(state->m_videoregs[0x02 / 2] & 0x8000))
482      if (!(m_videoregs[0x02 / 2] & 0x8000))
489483      {
490         src = state->m_spriteram + (sprites - 1) * (8 / 2);
484         src = m_spriteram + (sprites - 1) * (8 / 2);
491485         inc = -(8 / 2);
492486      } else {
493         src = state->m_spriteram;
487         src = m_spriteram;
494488         inc = (8 / 2);
495489      }
496490
r20826r20827
520514            continue;
521515         }
522516
523         pri = (state->m_videoregs[0x02 / 2] & 0x0300) >> 8;
517         pri = (m_videoregs[0x02 / 2] & 0x0300) >> 8;
524518
525         if (!(state->m_videoregs[0x02 / 2] & 0x8000))
519         if (!(m_videoregs[0x02 / 2] & 0x8000))
526520         {
527            if (curr_pri > (state->m_videoregs[0x02 / 2] & 0x1f))
528               pri = (state->m_videoregs[0x02 / 2] & 0x0c00) >> 10;
521            if (curr_pri > (m_videoregs[0x02 / 2] & 0x1f))
522               pri = (m_videoregs[0x02 / 2] & 0x0c00) >> 10;
529523         }
530524
531525         y = src[1];
r20826r20827
538532
539533         zoom = zoomtable[(y & 0xfc00) >> 10] << (16 - 8);
540534
541         x = (x & 0x07ff) - state->m_sprite_xoffs;
542         y = (y & 0x03ff) - state->m_sprite_yoffs;
535         x = (x & 0x07ff) - m_sprite_xoffs;
536         y = (y & 0x03ff) - m_sprite_yoffs;
543537
544538         width = (((attr >> 11) & 0x7) + 1) * 8;
545539         height = (((attr >>  8) & 0x7) + 1) * 8;
546540
547541         UINT32 gfxstart = (8 * 8 * 4 / 8) * (((attr & 0x000f) << 16) + code);
548542
549         if (state->flip_screen())
543         if (flip_screen())
550544         {
551545            flipx = !flipx;     x = max_x - x - width;
552546            flipy = !flipy;     y = max_y - y - height;
r20826r20827
558552            if ((gfxstart + width * height - 1) >= gfx_size)
559553               continue;
560554
561            gfx_element gfx(machine, base_gfx8 + gfxstart, width, height, width, 0, 256);
555            gfx_element gfx(machine(), base_gfx8 + gfxstart, width, height, width, 0, 256);
562556
563557            pdrawgfxzoom_transpen(bitmap,cliprect, &gfx,
564558                        0,
r20826r20827
566560                        flipx, flipy,
567561                        x, y,
568562                        zoom, zoom,
569                        machine.priority_bitmap,primask[pri], 255);
563                        machine().priority_bitmap,primask[pri], 255);
570564         }
571565         else
572566         {
r20826r20827
574568            if ((gfxstart + width / 2 * height - 1) >= gfx_size)
575569               continue;
576570
577            gfx_element gfx(machine, base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
571            gfx_element gfx(machine(), base_gfx4 + 2 * gfxstart, width, height, width, 0, 16);
578572
579573            pdrawgfxzoom_transpen(bitmap,cliprect, &gfx,
580574                        0,
r20826r20827
582576                        flipx, flipy,
583577                        x, y,
584578                        zoom, zoom,
585                        machine.priority_bitmap,primask[pri], 15);
579                        machine().priority_bitmap,primask[pri], 15);
586580         }
587581#if 0
588582{   /* Display priority + zoom on each sprite */
r20826r20827
630624}
631625
632626
633static void draw_layers( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl )
627void hyprduel_state::draw_layers( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri, int layers_ctrl )
634628{
635   hyprduel_state *state = machine.driver_data<hyprduel_state>();
636   UINT16 layers_pri = state->m_videoregs[0x10/2];
629   UINT16 layers_pri = m_videoregs[0x10/2];
637630   int layer;
638631
639632   /* Draw all the layers with priority == pri */
r20826r20827
642635      if ( pri == ((layers_pri >> (layer*2)) & 3) )
643636      {
644637         if (layers_ctrl & (1 << layer)) // for debug
645            state->m_bg_tilemap[layer]->draw(bitmap, cliprect, 0, 1 << (3 - pri));
638            m_bg_tilemap[layer]->draw(bitmap, cliprect, 0, 1 << (3 - pri));
646639      }
647640   }
648641}
649642
650643/* Dirty tilemaps when the tiles set changes */
651static void dirty_tiles( running_machine &machine, int layer, UINT16 *vram )
644void hyprduel_state::dirty_tiles( int layer, UINT16 *vram )
652645{
653   hyprduel_state *state = machine.driver_data<hyprduel_state>();
654646   int col, row;
655647
656648   for (row = 0; row < WIN_NY; row++)
657649   {
658650      for (col = 0; col < WIN_NX; col++)
659651      {
660         int offset = (col + state->m_window[layer * 2 + 1] / 8) % BIG_NX + ((row + state->m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX;
652         int offset = (col + m_window[layer * 2 + 1] / 8) % BIG_NX + ((row + m_window[layer * 2 + 0] / 8) % BIG_NY) * BIG_NX;
661653         UINT16 code = vram[offset];
662654
663         if (!(code & 0x8000) && state->m_dirtyindex[(code & 0x1ff0) >> 4])
664            state->m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
655         if (!(code & 0x8000) && m_dirtyindex[(code & 0x1ff0) >> 4])
656            m_bg_tilemap[layer]->mark_tile_dirty(row * WIN_NX + col);
665657      }
666658   }
667659}
r20826r20827
691683
692684      if (dirty)
693685      {
694         dirty_tiles(machine(), 0, m_vram_0);
695         dirty_tiles(machine(), 1, m_vram_1);
696         dirty_tiles(machine(), 2, m_vram_2);
686         dirty_tiles(0, m_vram_0);
687         dirty_tiles(1, m_vram_1);
688         dirty_tiles(2, m_vram_2);
697689      }
698690   }
699691
r20826r20827
740732#endif
741733
742734   for (pri = 3; pri >= 0; pri--)
743      draw_layers(machine(), bitmap, cliprect, pri, layers_ctrl);
735      draw_layers(bitmap, cliprect, pri, layers_ctrl);
744736
745737   if (layers_ctrl & 0x08)
746      draw_sprites(machine(), bitmap, cliprect);
738      draw_sprites(bitmap, cliprect);
747739
748740   return 0;
749741}
trunk/src/mame/video/hcastle.c
r20826r20827
4242}
4343
4444
45static void set_pens(running_machine &machine)
45void hcastle_state::set_pens()
4646{
47   hcastle_state *state = machine.driver_data<hcastle_state>();
4847   int i;
4948
5049   for (i = 0x00; i < 0x100; i += 2)
5150   {
52      UINT16 data = state->m_paletteram[i | 1] | (state->m_paletteram[i] << 8);
51      UINT16 data = m_paletteram[i | 1] | (m_paletteram[i] << 8);
5352
5453      rgb_t color = MAKE_RGB(pal5bit(data >> 0), pal5bit(data >> 5), pal5bit(data >> 10));
5554
56      colortable_palette_set_color(machine.colortable, i >> 1, color);
55      colortable_palette_set_color(machine().colortable, i >> 1, color);
5756   }
5857}
5958
r20826r20827
199198
200199/*****************************************************************************/
201200
202static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank )
201void hcastle_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT8 *sbank, int bank )
203202{
204   hcastle_state *state = machine.driver_data<hcastle_state>();
205   device_t *k007121 = bank ? state->m_k007121_2 : state->m_k007121_1;
206   address_space &space = machine.driver_data()->generic_space();
203   device_t *k007121 = bank ? m_k007121_2 : m_k007121_1;
204   address_space &space = machine().driver_data()->generic_space();
207205   int base_color = (k007121_ctrlram_r(k007121, space, 6) & 0x30) * 2;
208   int bank_base = (bank == 0) ? 0x4000 * (state->m_gfx_bank & 1) : 0;
206   int bank_base = (bank == 0) ? 0x4000 * (m_gfx_bank & 1) : 0;
209207
210   k007121_sprites_draw(k007121, bitmap, cliprect, machine.gfx[bank], machine.colortable, sbank, base_color, 0, bank_base, (UINT32)-1);
208   k007121_sprites_draw(k007121, bitmap, cliprect, machine().gfx[bank], machine().colortable, sbank, base_color, 0, bank_base, (UINT32)-1);
211209}
212210
213211/*****************************************************************************/
r20826r20827
225223   UINT8 ctrl_2_2 = k007121_ctrlram_r(m_k007121_2, space, 2);
226224   UINT8 ctrl_2_3 = k007121_ctrlram_r(m_k007121_2, space, 3);
227225
228   set_pens(machine());
226   set_pens();
229227
230228   m_pf1_bankbase = 0x0000;
231229   m_pf2_bankbase = 0x4000 * ((m_gfx_bank & 2) >> 1);
r20826r20827
254252   if ((m_gfx_bank & 0x04) == 0)
255253   {
256254      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
257      draw_sprites(machine(), bitmap, cliprect, m_spriteram->buffer(), 0);
258      draw_sprites(machine(), bitmap, cliprect, m_spriteram2->buffer(), 1);
255      draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0);
256      draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 1);
259257      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
260258   }
261259   else
262260   {
263261      m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
264262      m_fg_tilemap->draw(bitmap, cliprect, 0, 0);
265      draw_sprites(machine(), bitmap, cliprect, m_spriteram->buffer(), 0);
266      draw_sprites(machine(), bitmap, cliprect, m_spriteram2->buffer(), 1);
263      draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0);
264      draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 1);
267265   }
268266   return 0;
269267}
trunk/src/mame/video/hyperspt.c
r20826r20827
126126   m_bg_tilemap->set_scroll_rows(32);
127127}
128128
129static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
129void hyperspt_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
130130{
131   hyperspt_state *state = machine.driver_data<hyperspt_state>();
132   UINT8 *spriteram = state->m_spriteram;
131   UINT8 *spriteram = m_spriteram;
133132   int offs;
134133
135   for (offs = state->m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
134   for (offs = m_spriteram.bytes() - 4;offs >= 0;offs -= 4)
136135   {
137136      int sx = spriteram[offs + 3];
138137      int sy = 240 - spriteram[offs + 1];
r20826r20827
141140      int flipx = ~spriteram[offs] & 0x40;
142141      int flipy = spriteram[offs] & 0x80;
143142
144      if (state->flip_screen())
143      if (flip_screen())
145144      {
146145         sy = 240 - sy;
147146         flipy = !flipy;
148147      }
149148
150      /* Note that this adjustment must be done AFTER handling state->flip_screen(), thus */
149      /* Note that this adjustment must be done AFTER handling flip_screen(), thus */
151150      /* proving that this is a hardware related "feature" */
152151
153152      sy += 1;
154153
155154      drawgfx_transmask(bitmap,cliprect,
156         machine.gfx[0],
155         machine().gfx[0],
157156         code, color,
158157         flipx, flipy,
159158         sx, sy,
160         colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
159         colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
161160
162161      /* redraw with wraparound */
163162
164163      drawgfx_transmask(bitmap,cliprect,
165         machine.gfx[0],
164         machine().gfx[0],
166165         code, color,
167166         flipx, flipy,
168167         sx - 256, sy,
169         colortable_get_transpen_mask(machine.colortable, machine.gfx[0], color, 0));
168         colortable_get_transpen_mask(machine().colortable, machine().gfx[0], color, 0));
170169   }
171170}
172171
r20826r20827
182181   }
183182
184183   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
185   draw_sprites(machine(), bitmap, cliprect);
184   draw_sprites(bitmap, cliprect);
186185   return 0;
187186}
188187
trunk/src/mame/video/hnayayoi.c
r20826r20827
1212#include "emu.h"
1313#include "includes/hnayayoi.h"
1414
15static void common_vh_start( running_machine &machine, int num_pixmaps )
15void hnayayoi_state::common_vh_start( int num_pixmaps )
1616{
17   hnayayoi_state *state = machine.driver_data<hnayayoi_state>();
1817   int i;
1918
20   state->m_total_pixmaps = num_pixmaps;
19   m_total_pixmaps = num_pixmaps;
2120
2221   for (i = 0; i < 8; i++)
2322   {
24      if (i < state->m_total_pixmaps)
23      if (i < m_total_pixmaps)
2524      {
26         state->m_pixmap[i] = auto_alloc_array(machine, UINT8, 256 * 256);
25         m_pixmap[i] = auto_alloc_array(machine(), UINT8, 256 * 256);
2726      }
2827      else
29         state->m_pixmap[i] = NULL;
28         m_pixmap[i] = NULL;
3029   }
3130}
3231
3332void hnayayoi_state::video_start()
3433{
35   common_vh_start(machine(), 4);  /* 4 bitmaps -> 2 layers */
34   common_vh_start(4);  /* 4 bitmaps -> 2 layers */
3635
3736   save_pointer(NAME(m_pixmap[0]), 256 * 256);
3837   save_pointer(NAME(m_pixmap[1]), 256 * 256);
r20826r20827
4241
4342VIDEO_START_MEMBER(hnayayoi_state,untoucha)
4443{
45   common_vh_start(machine(), 8);  /* 8 bitmaps -> 4 layers */
44   common_vh_start(8);  /* 8 bitmaps -> 4 layers */
4645
4746   save_pointer(NAME(m_pixmap[0]), 256 * 256);
4847   save_pointer(NAME(m_pixmap[1]), 256 * 256);
r20826r20827
111110   }
112111}
113112
114static void copy_pixel( running_machine &machine, int x, int y, int pen )
113void hnayayoi_state::copy_pixel( int x, int y, int pen )
115114{
116   hnayayoi_state *state = machine.driver_data<hnayayoi_state>();
117115   if (x >= 0 && x <= 255 && y >= 0 && y <= 255)
118116   {
119117      int i;
120118
121119      for (i = 0; i < 8; i++)
122120      {
123         if ((~state->m_blit_layer & (1 << i)) && (state->m_pixmap[i]))
124            state->m_pixmap[i][256 * y + x] = pen;
121         if ((~m_blit_layer & (1 << i)) && (m_pixmap[i]))
122            m_pixmap[i][256 * y + x] = pen;
125123      }
126124   }
127125}
r20826r20827
190188         case 0x2:
191189         case 0x1:
192190            while (cmd--)
193               copy_pixel(machine(), x++, y, pen);
191               copy_pixel(x++, y, pen);
194192            break;
195193
196194         case 0x0:
r20826r20827
221219}
222220
223221
224static void draw_layer_interleaved( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int left_pixmap, int right_pixmap, int palbase, int transp )
222void hnayayoi_state::draw_layer_interleaved( bitmap_ind16 &bitmap, const rectangle &cliprect, int left_pixmap, int right_pixmap, int palbase, int transp )
225223{
226   hnayayoi_state *state = machine.driver_data<hnayayoi_state>();
227224   int county, countx, pen;
228   UINT8 *src1 = state->m_pixmap[left_pixmap];
229   UINT8 *src2 = state->m_pixmap[right_pixmap];
225   UINT8 *src1 = m_pixmap[left_pixmap];
226   UINT8 *src2 = m_pixmap[right_pixmap];
230227   UINT16 *dstbase = &bitmap.pix16(0);
231228
232229   palbase *= 16;
r20826r20827
266263
267264   if (m_total_pixmaps == 4)
268265   {
269      draw_layer_interleaved(machine(), bitmap, cliprect, 3, 2, col1, 0);
270      draw_layer_interleaved(machine(), bitmap, cliprect, 1, 0, col0, 1);
266      draw_layer_interleaved(bitmap, cliprect, 3, 2, col1, 0);
267      draw_layer_interleaved(bitmap, cliprect, 1, 0, col0, 1);
271268   }
272269   else    /* total_pixmaps == 8 */
273270   {
274      draw_layer_interleaved(machine(), bitmap, cliprect, 7, 6, col3, 0);
275      draw_layer_interleaved(machine(), bitmap, cliprect, 5, 4, col2, 1);
276      draw_layer_interleaved(machine(), bitmap, cliprect, 3, 2, col1, 1);
277      draw_layer_interleaved(machine(), bitmap, cliprect, 1, 0, col0, 1);
271      draw_layer_interleaved(bitmap, cliprect, 7, 6, col3, 0);
272      draw_layer_interleaved(bitmap, cliprect, 5, 4, col2, 1);
273      draw_layer_interleaved(bitmap, cliprect, 3, 2, col1, 1);
274      draw_layer_interleaved(bitmap, cliprect, 1, 0, col0, 1);
278275   }
279276   return 0;
280277}
trunk/src/mame/video/himesiki.c
r20826r20827
4545      logerror("p08_w %02x\n",data);
4646}
4747
48static void himesiki_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
48void himesiki_state::himesiki_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
4949{
50   himesiki_state *state = machine.driver_data<himesiki_state>();
51   UINT8 *spriteram = state->m_spriteram;
50   UINT8 *spriteram = m_spriteram;
5251   int offs;
5352
5453   for (offs = 0x100; offs < 0x160; offs += 4)
r20826r20827
6564      if (x > 0x1e0)
6665         x -= 0x200;
6766
68      if (state->m_flipscreen)
67      if (m_flipscreen)
6968      {
7069         y = (y + 33) & 0xff;
7170         x = 224 - x;
r20826r20827
7978            y -= 0x100;
8079      }
8180
82      drawgfx_transpen(bitmap, cliprect, machine.gfx[1], code, col, fx, fy, x, y, 15);
81      drawgfx_transpen(bitmap, cliprect, machine().gfx[1], code, col, fx, fy, x, y, 15);
8382   }
8483
8584   for (offs = 0; offs < 0x100; offs += 4)
r20826r20827
9594      if (x > 0x1e0)
9695         x -= 0x200;
9796
98      if (state->m_flipscreen)
97      if (m_flipscreen)
9998      {
10099         y += 49;
101100         x = 240 - x;
r20826r20827
108107      if (y > 0xf0)
109108         y -= 0x100;
110109
111      drawgfx_transpen(bitmap, cliprect, machine.gfx[2], code, col, f, f, x, y, 15);
110      drawgfx_transpen(bitmap, cliprect, machine().gfx[2], code, col, f, f, x, y, 15);
112111   }
113112}
114113
r20826r20827
118117   m_bg_tilemap->set_scrolldx(x, x);
119118
120119   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_OPAQUE, 0);
121   himesiki_draw_sprites(machine(), bitmap, cliprect);
120   himesiki_draw_sprites(bitmap, cliprect);
122121
123122   return 0;
124123}
trunk/src/mame/video/holeland.c
r20826r20827
101101}
102102
103103
104static void holeland_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
104void holeland_state::holeland_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
105105{
106   holeland_state *state = machine.driver_data<holeland_state>();
107   UINT8 *spriteram = state->m_spriteram;
106   UINT8 *spriteram = m_spriteram;
108107   int offs, code, sx, sy, color, flipx, flipy;
109108
110109   /* Weird, sprites entries don't start on DWORD boundary */
111   for (offs = 3; offs < state->m_spriteram.bytes() - 1; offs += 4)
110   for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4)
112111   {
113112      sy = 236 - spriteram[offs];
114113      sx = spriteram[offs + 2];
115114
116115      /* Bit 7 unknown */
117116      code = spriteram[offs + 1] & 0x7f;
118      color = state->m_palette_offset + (spriteram[offs + 3] >> 4);
117      color = m_palette_offset + (spriteram[offs + 3] >> 4);
119118
120119      /* Bit 0, 1 unknown */
121120      flipx = spriteram[offs + 3] & 0x04;
122121      flipy = spriteram[offs + 3] & 0x08;
123122
124      if (state->flip_screen_x())
123      if (flip_screen_x())
125124      {
126125         flipx = !flipx;
127126         sx = 240 - sx;
128127      }
129128
130      if (state->flip_screen_y())
129      if (flip_screen_y())
131130      {
132131         flipy = !flipy;
133132         sy = 240 - sy;
134133      }
135134
136      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
135      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
137136            code,
138137            color,
139138            flipx,flipy,
r20826r20827
141140   }
142141}
143142
144static void crzrally_draw_sprites( running_machine &machine, bitmap_ind16 &bitmap,const rectangle &cliprect )
143void holeland_state::crzrally_draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect )
145144{
146   holeland_state *state = machine.driver_data<holeland_state>();
147   UINT8 *spriteram = state->m_spriteram;
145   UINT8 *spriteram = m_spriteram;
148146   int offs, code, sx, sy, color, flipx, flipy;
149147
150148   /* Weird, sprites entries don't start on DWORD boundary */
151   for (offs = 3; offs < state->m_spriteram.bytes() - 1; offs += 4)
149   for (offs = 3; offs < m_spriteram.bytes() - 1; offs += 4)
152150   {
153151      sy = 236 - spriteram[offs];
154152      sx = spriteram[offs + 2];
r20826r20827
160158      flipx = spriteram[offs + 3] & 0x04;
161159      flipy = spriteram[offs + 3] & 0x08;
162160
163      if (state->flip_screen_x())
161      if (flip_screen_x())
164162      {
165163         flipx = !flipx;
166164         sx = 240 - sx;
167165      }
168166
169      if (state->flip_screen_y())
167      if (flip_screen_y())
170168      {
171169         flipy = !flipy;
172170         sy = 240 - sy;
173171      }
174172
175      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
173      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
176174            code,
177175            color,
178176            flipx,flipy,
r20826r20827
184182{
185183/*m_bg_tilemap->mark_all_dirty(); */
186184   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER1, 0);
187   holeland_draw_sprites(machine(), bitmap, cliprect);
185   holeland_draw_sprites(bitmap, cliprect);
188186   m_bg_tilemap->draw(bitmap, cliprect, TILEMAP_DRAW_LAYER0, 0);
189187   return 0;
190188}
r20826r20827
192190UINT32 holeland_state::screen_update_crzrally(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
193191{
194192   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
195   crzrally_draw_sprites(machine(), bitmap, cliprect);
193   crzrally_draw_sprites(bitmap, cliprect);
196194   return 0;
197195}
trunk/src/mame/video/higemaru.c
r20826r20827
102102   m_bg_tilemap = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(higemaru_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
103103}
104104
105static void draw_sprites( running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect )
105void higemaru_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
106106{
107   higemaru_state *state = machine.driver_data<higemaru_state>();
108   UINT8 *spriteram = state->m_spriteram;
107   UINT8 *spriteram = m_spriteram;
109108   int offs;
110109
111   for (offs = state->m_spriteram.bytes() - 16; offs >= 0; offs -= 16)
110   for (offs = m_spriteram.bytes() - 16; offs >= 0; offs -= 16)
112111   {
113112      int code,col,sx,sy,flipx,flipy;
114113
r20826r20827
118117      sy = spriteram[offs + 8];
119118      flipx = spriteram[offs + 4] & 0x10;
120119      flipy = spriteram[offs + 4] & 0x20;
121      if (state->flip_screen())
120      if (flip_screen())
122121      {
123122         sx = 240 - sx;
124123         sy = 240 - sy;
r20826r20827
126125         flipy = !flipy;
127126      }
128127
129      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
128      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
130129            code,
131130            col,
132131            flipx,flipy,
133132            sx,sy,15);
134133
135134      /* draw again with wraparound */
136      drawgfx_transpen(bitmap,cliprect,machine.gfx[1],
135      drawgfx_transpen(bitmap,cliprect,machine().gfx[1],
137136            code,
138137            col,
139138            flipx,flipy,
r20826r20827
144143UINT32 higemaru_state::screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
145144{
146145   m_bg_tilemap->draw(bitmap, cliprect, 0, 0);
147   draw_sprites(machine(), bitmap, cliprect);
146   draw_sprites(bitmap, cliprect);
148147   return 0;
149148}
trunk/src/mame/video/hexion.c
r20826r20827
1010
1111***************************************************************************/
1212
13INLINE void get_tile_info(running_machine &machine,tile_data &tileinfo,int tile_index,UINT8 *ram)
13inline void hexion_state::get_tile_info(tile_data &tileinfo,int tile_index,UINT8 *ram)
1414{
1515   tile_index *= 4;
16   SET_TILE_INFO(
16   SET_TILE_INFO_MEMBER(
1717         0,
1818         ram[tile_index] + ((ram[tile_index+1] & 0x3f) << 8),
1919         ram[tile_index+2] & 0x0f,
r20826r20827
2222
2323TILE_GET_INFO_MEMBER(hexion_state::get_tile_info0)
2424{
25   get_tile_info(machine(),tileinfo,tile_index,m_vram[0]);
25   get_tile_info(tileinfo,tile_index,m_vram[0]);
2626}
2727
2828TILE_GET_INFO_MEMBER(hexion_state::get_tile_info1)
2929{
30   get_tile_info(machine(),tileinfo,tile_index,m_vram[1]);
30   get_tile_info(tileinfo,tile_index,m_vram[1]);
3131}
3232
3333
trunk/src/mame/video/hyhoo.c
r20826r20827
1111#include "includes/hyhoo.h"
1212
1313
14static void hyhoo_gfxdraw(running_machine &machine);
15
16
1714WRITE8_MEMBER(hyhoo_state::hyhoo_blitter_w)
1815{
1916   switch (offset)
r20826r20827
2724      case 0x04:  m_blitter_sizex = data; break;
2825      case 0x05:  m_blitter_sizey = data;
2926               /* writing here also starts the blit */
30               hyhoo_gfxdraw(machine());
27               hyhoo_gfxdraw();
3128               break;
3229      case 0x06:  m_blitter_direction_x = (data >> 0) & 0x01;
3330               m_blitter_direction_y = (data >> 1) & 0x01;
r20826r20827
6158   nb1413m3_busyflag = 1;
6259}
6360
64static void hyhoo_gfxdraw(running_machine &machine)
61void hyhoo_state::hyhoo_gfxdraw()
6562{
66   hyhoo_state *state = machine.driver_data<hyhoo_state>();
67   UINT8 *GFX = state->memregion("gfx1")->base();
63   UINT8 *GFX = memregion("gfx1")->base();
6864
6965   int x, y;
7066   int dx1, dx2, dy;
r20826r20827
7975
8076   nb1413m3_busyctr = 0;
8177
82   state->m_gfxrom |= ((nb1413m3_sndrombank1 & 0x02) << 3);
78   m_gfxrom |= ((nb1413m3_sndrombank1 & 0x02) << 3);
8379
84   startx = state->m_blitter_destx + state->m_blitter_sizex;
85   starty = state->m_blitter_desty + state->m_blitter_sizey;
80   startx = m_blitter_destx + m_blitter_sizex;
81   starty = m_blitter_desty + m_blitter_sizey;
8682
87   if (state->m_blitter_direction_x)
83   if (m_blitter_direction_x)
8884   {
89      sizex = state->m_blitter_sizex ^ 0xff;
85      sizex = m_blitter_sizex ^ 0xff;
9086      skipx = 1;
9187   }
9288   else
9389   {
94      sizex = state->m_blitter_sizex;
90      sizex = m_blitter_sizex;
9591      skipx = -1;
9692   }
9793
98   if (state->m_blitter_direction_y)
94   if (m_blitter_direction_y)
9995   {
100      sizey = state->m_blitter_sizey ^ 0xff;
96      sizey = m_blitter_sizey ^ 0xff;
10197      skipy = 1;
10298   }
10399   else
104100   {
105      sizey = state->m_blitter_sizey;
101      sizey = m_blitter_sizey;
106102      skipy = -1;
107103   }
108104
109   gfxlen = machine.root_device().memregion("gfx1")->bytes();
110   gfxaddr = (state->m_gfxrom << 17) + (state->m_blitter_src_addr << 1);
105   gfxlen = machine().root_device().memregion("gfx1")->bytes();
106   gfxaddr = (m_gfxrom << 17) + (m_blitter_src_addr << 1);
111107
112108   for (y = starty, ctry = sizey; ctry >= 0; y += skipy, ctry--)
113109   {
r20826r20827
127123         dx2 = (2 * x + 1) & 0x1ff;
128124         dy = y & 0xff;
129125
130         if (state->m_highcolorflag & 0x04)
126         if (m_highcolorflag & 0x04)
131127         {
132128            // direct mode
133129
134130            if (color != 0xff)
135131            {
136               if (state->m_highcolorflag & 0x20)
132               if (m_highcolorflag & 0x20)
137133               {
138134                  /* least significant bits */
139135
r20826r20827
146142
147143                  pen = MAKE_RGB(pal6bit(r), pal5bit(g), pal5bit(b));
148144
149                  state->m_tmpbitmap.pix32(dy, dx1) = state->m_tmpbitmap.pix32(dy, dx1) | pen;
150                  state->m_tmpbitmap.pix32(dy, dx2) = state->m_tmpbitmap.pix32(dy, dx2) | pen;
145                  m_tmpbitmap.pix32(dy, dx1) = m_tmpbitmap.pix32(dy, dx1) | pen;
146                  m_tmpbitmap.pix32(dy, dx2) = m_tmpbitmap.pix32(dy, dx2) | pen;
151147               }
152148               else
153149               {
r20826r20827
162158
163159                  pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
164160
165                  state->m_tmpbitmap.pix32(dy, dx1) = pen;
166                  state->m_tmpbitmap.pix32(dy, dx2) = pen;
161                  m_tmpbitmap.pix32(dy, dx1) = pen;
162                  m_tmpbitmap.pix32(dy, dx2) = pen;
167163               }
168164            }
169165         }
r20826r20827
171167         {
172168            // lookup table mode
173169
174            if (state->m_blitter_direction_x)
170            if (m_blitter_direction_x)
175171            {
176172               // flip
177173               color1 = (color & 0x0f) >> 0;
r20826r20827
184180               color2 = (color & 0x0f) >> 0;
185181            }
186182
187            if (state->m_clut[color1])
183            if (m_clut[color1])
188184            {
189185               // src xxxxxxxx_bbgggrrr
190186               // dst bbxxxggg_xxrrrxxx
191187
192               r = ((~state->m_clut[color1] & 0x07) >> 0) & 0x07;
193               g = ((~state->m_clut[color1] & 0x38) >> 3) & 0x07;
194               b = ((~state->m_clut[color1] & 0xc0) >> 6) & 0x03;
188               r = ((~m_clut[color1] & 0x07) >> 0) & 0x07;
189               g = ((~m_clut[color1] & 0x38) >> 3) & 0x07;
190               b = ((~m_clut[color1] & 0xc0) >> 6) & 0x03;
195191
196192               pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
197193
198               state->m_tmpbitmap.pix32(dy, dx1) = pen;
194               m_tmpbitmap.pix32(dy, dx1) = pen;
199195            }
200196
201            if (state->m_clut[color2])
197            if (m_clut[color2])
202198            {
203199               // src xxxxxxxx_bbgggrrr
204200               // dst bbxxxggg_xxrrrxxx
205201
206               r = ((~state->m_clut[color2] & 0x07) >> 0) & 0x07;
207               g = ((~state->m_clut[color2] & 0x38) >> 3) & 0x07;
208               b = ((~state->m_clut[color2] & 0xc0) >> 6) & 0x03;
202               r = ((~m_clut[color2] & 0x07) >> 0) & 0x07;
203               g = ((~m_clut[color2] & 0x38) >> 3) & 0x07;
204               b = ((~m_clut[color2] & 0xc0) >> 6) & 0x03;
209205
210206               pen = MAKE_RGB(pal6bit(r << 3), pal5bit(g << 2), pal5bit(b << 3));
211207
212               state->m_tmpbitmap.pix32(dy, dx2) = pen;
208               m_tmpbitmap.pix32(dy, dx2) = pen;
213209            }
214210         }
215211
r20826r20827
218214   }
219215
220216   nb1413m3_busyflag = 0;
221   machine.scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(hyhoo_state::blitter_timer_callback),state));
217   machine().scheduler().timer_set(attotime::from_hz(400000) * nb1413m3_busyctr, timer_expired_delegate(FUNC(hyhoo_state::blitter_timer_callback),this));
222218}
223219
224220
trunk/src/mame/video/homedata.c
r20826r20827
3232
3333***************************************************************************/
3434
35static void mrokumei_handleblit( address_space &space, int rom_base )
35void homedata_state::mrokumei_handleblit( address_space &space, int rom_base )
3636{
37   homedata_state *state = space.machine().driver_data<homedata_state>();
3837   int i;
3938   int dest_param;
4039   int source_addr;
4140   int dest_addr;
4241   int base_addr;
4342   int opcode, data, num_tiles;
44   UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
43   UINT8 *pBlitData = memregion("user1")->base() + rom_base;
4544
46   dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
47      state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
45   dest_param = m_blitter_param[(m_blitter_param_count - 4) & 3] * 256 +
46      m_blitter_param[(m_blitter_param_count - 3) & 3];
4847
49   source_addr = state->m_blitter_param[(state->m_blitter_param_count - 2) & 3] * 256 +
50      state->m_blitter_param[(state->m_blitter_param_count - 1) & 3];
48   source_addr = m_blitter_param[(m_blitter_param_count - 2) & 3] * 256 +
49      m_blitter_param[(m_blitter_param_count - 1) & 3];
5150
5251   /*  xxx-.----.----.---- not used?
5352    *  ---x.----.----.---- layer
r20826r20827
5857
5958//  logerror( "[blit bank %02x src %04x dst %04x]\n", blitter_bank, source_addr, dest_param);
6059
61   if( state->m_visible_page == 0 )
60   if( m_visible_page == 0 )
6261   {
6362      base_addr += 0x2000;
6463   }
r20826r20827
9998         } /* i!=0 */
10099
101100         if (data)   /* 00 is a nop */
102            state->mrokumei_videoram_w(space, base_addr + dest_addr, data);
101            mrokumei_videoram_w(space, base_addr + dest_addr, data);
103102
104         if (state->m_vreg[1] & 0x80)    /* flip screen */
103         if (m_vreg[1] & 0x80)    /* flip screen */
105104         {
106105            dest_addr -= 2;
107106            if (dest_addr < 0)
r20826r20827
116115   } /* for(;;) */
117116
118117finish:
119   state->m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
118   m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
120119}
121120
122static void reikaids_handleblit( address_space &space, int rom_base )
121void homedata_state::reikaids_handleblit( address_space &space, int rom_base )
123122{
124   homedata_state *state = space.machine().driver_data<homedata_state>();
125123   int i;
126124   UINT16 dest_param;
127125   int flipx;
128126   int source_addr, base_addr;
129127   int dest_addr;
130   UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
128   UINT8 *pBlitData = memregion("user1")->base() + rom_base;
131129
132130   int opcode, data, num_tiles;
133131
134   dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
135      state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
132   dest_param = m_blitter_param[(m_blitter_param_count - 4) & 3] * 256 +
133      m_blitter_param[(m_blitter_param_count - 3) & 3];
136134
137   source_addr = state->m_blitter_param[(state->m_blitter_param_count - 2) & 3] * 256 +
138      state->m_blitter_param[(state->m_blitter_param_count - 1) & 3];
135   source_addr = m_blitter_param[(m_blitter_param_count - 2) & 3] * 256 +
136      m_blitter_param[(m_blitter_param_count - 1) & 3];
139137
140138   /*  x---.----.----.---- flipx
141139    *  -x--.----.----.---- select: attr/tile
r20826r20827
147145
148146//  logerror( "[blit %02x %04x %04x]\n",blitter_bank,source_addr,dest_param);
149147
150   if (state->m_visible_page == 0)
148   if (m_visible_page == 0)
151149      base_addr += 0x2000 << 2;
152150
153151   for(;;)
r20826r20827
202200                  addr ^= 0x007c;
203201               }
204202
205               state->reikaids_videoram_w(space, addr, dat);
203               reikaids_videoram_w(space, addr, dat);
206204            }
207205         }
208206
209         if (state->m_vreg[1] & 0x80)    /* flip screen */
207         if (m_vreg[1] & 0x80)    /* flip screen */
210208            dest_addr-=4;
211209         else
212210            dest_addr+=4;
r20826r20827
214212   }
215213
216214finish:
217   state->m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
215   m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
218216}
219217
220static void pteacher_handleblit( address_space &space, int rom_base )
218void homedata_state::pteacher_handleblit( address_space &space, int rom_base )
221219{
222   homedata_state *state = space.machine().driver_data<homedata_state>();
223220   int i;
224221   int dest_param;
225222   int source_addr;
226223   int dest_addr, base_addr;
227224   int opcode, data, num_tiles;
228   UINT8 *pBlitData = state->memregion("user1")->base() + rom_base;
225   UINT8 *pBlitData = memregion("user1")->base() + rom_base;
229226
230   dest_param = state->m_blitter_param[(state->m_blitter_param_count - 4) & 3] * 256 +
231      state->m_blitter_param[(state->m_blitter_param_count - 3) & 3];
227   dest_param = m_blitter_param[(m_blitter_param_count - 4) & 3] * 256 +
228      m_blitter_param[(m_blitter_param_count - 3) & 3];
232229
233   source_addr = state->m_blitter_param[(state->m_blitter_param_count - 2) & 3] * 256 +
234      state->m_blitter_param[(state->m_blitter_param_count - 1) & 3];
230   source_addr = m_blitter_param[(m_blitter_param_count - 2) & 3] * 256 +
231      m_blitter_param[(m_blitter_param_count - 1) & 3];
235232
236233   /*  x---.----.----.---- not used?
237234    *  -x--.----.----.---- layer   (0..1)
r20826r20827
242239
243240//  logerror( "[blit %02x %04x %04x]->%d\n",blitter_bank,source_addr,dest_param,homedata_visible_page);
244241
245   if (state->m_visible_page == 0)
242   if (m_visible_page == 0)
246243   {
247244      base_addr += 0x2000 << 2;
248245   }
r20826r20827
289286            if ((addr & 0x2080) == 0)
290287            {
291288               addr = ((addr & 0xc000) >> 2) | ((addr & 0x1f00) >> 1) | (addr & 0x7f);
292               state->mrokumei_videoram_w(space, addr, data);
289               mrokumei_videoram_w(space, addr, data);
293290            }
294291         }
295292
296         if (state->m_vreg[1] & 0x80)    /* flip screen */
293         if (m_vreg[1] & 0x80)    /* flip screen */
297294            dest_addr -= 2;
298295         else
299296            dest_addr += 2;
r20826r20827
301298   } /* for(;;) */
302299
303300finish:
304   state->m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
301   m_maincpu->set_input_line(M6809_FIRQ_LINE, HOLD_LINE);
305302}
306303
307304
r20826r20827
404401
405402***************************************************************************/
406403
407INLINE void mrokumei_info0( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
404inline void homedata_state::mrokumei_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank )
408405{
409   homedata_state *state = machine.driver_data<homedata_state>();
410406   int addr  = tile_index * 2 + 0x2000 * page;
411   int attr  = state->m_videoram[addr];
412   int code  = state->m_videoram[addr + 1] + ((attr & 0x03) << 8) + (gfxbank << 10);
407   int attr  = m_videoram[addr];
408   int code  = m_videoram[addr + 1] + ((attr & 0x03) << 8) + (gfxbank << 10);
413409   int color = (attr >> 2) + (gfxbank << 6);
414410
415   SET_TILE_INFO( 0, code, color, state->m_flipscreen );
411   SET_TILE_INFO_MEMBER( 0, code, color, m_flipscreen );
416412}
417INLINE void mrokumei_info1( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
413inline void homedata_state::mrokumei_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank )
418414{
419   homedata_state *state = machine.driver_data<homedata_state>();
420415   int addr  = tile_index * 2 + 0x1000 + 0x2000 * page;
421   int attr  = state->m_videoram[addr];
422   int code  = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
416   int attr  = m_videoram[addr];
417   int code  = m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
423418   int color = (attr >> 3) + ((gfxbank & 3) << 6);
424419
425   SET_TILE_INFO( 1, code, color, state->m_flipscreen );
420   SET_TILE_INFO_MEMBER( 1, code, color, m_flipscreen );
426421}
427422
428423TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info0_0)
429424{
430   mrokumei_info0( machine(), tileinfo, tile_index, 0,  m_blitter_bank & 0x03 );
425   mrokumei_info0(tileinfo, tile_index, 0,  m_blitter_bank & 0x03 );
431426}
432427
433428TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info1_0)
434429{
435   mrokumei_info0( machine(), tileinfo, tile_index, 1,  m_blitter_bank & 0x03 );
430   mrokumei_info0(tileinfo, tile_index, 1,  m_blitter_bank & 0x03 );
436431}
437432
438433TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info0_1)
439434{
440   mrokumei_info1( machine(), tileinfo, tile_index, 0, (m_blitter_bank & 0x38) >> 3 );
435   mrokumei_info1(tileinfo, tile_index, 0, (m_blitter_bank & 0x38) >> 3 );
441436}
442437
443438TILE_GET_INFO_MEMBER(homedata_state::mrokumei_get_info1_1)
444439{
445   mrokumei_info1( machine(), tileinfo, tile_index, 1, (m_blitter_bank & 0x38) >> 3 );
440   mrokumei_info1(tileinfo, tile_index, 1, (m_blitter_bank & 0x38) >> 3 );
446441}
447442
448443
449INLINE void reikaids_info( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
444inline void homedata_state::reikaids_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
450445{
451   homedata_state *state = machine.driver_data<homedata_state>();
452446   int addr  = tile_index * 4 + layer + 0x2000 * page;
453   int attr  = state->m_videoram[addr];
454   int code  = state->m_videoram[addr + 0x1000] + ((attr & 0x03) << 8) + (gfxbank << 10);
447   int attr  = m_videoram[addr];
448   int code  = m_videoram[addr + 0x1000] + ((attr & 0x03) << 8) + (gfxbank << 10);
455449   int color = (attr & 0x7c) >> 2;
456   int flags = state->m_flipscreen;
450   int flags = m_flipscreen;
457451
458452   if (attr & 0x80) flags ^= TILE_FLIPX;
459453
460   SET_TILE_INFO( layer, code, color, flags );
454   SET_TILE_INFO_MEMBER( layer, code, color, flags );
461455}
462456
463457   /* reikaids_gfx_bank[0]:
r20826r20827
470464    */
471465TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_0)
472466{
473   reikaids_info(machine(), tileinfo, tile_index, 0, 0,  (m_gfx_bank[1] >> 3));
467   reikaids_info(tileinfo, tile_index, 0, 0,  (m_gfx_bank[1] >> 3));
474468}
475469
476470TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_0)
477471{
478   reikaids_info(machine(), tileinfo, tile_index, 1, 0,  (m_gfx_bank[1] >> 3));
472   reikaids_info(tileinfo, tile_index, 1, 0,  (m_gfx_bank[1] >> 3));
479473}
480474
481475TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_1)
482476{
483   reikaids_info(machine(), tileinfo, tile_index, 0, 1, ((m_gfx_bank[0] & 0x78) >> 3));
477   reikaids_info(tileinfo, tile_index, 0, 1, ((m_gfx_bank[0] & 0x78) >> 3));
484478}
485479
486480TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_1)
487481{
488   reikaids_info(machine(), tileinfo, tile_index, 1, 1, ((m_gfx_bank[0] & 0x78) >> 3));
482   reikaids_info(tileinfo, tile_index, 1, 1, ((m_gfx_bank[0] & 0x78) >> 3));
489483}
490484
491485TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_2)
492486{
493   reikaids_info(machine(), tileinfo, tile_index, 0, 2,  (m_gfx_bank[1] & 0x7));
487   reikaids_info(tileinfo, tile_index, 0, 2,  (m_gfx_bank[1] & 0x7));
494488}
495489
496490TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_2)
497491{
498   reikaids_info(machine(), tileinfo, tile_index, 1, 2,  (m_gfx_bank[1] & 0x7));
492   reikaids_info(tileinfo, tile_index, 1, 2,  (m_gfx_bank[1] & 0x7));
499493}
500494
501495TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info0_3)
502496{
503   reikaids_info(machine(), tileinfo, tile_index, 0, 3,  (m_gfx_bank[0] & 0x7));
497   reikaids_info(tileinfo, tile_index, 0, 3,  (m_gfx_bank[0] & 0x7));
504498}
505499
506500TILE_GET_INFO_MEMBER(homedata_state::reikaids_get_info1_3)
507501{
508   reikaids_info(machine(), tileinfo, tile_index, 1, 3,  (m_gfx_bank[0] & 0x7));
502   reikaids_info(tileinfo, tile_index, 1, 3,  (m_gfx_bank[0] & 0x7));
509503}
510504
511505
512INLINE void pteacher_info( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
506inline void homedata_state::pteacher_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxbank )
513507{
514   homedata_state *state = machine.driver_data<homedata_state>();
515508   int addr  = tile_index * 2 + 0x1000 * layer + 0x2000 * page;
516   int attr  = state->m_videoram[addr];
517   int code  = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
509   int attr  = m_videoram[addr];
510   int code  = m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
518511   int color = (attr >> 3) + ((gfxbank & 1) << 5);
519512
520   SET_TILE_INFO(layer, code, color, state->m_flipscreen);
513   SET_TILE_INFO_MEMBER(layer, code, color, m_flipscreen);
521514}
522515
523516TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info0_0)
524517{
525   pteacher_info(machine(), tileinfo, tile_index, 0, 0, m_gfx_bank[0] & 0x0f);
518   pteacher_info(tileinfo, tile_index, 0, 0, m_gfx_bank[0] & 0x0f);
526519}
527520
528521TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info1_0)
529522{
530   pteacher_info(machine(), tileinfo, tile_index, 1, 0, m_gfx_bank[0] & 0x0f);
523   pteacher_info(tileinfo, tile_index, 1, 0, m_gfx_bank[0] & 0x0f);
531524}
532525
533526TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info0_1)
534527{
535   pteacher_info(machine(), tileinfo, tile_index, 0, 1, m_gfx_bank[0] >> 4);
528   pteacher_info(tileinfo, tile_index, 0, 1, m_gfx_bank[0] >> 4);
536529}
537530
538531TILE_GET_INFO_MEMBER(homedata_state::pteacher_get_info1_1)
539532{
540   pteacher_info(machine(), tileinfo, tile_index, 1, 1, m_gfx_bank[0] >> 4);
533   pteacher_info(tileinfo, tile_index, 1, 1, m_gfx_bank[0] >> 4);
541534}
542535
543536
544INLINE void lemnangl_info( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int layer, int gfxset, int gfxbank )
537inline void homedata_state::lemnangl_info( tile_data &tileinfo, int tile_index, int page, int layer, int gfxset, int gfxbank )
545538{
546   homedata_state *state = machine.driver_data<homedata_state>();
547539   int addr  = tile_index * 2 + 0x1000 * layer + 0x2000 * page;
548   int attr  = state->m_videoram[addr];
549   int code  = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
540   int attr  = m_videoram[addr];
541   int code  = m_videoram[addr + 1] + ((attr & 0x07) << 8) + (gfxbank << 11);
550542   int color = 16 * (attr >> 3) + gfxbank;
551543
552   SET_TILE_INFO(2 * layer + gfxset, code, color, state->m_flipscreen);
544   SET_TILE_INFO_MEMBER(2 * layer + gfxset, code, color, m_flipscreen);
553545}
554546
555547TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info0_0)
556548{
557   lemnangl_info( machine(), tileinfo, tile_index, 0, 0,  m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
549   lemnangl_info(tileinfo, tile_index, 0, 0,  m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
558550}
559551
560552TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info1_0)
561553{
562   lemnangl_info( machine(), tileinfo, tile_index, 1, 0,  m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
554   lemnangl_info(tileinfo, tile_index, 1, 0,  m_blitter_bank & 1, m_gfx_bank[0] & 0x0f );
563555}
564556
565557
566558TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info0_1)
567559{
568   lemnangl_info( machine(), tileinfo, tile_index, 0, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
560   lemnangl_info(tileinfo, tile_index, 0, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
569561}
570562
571563TILE_GET_INFO_MEMBER(homedata_state::lemnangl_get_info1_1)
572564{
573   lemnangl_info( machine(), tileinfo, tile_index, 1, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
565   lemnangl_info(tileinfo, tile_index, 1, 1, (m_blitter_bank & 2) >> 1, m_gfx_bank[0] >> 4 );
574566}
575567
576568
577INLINE void mirderby_info0( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
569inline void homedata_state::mirderby_info0( tile_data &tileinfo, int tile_index, int page, int gfxbank )
578570{
579   homedata_state *state = machine.driver_data<homedata_state>();
580571   int addr  = tile_index * 2 + 0x2000 * page;
581   int attr  = state->m_videoram[addr];
582   int code  = state->m_videoram[addr + 1] + ((attr & 0x03) << 8) + 0x400;// + (gfxbank << 10);
572   int attr  = m_videoram[addr];
573   int code  = m_videoram[addr + 1] + ((attr & 0x03) << 8) + 0x400;// + (gfxbank << 10);
583574   int color = (attr >> 2) + (gfxbank << 6);
584575
585   SET_TILE_INFO( 0, code, color, state->m_flipscreen );
576   SET_TILE_INFO_MEMBER( 0, code, color, m_flipscreen );
586577}
587INLINE void mirderby_info1( running_machine &machine, tile_data &tileinfo, int tile_index, int page, int gfxbank )
578inline void homedata_state::mirderby_info1( tile_data &tileinfo, int tile_index, int page, int gfxbank )
588579{
589   homedata_state *state = machine.driver_data<homedata_state>();
590580   int addr  = tile_index * 2 + 0x1000 + 0x2000 * page;
591   int attr  = state->m_videoram[addr];
592   int code  = state->m_videoram[addr + 1] + ((attr & 0x07) << 8) + 0x400;//(gfxbank << 11);
581   int attr  = m_videoram[addr];
582   int code  = m_videoram[addr + 1] + ((attr & 0x07) << 8) + 0x400;//(gfxbank << 11);
593583   int color = (attr >> 3) + ((gfxbank & 3) << 6);
594584
595   SET_TILE_INFO( 1, code, color, state->m_flipscreen );
585   SET_TILE_INFO_MEMBER( 1, code, color, m_flipscreen );
596586}
597587
598588TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info0_0)
599589{
600   mirderby_info0( machine(), tileinfo, tile_index, 0, 0);// m_blitter_bank & 0x03 );
590   mirderby_info0(tileinfo, tile_index, 0, 0);// m_blitter_bank & 0x03 );
601591}
602592
603593TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info1_0)
604594{
605   mirderby_info0( machine(), tileinfo, tile_index, 1, 0);// m_blitter_bank & 0x03 );
595   mirderby_info0(tileinfo, tile_index, 1, 0);// m_blitter_bank & 0x03 );
606596}
607597
608598TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info0_1)
609599{
610   mirderby_info1( machine(), tileinfo, tile_index, 0, 0);//(m_blitter_bank & 0x38) >> 3 );
600   mirderby_info1(tileinfo, tile_index, 0, 0);//(m_blitter_bank & 0x38) >> 3 );
611601}
612602
613603TILE_GET_INFO_MEMBER(homedata_state::mirderby_get_info1_1)
614604{
615   mirderby_info1( machine(), tileinfo, tile_index, 1, 0);//(m_blitter_bank & 0x38) >> 3 );
605   mirderby_info1(tileinfo, tile_index, 1, 0);//(m_blitter_bank & 0x38) >> 3 );
616606}
617607
618608

Previous 199869 Revisions Next


© 1997-2024 The MAME Team