Previous 199869 Revisions Next

r33401 Saturday 15th November, 2014 at 03:31:30 UTC by Vasantha Crabb
More dooyong cleanup
[src/mame/drivers]dooyong.c
[src/mame/includes]dooyong.h
[src/mame/video]dooyong.c

trunk/src/mame/drivers/dooyong.c
r241912r241913
235235   AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("DSW")
236236   AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("P1_P2")
237237   AM_RANGE(0x0c0006, 0x0c0007) AM_READ_PORT("SYSTEM")
238   AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(bgscroll_w)
239   AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(bg2scroll_w)
238   AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
239   AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff)
240240   AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
241241   AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w)
242242   AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w)    /* flip screen + unknown stuff */
243   AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(fgscroll_w)
244   AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(fg2scroll_w)
243   AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff)
244   AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff)
245245ADDRESS_MAP_END
246246
247247static ADDRESS_MAP_START( superx_map, AS_PROGRAM, 16, dooyong_68k_state )
r241912r241913
253253   AM_RANGE(0x080002, 0x080003) AM_READ_PORT("DSW")
254254   AM_RANGE(0x080004, 0x080005) AM_READ_PORT("P1_P2")
255255   AM_RANGE(0x080006, 0x080007) AM_READ_PORT("SYSTEM")
256   AM_RANGE(0x084000, 0x08400f) AM_WRITE(bgscroll_w)
257   AM_RANGE(0x084010, 0x08401f) AM_WRITE(bg2scroll_w)
256   AM_RANGE(0x084000, 0x08400f) AM_WRITE8(bgscroll_w, 0x00ff)
257   AM_RANGE(0x084010, 0x08401f) AM_WRITE8(bg2scroll_w, 0x00ff)
258258   AM_RANGE(0x088000, 0x088fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
259259   AM_RANGE(0x080012, 0x080013) AM_WRITE(soundlatch_word_w)
260260   AM_RANGE(0x080014, 0x080015) AM_WRITE(ctrl_w)    /* flip screen + unknown stuff */
261   AM_RANGE(0x08c000, 0x08c00f) AM_WRITE(fgscroll_w)
262   AM_RANGE(0x08c010, 0x08c01f) AM_WRITE(fg2scroll_w)
261   AM_RANGE(0x08c000, 0x08c00f) AM_WRITE8(fgscroll_w, 0x00ff)
262   AM_RANGE(0x08c010, 0x08c01f) AM_WRITE8(fg2scroll_w, 0x00ff)
263263ADDRESS_MAP_END
264264
265265static ADDRESS_MAP_START( popbingo_map, AS_PROGRAM, 16, dooyong_68k_state )
r241912r241913
274274   AM_RANGE(0x0c0012, 0x0c0013) AM_WRITE(soundlatch_word_w)
275275   AM_RANGE(0x0c0014, 0x0c0015) AM_WRITE(ctrl_w)
276276   AM_RANGE(0x0c0018, 0x0c001b) AM_WRITENOP // ?
277   AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE(bgscroll_w)
278   AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE(bg2scroll_w) // not used atm
277   AM_RANGE(0x0c4000, 0x0c400f) AM_WRITE8(bgscroll_w, 0x00ff)
278   AM_RANGE(0x0c4010, 0x0c401f) AM_WRITE8(bg2scroll_w, 0x00ff) // not used atm
279279   AM_RANGE(0x0c8000, 0x0c8fff) AM_DEVWRITE("palette", palette_device, write) AM_SHARE("palette")
280   AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE(fgscroll_w) // not used atm
281   AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE(fg2scroll_w) // not used atm
280   AM_RANGE(0x0cc000, 0x0cc00f) AM_WRITE8(fgscroll_w, 0x00ff) // not used atm
281   AM_RANGE(0x0cc010, 0x0cc01f) AM_WRITE8(fg2scroll_w, 0x00ff) // not used atm
282282   AM_RANGE(0x0dc000, 0x0dc01f) AM_RAM // registers of some kind?
283283ADDRESS_MAP_END
284284
trunk/src/mame/includes/dooyong.h
r241912r241913
1111      m_palette(*this, "palette")
1212   { }
1313
14   inline void lastday_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom, UINT8 *scroll, int graphics);
14   DECLARE_WRITE8_MEMBER(bgscroll_w);
15   DECLARE_WRITE8_MEMBER(bg2scroll_w);
16   DECLARE_WRITE8_MEMBER(fgscroll_w);
17   DECLARE_WRITE8_MEMBER(fg2scroll_w);
18   TILE_GET_INFO_MEMBER(get_bg_tile_info);
19   TILE_GET_INFO_MEMBER(get_bg2_tile_info);
20   TILE_GET_INFO_MEMBER(get_fg_tile_info);
21   TILE_GET_INFO_MEMBER(get_fg2_tile_info);
22   inline void get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom, UINT8 const *scroll, int graphics);
1523   inline void scroll8_w(offs_t offset, UINT8 data, UINT8 *scroll, tilemap_t *map);
1624
1725   tilemap_t *m_bg_tilemap;
r241912r241913
4856      m_spriteram(*this, "spriteram")
4957   { }
5058
51   DECLARE_WRITE8_MEMBER(bgscroll_w);
52   DECLARE_WRITE8_MEMBER(bg2scroll_w);
53   DECLARE_WRITE8_MEMBER(fgscroll_w);
54   DECLARE_WRITE8_MEMBER(fg2scroll_w);
59   enum
60   {
61      SPRITE_12BIT = 0x01,
62      SPRITE_HEIGHT = 0x02,
63      SPRITE_YSHIFT_BLUEHAWK = 0x04,
64      SPRITE_YSHIFT_FLYTIGER = 0x08
65   };
66
5567   DECLARE_WRITE8_MEMBER(flip_screen_w);
5668   DECLARE_WRITE8_MEMBER(bankswitch_w);
5769   DECLARE_WRITE8_MEMBER(txvideoram_w);
5870   DECLARE_WRITE8_MEMBER(primella_ctrl_w);
5971   DECLARE_WRITE8_MEMBER(paletteram_flytiger_w);
6072   DECLARE_WRITE8_MEMBER(flytiger_ctrl_w);
61   TILE_GET_INFO_MEMBER(get_bg_tile_info);
62   TILE_GET_INFO_MEMBER(get_bg2_tile_info);
63   TILE_GET_INFO_MEMBER(get_fg_tile_info);
64   TILE_GET_INFO_MEMBER(get_fg2_tile_info);
6573   TILE_GET_INFO_MEMBER(get_tx_tile_info);
66   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions);
74   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, unsigned extensions = 0);
6775   UINT32 screen_update_bluehawk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6876   UINT32 screen_update_flytiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6977   UINT32 screen_update_primella(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
r241912r241913
115123      m_spriteram(*this, "spriteram")
116124   { }
117125
118   DECLARE_WRITE16_MEMBER(bgscroll_w);
119   DECLARE_WRITE16_MEMBER(bg2scroll_w);
120   DECLARE_WRITE16_MEMBER(fgscroll_w);
121   DECLARE_WRITE16_MEMBER(fg2scroll_w);
122126   DECLARE_WRITE16_MEMBER(ctrl_w);
123127   TIMER_DEVICE_CALLBACK_MEMBER(scanline);
124   TILE_GET_INFO_MEMBER(get_bg_tile_info);
125   TILE_GET_INFO_MEMBER(get_bg2_tile_info);
126   TILE_GET_INFO_MEMBER(get_fg_tile_info);
127   TILE_GET_INFO_MEMBER(get_fg2_tile_info);
128   inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics);
128   TILE_GET_INFO_MEMBER(rshark_get_bg_tile_info);
129   TILE_GET_INFO_MEMBER(rshark_get_bg2_tile_info);
130   TILE_GET_INFO_MEMBER(rshark_get_fg_tile_info);
131   TILE_GET_INFO_MEMBER(rshark_get_fg2_tile_info);
132   inline void rshark_get_tile_info(tile_data &tileinfo, int tile_index, UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics);
129133   void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
130134   UINT32 screen_update_rshark(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
131135   UINT32 screen_update_popbingo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/video/dooyong.c
r241912r241913
1818         break;
1919      case 3: /* Low byte of y scroll */
2020      case 4: /* High byte of y scroll */
21         map->set_scrolly(0, (int)scroll[3] | ((int)scroll[4] << 8));
21         map->set_scrolly(0, (unsigned)scroll[3] | ((unsigned)scroll[4] << 8));
2222         break;
2323      case 6: /* Tilemap enable and mode control */
2424         map->enable(!(data & 0x10));
r241912r241913
4343}
4444
4545
46/* These handle writes to the tilemap scroll registers in 8-bit machines.
46/* These handle writes to the tilemap scroll registers.
4747   There is one per tilemap, wrapping the above function that does the work. */
4848
49WRITE8_MEMBER(dooyong_z80_state::bgscroll_w)
49WRITE8_MEMBER(dooyong_state::bgscroll_w)
5050{
5151   scroll8_w(offset, data, m_bgscroll8, m_bg_tilemap);
5252}
5353
54WRITE8_MEMBER(dooyong_z80_state::bg2scroll_w)
54WRITE8_MEMBER(dooyong_state::bg2scroll_w)
5555{
5656   scroll8_w(offset, data, m_bg2scroll8, m_bg2_tilemap);
5757}
5858
59WRITE8_MEMBER(dooyong_z80_state::fgscroll_w)
59WRITE8_MEMBER(dooyong_state::fgscroll_w)
6060{
6161   scroll8_w(offset, data, m_fgscroll8, m_fg_tilemap);
6262}
6363
64WRITE8_MEMBER(dooyong_z80_state::fg2scroll_w)
64WRITE8_MEMBER(dooyong_state::fg2scroll_w)
6565{
6666   scroll8_w(offset, data, m_fg2scroll8, m_fg2_tilemap);
6767}
r241912r241913
164164   when the x scroll moves out of range (trying to decode the whole lot
165165   at once uses hundreds of megabytes of RAM). */
166166
167inline void dooyong_state::lastday_get_tile_info(tile_data &tileinfo, int tile_index,
168      const UINT8 *tilerom, UINT8 *scroll, int graphics)
167inline void dooyong_state::get_tile_info(tile_data &tileinfo, int tile_index,
168      UINT8 const *tilerom, UINT8 const *scroll, int graphics)
169169{
170170   int const offs = (tile_index + ((int)scroll[1] << 6)) * 2;
171171   int const attr = tilerom[offs];
r241912r241913
185185      flags = TILE_FLIPYX((attr & 0x06) >> 1);
186186   }
187187   else
188   {
189      /* primella */
188   {   /* primella/popbingo */
190189      /* Tiles take two bytes in ROM:
191190                       MSB   LSB
192191         [offs + 0x00] YXCC CCcc    (Y flip, X flip, bits 3-0 of color code, bits 9-8 of gfx code)
r241912r241913
212211   tileinfo.set(graphics, code, color, flags);
213212}
214213
215TILE_GET_INFO_MEMBER(dooyong_z80_state::get_bg_tile_info)
214TILE_GET_INFO_MEMBER(dooyong_state::get_bg_tile_info)
216215{
217   lastday_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
216   get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
218217}
219218
220TILE_GET_INFO_MEMBER(dooyong_z80_state::get_bg2_tile_info)
219TILE_GET_INFO_MEMBER(dooyong_state::get_bg2_tile_info)
221220{
222   lastday_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
221   get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
223222}
224223
225TILE_GET_INFO_MEMBER(dooyong_z80_state::get_fg_tile_info)
224TILE_GET_INFO_MEMBER(dooyong_state::get_fg_tile_info)
226225{
227   lastday_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
226   get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
228227}
229228
230TILE_GET_INFO_MEMBER(dooyong_z80_state::get_fg2_tile_info)
229TILE_GET_INFO_MEMBER(dooyong_state::get_fg2_tile_info)
231230{
232   lastday_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
231   get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
233232}
234233
235234TILE_GET_INFO_MEMBER(dooyong_z80_state::get_tx_tile_info)
r241912r241913
240239      [offs + 0x01] CCCC cccc    (bits 3-0 of color code, bits 11-8 of gfx code)
241240      c = gfx code
242241      C = color code */
243   int offs, attr;
242   unsigned offs, attr;
244243   if (m_tx_tilemap_mode == 0)
245244   {   /* lastday/gulfstrm/pollux/flytiger */
246245      offs = tile_index;
r241912r241913
258257}
259258
260259
261void dooyong_z80_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pollux_extensions)
260void dooyong_z80_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, unsigned extensions)
262261{
263262   /* Sprites take 32 bytes each in memory:
264263                    MSB   LSB
r241912r241913
278277      w = width
279278      X = x flip
280279      Y = y flip
281      * = alters y position in pollux and flytiger - see code below
280      * = alters y position in bluehawk and flytiger - see code below
282281      bit 11 of gfx code only used by gulfstrm, pollux, bluehawk and flytiger
283282      height only used by pollux, bluehawk and flytiger
284283      x flip and y flip only used by pollux and flytiger */
285284
286   UINT8 *buffered_spriteram = m_spriteram->buffer();
287   int offs;
288
289   for (offs = 0; offs < m_spriteram->bytes(); offs += 32)
285   UINT8 const *const buffered_spriteram = m_spriteram->buffer();
286   for (int offs = 0; offs < m_spriteram->bytes(); offs += 32)
290287   {
291      int sx, sy, code, color, pri;
292      int flipx = 0, flipy = 0, height = 0, y;
293
294      sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4);
295      sy = buffered_spriteram[offs+2];
296      code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3);
297      color = buffered_spriteram[offs+1] & 0x0f;
288      int sx = buffered_spriteram[offs+3] | ((buffered_spriteram[offs+1] & 0x10) << 4);
289      int sy = buffered_spriteram[offs+2];
290      int code = buffered_spriteram[offs] | ((buffered_spriteram[offs+1] & 0xe0) << 3);
291      int const color = buffered_spriteram[offs+1] & 0x0f;
298292      //TODO: This priority mechanism works for known games, but seems a bit strange.
299293      //Are we missing something?  (The obvious spare palette bit isn't it.)
300      pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
294      int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
301295
302      if (pollux_extensions)
296      bool flipx = false, flipy = false;
297      int height = 0;
298      if (extensions)
303299      {
304         /* gulfstrm, pollux, bluehawk, flytiger */
305         code |= ((buffered_spriteram[offs+0x1c] & 0x01) << 11);
300         UINT8 const ext = buffered_spriteram[offs+0x1c];
306301
307         if (pollux_extensions >= 2)
302         if (extensions & SPRITE_12BIT)
303            code |= ((ext & 0x01) << 11);
304
305         if (extensions & SPRITE_HEIGHT)
308306         {
309            /* pollux, bluehawk, flytiger */
310            height = (buffered_spriteram[offs+0x1c] & 0x70) >> 4;
307            height = (ext & 0x70) >> 4;
311308            code &= ~height;
312309
313            flipx = buffered_spriteram[offs+0x1c] & 0x08;
314            flipy = buffered_spriteram[offs+0x1c] & 0x04;
310            flipx = ext & 0x08;
311            flipy = ext & 0x04;
312         }
315313
316            if (pollux_extensions == 3)
317            {
318               /* bluehawk */
319               sy += 6 - ((~buffered_spriteram[offs+0x1c] & 0x02) << 7);
320            }
314         if (extensions & SPRITE_YSHIFT_BLUEHAWK)
315            sy += 6 - ((~ext & 0x02) << 7);
321316
322            if (pollux_extensions == 4)
323            {
324               /* flytiger */
325               sy -=(buffered_spriteram[offs+0x1c] & 0x02) << 7;
326            }
327         }
317         if (extensions & SPRITE_YSHIFT_FLYTIGER)
318            sy -=(ext & 0x02) << 7;
328319      }
329320
330321      if (flip_screen())
r241912r241913
335326         flipy = !flipy;
336327      }
337328
338      for (y = 0; y <= height; y++)
329      for (int y = 0; y <= height; y++)
339330      {
340331         m_gfxdecode->gfx(1)->prio_transpen(bitmap,cliprect,
341332               code + y,
r241912r241913
359350   m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
360351
361352   if (!m_sprites_disabled)
362      draw_sprites(screen, bitmap, cliprect, 0);
353      draw_sprites(screen, bitmap, cliprect);
354
363355   return 0;
364356}
365357
r241912r241913
372364   m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
373365   m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
374366
375   draw_sprites(screen, bitmap, cliprect, 1);
367   draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT);
368
376369   return 0;
377370}
378371
r241912r241913
385378   m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 2);
386379   m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
387380
388   draw_sprites(screen, bitmap, cliprect, 2);
381   draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT);
382
389383   return 0;
390384}
391385
r241912r241913
406400   }
407401   m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
408402
409   draw_sprites(screen, bitmap, cliprect, 4);
403   draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_FLYTIGER);
404
410405   return 0;
411406}
412407
r241912r241913
421416   m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 4);
422417   m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 4);
423418
424   draw_sprites(screen, bitmap, cliprect, 3);
419   draw_sprites(screen, bitmap, cliprect, SPRITE_12BIT | SPRITE_HEIGHT | SPRITE_YSHIFT_BLUEHAWK);
420
425421   return 0;
426422}
427423
r241912r241913
433429   if (m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
434430   m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
435431   if (!m_tx_pri) m_tx_tilemap->draw(screen, bitmap, cliprect, 0, 0);
432
436433   return 0;
437434}
438435
r241912r241913
446443   m_tx_tilemap_mode = 0;
447444
448445   /* Create tilemaps */
449   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
446   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
450447         32, 32, 32, 8);
451   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
448   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
452449         32, 32, 32, 8);
453450   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
454451         8, 8, 64, 32);
r241912r241913
483480   m_tx_tilemap_mode = 0;
484481
485482   /* Create tilemaps */
486   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
483   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
487484         32, 32, 32, 8);
488   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
485   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
489486         32, 32, 32, 8);
490487   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
491488         8, 8, 64, 32);
r241912r241913
519516   m_tx_tilemap_mode = 0;
520517
521518   /* Create tilemaps */
522   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
519   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
523520         32, 32, 32, 8);
524   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
521   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
525522         32, 32, 32, 8);
526523   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
527524         8, 8, 64, 32);
r241912r241913
542539   save_item(NAME(m_interrupt_line_2));
543540}
544541
545VIDEO_START_MEMBER(dooyong_z80_state,bluehawk)
542VIDEO_START_MEMBER(dooyong_z80_state, bluehawk)
546543{
547544   /* Configure tilemap callbacks */
548545   m_bg_tilerom = memregion("gfx3")->base() + 0x78000;
r241912r241913
554551   m_tx_tilemap_mode = 1;
555552
556553   /* Create tilemaps */
557   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
554   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
558555         32, 32, 32, 8);
559   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
556   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
560557         32, 32, 32, 8);
561   m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
558   m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
562559         32, 32, 32, 8);
563560   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
564561         8, 8, 64, 32);
r241912r241913
579576   save_item(NAME(m_fg2scroll8));
580577}
581578
582VIDEO_START_MEMBER(dooyong_z80_state,flytiger)
579VIDEO_START_MEMBER(dooyong_z80_state, flytiger)
583580{
584581   /* Configure tilemap callbacks */
585582   m_bg_tilerom = memregion("gfx3")->base() + 0x78000;
r241912r241913
589586   m_tx_tilemap_mode = 0;
590587
591588   /* Create tilemaps */
592   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
589   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
593590         32, 32, 32, 8);
594   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
591   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
595592         32, 32, 32, 8);
596593   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
597594         8, 8, 64, 32);
r241912r241913
612609   save_item(NAME(m_flytiger_pri));
613610}
614611
615VIDEO_START_MEMBER(dooyong_z80_state,primella)
612VIDEO_START_MEMBER(dooyong_z80_state, primella)
616613{
617614   /* Configure tilemap callbacks */
618615   m_bg_tilerom = memregion("gfx2")->base() + memregion("gfx2")->bytes() - 0x8000;
r241912r241913
622619   m_tx_tilemap_mode = 1;
623620
624621   /* Create tilemaps */
625   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
622   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
626623         32, 32, 32, 8);
627   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
624   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
628625         32, 32, 32, 8);
629626   m_tx_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_z80_state::get_tx_tile_info),this), TILEMAP_SCAN_COLS,
630627         8, 8, 64, 32);
r241912r241913
645642}
646643
647644
648/* These handle writes to the tilemap scroll registers in 16-bit machines.
649   This is just an 8-bit peripheral in a 16-bit machine. */
650
651WRITE16_MEMBER(dooyong_68k_state::bgscroll_w)
652{
653   if (ACCESSING_BITS_0_7) scroll8_w(offset, data & 0x00ff, m_bgscroll8, m_bg_tilemap);
654}
655
656WRITE16_MEMBER(dooyong_68k_state::bg2scroll_w)
657{
658   if (ACCESSING_BITS_0_7) scroll8_w(offset, data & 0x00ff, m_bg2scroll8, m_bg2_tilemap);
659}
660
661WRITE16_MEMBER(dooyong_68k_state::fgscroll_w)
662{
663   if (ACCESSING_BITS_0_7) scroll8_w(offset, data & 0x00ff, m_fgscroll8, m_fg_tilemap);
664}
665
666WRITE16_MEMBER(dooyong_68k_state::fg2scroll_w)
667{
668   if (ACCESSING_BITS_0_7) scroll8_w(offset, data & 0x00ff, m_fg2scroll8, m_fg2_tilemap);
669}
670
671645WRITE16_MEMBER(dooyong_68k_state::ctrl_w)
672
673646{
674647   if (ACCESSING_BITS_0_7)
675648   {
r241912r241913
685658
686659
687660inline void dooyong_68k_state::rshark_get_tile_info(tile_data &tileinfo, int tile_index,
688      const UINT8 *tilerom1, const UINT8 *tilerom2, UINT8 *scroll, int graphics)
661      UINT8 const *tilerom1, UINT8 const *tilerom2, UINT8 const *scroll, int graphics)
689662{
690663      /* Tiles take two bytes in tile ROM 1:
691664                       MSB   LSB
r241912r241913
704677   tileinfo.set(graphics, code, color, flags);
705678}
706679
707TILE_GET_INFO_MEMBER(dooyong_68k_state::get_bg_tile_info)
680TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg_tile_info)
708681{
709   if (m_bg_tilerom2 != NULL)
710      rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
711   else
712      lastday_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bgscroll8, m_bg_gfx);
682   rshark_get_tile_info(tileinfo, tile_index, m_bg_tilerom, m_bg_tilerom2, m_bgscroll8, m_bg_gfx);
713683}
714684
715TILE_GET_INFO_MEMBER(dooyong_68k_state::get_bg2_tile_info)
685TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_bg2_tile_info)
716686{
717   if (m_bg2_tilerom2 != NULL)
718      rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
719   else
720      lastday_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2scroll8, m_bg2_gfx);
687   rshark_get_tile_info(tileinfo, tile_index, m_bg2_tilerom, m_bg2_tilerom2, m_bg2scroll8, m_bg2_gfx);
721688}
722689
723TILE_GET_INFO_MEMBER(dooyong_68k_state::get_fg_tile_info)
690TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg_tile_info)
724691{
725   if (m_fg_tilerom2 != NULL)
726      rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
727   else
728      lastday_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fgscroll8, m_fg_gfx);
692   rshark_get_tile_info(tileinfo, tile_index, m_fg_tilerom, m_fg_tilerom2, m_fgscroll8, m_fg_gfx);
729693}
730694
731TILE_GET_INFO_MEMBER(dooyong_68k_state::get_fg2_tile_info)
695TILE_GET_INFO_MEMBER(dooyong_68k_state::rshark_get_fg2_tile_info)
732696{
733   if (m_fg2_tilerom2 != NULL)
734      rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
735   else
736      lastday_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2scroll8, m_fg2_gfx);
697   rshark_get_tile_info(tileinfo, tile_index, m_fg2_tilerom, m_fg2_tilerom2, m_fg2scroll8, m_fg2_gfx);
737698}
738699
739700
740701void dooyong_68k_state::draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
741702{
742   UINT16 *buffered_spriteram = m_spriteram->buffer();
743
744703   /* Sprites take 8 16-bit words each in memory:
745704                 MSB             LSB
746705      [offs + 0] ???? ???? ???? ???E
r241912r241913
760719      w = width
761720      h = height */
762721
763   int offs;
764
765   for (offs = (m_spriteram->bytes() / 2) - 8; offs >= 0; offs -= 8)
722   UINT16 const *const buffered_spriteram = m_spriteram->buffer();
723   for (int offs = (m_spriteram->bytes() / 2) - 8; offs >= 0; offs -= 8)
766724   {
767725      if (buffered_spriteram[offs] & 0x0001)    /* enable */
768726      {
769         int sx, sy, code, color, pri;
770         int flipx = 0, flipy = 0, width, height, x, y;
771
772         sx = buffered_spriteram[offs+4] & 0x01ff;
773         sy = (INT16)buffered_spriteram[offs+6] & 0x01ff;
774         if (sy & 0x0100) sy |= ~(int)0x01ff;    // Correctly sign-extend 9-bit number
775         code = buffered_spriteram[offs+3];
776         color = buffered_spriteram[offs+7] & 0x000f;
727         int code = buffered_spriteram[offs+3];
728         int const color = buffered_spriteram[offs+7] & 0x000f;
777729         //TODO: This priority mechanism works for known games, but seems a bit strange.
778730         //Are we missing something?  (The obvious spare palette bit isn't it.)
779         pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
780         width = buffered_spriteram[offs+1] & 0x000f;
781         height = (buffered_spriteram[offs+1] & 0x00f0) >> 4;
731         int const pri = (((color == 0x00) || (color == 0x0f)) ? 0xfc : 0xf0);
732         int const width = buffered_spriteram[offs+1] & 0x000f;
733         int const height = (buffered_spriteram[offs+1] & 0x00f0) >> 4;
782734
783         if (flip_screen())
735         bool const flip = flip_screen();
736         int sx = buffered_spriteram[offs+4] & 0x01ff;
737         int sy = (INT16)buffered_spriteram[offs+6] & 0x01ff;
738         if (sy & 0x0100) sy |= ~(int)0x01ff;    // Correctly sign-extend 9-bit number
739         if (flip)
784740         {
785741            sx = 498 - (16 * width) - sx;
786742            sy = 240 - (16 * height) - sy;
787            flipx = !flipx;
788            flipy = !flipy;
789743         }
790744
791         for (y = 0; y <= height; y++)
745         for (int y = 0; y <= height; y++)
792746         {
793            int _y = sy + (16 * (flipy ? (height - y) : y));
794            for (x = 0; x <= width; x++)
747            int const _y = sy + (16 * (flip ? (height - y) : y));
748            for (int x = 0; x <= width; x++)
795749            {
796               int _x = sx + (16 * (flipx ? (width - x) : x));
750               int const _x = sx + (16 * (flip ? (width - x) : x));
797751               m_gfxdecode->gfx(0)->prio_transpen(bitmap,cliprect,
798752                     code,
799753                     color,
800                     flipx, flipy,
754                     flip, flip,
801755                     _x, _y,
802756                     screen.priority(),
803757                     pri, 15);
r241912r241913
819773   m_fg2_tilemap->draw(screen, bitmap, cliprect, 0, 2);
820774
821775   draw_sprites(screen, bitmap, cliprect);
776
822777   return 0;
823778}
824779
r241912r241913
830785   m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 1);
831786
832787   draw_sprites(screen, bitmap, cliprect);
788
833789   return 0;
834790}
835791
r241912r241913
851807   m_fg2_gfx = 1;
852808
853809   /* Create tilemaps */
854   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
810   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg_tile_info),this), TILEMAP_SCAN_COLS,
855811         16, 16, 64, 32);
856   m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::get_bg2_tile_info),this), TILEMAP_SCAN_COLS,
812   m_bg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_bg2_tile_info),this), TILEMAP_SCAN_COLS,
857813         16, 16, 64, 32);
858   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,
814   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg_tile_info),this), TILEMAP_SCAN_COLS,
859815         16, 16, 64, 32);
860   m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
816   m_fg2_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::rshark_get_fg2_tile_info),this), TILEMAP_SCAN_COLS,
861817         16, 16, 64, 32);
862818
863819   /* Configure tilemap transparency */
r241912r241913
882838{
883839   /* Configure tilemap callbacks */
884840   m_bg_tilerom = memregion("gfx2")->base();
885   m_bg_tilerom2 = NULL;
886841   m_bg_gfx = 1;
887842
888843   /* Create tilemaps */
889   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_68k_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
844   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(dooyong_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS,
890845         32, 32, 32, 8);
891846   m_bg2_tilemap = m_fg_tilemap = m_fg2_tilemap = NULL;    /* Stop scroll handler from crashing on these */
892847


Previous 199869 Revisions Next


© 1997-2024 The MAME Team