Previous 199869 Revisions Next

r23671 Thursday 13th June, 2013 at 12:26:12 UTC by Fabio Priuli
Modernized Taito PC080SN video device. [Osso]
[src/mame/drivers]darius.c opwolf.c rainbow.c rastan.c topspeed.c
[src/mame/video]darius.c opwolf.c rainbow.c rastan.c taitoic.c taitoic.h topspeed.c

trunk/src/mame/drivers/topspeed.c
r23670r23671
503503   AM_RANGE(0x7e0002, 0x7e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
504504   AM_RANGE(0x800000, 0x8003ff) AM_RAM AM_SHARE("raster_ctrl")
505505   AM_RANGE(0x800400, 0x80ffff) AM_RAM
506   AM_RANGE(0xa00000, 0xa0ffff) AM_DEVREADWRITE_LEGACY("pc080sn_1", pc080sn_word_r, pc080sn_word_w)
507   AM_RANGE(0xa20000, 0xa20003) AM_DEVWRITE_LEGACY("pc080sn_1", pc080sn_yscroll_word_w)
508   AM_RANGE(0xa40000, 0xa40003) AM_DEVWRITE_LEGACY("pc080sn_1", pc080sn_xscroll_word_w)
509   AM_RANGE(0xa50000, 0xa50003) AM_DEVWRITE_LEGACY("pc080sn_1", pc080sn_ctrl_word_w)
510   AM_RANGE(0xb00000, 0xb0ffff) AM_DEVREADWRITE_LEGACY("pc080sn_2", pc080sn_word_r, pc080sn_word_w)
511   AM_RANGE(0xb20000, 0xb20003) AM_DEVWRITE_LEGACY("pc080sn_2", pc080sn_yscroll_word_w)
512   AM_RANGE(0xb40000, 0xb40003) AM_DEVWRITE_LEGACY("pc080sn_2", pc080sn_xscroll_word_w)
513   AM_RANGE(0xb50000, 0xb50003) AM_DEVWRITE_LEGACY("pc080sn_2", pc080sn_ctrl_word_w)
506   AM_RANGE(0xa00000, 0xa0ffff) AM_DEVREADWRITE("pc080sn_1", pc080sn_device, word_r, word_w)
507   AM_RANGE(0xa20000, 0xa20003) AM_DEVWRITE("pc080sn_1", pc080sn_device, yscroll_word_w)
508   AM_RANGE(0xa40000, 0xa40003) AM_DEVWRITE("pc080sn_1", pc080sn_device, xscroll_word_w)
509   AM_RANGE(0xa50000, 0xa50003) AM_DEVWRITE("pc080sn_1", pc080sn_device, ctrl_word_w)
510   AM_RANGE(0xb00000, 0xb0ffff) AM_DEVREADWRITE("pc080sn_2", pc080sn_device, word_r, word_w)
511   AM_RANGE(0xb20000, 0xb20003) AM_DEVWRITE("pc080sn_2", pc080sn_device, yscroll_word_w)
512   AM_RANGE(0xb40000, 0xb40003) AM_DEVWRITE("pc080sn_2", pc080sn_device, xscroll_word_w)
513   AM_RANGE(0xb50000, 0xb50003) AM_DEVWRITE("pc080sn_2", pc080sn_device, ctrl_word_w)
514514   AM_RANGE(0xd00000, 0xd00fff) AM_RAM AM_SHARE("spriteram")
515515   AM_RANGE(0xe00000, 0xe0ffff) AM_RAM AM_SHARE("spritemap")
516516ADDRESS_MAP_END
trunk/src/mame/drivers/opwolf.c
r23670r23671
369369   AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP                    /* watchdog ?? */
370370   AM_RANGE(0x3e0000, 0x3e0001) AM_READNOP AM_DEVWRITE8("tc0140syt", tc0140syt_device, tc0140syt_port_w, 0xff00)
371371   AM_RANGE(0x3e0002, 0x3e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
372   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("pc080sn", pc080sn_word_r, pc080sn_word_w)
372   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("pc080sn", pc080sn_device, word_r, word_w)
373373   AM_RANGE(0xc10000, 0xc1ffff) AM_WRITEONLY                   /* error in init code (?) */
374   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
375   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
376   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_ctrl_word_w)
374   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
375   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
376   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
377377   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
378378ADDRESS_MAP_END
379379
r23670r23671
390390   AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP                    /* watchdog ?? */
391391   AM_RANGE(0x3e0000, 0x3e0001) AM_READNOP AM_DEVWRITE8("tc0140syt", tc0140syt_device, tc0140syt_port_w, 0xff00)
392392   AM_RANGE(0x3e0002, 0x3e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0xff00)
393   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("pc080sn", pc080sn_word_r, pc080sn_word_w)
393   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("pc080sn", pc080sn_device, word_r, word_w)
394394   AM_RANGE(0xc10000, 0xc1ffff) AM_WRITEONLY                   /* error in init code (?) */
395   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
396   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
397   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_ctrl_word_w)
395   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
396   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
397   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
398398   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
399399ADDRESS_MAP_END
400400
trunk/src/mame/drivers/rastan.c
r23670r23671
215215   AM_RANGE(0x3c0000, 0x3c0001) AM_WRITE(watchdog_reset16_w)
216216   AM_RANGE(0x3e0000, 0x3e0001) AM_READNOP AM_DEVWRITE8("tc0140syt", tc0140syt_device, tc0140syt_port_w, 0x00ff)
217217   AM_RANGE(0x3e0002, 0x3e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
218   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("pc080sn", pc080sn_word_r, pc080sn_word_w)
219   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
220   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
221   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_ctrl_word_w)
218   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("pc080sn", pc080sn_device, word_r, word_w)
219   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
220   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
221   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
222222   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
223223ADDRESS_MAP_END
224224
trunk/src/mame/drivers/darius.c
r23670r23671
241241   AM_RANGE(0x0a0000, 0x0a0001) AM_WRITE(cpua_ctrl_w)
242242   AM_RANGE(0x0b0000, 0x0b0001) AM_WRITE(darius_watchdog_w)
243243   AM_RANGE(0xc00000, 0xc0007f) AM_READWRITE(darius_ioc_r, darius_ioc_w)           /* inputs, sound */
244   AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE_LEGACY("pc080sn", pc080sn_word_r, pc080sn_word_w)  /* tilemaps */
245   AM_RANGE(0xd20000, 0xd20003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
246   AM_RANGE(0xd40000, 0xd40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
247   AM_RANGE(0xd50000, 0xd50003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_ctrl_word_w)
244   AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE("pc080sn", pc080sn_device, word_r, word_w)  /* tilemaps */
245   AM_RANGE(0xd20000, 0xd20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
246   AM_RANGE(0xd40000, 0xd40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
247   AM_RANGE(0xd50000, 0xd50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
248248   AM_RANGE(0xd80000, 0xd80fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")/* palette */
249249   AM_RANGE(0xe00100, 0xe00fff) AM_RAM AM_SHARE("spriteram")
250250   AM_RANGE(0xe01000, 0xe02fff) AM_RAM AM_SHARE("share2")
trunk/src/mame/drivers/rainbow.c
r23670r23671
357357   AM_RANGE(0x800000, 0x8007ff) AM_READWRITE(rbisland_cchip_ram_r,rbisland_cchip_ram_w)
358358   AM_RANGE(0x800802, 0x800803) AM_READWRITE(rbisland_cchip_ctrl_r,rbisland_cchip_ctrl_w)
359359   AM_RANGE(0x800c00, 0x800c01) AM_WRITE(rbisland_cchip_bank_w)
360   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("pc080sn", pc080sn_word_r, pc080sn_word_w)
361   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
362   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
363   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_ctrl_word_w)
360   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("pc080sn", pc080sn_device, word_r, word_w)
361   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
362   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
363   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
364364   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram + other stuff */
365365ADDRESS_MAP_END
366366
r23670r23671
377377   AM_RANGE(0x3c0000, 0x3c0001) AM_WRITENOP        /* watchdog? */
378378   AM_RANGE(0x400006, 0x400007) AM_WRITE(jumping_sound_w)
379379   AM_RANGE(0x420000, 0x420001) AM_READNOP         /* read, but result not used */
380   AM_RANGE(0x430000, 0x430003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_yscroll_word_w)
380   AM_RANGE(0x430000, 0x430003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
381381   AM_RANGE(0x440000, 0x4407ff) AM_RAM AM_SHARE("spriteram")
382382   AM_RANGE(0x800000, 0x80ffff) AM_WRITENOP        /* original c-chip location (not used) */
383   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("pc080sn", pc080sn_word_r, pc080sn_word_w)
383   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE("pc080sn", pc080sn_device, word_r, word_w)
384384   AM_RANGE(0xc20000, 0xc20003) AM_WRITENOP        /* seems it is a leftover from rbisland: scroll y written here too */
385   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE_LEGACY("pc080sn", pc080sn_xscroll_word_w)
385   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
386386   AM_RANGE(0xd00000, 0xd01fff) AM_RAM             /* original spriteram location, needed for Attract Mode */
387387ADDRESS_MAP_END
388388
trunk/src/mame/video/rastan.c
r23670r23671
3333{
3434   int layer[2];
3535
36   pc080sn_tilemap_update(m_pc080sn);
36   m_pc080sn->tilemap_update();
3737
3838   layer[0] = 0;
3939   layer[1] = 1;
4040
4141   machine().priority_bitmap.fill(0, cliprect);
4242
43   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
44   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[1], 0, 2);
43   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
44   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
4545
4646   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
4747   return 0;
trunk/src/mame/video/rainbow.c
r23670r23671
4242{
4343   int layer[2];
4444
45   pc080sn_tilemap_update(m_pc080sn);
45   m_pc080sn->tilemap_update();
4646
4747   layer[0] = 0;
4848   layer[1] = 1;
4949
5050   machine().priority_bitmap.fill(0, cliprect);
5151
52   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
53   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[1], 0, 2);
52   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
53   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
5454
5555   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 1);
5656   return 0;
r23670r23671
6969
7070VIDEO_START_MEMBER(rbisland_state,jumping)
7171{
72   pc080sn_set_trans_pen(m_pc080sn, 1, 15);
72   m_pc080sn->set_trans_pen(1, 15);
7373
7474   m_sprite_ctrl = 0;
7575   m_sprites_flipscreen = 0;
r23670r23671
8686   int offs, layer[2];
8787   int sprite_colbank = (m_sprite_ctrl & 0xe0) >> 1;
8888
89   pc080sn_tilemap_update(m_pc080sn);
89   m_pc080sn->tilemap_update();
9090
9191   /* Override values, or foreground layer is in wrong position */
92   pc080sn_set_scroll(m_pc080sn, 1, 16, 0);
92   m_pc080sn->set_scroll(1, 16, 0);
9393
9494   layer[0] = 0;
9595   layer[1] = 1;
9696
9797   machine().priority_bitmap.fill(0, cliprect);
9898
99   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0);
99   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 0);
100100
101101   /* Draw the sprites. 128 sprites in total */
102102   for (offs = m_spriteram.bytes() / 2 - 8; offs >= 0; offs -= 8)
r23670r23671
122122      }
123123   }
124124
125   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[1], 0, 0);
125   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 0);
126126
127127#if 0
128128   {
trunk/src/mame/video/taitoic.c
r23670r23671
544544/*                                                                         */
545545/***************************************************************************/
546546
547struct pc080sn_state
548{
549   UINT16         ctrl[8];
547#define PC080SN_RAM_SIZE 0x10000
550548
551   UINT16 *       ram;
552   UINT16 *       bg_ram[2];
553   UINT16 *       bgscroll_ram[2];
549const device_type PC080SN = &device_creator<pc080sn_device>;
554550
555   int            bgscrollx[2], bgscrolly[2];
556   int            xoffs, yoffs;
551pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
552   : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock)
553{
554}
557555
558   tilemap_t        *tilemap[2];
559   int            bg_gfx;
560   int            yinvert, dblwidth;
561};
556//-------------------------------------------------
557//  device_config_complete - perform any
558//  operations now that the configuration is
559//  complete
560//-------------------------------------------------
562561
563#define PC080SN_RAM_SIZE 0x10000
562void pc080sn_device::device_config_complete()
563{
564   // inherit a copy of the static data
565   const pc080sn_interface *intf = reinterpret_cast<const pc080sn_interface *>(static_config());
566   if (intf != NULL)
567   *static_cast<pc080sn_interface *>(this) = *intf;
568   
569   // or initialize to defaults if none provided
570   else
571   {
572   }
573}
564574
565/*****************************************************************************
566    INLINE FUNCTIONS
567*****************************************************************************/
575//-------------------------------------------------
576//  device_start - device-specific startup
577//-------------------------------------------------
568578
569INLINE pc080sn_state *pc080sn_get_safe_token( device_t *device )
579void pc080sn_device::device_start()
570580{
571   assert(device != NULL);
572   assert(device->type() == PC080SN);
581   /* use the given gfx set for bg tiles */
582   if (!m_dblwidth) /* standard tilemaps */
583   {
584      m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
585      m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
586   }
587   else    /* double width tilemaps */
588   {
589      m_tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
590      m_tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
591   }
573592
574   return (pc080sn_state *)downcast<pc080sn_device *>(device)->token();
575}
593   m_tilemap[0]->set_transparent_pen(0);
594   m_tilemap[1]->set_transparent_pen(0);
576595
577INLINE const pc080sn_interface *pc080sn_get_interface( device_t *device )
578{
579   assert(device != NULL);
580   assert((device->type() == PC080SN));
581   return (const pc080sn_interface *) device->static_config();
596   m_tilemap[0]->set_scrolldx(-16 + m_x_offset, -16 - m_x_offset);
597   m_tilemap[0]->set_scrolldy(m_y_offset, -m_y_offset);
598   m_tilemap[1]->set_scrolldx(-16 + m_x_offset, -16 - m_x_offset);
599   m_tilemap[1]->set_scrolldy(m_y_offset, -m_y_offset);
600
601   if (!m_dblwidth)
602   {
603      m_tilemap[0]->set_scroll_rows(512);
604      m_tilemap[1]->set_scroll_rows(512);
605   }
606
607   m_ram = auto_alloc_array_clear(machine(), UINT16, PC080SN_RAM_SIZE / 2);
608
609   m_bg_ram[0]       = m_ram + 0x0000 /2;
610   m_bg_ram[1]       = m_ram + 0x8000 /2;
611   m_bgscroll_ram[0] = m_ram + 0x4000 /2;
612   m_bgscroll_ram[1] = m_ram + 0xc000 /2;
613
614   save_pointer(NAME(m_ram), PC080SN_RAM_SIZE / 2);
615   save_item(NAME(m_ctrl));
616   machine().save().register_postload(save_prepost_delegate(FUNC(pc080sn_device::restore_scroll), this));
617
582618}
583619
584620/*****************************************************************************
585621    DEVICE HANDLERS
586622*****************************************************************************/
587623
588INLINE void common_get_pc080sn_bg_tile_info( running_machine &machine, device_t *device, tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum )
624void pc080sn_device::common_get_pc080sn_bg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum )
589625{
590   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
591626   UINT16 code, attr;
592
593   if (!pc080sn->dblwidth)
627   
628   if (!m_dblwidth)
594629   {
595630      code = (ram[2 * tile_index + 1] & 0x3fff);
596631      attr = ram[2 * tile_index];
r23670r23671
601636      attr = ram[tile_index];
602637   }
603638
604   SET_TILE_INFO(
639   SET_TILE_INFO_MEMBER(
605640         gfxnum,
606641         code,
607642         (attr & 0x1ff),
608643         TILE_FLIPYX((attr & 0xc000) >> 14));
609644}
610645
611INLINE void common_get_pc080sn_fg_tile_info( running_machine &machine,  device_t *device, tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum )
646TILE_GET_INFO_MEMBER(pc080sn_device::get_bg_tile_info)
612647{
613   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
614   UINT16 code,attr;
648   common_get_pc080sn_bg_tile_info( tileinfo, tile_index, m_bg_ram[0], m_gfxnum );
649}
615650
616   if (!pc080sn->dblwidth)
651void pc080sn_device::common_get_pc080sn_fg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum )
652{
653   UINT16 code,attr;
654     
655   if (!m_dblwidth)
617656   {
618657      code = (ram[2 * tile_index + 1] & 0x3fff);
619658      attr = ram[2 * tile_index];
r23670r23671
624663      attr = ram[tile_index];
625664   }
626665
627   SET_TILE_INFO(
666   SET_TILE_INFO_MEMBER(
628667         gfxnum,
629668         code,
630669         (attr & 0x1ff),
631670         TILE_FLIPYX((attr & 0xc000) >> 14));
632671}
633672
634TILE_GET_INFO_MEMBER(pc080sn_device::pc080sn_get_bg_tile_info)
673TILE_GET_INFO_MEMBER(pc080sn_device::get_fg_tile_info)
635674{
636   pc080sn_state *pc080sn = pc080sn_get_safe_token(this);
637   common_get_pc080sn_bg_tile_info(machine(), this, tileinfo, tile_index, pc080sn->bg_ram[0], pc080sn->bg_gfx);
675   common_get_pc080sn_fg_tile_info( tileinfo, tile_index, m_bg_ram[1], m_gfxnum );
638676}
639677
640TILE_GET_INFO_MEMBER(pc080sn_device::pc080sn_get_fg_tile_info)
678READ16_MEMBER( pc080sn_device::word_r )
641679{
642   pc080sn_state *pc080sn = pc080sn_get_safe_token(this);
643   common_get_pc080sn_fg_tile_info(machine(), this, tileinfo, tile_index, pc080sn->bg_ram[1], pc080sn->bg_gfx);
680   return m_ram[offset];
644681}
645682
646
647READ16_DEVICE_HANDLER( pc080sn_word_r )
683WRITE16_MEMBER( pc080sn_device::word_w )
648684{
649   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
650   return pc080sn->ram[offset];
651}
685   COMBINE_DATA(&m_ram[offset]);
652686
653WRITE16_DEVICE_HANDLER( pc080sn_word_w )
654{
655   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
656
657   COMBINE_DATA(&pc080sn->ram[offset]);
658
659   if (!pc080sn->dblwidth)
687   if (!m_dblwidth)
660688   {
661689      if (offset < 0x2000)
662         pc080sn->tilemap[0]->mark_tile_dirty(offset / 2);
690         m_tilemap[0]->mark_tile_dirty(offset / 2);
663691      else if (offset >= 0x4000 && offset < 0x6000)
664         pc080sn->tilemap[1]->mark_tile_dirty((offset & 0x1fff) / 2);
692         m_tilemap[1]->mark_tile_dirty((offset & 0x1fff) / 2);
665693   }
666694   else
667695   {
668696      if (offset < 0x4000)
669         pc080sn->tilemap[0]->mark_tile_dirty((offset & 0x1fff));
697         m_tilemap[0]->mark_tile_dirty((offset & 0x1fff));
670698      else if (offset >= 0x4000 && offset < 0x8000)
671         pc080sn->tilemap[1]->mark_tile_dirty((offset & 0x1fff));
699         m_tilemap[1]->mark_tile_dirty((offset & 0x1fff));
672700   }
673701}
674702
675WRITE16_DEVICE_HANDLER( pc080sn_xscroll_word_w )
703WRITE16_MEMBER( pc080sn_device::xscroll_word_w )
676704{
677   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
705   COMBINE_DATA(&m_ctrl[offset]);
678706
679   COMBINE_DATA(&pc080sn->ctrl[offset]);
707   data = m_ctrl[offset];
680708
681   data = pc080sn->ctrl[offset];
682
683709   switch (offset)
684710   {
685711      case 0x00:
686         pc080sn->bgscrollx[0] = -data;
712         m_bgscrollx[0] = -data;
687713         break;
688714
689715      case 0x01:
690         pc080sn->bgscrollx[1] = -data;
716         m_bgscrollx[1] = -data;
691717         break;
692718   }
693719}
694720
695WRITE16_DEVICE_HANDLER( pc080sn_yscroll_word_w )
721WRITE16_MEMBER( pc080sn_device::yscroll_word_w )
696722{
697   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
723   COMBINE_DATA(&m_ctrl[offset + 2]);
698724
699   COMBINE_DATA(&pc080sn->ctrl[offset + 2]);
725   data = m_ctrl[offset + 2];
700726
701   data = pc080sn->ctrl[offset + 2];
702
703   if (pc080sn->yinvert)
727   if (m_y_invert)
704728      data = -data;
705729
706730   switch (offset)
707731   {
708732      case 0x00:
709         pc080sn->bgscrolly[0] = -data;
733         m_bgscrolly[0] = -data;
710734         break;
711735
712736      case 0x01:
713         pc080sn->bgscrolly[1] = -data;
737         m_bgscrolly[1] = -data;
714738         break;
715739   }
716740}
717741
718WRITE16_DEVICE_HANDLER( pc080sn_ctrl_word_w )
742WRITE16_MEMBER( pc080sn_device::ctrl_word_w )
719743{
720   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
744   COMBINE_DATA(&m_ctrl[offset + 4]);
721745
722   COMBINE_DATA(&pc080sn->ctrl[offset + 4]);
746   data = m_ctrl[offset + 4];
723747
724   data = pc080sn->ctrl[offset + 4];
725
726748   switch (offset)
727749   {
728750      case 0x00:
729751      {
730752         int flip = (data & 0x01) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
731753
732         pc080sn->tilemap[0]->set_flip(flip);
733         pc080sn->tilemap[1]->set_flip(flip);
754         m_tilemap[0]->set_flip(flip);
755         m_tilemap[1]->set_flip(flip);
734756         break;
735757      }
736758   }
r23670r23671
743765/* This routine is needed as an override by Jumping, which
744766   doesn't set proper scroll values for foreground tilemap */
745767
746void pc080sn_set_scroll( device_t *device, int tilemap_num, int scrollx, int scrolly )
768void pc080sn_device::set_scroll( int tilemap_num, int scrollx, int scrolly )
747769{
748   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
749
750   pc080sn->tilemap[tilemap_num]->set_scrollx(0, scrollx);
751   pc080sn->tilemap[tilemap_num]->set_scrolly(0, scrolly);
770   m_tilemap[tilemap_num]->set_scrollx(0, scrollx);
771   m_tilemap[tilemap_num]->set_scrolly(0, scrolly);
752772}
753773
754774/* This routine is needed as an override by Jumping */
755775
756void pc080sn_set_trans_pen( device_t *device, int tilemap_num, int pen )
776void pc080sn_device::set_trans_pen( int tilemap_num, int pen )
757777{
758   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
759   pc080sn->tilemap[tilemap_num]->set_transparent_pen(pen);
778   m_tilemap[tilemap_num]->set_transparent_pen(pen);
760779}
761780
762781
763void pc080sn_tilemap_update( device_t *device )
782void pc080sn_device::tilemap_update( )
764783{
765   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
766784   int j;
767785
768   pc080sn->tilemap[0]->set_scrolly(0, pc080sn->bgscrolly[0]);
769   pc080sn->tilemap[1]->set_scrolly(0, pc080sn->bgscrolly[1]);
786   m_tilemap[0]->set_scrolly(0, m_bgscrolly[0]);
787   m_tilemap[1]->set_scrolly(0, m_bgscrolly[1]);
770788
771   if (!pc080sn->dblwidth)
789   if (!m_dblwidth)
772790   {
773791      for (j = 0; j < 256; j++)
774         pc080sn->tilemap[0]->set_scrollx((j + pc080sn->bgscrolly[0]) & 0x1ff,   pc080sn->bgscrollx[0] - pc080sn->bgscroll_ram[0][j]);
792         m_tilemap[0]->set_scrollx((j + m_bgscrolly[0]) & 0x1ff,   m_bgscrollx[0] - m_bgscroll_ram[0][j]);
775793
776794      for (j = 0; j < 256; j++)
777         pc080sn->tilemap[1]->set_scrollx((j + pc080sn->bgscrolly[1]) & 0x1ff, pc080sn->bgscrollx[1] - pc080sn->bgscroll_ram[1][j]);
795         m_tilemap[1]->set_scrollx((j + m_bgscrolly[1]) & 0x1ff, m_bgscrollx[1] - m_bgscroll_ram[1][j]);
778796   }
779797   else
780798   {
781      pc080sn->tilemap[0]->set_scrollx(0, pc080sn->bgscrollx[0]);
782      pc080sn->tilemap[1]->set_scrollx(0, pc080sn->bgscrollx[1]);
799      m_tilemap[0]->set_scrollx(0, m_bgscrollx[0]);
800      m_tilemap[1]->set_scrollx(0, m_bgscrollx[1]);
783801   }
784802}
785803
r23670r23671
833851}
834852
835853
836static void topspeed_custom_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags,
837                     UINT32 priority, UINT16 *color_ctrl_ram )
854void pc080sn_device::topspeed_custom_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags,   UINT32 priority, UINT16 *color_ctrl_ram )
838855{
839   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
840856   UINT16 *dst16, *src16;
841857   UINT8 *tsrc;
842858   UINT16 scanline[1024];  /* won't be called by a wide-screen game, but just in case... */
843859
844   bitmap_ind16 &srcbitmap = pc080sn->tilemap[layer]->pixmap();
845   bitmap_ind8 &flagsbitmap = pc080sn->tilemap[layer]->flagsmap();
860   bitmap_ind16 &srcbitmap = m_tilemap[layer]->pixmap();
861   bitmap_ind8 &flagsbitmap = m_tilemap[layer]->flagsmap();
846862
847863   UINT16 a, color;
848864   int sx, x_index;
r23670r23671
860876
861877   if (!flip)
862878   {
863      sx = pc080sn->bgscrollx[layer] + 16 - pc080sn->xoffs;
864      y_index = pc080sn->bgscrolly[layer] + min_y - pc080sn->yoffs;
879      sx = m_bgscrollx[layer] + 16 - m_x_offset;
880      y_index = m_bgscrolly[layer] + min_y - m_y_offset;
865881   }
866882   else    // never used
867883   {
r23670r23671
877893   do
878894   {
879895      src_y_index = y_index & 0x1ff;  /* tilemaps are 512 px up/down */
880      row_index = (src_y_index - pc080sn->bgscrolly[layer]) & 0x1ff;
881      color = color_ctrl_ram[(row_index + pc080sn->yoffs - 2) & 0xff];
896      row_index = (src_y_index - m_bgscrolly[layer]) & 0x1ff;
897      color = color_ctrl_ram[(row_index + m_y_offset - 2) & 0xff];
882898
883      x_index = sx - (pc080sn->bgscroll_ram[layer][row_index]);
899      x_index = sx - (m_bgscroll_ram[layer][row_index]);
884900
885901      src16 = &srcbitmap.pix16(src_y_index);
886902      tsrc  = &flagsbitmap.pix8(src_y_index);
r23670r23671
916932         }
917933      }
918934
919      taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, device->machine().priority_bitmap, priority);
935      taitoic_drawscanline(bitmap, cliprect, 0, y, scanline, (flags & TILEMAP_DRAW_OPAQUE) ? 0 : 1, ROT0, machine().priority_bitmap, priority);
920936      y_index++;
921937
922938      if (!machine_flip)
r23670r23671
927943   while ((!machine_flip && y <= max_y) || (machine_flip && y >= min_y));
928944}
929945
930void pc080sn_tilemap_draw( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority )
946void pc080sn_device::tilemap_draw( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority )
931947{
932   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
933   pc080sn->tilemap[layer]->draw(bitmap, cliprect, flags, priority);
948   m_tilemap[layer]->draw(bitmap, cliprect, flags, priority);
934949}
935950
936void pc080sn_tilemap_draw_offset( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, int xoffs, int yoffs )
951void pc080sn_device::tilemap_draw_offset( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, int x_offset, int y_offset )
937952{
938   pc080sn_state *pc080sn = pc080sn_get_safe_token(device);
939   int basedx = -16 - pc080sn->xoffs;
940   int basedxflip = -16 + pc080sn->xoffs;
941   int basedy = pc080sn->yoffs;
942   int basedyflip = -pc080sn->yoffs;
953   int basedx = -16 - m_x_offset;
954   int basedxflip = -16 + m_x_offset;
955   int basedy = m_y_offset;
956   int basedyflip = -m_y_offset;
943957
944   pc080sn->tilemap[layer]->set_scrolldx(basedx + xoffs, basedxflip + xoffs);
945   pc080sn->tilemap[layer]->set_scrolldy(basedy + yoffs, basedyflip + yoffs);
946   pc080sn->tilemap[layer]->draw(bitmap, cliprect, flags, priority);
947   pc080sn->tilemap[layer]->set_scrolldx(basedx, basedxflip);
948   pc080sn->tilemap[layer]->set_scrolldy(basedy, basedyflip);
958   m_tilemap[layer]->set_scrolldx(basedx + x_offset, basedxflip + x_offset);
959   m_tilemap[layer]->set_scrolldy(basedy + y_offset, basedyflip + y_offset);
960   m_tilemap[layer]->draw(bitmap, cliprect, flags, priority);
961   m_tilemap[layer]->set_scrolldx(basedx, basedxflip);
962   m_tilemap[layer]->set_scrolldy(basedy, basedyflip);
949963}
950964
951void pc080sn_tilemap_draw_special( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, UINT16 *ram )
965void pc080sn_device::tilemap_draw_special( bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, UINT16 *ram )
952966{
953   topspeed_custom_draw(device, bitmap, cliprect, layer, flags, priority, ram);
967   pc080sn_device::topspeed_custom_draw(bitmap, cliprect, layer, flags, priority, ram);
954968}
955969
956970
957void pc080sn_device::pc080sn_restore_scroll()
971void pc080sn_device::restore_scroll()
958972{
959   pc080sn_state *pc080sn = pc080sn_get_safe_token(this);
973   
960974   int flip;
961975
962   pc080sn->bgscrollx[0] = -pc080sn->ctrl[0];
963   pc080sn->bgscrollx[1] = -pc080sn->ctrl[1];
964   pc080sn->bgscrolly[0] = -pc080sn->ctrl[2];
965   pc080sn->bgscrolly[1] = -pc080sn->ctrl[3];
976   m_bgscrollx[0] = -m_ctrl[0];
977   m_bgscrollx[1] = -m_ctrl[1];
978   m_bgscrolly[0] = -m_ctrl[2];
979   m_bgscrolly[1] = -m_ctrl[3];
966980
967   flip = (pc080sn->ctrl[4] & 0x01) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
968   pc080sn->tilemap[0]->set_flip(flip);
969   pc080sn->tilemap[1]->set_flip(flip);
981   flip = (m_ctrl[4] & 0x01) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
982   m_tilemap[0]->set_flip(flip);
983   m_tilemap[1]->set_flip(flip);
970984}
971985
972const device_type PC080SN = &device_creator<pc080sn_device>;
973986
974pc080sn_device::pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
975   : device_t(mconfig, PC080SN, "Taito PC080SN", tag, owner, clock)
976{
977   m_token = global_alloc_clear(pc080sn_state);
978}
979
980//-------------------------------------------------
981//  device_config_complete - perform any
982//  operations now that the configuration is
983//  complete
984//-------------------------------------------------
985
986void pc080sn_device::device_config_complete()
987{
988}
989
990//-------------------------------------------------
991//  device_start - device-specific startup
992//-------------------------------------------------
993
994void pc080sn_device::device_start()
995{
996   pc080sn_state *pc080sn = pc080sn_get_safe_token(this);
997   const pc080sn_interface *intf = pc080sn_get_interface(this);
998
999   /* use the given gfx set for bg tiles */
1000   pc080sn->bg_gfx = intf->gfxnum;
1001
1002   pc080sn->yinvert = intf->y_invert;
1003   pc080sn->dblwidth = intf->dblwidth;
1004   pc080sn->xoffs = intf->x_offset;
1005   pc080sn->yoffs = intf->y_offset;
1006
1007   if (!pc080sn->dblwidth) /* standard tilemaps */
1008   {
1009      pc080sn->tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::pc080sn_get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
1010      pc080sn->tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::pc080sn_get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 64);
1011   }
1012   else    /* double width tilemaps */
1013   {
1014      pc080sn->tilemap[0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::pc080sn_get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
1015      pc080sn->tilemap[1] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(pc080sn_device::pc080sn_get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
1016   }
1017
1018   pc080sn->tilemap[0]->set_transparent_pen(0);
1019   pc080sn->tilemap[1]->set_transparent_pen(0);
1020
1021   pc080sn->tilemap[0]->set_scrolldx(-16 + pc080sn->xoffs, -16 - pc080sn->xoffs);
1022   pc080sn->tilemap[0]->set_scrolldy(pc080sn->yoffs, -pc080sn->yoffs);
1023   pc080sn->tilemap[1]->set_scrolldx(-16 + pc080sn->xoffs, -16 - pc080sn->xoffs);
1024   pc080sn->tilemap[1]->set_scrolldy(pc080sn->yoffs, -pc080sn->yoffs);
1025
1026   if (!pc080sn->dblwidth)
1027   {
1028      pc080sn->tilemap[0]->set_scroll_rows(512);
1029      pc080sn->tilemap[1]->set_scroll_rows(512);
1030   }
1031
1032   pc080sn->ram = auto_alloc_array_clear(machine(), UINT16, PC080SN_RAM_SIZE / 2);
1033
1034   pc080sn->bg_ram[0]       = pc080sn->ram + 0x0000 /2;
1035   pc080sn->bg_ram[1]       = pc080sn->ram + 0x8000 /2;
1036   pc080sn->bgscroll_ram[0] = pc080sn->ram + 0x4000 /2;
1037   pc080sn->bgscroll_ram[1] = pc080sn->ram + 0xc000 /2;
1038
1039   save_pointer(NAME(pc080sn->ram), PC080SN_RAM_SIZE / 2);
1040   save_item(NAME(pc080sn->ctrl));
1041   machine().save().register_postload(save_prepost_delegate(FUNC(pc080sn_device::pc080sn_restore_scroll), this));
1042
1043}
1044
1045987/***************************************************************************/
1046988/*                                                                         */
1047989/*                                 PC090OJ                                 */
trunk/src/mame/video/taitoic.h
r23670r23671
1717
1818struct pc080sn_interface
1919{
20   int                gfxnum;
20   int                m_gfxnum;
2121
22   int                x_offset, y_offset;
23   int                y_invert;
24   int                dblwidth;
22   int                m_x_offset, m_y_offset;
23   int                m_y_invert;
24   int                m_dblwidth;
2525};
2626
2727
r23670r23671
100100   int            tx_color_base;
101101};
102102
103class pc080sn_device : public device_t
103class pc080sn_device : public device_t,
104                              pc080sn_interface
104105{
105106public:
106107   pc080sn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
107   ~pc080sn_device() { global_free(m_token); }
108   ~pc080sn_device() {}
109   
110   DECLARE_READ16_MEMBER( word_r );
111   DECLARE_WRITE16_MEMBER( word_w );
112   DECLARE_WRITE16_MEMBER( xscroll_word_w );
113   DECLARE_WRITE16_MEMBER( yscroll_word_w );
114   DECLARE_WRITE16_MEMBER( ctrl_word_w );
115   
116   TILE_GET_INFO_MEMBER(get_bg_tile_info);
117   TILE_GET_INFO_MEMBER(get_fg_tile_info);
118   
119   void common_get_pc080sn_bg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum );
120   void common_get_pc080sn_fg_tile_info( tile_data &tileinfo, int tile_index, UINT16 *ram, int gfxnum );
108121
109   // access to legacy token
110   void *token() const { assert(m_token != NULL); return m_token; }
111   void pc080sn_restore_scroll();
112protected:
122   void set_scroll(int tilemap_num, int scrollx, int scrolly);
123   void set_trans_pen(int tilemap_num, int pen);
124   void tilemap_update();
125   void tilemap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority);
126   void tilemap_draw_offset(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, int xoffs, int yoffs);
127   void topspeed_custom_draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, UINT16 *color_ctrl_ram);
128
129   /* For Topspeed */
130   void tilemap_draw_special(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, UINT16 *ram);
131   
132   void restore_scroll();
133
134   protected:
113135   // device-level overrides
114136   virtual void device_config_complete();
115137   virtual void device_start();
116private:
138   
139   private:
117140   // internal state
118   void *m_token;
141   UINT16         m_ctrl[8];
119142
120   TILE_GET_INFO_MEMBER(pc080sn_get_bg_tile_info);
121   TILE_GET_INFO_MEMBER(pc080sn_get_fg_tile_info);
143   UINT16          *m_ram;
144   UINT16          *m_bg_ram[2];
145   UINT16         *m_bgscroll_ram[2];
146
147   int            m_bgscrollx[2], m_bgscrolly[2];
148     
149   tilemap_t      *m_tilemap[2];
150         
122151};
123152
124153extern const device_type PC080SN;
r23670r23671
379408    DEVICE I/O FUNCTIONS
380409***************************************************************************/
381410
382/**  PC080SN  **/
383DECLARE_READ16_DEVICE_HANDLER( pc080sn_word_r );
384DECLARE_WRITE16_DEVICE_HANDLER( pc080sn_word_w );
385DECLARE_WRITE16_DEVICE_HANDLER( pc080sn_xscroll_word_w );
386DECLARE_WRITE16_DEVICE_HANDLER( pc080sn_yscroll_word_w );
387DECLARE_WRITE16_DEVICE_HANDLER( pc080sn_ctrl_word_w );
388
389void pc080sn_set_scroll(device_t *device, int tilemap_num, int scrollx, int scrolly);
390void pc080sn_set_trans_pen(device_t *device, int tilemap_num, int pen);
391void pc080sn_tilemap_update(device_t *device);
392void pc080sn_tilemap_draw(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority);
393void pc080sn_tilemap_draw_offset(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, int xoffs, int yoffs);
394
395/* For Topspeed */
396void pc080sn_tilemap_draw_special(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int flags, UINT32 priority, UINT16 *ram);
397
398
399411/**  PC090OJ  **/
400412DECLARE_READ16_DEVICE_HANDLER( pc090oj_word_r );
401413DECLARE_WRITE16_DEVICE_HANDLER( pc090oj_word_w );
trunk/src/mame/video/topspeed.c
r23670r23671
144144   }
145145#endif
146146
147   pc080sn_tilemap_update(m_pc080sn_1);
148   pc080sn_tilemap_update(m_pc080sn_2);
147   m_pc080sn_1->tilemap_update();
148   m_pc080sn_2->tilemap_update();
149149
150150   /* Tilemap layer priority seems hardwired (the order is odd, too) */
151151   layer[0] = 1;
r23670r23671
159159#ifdef MAME_DEBUG
160160   if (m_dislayer[3] == 0)
161161#endif
162   pc080sn_tilemap_draw(m_pc080sn_2, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
162   m_pc080sn_2->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
163163
164164#ifdef MAME_DEBUG
165165   if (m_dislayer[2] == 0)
166166#endif
167   pc080sn_tilemap_draw_special(m_pc080sn_2, bitmap, cliprect, layer[1], 0, 2, m_raster_ctrl);
167   m_pc080sn_2->tilemap_draw_special(bitmap, cliprect, layer[1], 0, 2, m_raster_ctrl);
168168
169169#ifdef MAME_DEBUG
170170   if (m_dislayer[1] == 0)
171171#endif
172   pc080sn_tilemap_draw_special(m_pc080sn_1, bitmap, cliprect, layer[2], 0, 4, m_raster_ctrl + 0x100);
172   m_pc080sn_1->tilemap_draw_special(bitmap, cliprect, layer[2], 0, 4, m_raster_ctrl + 0x100);
173173
174174#ifdef MAME_DEBUG
175175   if (m_dislayer[0] == 0)
176176#endif
177   pc080sn_tilemap_draw(m_pc080sn_1, bitmap, cliprect, layer[3], 0, 8);
177   m_pc080sn_1->tilemap_draw(bitmap, cliprect, layer[3], 0, 8);
178178
179179#ifdef MAME_DEBUG
180180   if (m_dislayer[4] == 0)
trunk/src/mame/video/darius.c
r23670r23671
8888
8989UINT32 darius_state::update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int xoffs)
9090{
91   pc080sn_tilemap_update(m_pc080sn);
91   m_pc080sn->tilemap_update();
9292
9393   // draw bottom layer(always active)
94   pc080sn_tilemap_draw_offset(m_pc080sn, bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0, -xoffs, 0);
94   m_pc080sn->tilemap_draw_offset(bitmap, cliprect, 0, TILEMAP_DRAW_OPAQUE, 0, -xoffs, 0);
9595
9696   /* Sprites can be under/over the layer below text layer */
9797   draw_sprites(bitmap, cliprect, 0, xoffs, -8); // draw sprites with priority 0 which are under the mid layer
9898
9999   // draw middle layer
100   pc080sn_tilemap_draw_offset(m_pc080sn, bitmap, cliprect, 1, 0, 0, -xoffs, 0);
100   m_pc080sn->tilemap_draw_offset(bitmap, cliprect, 1, 0, 0, -xoffs, 0);
101101
102102   draw_sprites(bitmap, cliprect, 1, xoffs, -8); // draw sprites with priority 1 which are over the mid layer
103103
trunk/src/mame/video/opwolf.c
r23670r23671
3838{
3939   int layer[2];
4040
41   pc080sn_tilemap_update(m_pc080sn);
41   m_pc080sn->tilemap_update();
4242
4343   layer[0] = 0;
4444   layer[1] = 1;
4545
4646   machine().priority_bitmap.fill(0, cliprect);
4747
48   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
49   pc080sn_tilemap_draw(m_pc080sn, bitmap, cliprect, layer[1], 0, 2);
48   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
49   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
5050
5151   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 1);
5252

Previous 199869 Revisions Next


© 1997-2024 The MAME Team