Previous 199869 Revisions Next

r29459 Tuesday 8th April, 2014 at 16:10:59 UTC by Fabio Priuli
tc0150rod: updated to use inline configs. nw.
[src/mame/drivers]taito_z.c
[src/mame/video]tc0150rod.c tc0150rod.h

trunk/src/mame/video/tc0150rod.c
r29458r29459
1111
1212#define TC0150ROD_RAM_SIZE 0x2000
1313
14
15
1614const device_type TC0150ROD = &device_creator<tc0150rod_device>;
1715
1816tc0150rod_device::tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
r29458r29459
2220}
2321
2422//-------------------------------------------------
25//  device_config_complete - perform any
26//  operations now that the configuration is
27//  complete
28//-------------------------------------------------
29
30void tc0150rod_device::device_config_complete()
31{
32   // inherit a copy of the static data
33   const tc0150rod_interface *intf = reinterpret_cast<const tc0150rod_interface *>(static_config());
34   if (intf != NULL)
35   *static_cast<tc0150rod_interface *>(this) = *intf;
36
37   // or initialize to defaults if none provided
38   else
39   {
40   }
41}
42
43//-------------------------------------------------
4423//  device_start - device-specific startup
4524//-------------------------------------------------
4625
4726void tc0150rod_device::device_start()
4827{
4928   m_ram = auto_alloc_array_clear(machine(), UINT16, TC0150ROD_RAM_SIZE / 2);
50
5129   save_pointer(NAME(m_ram), TC0150ROD_RAM_SIZE / 2);
30
31   m_roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base();
32   assert(m_roadgfx);
5233}
5334
5435
r29458r29459
240221   UINT16 roada_line[512], roadb_line[512];
241222   UINT16 *dst16;
242223   UINT16 *roada, *roadb;
243   UINT16 *roadgfx = (UINT16 *)machine().root_device().memregion(m_gfx_region)->base();
244224
245225   UINT16 pixel, color, gfx_word;
246226   UINT16 roada_clipl, roada_clipr, roada_bodyctrl;
r29458r29459
434414         {
435415            if (road_gfx_tilenum)   /* fixes Nightstr round C */
436416            {
437               gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
417               gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
438418               pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
439419
440420               if ((pixel) || !(road_trans))
r29458r29459
485465            {
486466               for (i = left_edge; i >= 0; i--)
487467               {
488                  gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
468                  gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
489469                  pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
490470
491471                  pixpri = (pixel == 0) ? (0) : (pri);    /* off edge has low priority */
r29458r29459
528508         {
529509            for (i = right_edge; i < screen_width; i++)
530510            {
531               gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
511               gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
532512               pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
533513
534514               pixpri = (pixel == 0) ? (0) : (pri);    /* off edge has low priority */
r29458r29459
642622         {
643623            for (i = begin; i < end; i++)
644624            {
645               gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
625               gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
646626               pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
647627
648628               if ((pixel) || !(road_trans))
r29458r29459
692672            {
693673               for (i = left_edge; i >= 0; i--)
694674               {
695                  gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
675                  gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
696676                  pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
697677
698678                  pixpri = (pixel == 0) ? (0) : (pri);    /* off edge has low priority */
r29458r29459
735715         {
736716            for (i = right_edge; i < screen_width; i++)
737717            {
738               gfx_word = roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
718               gfx_word = m_roadgfx[(road_gfx_tilenum << 8) + (x_index >> 3)];
739719               pixel = ((gfx_word >> (7 - (x_index % 8) + 8)) & 0x1) * 2 + ((gfx_word >> (7 - (x_index % 8))) & 0x1);
740720
741721               pixpri = (pixel == 0) ? (0) : (pri);    /* off edge has low priority */
trunk/src/mame/video/tc0150rod.h
r29458r29459
11#ifndef __TC0150ROD_H__
22#define __TC0150ROD_H__
33
4struct tc0150rod_interface
4class tc0150rod_device : public device_t
55{
6   const char      *m_gfx_region;    /* gfx region for the road */
7};
8
9class tc0150rod_device : public device_t,
10                                 public tc0150rod_interface
11{
126public:
137   tc0150rod_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
148   ~tc0150rod_device() {}
159
10   static void set_gfx_tag(device_t &device, const char *tag) { downcast<tc0150rod_device &>(device).m_gfx_region = tag; }
11
1612   DECLARE_READ16_MEMBER( word_r );
1713   DECLARE_WRITE16_MEMBER( word_w );
1814   void draw(bitmap_ind16 &bitmap, const rectangle &cliprect, int y_offs, int palette_offs, int type, int road_trans, bitmap_ind8 &priority_bitmap, UINT32 low_priority, UINT32 high_priority);
1915
2016protected:
2117   // device-level overrides
22   virtual void device_config_complete();
2318   virtual void device_start();
2419
2520private:
2621   // internal state
2722   UINT16 *        m_ram;
23   const char      *m_gfx_region;    /* gfx region for the road */
24   UINT16 *        m_roadgfx;
2825};
2926
3027extern const device_type TC0150ROD;
3128
32#define MCFG_TC0150ROD_ADD(_tag, _interface) \
33   MCFG_DEVICE_ADD(_tag, TC0150ROD, 0) \
34   MCFG_DEVICE_CONFIG(_interface)
3529
30#define MCFG_TC0150ROD_GFXTAG(_tag) \
31   tc0150rod_device::set_gfx_tag(*device, _tag);
32
3633#endif
trunk/src/mame/drivers/taito_z.c
r29458r29459
29942994};
29952995
29962996
2997static const tc0150rod_interface taitoz_tc0150rod_intf = { "gfx3" };
2998
29992997/***********************************************************
30002998                   SAVE STATES
30012999***********************************************************/
r29458r29459
30813079   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
30823080   MCFG_TC0100SCN_PALETTE("palette")
30833081
3084   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3082   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3083   MCFG_TC0150ROD_GFXTAG("gfx3")
3084
30853085   MCFG_TC0110PCR_ADD("tc0110pcr")
30863086   MCFG_TC0110PCR_PALETTE("palette")
30873087
r29458r29459
31563156   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
31573157   MCFG_TC0100SCN_PALETTE("palette")
31583158
3159   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3159   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3160   MCFG_TC0150ROD_GFXTAG("gfx3")
3161
31603162   MCFG_TC0110PCR_ADD("tc0110pcr")
31613163   MCFG_TC0110PCR_PALETTE("palette")
31623164
r29458r29459
32333235   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
32343236   MCFG_TC0100SCN_PALETTE("palette")
32353237
3236   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3238   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3239   MCFG_TC0150ROD_GFXTAG("gfx3")
3240
32373241   MCFG_TC0110PCR_ADD("tc0110pcr")
32383242   MCFG_TC0110PCR_PALETTE("palette")
32393243
r29458r29459
33063310   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
33073311   MCFG_TC0100SCN_PALETTE("palette")
33083312
3309   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3313   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3314   MCFG_TC0150ROD_GFXTAG("gfx3")
33103315
33113316   /* sound hardware */
33123317   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
r29458r29459
33853390   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
33863391   MCFG_TC0100SCN_PALETTE("palette")
33873392
3388   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3393   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3394   MCFG_TC0150ROD_GFXTAG("gfx3")
33893395
33903396   /* sound hardware */
33913397   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
r29458r29459
34593465   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
34603466   MCFG_TC0100SCN_PALETTE("palette")
34613467
3462   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3468   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3469   MCFG_TC0150ROD_GFXTAG("gfx3")
3470
34633471   MCFG_TC0110PCR_ADD("tc0110pcr")
34643472   MCFG_TC0110PCR_PALETTE("palette")
34653473
r29458r29459
35363544   MCFG_TC0100SCN_GFXDECODE("gfxdecode")
35373545   MCFG_TC0100SCN_PALETTE("palette")
35383546
3539   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3547   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3548   MCFG_TC0150ROD_GFXTAG("gfx3")
3549
35403550   MCFG_TC0110PCR_ADD("tc0110pcr")
35413551   MCFG_TC0110PCR_PALETTE("palette")
35423552
r29458r29459
36793689   MCFG_TC0480SCP_GFXDECODE("gfxdecode")
36803690   MCFG_TC0480SCP_PALETTE("palette")
36813691
3682   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3692   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3693   MCFG_TC0150ROD_GFXTAG("gfx3")
36833694
36843695   /* sound hardware */
36853696   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
r29458r29459
37523763   MCFG_TC0480SCP_GFXDECODE("gfxdecode")
37533764   MCFG_TC0480SCP_PALETTE("palette")
37543765
3755   MCFG_TC0150ROD_ADD("tc0150rod", taitoz_tc0150rod_intf)
3766   MCFG_DEVICE_ADD("tc0150rod", TC0150ROD, 0)
3767   MCFG_TC0150ROD_GFXTAG("gfx3")
37563768
37573769   /* sound hardware */
37583770   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")

Previous 199869 Revisions Next


© 1997-2024 The MAME Team