Previous 199869 Revisions Next

r23698 Friday 14th June, 2013 at 08:13:00 UTC by Fabio Priuli
Modernized Taito PC090OJ video device. [Osso]
[src/mame/drivers]asuka.c opwolf.c rainbow.c rastan.c volfied.c
[src/mame/video]asuka.c opwolf.c rainbow.c rastan.c taitoic.c taitoic.h volfied.c

trunk/src/mame/drivers/opwolf.c
r23697r23698
374374   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
375375   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
376376   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
377   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
377   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
378378ADDRESS_MAP_END
379379
380380
r23697r23698
395395   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
396396   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
397397   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
398   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
398   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
399399ADDRESS_MAP_END
400400
401401
trunk/src/mame/drivers/rastan.c
r23697r23698
219219   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
220220   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
221221   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
222   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
222   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
223223ADDRESS_MAP_END
224224
225225
trunk/src/mame/drivers/rainbow.c
r23697r23698
361361   AM_RANGE(0xc20000, 0xc20003) AM_DEVWRITE("pc080sn", pc080sn_device, yscroll_word_w)
362362   AM_RANGE(0xc40000, 0xc40003) AM_DEVWRITE("pc080sn", pc080sn_device, xscroll_word_w)
363363   AM_RANGE(0xc50000, 0xc50003) AM_DEVWRITE("pc080sn", pc080sn_device, ctrl_word_w)
364   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram + other stuff */
364   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram + other stuff */
365365ADDRESS_MAP_END
366366
367367static ADDRESS_MAP_START( jumping_map, AS_PROGRAM, 16, rbisland_state )
trunk/src/mame/drivers/volfied.c
r23697r23698
6565   AM_RANGE(0x000000, 0x03ffff) AM_ROM     /* program */
6666   AM_RANGE(0x080000, 0x0fffff) AM_ROM     /* tiles   */
6767   AM_RANGE(0x100000, 0x103fff) AM_RAM     /* main    */
68   AM_RANGE(0x200000, 0x203fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)
68   AM_RANGE(0x200000, 0x203fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)
6969   AM_RANGE(0x400000, 0x47ffff) AM_READWRITE(volfied_video_ram_r, volfied_video_ram_w)
7070   AM_RANGE(0x500000, 0x503fff) AM_RAM_WRITE(paletteram_xBBBBBGGGGGRRRRR_word_w) AM_SHARE("paletteram")
7171   AM_RANGE(0x600000, 0x600001) AM_WRITE(volfied_video_mask_w)
trunk/src/mame/drivers/asuka.c
r23697r23698
328328   AM_RANGE(0x800c00, 0x800c01) AM_WRITE(bonzeadv_cchip_bank_w)
329329   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)    /* tilemaps */
330330   AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
331   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
331   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
332332ADDRESS_MAP_END
333333
334334static ADDRESS_MAP_START( asuka_map, AS_PROGRAM, 16, asuka_state )
r23697r23698
343343   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)    /* tilemaps */
344344   AM_RANGE(0xc10000, 0xc103ff) AM_WRITENOP    /* error in Asuka init code */
345345   AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
346   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
346   AM_RANGE(0xd00000, 0xd03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
347347ADDRESS_MAP_END
348348
349349static ADDRESS_MAP_START( cadash_map, AS_PROGRAM, 16, asuka_state )
r23697r23698
355355   AM_RANGE(0x800000, 0x800fff) AM_READWRITE(cadash_share_r,cadash_share_w)    /* network ram */
356356   AM_RANGE(0x900000, 0x90000f) AM_DEVREADWRITE8("tc0220ioc", tc0220ioc_device, read, write, 0x00ff)
357357   AM_RANGE(0xa00000, 0xa0000f) AM_DEVREADWRITE_LEGACY("tc0110pcr", tc0110pcr_word_r, tc0110pcr_step1_4bpg_word_w)
358   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
358   AM_RANGE(0xb00000, 0xb03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
359359   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)    /* tilemaps */
360360   AM_RANGE(0xc20000, 0xc2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
361361ADDRESS_MAP_END
r23697r23698
369369   AM_RANGE(0x4a0000, 0x4a0003) AM_WRITE(asuka_spritectrl_w)
370370   AM_RANGE(0x4e0000, 0x4e0001) AM_READNOP AM_DEVWRITE8("tc0140syt", tc0140syt_device, tc0140syt_port_w, 0x00ff)
371371   AM_RANGE(0x4e0002, 0x4e0003) AM_DEVREADWRITE8("tc0140syt", tc0140syt_device, tc0140syt_comm_r, tc0140syt_comm_w, 0x00ff)
372   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE_LEGACY("pc090oj", pc090oj_word_r, pc090oj_word_w)  /* sprite ram */
372   AM_RANGE(0xc00000, 0xc03fff) AM_DEVREADWRITE("pc090oj", pc090oj_device, word_r, word_w)  /* sprite ram */
373373   AM_RANGE(0xc00000, 0xc0ffff) AM_DEVWRITE_LEGACY("tc0100scn", tc0100scn_word_w)
374374   AM_RANGE(0xd00000, 0xd0ffff) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_word_r, tc0100scn_word_w)    /* tilemaps */
375375   AM_RANGE(0xd20000, 0xd2000f) AM_DEVREADWRITE_LEGACY("tc0100scn", tc0100scn_ctrl_word_r, tc0100scn_ctrl_word_w)
r23697r23698
859859   // rising edge
860860   if (state)
861861   {
862      pc090oj_eof_callback(m_pc090oj);
862      m_pc090oj->eof_callback();
863863   }
864864}
865865
trunk/src/mame/video/rastan.c
r23697r23698
1414WRITE16_MEMBER(rastan_state::rastan_spritectrl_w)
1515{
1616   /* bits 5-7 are the sprite palette bank */
17   pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0xe0) >> 5);
17   m_pc090oj->set_sprite_ctrl((data & 0xe0) >> 5);
1818
1919   /* bit 4 unused */
2020
r23697r23698
4343   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
4444   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
4545
46   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
46   m_pc090oj->draw_sprites(bitmap, cliprect, 0);
4747   return 0;
4848}
trunk/src/mame/video/rainbow.c
r23697r23698
2020      /* bits 5-7 are the sprite palette bank */
2121      /* other bits unknown */
2222
23      pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0xe0) >> 5);
23      m_pc090oj->set_sprite_ctrl((data & 0xe0) >> 5);
2424   }
2525}
2626
r23697r23698
5252   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
5353   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
5454
55   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 1);
55   m_pc090oj->draw_sprites(bitmap, cliprect, 1);
5656   return 0;
5757}
5858
trunk/src/mame/video/opwolf.c
r23697r23698
1818      /* bits 5-7 are the sprite palette bank */
1919      /* other bits unknown */
2020
21      pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0xe0) >> 5);
21      m_pc090oj->set_sprite_ctrl((data & 0xe0) >> 5);
2222
2323      /* If data = 4, the Piston Motor is off, otherwise it's on. */
2424      if (data == 4)
r23697r23698
4848   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[0], TILEMAP_DRAW_OPAQUE, 1);
4949   m_pc080sn->tilemap_draw(bitmap, cliprect, layer[1], 0, 2);
5050
51   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 1);
51   m_pc090oj->draw_sprites(bitmap, cliprect, 1);
5252
5353//  if (ioport("P1X")->read())
5454//  popmessage("%d %d", machine(), "P1X"), ioport("P1Y")->read());
trunk/src/mame/video/volfied.c
r23697r23698
5858
5959WRITE16_MEMBER(volfied_state::volfied_sprite_ctrl_w)
6060{
61   pc090oj_set_sprite_ctrl(m_pc090oj, (data & 0x3c) >> 2);
61   m_pc090oj->set_sprite_ctrl((data & 0x3c) >> 2);
6262}
6363
6464
r23697r23698
124124{
125125   machine().priority_bitmap.fill(0, cliprect);
126126   refresh_pixel_layer(bitmap);
127   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
127   m_pc090oj->draw_sprites(bitmap, cliprect, 0);
128128   return 0;
129129}
trunk/src/mame/video/asuka.c
r23697r23698
99WRITE16_MEMBER(asuka_state::asuka_spritectrl_w)
1010{
1111   /* Bits 2-5 are color bank; in asuka games bit 0 is global priority */
12   pc090oj_set_sprite_ctrl(m_pc090oj, ((data & 0x3c) >> 2) | ((data & 0x1) << 15));
12   m_pc090oj->set_sprite_ctrl(((data & 0x3c) >> 2) | ((data & 0x1) << 15));
1313}
1414
1515
r23697r23698
3737   tc0100scn_tilemap_draw(m_tc0100scn, bitmap, cliprect, layer[2], 0, 4);
3838
3939   /* Sprites may be over or under top bg layer */
40   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 2);
40   m_pc090oj->draw_sprites(bitmap, cliprect, 2);
4141   return 0;
4242}
4343
r23697r23698
6262   tc0100scn_tilemap_draw(m_tc0100scn, bitmap, cliprect, layer[2], 0, 4);
6363
6464   /* Sprites are always over both bg layers */
65   pc090oj_draw_sprites(m_pc090oj, bitmap, cliprect, 0);
65   m_pc090oj->draw_sprites(bitmap, cliprect, 0);
6666   return 0;
6767}
trunk/src/mame/video/taitoic.c
r23697r23698
990990/*                                                                         */
991991/***************************************************************************/
992992
993struct pc090oj_state
994{
995/* NB: pc090oj_ctrl is the internal register controlling flipping
996993
997   pc090oj_sprite_ctrl is a representation of the hardware OUTSIDE the pc090oj
998   which impacts on sprite plotting, and which varies between games. It
999   includes color banking and (optionally) priority. It allows each game to
1000   control these aspects of the sprites in different ways, while keeping the
1001   routines here modular.
994#define PC090OJ_RAM_SIZE 0x4000
995#define PC090OJ_ACTIVE_RAM_SIZE 0x800
1002996
1003*/
1004997
1005   UINT16     ctrl, buffer, gfxnum;
1006   UINT16     sprite_ctrl;
1007998
1008   UINT16 *   ram;
1009   UINT16 *   ram_buffered;
999/*****************************************************************************
1000    DEVICE INTERFACE
1001*****************************************************************************/
10101002
1011   int        xoffs, yoffs;
1012};
10131003
1014#define PC090OJ_RAM_SIZE 0x4000
1015#define PC090OJ_ACTIVE_RAM_SIZE 0x800
10161004
1017/*****************************************************************************
1018    INLINE FUNCTIONS
1019*****************************************************************************/
1005const device_type PC090OJ = &device_creator<pc090oj_device>;
10201006
1021INLINE pc090oj_state *pc090oj_get_safe_token( device_t *device )
1007pc090oj_device::pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1008   : device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock)
10221009{
1023   assert(device != NULL);
1024   assert(device->type() == PC090OJ);
1010}
10251011
1026   return (pc090oj_state *)downcast<pc090oj_device *>(device)->token();
1012//-------------------------------------------------
1013//  device_config_complete - perform any
1014//  operations now that the configuration is
1015//  complete
1016//-------------------------------------------------
1017
1018void pc090oj_device::device_config_complete()
1019{
1020   // inherit a copy of the static data
1021   const pc090oj_interface *intf = reinterpret_cast<const pc090oj_interface *>(static_config());
1022   if (intf != NULL)
1023   *static_cast<pc090oj_interface *>(this) = *intf;
1024   
1025   // or initialize to defaults if none provided
1026   else
1027   {
1028   }
10271029}
10281030
1029INLINE const pc090oj_interface *pc090oj_get_interface( device_t *device )
1031//-------------------------------------------------
1032//  device_start - device-specific startup
1033//-------------------------------------------------
1034
1035void pc090oj_device::device_start()
10301036{
1031   assert(device != NULL);
1032   assert((device->type() == PC090OJ));
1033   return (const pc090oj_interface *) device->static_config();
1037   m_ram = auto_alloc_array_clear(machine(), UINT16, PC090OJ_RAM_SIZE / 2);
1038   m_ram_buffered = auto_alloc_array_clear(machine(), UINT16, PC090OJ_RAM_SIZE / 2);
1039
1040   save_pointer(NAME(m_ram), PC090OJ_RAM_SIZE / 2);
1041   save_pointer(NAME(m_ram_buffered), PC090OJ_RAM_SIZE / 2);
1042   save_item(NAME(m_ctrl));
1043   save_item(NAME(m_sprite_ctrl));  // should this be set in intf?!?
10341044}
10351045
1046//-------------------------------------------------
1047//  device_reset - device-specific reset
1048//-------------------------------------------------
1049
1050void pc090oj_device::device_reset()
1051{
1052   m_ctrl = 0;
1053}
1054
10361055/*****************************************************************************
10371056    DEVICE HANDLERS
10381057*****************************************************************************/
10391058
1040void pc090oj_set_sprite_ctrl( device_t *device, UINT16 sprctrl )
1059void pc090oj_device::set_sprite_ctrl( UINT16 sprctrl )
10411060{
1042   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
1043   pc090oj->sprite_ctrl = sprctrl;
1061   m_sprite_ctrl = sprctrl;
10441062}
10451063
1046READ16_DEVICE_HANDLER( pc090oj_word_r )
1064READ16_MEMBER( pc090oj_device::word_r )
10471065{
1048   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
1049   return pc090oj->ram[offset];
1066   return m_ram[offset];
10501067}
10511068
1052WRITE16_DEVICE_HANDLER( pc090oj_word_w )
1069WRITE16_MEMBER( pc090oj_device::word_w )
10531070{
1054   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
1055   COMBINE_DATA(&pc090oj->ram[offset]);
1071   COMBINE_DATA(&m_ram[offset]);
10561072
10571073   /* If we're not buffering sprite ram, write it straight through... */
1058   if (!pc090oj->buffer)
1059      pc090oj->ram_buffered[offset] = pc090oj->ram[offset];
1074   if (!m_use_buffer)
1075      m_ram_buffered[offset] = m_ram[offset];
10601076
10611077   if (offset == 0xdff)
10621078   {
10631079      /* Bit 0 is flip control, others seem unused */
1064      pc090oj->ctrl = data;
1080      m_ctrl = data;
10651081
10661082#if 0
10671083   popmessage("pc090oj ctrl = %4x", data);
r23697r23698
10691085   }
10701086}
10711087
1072void pc090oj_eof_callback( device_t *device )
1088void pc090oj_device::eof_callback( )
10731089{
1074   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
1075   if (pc090oj->buffer)
1090   if (m_use_buffer)
10761091   {
10771092      int i;
10781093      for (i = 0; i < PC090OJ_ACTIVE_RAM_SIZE / 2; i++)
1079         pc090oj->ram_buffered[i] = pc090oj->ram[i];
1094         m_ram_buffered[i] = m_ram[i];
10801095   }
10811096}
10821097
10831098
1084void pc090oj_draw_sprites( device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type )
1099void pc090oj_device::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type )
10851100{
1086   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
10871101   int offs, priority = 0;
1088   int sprite_colbank = (pc090oj->sprite_ctrl & 0xf) << 4; /* top nibble */
1102   int sprite_colbank = (m_sprite_ctrl & 0xf) << 4; /* top nibble */
10891103
10901104   switch (pri_type)
10911105   {
r23697r23698
10981112         break;
10991113
11001114      case 0x02:
1101         priority = pc090oj->sprite_ctrl >> 15;  /* variable sprite/tile priority */
1115         priority = m_sprite_ctrl >> 15;  /* variable sprite/tile priority */
11021116   }
11031117
11041118   for (offs = 0; offs < PC090OJ_ACTIVE_RAM_SIZE / 2; offs += 4)
r23697r23698
11071121      int x, y;
11081122      int data, code, color;
11091123
1110      data = pc090oj->ram_buffered[offs];
1124      data = m_ram_buffered[offs];
11111125      flipy = (data & 0x8000) >> 15;
11121126      flipx = (data & 0x4000) >> 14;
11131127      color = (data & 0x000f) | sprite_colbank;
11141128
1115      code = pc090oj->ram_buffered[offs + 2] & 0x1fff;
1116      x = pc090oj->ram_buffered[offs + 3] & 0x1ff;   /* mask verified with Rainbowe board */
1117      y = pc090oj->ram_buffered[offs + 1] & 0x1ff;   /* mask verified with Rainbowe board */
1129      code = m_ram_buffered[offs + 2] & 0x1fff;
1130      x = m_ram_buffered[offs + 3] & 0x1ff;   /* mask verified with Rainbowe board */
1131      y = m_ram_buffered[offs + 1] & 0x1ff;   /* mask verified with Rainbowe board */
11181132
11191133      /* treat coords as signed */
11201134      if (x > 0x140) x -= 0x200;
11211135      if (y > 0x140) y -= 0x200;
11221136
1123      if (!(pc090oj->ctrl & 1))   /* sprites flipscreen */
1137      if (!(m_ctrl & 1))   /* sprites flipscreen */
11241138      {
11251139         x = 320 - x - 16;
11261140         y = 256 - y - 16;
r23697r23698
11281142         flipy = !flipy;
11291143      }
11301144
1131      x += pc090oj->xoffs;
1132      y += pc090oj->yoffs;
1145      x += m_x_offset;
1146      y += m_y_offset;
11331147
1134      pdrawgfx_transpen(bitmap,cliprect,device->machine().gfx[pc090oj->gfxnum],
1148      pdrawgfx_transpen(bitmap,cliprect,machine().gfx[m_gfxnum],
11351149            code,
11361150            color,
11371151            flipx,flipy,
11381152            x,y,
1139            device->machine().priority_bitmap,
1153            machine().priority_bitmap,
11401154            priority ? 0xfc : 0xf0,0);
11411155   }
11421156}
11431157
11441158
1145/*****************************************************************************
1146    DEVICE INTERFACE
1147*****************************************************************************/
11481159
1149static DEVICE_START( pc090oj )
1150{
1151   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
1152   const pc090oj_interface *intf = pc090oj_get_interface(device);
1153
1154   /* use the given gfx set */
1155   pc090oj->gfxnum = intf->gfxnum;
1156
1157   pc090oj->xoffs = intf->x_offset;
1158   pc090oj->yoffs = intf->y_offset;
1159
1160   pc090oj->buffer = intf->use_buffer;
1161
1162
1163   pc090oj->ram = auto_alloc_array_clear(device->machine(), UINT16, PC090OJ_RAM_SIZE / 2);
1164   pc090oj->ram_buffered = auto_alloc_array_clear(device->machine(), UINT16, PC090OJ_RAM_SIZE / 2);
1165
1166   device->save_pointer(NAME(pc090oj->ram), PC090OJ_RAM_SIZE / 2);
1167   device->save_pointer(NAME(pc090oj->ram_buffered), PC090OJ_RAM_SIZE / 2);
1168   device->save_item(NAME(pc090oj->ctrl));
1169   device->save_item(NAME(pc090oj->sprite_ctrl));  // should this be set in intf?!?
1170}
1171
1172static DEVICE_RESET( pc090oj )
1173{
1174   pc090oj_state *pc090oj = pc090oj_get_safe_token(device);
1175
1176   pc090oj->ctrl = 0;
1177}
1178
1179const device_type PC090OJ = &device_creator<pc090oj_device>;
1180
1181pc090oj_device::pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
1182   : device_t(mconfig, PC090OJ, "Taito PC090OJ", tag, owner, clock)
1183{
1184   m_token = global_alloc_clear(pc090oj_state);
1185}
1186
1187//-------------------------------------------------
1188//  device_config_complete - perform any
1189//  operations now that the configuration is
1190//  complete
1191//-------------------------------------------------
1192
1193void pc090oj_device::device_config_complete()
1194{
1195}
1196
1197//-------------------------------------------------
1198//  device_start - device-specific startup
1199//-------------------------------------------------
1200
1201void pc090oj_device::device_start()
1202{
1203   DEVICE_START_NAME( pc090oj )(this);
1204}
1205
1206//-------------------------------------------------
1207//  device_reset - device-specific reset
1208//-------------------------------------------------
1209
1210void pc090oj_device::device_reset()
1211{
1212   DEVICE_RESET_NAME( pc090oj )(this);
1213}
1214
1215
12161160/***************************************************************************/
12171161/*                                                                         */
12181162/*                            TC0080VCO                                    */
trunk/src/mame/video/taitoic.h
r23697r23698
2727
2828struct pc090oj_interface
2929{
30   int                gfxnum;
30   int                m_gfxnum;
3131
32   int                x_offset, y_offset;
33   int                use_buffer;
32   int                m_x_offset, m_y_offset;
33   int                m_use_buffer;
3434};
3535
3636
r23697r23698
152152
153153extern const device_type PC080SN;
154154
155class pc090oj_device : public device_t
155class pc090oj_device : public device_t,
156                              public pc090oj_interface
156157{
157158public:
158159   pc090oj_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
159   ~pc090oj_device() { global_free(m_token); }
160   ~pc090oj_device() {}
160161
161   // access to legacy token
162   void *token() const { assert(m_token != NULL); return m_token; }
162   DECLARE_READ16_MEMBER( word_r );
163   DECLARE_WRITE16_MEMBER( word_w );
164
165   void set_sprite_ctrl(UINT16 sprctrl);
166   void eof_callback();
167   void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type);
168   
163169protected:
164170   // device-level overrides
165171   virtual void device_config_complete();
166172   virtual void device_start();
167173   virtual void device_reset();
174
168175private:
169   // internal state
170   void *m_token;
176   /* NB: pc090oj_ctrl is the internal register controlling flipping
177
178   pc090oj_sprite_ctrl is a representation of the hardware OUTSIDE the pc090oj
179   which impacts on sprite plotting, and which varies between games. It
180   includes color banking and (optionally) priority. It allows each game to
181   control these aspects of the sprites in different ways, while keeping the
182   routines here modular.
183
184*/
185
186   UINT16     m_ctrl;
187   UINT16     m_sprite_ctrl;
188
189   UINT16 *   m_ram;
190   UINT16 *   m_ram_buffered;
171191};
172192
173193extern const device_type PC090OJ;
r23697r23698
408428    DEVICE I/O FUNCTIONS
409429***************************************************************************/
410430
411/**  PC090OJ  **/
412DECLARE_READ16_DEVICE_HANDLER( pc090oj_word_r );
413DECLARE_WRITE16_DEVICE_HANDLER( pc090oj_word_w );
414
415void pc090oj_set_sprite_ctrl(device_t *device, UINT16 sprctrl);
416void pc090oj_eof_callback(device_t *device);
417void pc090oj_draw_sprites(device_t *device, bitmap_ind16 &bitmap, const rectangle &cliprect, int pri_type);
418
419
420431/** TC0080VCO **/
421432DECLARE_READ16_DEVICE_HANDLER( tc0080vco_word_r );
422433DECLARE_WRITE16_DEVICE_HANDLER( tc0080vco_word_w );

Previous 199869 Revisions Next


© 1997-2024 The MAME Team