Previous 199869 Revisions Next

r29575 Saturday 12th April, 2014 at 20:18:48 UTC by Fabio Priuli
k033906: converted to use inline configs. nw.

k056230: converted to use inline configs. nw.
[src/emu/machine]k033906.c k033906.h k056230.c k056230.h
[src/mame/drivers]gticlub.c hornet.c nwk-tr.c zr107.c
[src/mame/machine]konppc.c

trunk/src/emu/machine/k056230.c
r29574r29575
2020//-------------------------------------------------
2121
2222k056230_device::k056230_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
23   : device_t(mconfig, K056230, "Konami 056230", tag, owner, clock, "k056230", __FILE__)
23   : device_t(mconfig, K056230, "Konami 056230", tag, owner, clock, "k056230", __FILE__),
24      m_is_thunderh(0),
25      m_cpu(*this)
2426{
2527}
2628
2729
2830//-------------------------------------------------
29//  device_config_complete - perform any
30//  operations now that the configuration is
31//  complete
32//-------------------------------------------------
33
34void k056230_device::device_config_complete()
35{
36   // inherit a copy of the static data
37   const k056230_interface *intf = reinterpret_cast<const k056230_interface *>(static_config());
38   if (intf != NULL)
39   {
40      *static_cast<k056230_interface *>(this) = *intf;
41   }
42
43   // or initialize to defaults if none provided
44   else
45   {
46      m_cpu_tag = NULL;
47      m_is_thunderh = false;
48   }
49}
50
51
52//-------------------------------------------------
5331//  device_start - device-specific startup
5432//-------------------------------------------------
5533
5634void k056230_device::device_start()
5735{
58   if(m_cpu_tag)
59   {
60      m_cpu = machine().device(m_cpu_tag);
61   }
62   else
63   {
64      m_cpu = NULL;
65   }
66
6736   save_item(NAME(m_ram));
6837}
6938
7039
71READ8_MEMBER(k056230_device::k056230_r)
40READ8_MEMBER(k056230_device::read)
7241{
7342   switch (offset)
7443   {
r29574r29575
9059
9160void k056230_device::network_irq_clear()
9261{
93   if(m_cpu)
94   {
95      m_cpu->execute().set_input_line(INPUT_LINE_IRQ2, CLEAR_LINE);
96   }
62   if (m_cpu)
63      m_cpu->set_input_line(INPUT_LINE_IRQ2, CLEAR_LINE);
9764}
9865
9966
100WRITE8_MEMBER(k056230_device::k056230_w)
67WRITE8_MEMBER(k056230_device::write)
10168{
10269   switch(offset)
10370   {
r29574r29575
11077         if(data & 0x20)
11178         {
11279            // Thunder Hurricane breaks otherwise...
113            if(!m_is_thunderh)
80            if (!m_is_thunderh)
11481            {
115               if(m_cpu)
116               {
117                  m_cpu->execute().set_input_line(INPUT_LINE_IRQ2, ASSERT_LINE);
118               }
82               if (m_cpu)
83                  m_cpu->set_input_line(INPUT_LINE_IRQ2, ASSERT_LINE);
84
11985               machine().scheduler().timer_set(attotime::from_usec(10), FUNC(network_irq_clear_callback), 0, (void*)this);
12086            }
12187         }
12288//          else
123//              k056230->cpu->execute().set_input_line(INPUT_LINE_IRQ2, CLEAR_LINE);
89//              m_cpu->set_input_line(INPUT_LINE_IRQ2, CLEAR_LINE);
12490         break;
12591      }
12692      case 2:     // Sub ID register
trunk/src/emu/machine/k056230.h
r29574r29575
1717    DEVICE CONFIGURATION MACROS
1818***************************************************************************/
1919
20#define MCFG_K056230_ADD(_tag, _config) \
21   MCFG_DEVICE_ADD(_tag, K056230, 0) \
22   MCFG_DEVICE_CONFIG(_config)
20#define MCFG_K056230_CPU(_tag) \
21   k056230_device::set_cpu_tag(*device, "^"_tag);
2322
23#define MCFG_K056230_HACK(_region) \
24   k056230_device::set_thunderh_hack(*device, _region);
2425
26
2527/***************************************************************************
2628    TYPE DEFINITIONS
2729***************************************************************************/
2830
29
30// ======================> k056230_interface
31
32struct k056230_interface
33{
34   const char         *m_cpu_tag;
35   bool                m_is_thunderh;
36};
37
38
39
4031// ======================> k056230_device
4132
42class k056230_device :  public device_t,
43                  public k056230_interface
33class k056230_device :  public device_t
4434{
4535public:
4636   // construction/destruction
4737   k056230_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4838
39   static void set_cpu_tag(device_t &device, const char *tag) { downcast<k056230_device &>(device).m_cpu.set_tag(tag); }
40   static void set_thunderh_hack(device_t &device, int thunderh) { downcast<k056230_device &>(device).m_is_thunderh = thunderh; }
41
4942   DECLARE_READ32_MEMBER(lanc_ram_r);
5043   DECLARE_WRITE32_MEMBER(lanc_ram_w);
5144
52   DECLARE_READ8_MEMBER(k056230_r);
53   DECLARE_WRITE8_MEMBER(k056230_w);
45   DECLARE_READ8_MEMBER(read);
46   DECLARE_WRITE8_MEMBER(write);
5447
5548   static TIMER_CALLBACK( network_irq_clear_callback );
5649
5750protected:
5851   // device-level overrides
59   virtual void device_config_complete();
6052   virtual void device_start();
6153   virtual void device_reset() { }
6254   virtual void device_post_load() { }
r29574r29575
6557private:
6658
6759   void network_irq_clear();
60   int m_is_thunderh;
6861
69   device_t *m_cpu;
62   required_device<cpu_device> m_cpu;
7063   UINT32 m_ram[0x2000];
7164};
7265
trunk/src/emu/machine/k033906.c
r29574r29575
2626}
2727
2828//-------------------------------------------------
29//  device_config_complete - perform any
30//  operations now that the configuration is
31//  complete
32//-------------------------------------------------
33
34void k033906_device::device_config_complete()
35{
36   // inherit a copy of the static data
37   const k033906_interface *intf = reinterpret_cast<const k033906_interface *>(static_config());
38   if (intf != NULL)
39   {
40      *static_cast<k033906_interface *>(this) = *intf;
41   }
42
43   // or initialize to defaults if none provided
44   else
45   {
46      m_voodoo_tag = NULL;
47   }
48}
49
50
51//-------------------------------------------------
5229//  device_start - device-specific startup
5330//-------------------------------------------------
5431
r29574r29575
6441}
6542
6643
67WRITE_LINE_MEMBER(k033906_device::k033906_set_reg)
44WRITE_LINE_MEMBER(k033906_device::set_reg)
6845{
6946   m_reg_set = state & 1;
7047}
7148
72UINT32 k033906_device::k033906_reg_r(int reg)
49UINT32 k033906_device::reg_r(int reg)
7350{
7451   switch (reg)
7552   {
r29574r29575
8461   return 0;
8562}
8663
87void k033906_device::k033906_reg_w(int reg, UINT32 data)
64void k033906_device::reg_w(int reg, UINT32 data)
8865{
8966   switch (reg)
9067   {
r29574r29575
131108   }
132109}
133110
134READ32_MEMBER(k033906_device::k033906_r)
111READ32_MEMBER(k033906_device::read)
135112{
136   if(m_reg_set)
137   {
138      return k033906_reg_r(offset);
139   }
113   if (m_reg_set)
114      return reg_r(offset);
140115   else
141   {
142116      return m_ram[offset];
143   }
144117}
145118
146WRITE32_MEMBER(k033906_device::k033906_w)
119WRITE32_MEMBER(k033906_device::write)
147120{
148   if(m_reg_set)
149   {
150      k033906_reg_w(offset, data);
151   }
121   if (m_reg_set)
122      reg_w(offset, data);
152123   else
153   {
154124      m_ram[offset] = data;
155   }
156125}
trunk/src/emu/machine/k033906.h
r29574r29575
1717    DEVICE CONFIGURATION MACROS
1818***************************************************************************/
1919
20#define MCFG_K033906_ADD(_tag, _config) \
21   MCFG_DEVICE_ADD(_tag, K033906, 0) \
22   MCFG_DEVICE_CONFIG(_config)
20#define MCFG_K033906_VOODOO(_tag) \
21   k033906_device::set_voodoo_tag(*device, _tag);
2322
24
2523/***************************************************************************
2624    TYPE DEFINITIONS
2725***************************************************************************/
2826
2927
30// ======================> k033906_interface
31
32struct k033906_interface
33{
34   const char         *m_voodoo_tag;
35};
36
37
38
3928// ======================> k033906_device
4029
41class k033906_device :  public device_t,
42                  public k033906_interface
30class k033906_device :  public device_t
4331{
4432public:
4533   // construction/destruction
4634   k033906_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4735
48   DECLARE_READ32_MEMBER( k033906_r );
49   DECLARE_WRITE32_MEMBER( k033906_w );
50   DECLARE_WRITE_LINE_MEMBER( k033906_set_reg );
36   static void set_voodoo_tag(device_t &device, const char *tag) { downcast<k033906_device &>(device).m_voodoo_tag = tag; }
5137
38   DECLARE_READ32_MEMBER( read );
39   DECLARE_WRITE32_MEMBER( write );
40   DECLARE_WRITE_LINE_MEMBER( set_reg );
41
5242protected:
5343   // device-level overrides
54   virtual void device_config_complete();
5544   virtual void device_start();
5645   virtual void device_reset() { }
5746   virtual void device_post_load() { }
r29574r29575
5948
6049private:
6150
62   UINT32 k033906_reg_r(int reg);
63   void k033906_reg_w(int reg, UINT32 data);
51   UINT32 reg_r(int reg);
52   void reg_w(int reg, UINT32 data);
6453
6554   /* i/o lines */
6655
6756   int          m_reg_set; // 1 = access reg / 0 = access ram
6857
69   device_t *m_voodoo;
58   const char   *m_voodoo_tag;
59   device_t     *m_voodoo;
7060
7161   UINT32       m_reg[256];
7262   UINT32       m_ram[32768];
trunk/src/mame/drivers/nwk-tr.c
r29574r29575
709709};
710710
711711
712static const k033906_interface nwktr_k033906_interface =
713{
714   "voodoo"
715};
716
717712void nwktr_state::machine_reset()
718713{
719714   m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
r29574r29575
747742
748743   MCFG_M48T58_ADD( "m48t58" )
749744   MCFG_ADC12138_ADD( "adc12138", nwktr_adc_interface )
750   MCFG_K033906_ADD("k033906_1", nwktr_k033906_interface)
751745
746   MCFG_DEVICE_ADD("k033906_1", K033906, 0)
747   MCFG_K033906_VOODOO("voodoo")
748
752749   /* video hardware */
753750   MCFG_3DFX_VOODOO_1_ADD("voodoo", STD_VOODOO_1_CLOCK, voodoo_intf)
754751
trunk/src/mame/drivers/hornet.c
r29574r29575
948948   adc12138_input_callback
949949};
950950
951static const k033906_interface hornet_k033906_intf_0 =
952{
953   "voodoo0"
954};
955
956static const k033906_interface hornet_k033906_intf_1 =
957{
958   "voodoo1"
959};
960
961951static const voodoo_config hornet_voodoo_intf =
962952{
963953   2, //               fbmem;
r29574r29575
990980
991981   MCFG_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, hornet_voodoo_intf)
992982
993   MCFG_K033906_ADD("k033906_1", hornet_k033906_intf_0)
983   MCFG_DEVICE_ADD("k033906_1", K033906, 0)
984   MCFG_K033906_VOODOO("voodoo0")
994985
995986   /* video hardware */
996987   MCFG_SCREEN_ADD("screen", RASTER)
r29574r29575
10861077   MCFG_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, voodoo_l_intf)
10871078   MCFG_3DFX_VOODOO_1_ADD("voodoo1", STD_VOODOO_1_CLOCK, voodoo_r_intf)
10881079
1089   MCFG_K033906_ADD("k033906_2", hornet_k033906_intf_1)
1080   MCFG_DEVICE_ADD("k033906_2", K033906, 0)
1081   MCFG_K033906_VOODOO("voodoo1")
10901082
10911083   /* video hardware */
10921084   MCFG_PALETTE_MODIFY("palette")
trunk/src/mame/drivers/zr107.c
r29574r29575
449449   AM_RANGE(0x78040000, 0x7804000f) AM_READWRITE_LEGACY(K001006_0_r, K001006_0_w)
450450   AM_RANGE(0x780c0000, 0x780c0007) AM_READWRITE_LEGACY(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
451451   AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
452   AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, k056230_r, k056230_w, 0xffffffff)               /* LANC registers */
452   AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, read, write, 0xffffffff)               /* LANC registers */
453453   AM_RANGE(0x7e00a000, 0x7e00bfff) AM_DEVREADWRITE("k056230", k056230_device, lanc_ram_r, lanc_ram_w)      /* LANC Buffer RAM (27E) */
454454   AM_RANGE(0x7e00c000, 0x7e00c00f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
455455   AM_RANGE(0x7f800000, 0x7f9fffff) AM_ROM AM_SHARE("share2")
r29574r29575
476476   AM_RANGE(0x78080000, 0x7808000f) AM_MIRROR(0x80000000) AM_READWRITE_LEGACY(K001006_1_r, K001006_1_w)
477477   AM_RANGE(0x780c0000, 0x780c0007) AM_MIRROR(0x80000000) AM_READWRITE_LEGACY(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
478478   AM_RANGE(0x7e000000, 0x7e003fff) AM_MIRROR(0x80000000) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
479   AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056230", k056230_device, k056230_r, k056230_w, 0xffffffff)             /* LANC registers */
479   AM_RANGE(0x7e008000, 0x7e009fff) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056230", k056230_device, read, write, 0xffffffff)             /* LANC registers */
480480   AM_RANGE(0x7e00a000, 0x7e00bfff) AM_MIRROR(0x80000000) AM_DEVREADWRITE("k056230", k056230_device, lanc_ram_r, lanc_ram_w)    /* LANC Buffer RAM (27E) */
481481   AM_RANGE(0x7e00c000, 0x7e00c00f) AM_MIRROR(0x80000000) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
482482   AM_RANGE(0x7f000000, 0x7f3fffff) AM_MIRROR(0x80000000) AM_ROM AM_REGION("user2", 0)
r29574r29575
721721   game_tile_callback, "none"
722722};
723723
724static const k056230_interface zr107_k056230_intf =
725{
726   "maincpu",
727   0
728};
729
730724/* PowerPC interrupts
731725
732726    IRQ0:  Vblank
r29574r29575
762756
763757   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
764758
765   MCFG_K056230_ADD("k056230", zr107_k056230_intf)
759   MCFG_DEVICE_ADD("k056230", K056230, 0)
760   MCFG_K056230_CPU("maincpu")
766761
767762   /* video hardware */
768763   MCFG_SCREEN_ADD("screen", RASTER)
r29574r29575
818813
819814   MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
820815
821   MCFG_K056230_ADD("k056230", zr107_k056230_intf)
816   MCFG_DEVICE_ADD("k056230", K056230, 0)
817   MCFG_K056230_CPU("maincpu")
822818
823819   /* video hardware */
824820   MCFG_SCREEN_ADD("screen", RASTER)
trunk/src/mame/drivers/gticlub.c
r29574r29575
480480   AM_RANGE(0x78080000, 0x7808000f) AM_READWRITE_LEGACY(K001006_1_r, K001006_1_w)
481481   AM_RANGE(0x780c0000, 0x780c0003) AM_READWRITE_LEGACY(cgboard_dsp_comm_r_ppc, cgboard_dsp_comm_w_ppc)
482482   AM_RANGE(0x7e000000, 0x7e003fff) AM_READWRITE8(sysreg_r, sysreg_w, 0xffffffff)
483   AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, k056230_r, k056230_w, 0xffffffff)
483   AM_RANGE(0x7e008000, 0x7e009fff) AM_DEVREADWRITE8("k056230", k056230_device, read, write, 0xffffffff)
484484   AM_RANGE(0x7e00a000, 0x7e00bfff) AM_DEVREADWRITE("k056230", k056230_device, lanc_ram_r, lanc_ram_w)
485485   AM_RANGE(0x7e00c000, 0x7e00c00f) AM_DEVREADWRITE8("k056800", k056800_device, host_r, host_w, 0xffffffff)
486486   AM_RANGE(0x7f000000, 0x7f3fffff) AM_ROM AM_REGION("user2", 0)   /* Data ROM */
r29574r29575
780780   adc1038_input_callback
781781};
782782
783static const k056230_interface gticlub_k056230_intf =
784{
785   "maincpu",
786   0
787};
788783
789static const k056230_interface thunderh_k056230_intf =
790{
791   "maincpu",
792   1
793};
794
795
796784MACHINE_RESET_MEMBER(gticlub_state,gticlub)
797785{
798786   m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
r29574r29575
940928
941929   MCFG_ADC1038_ADD("adc1038", gticlub_adc1038_intf)
942930
943   MCFG_K056230_ADD("k056230", gticlub_k056230_intf)
931   MCFG_DEVICE_ADD("k056230", K056230, 0)
932   MCFG_K056230_CPU("maincpu")
944933
945934   /* video hardware */
946935   MCFG_SCREEN_ADD("screen", RASTER)
r29574r29575
980969   MCFG_ADC1038_ADD("adc1038", thunderh_adc1038_intf)
981970
982971   MCFG_DEVICE_REMOVE("k056230")
983   MCFG_K056230_ADD("k056230", thunderh_k056230_intf)
972   MCFG_DEVICE_ADD("k056230", K056230, 0)
973   MCFG_K056230_CPU("maincpu")
974   MCFG_K056230_HACK(1)
984975MACHINE_CONFIG_END
985976
986977static MACHINE_CONFIG_DERIVED( slrasslt, gticlub )
r29574r29575
1001992MACHINE_CONFIG_END
1002993
1003994
1004static const k033906_interface hangplt_k033906_intf_0 =
1005{
1006   "voodoo0"
1007};
1008
1009static const k033906_interface hangplt_k033906_intf_1 =
1010{
1011   "voodoo1"
1012};
1013
1014995MACHINE_RESET_MEMBER(gticlub_state,hangplt)
1015996{
1016997   m_dsp->set_input_line(INPUT_LINE_RESET, ASSERT_LINE);
r29574r29575
10641045   MCFG_MACHINE_RESET_OVERRIDE(gticlub_state,hangplt)
10651046
10661047   MCFG_ADC1038_ADD("adc1038", thunderh_adc1038_intf)
1067   MCFG_K056230_ADD("k056230", gticlub_k056230_intf)
10681048
1049   MCFG_DEVICE_ADD("k056230", K056230, 0)
1050   MCFG_K056230_CPU("maincpu")
1051
10691052   MCFG_3DFX_VOODOO_1_ADD("voodoo0", STD_VOODOO_1_CLOCK, voodoo_l_intf)
10701053   MCFG_3DFX_VOODOO_1_ADD("voodoo1", STD_VOODOO_1_CLOCK, voodoo_r_intf)
10711054
1072   MCFG_K033906_ADD("k033906_1", hangplt_k033906_intf_0)
1073   MCFG_K033906_ADD("k033906_2", hangplt_k033906_intf_1)
1055   MCFG_DEVICE_ADD("k033906_1", K033906, 0)
1056   MCFG_K033906_VOODOO("voodoo0")
10741057
1058   MCFG_DEVICE_ADD("k033906_2", K033906, 0)
1059   MCFG_K033906_VOODOO("voodoo1")
1060
10751061   /* video hardware */
10761062   MCFG_PALETTE_ADD("palette", 65536)
10771063
trunk/src/mame/machine/konppc.c
r29574r29575
158158               dsp_state[cgboard_id] |= 0x10;
159159
160160            if (k033906 != NULL)    /* zr107.c has no PCI and some games only have one PCI Bridge */
161               k033906->k033906_set_reg((data & 0x20000000) ? 1 : 0);
161               k033906->set_reg((data & 0x20000000) ? 1 : 0);
162162
163163            if (data & 0x10000000)
164164               dsp->execute().set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
r29574r29575
413413   if (nwk_device_sel[0] & 0x01)
414414      return nwk_fifo_r(space, 0);
415415   else
416      return k033906_1->k033906_r(space, offset, mem_mask);
416      return k033906_1->read(space, offset, mem_mask);
417417}
418418
419419WRITE32_HANDLER( K033906_0_w )
420420{
421421   k033906_device *k033906_1 = space.machine().device<k033906_device>("k033906_1");
422   k033906_1->k033906_w(space, offset, data, mem_mask);
422   k033906_1->write(space, offset, data, mem_mask);
423423}
424424
425425READ32_HANDLER( K033906_1_r )
r29574r29575
428428   if (nwk_device_sel[1] & 0x01)
429429      return nwk_fifo_r(space, 1);
430430   else
431      return k033906_2->k033906_r(space, offset, mem_mask);
431      return k033906_2->read(space, offset, mem_mask);
432432}
433433
434434WRITE32_HANDLER(K033906_1_w)
435435{
436436   k033906_device *k033906_2 = space.machine().device<k033906_device>("k033906_2");
437   k033906_2->k033906_w(space, offset, data, mem_mask);
437   k033906_2->write(space, offset, data, mem_mask);
438438}
439439
440440/*****************************************************************************/

Previous 199869 Revisions Next


© 1997-2024 The MAME Team