Previous 15994 Revisions Next

r15814 Wednesday 8th August, 2012 at 14:47:06 UTC by Curt Coder
[COMX35] Cleaned up expansion slot interface. (nw)
[src/mess/machine]comx_clm.c comx_clm.h comx_eb.c comx_eb.h comx_epr.c comx_epr.h comx_fd.c comx_fd.h comx_joy.c comx_joy.h comx_prn.c comx_prn.h comx_ram.c comx_ram.h comx_thm.c comx_thm.h comxexp.c comxexp.h

src/mess/machine/comx_fd.c
r15813r15814
193193
194194void comx_fd_device::device_start()
195195{
196   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
197
198196   m_rom = memregion("c000")->base();
199197
200198   // state saving
src/mess/machine/comx_fd.h
r15813r15814
5757   virtual void comx_io_w(offs_t offset, UINT8 data);
5858
5959private:
60   comx_expansion_slot_device *m_slot;
61
6260   inline void update_ef4();
6361
6462   // internal state
src/mess/machine/comx_thm.c
r15813r15814
6565
6666void comx_thm_device::device_start()
6767{
68   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
69
7068   m_rom = memregion("c000")->base();
7169}
7270
src/mess/machine/comx_thm.h
r15813r15814
4646   virtual void comx_io_w(offs_t offset, UINT8 data);
4747
4848private:
49   comx_expansion_slot_device *m_slot;
50
51   // internal state
5249   UINT8 *m_rom;            // program ROM
5350};
5451
src/mess/machine/comx_ram.c
r15813r15814
4747
4848void comx_ram_device::device_start()
4949{
50   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
51
5250   m_ram = auto_alloc_array(machine(), UINT8, RAM_SIZE);
5351
5452   // state saving
src/mess/machine/comx_ram.h
r15813r15814
4343   virtual void comx_io_w(offs_t offset, UINT8 data);
4444
4545private:
46   // internal state
47   comx_expansion_slot_device *m_slot;
48
4946   UINT8 *m_ram;
5047   int m_ram_bank;
5148};
src/mess/machine/comxexp.c
r15813r15814
3030device_comx_expansion_card_interface::device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device)
3131   : device_slot_card_interface(mconfig,device)
3232{
33   m_slot = dynamic_cast<comx_expansion_slot_device *>(device.owner());
3334}
3435
3536
src/mess/machine/comx_joy.c
r15813r15814
8080
8181void comx_joy_device::device_start()
8282{
83   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
8483}
8584
8685
src/mess/machine/comxexp.h
r15813r15814
7979};
8080
8181
82// ======================> device_comx_expansion_card_interface
82// ======================> comx_expansion_slot_device
8383
84// class representing interface-specific live comx_expansion card
85class device_comx_expansion_card_interface : public device_slot_card_interface
86{
87public:
88   // construction/destruction
89   device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device);
90   virtual ~device_comx_expansion_card_interface();
84class device_comx_expansion_card_interface;
9185
92   // signals
93   virtual void comx_ds_w(int state) { };
94   virtual void comx_q_w(int state) { };
95
96   // memory access
97   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom) { return 0; };
98   virtual void comx_mwr_w(offs_t offset, UINT8 data) { };
99
100   // I/O access
101   virtual UINT8 comx_io_r(offs_t offset) { return 0; };
102   virtual void comx_io_w(offs_t offset, UINT8 data) { };
103
104   // video
105   virtual UINT32 comx_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
106};
107
108
109// ======================> comx_expansion_slot_device
110
11186class comx_expansion_slot_device : public device_t,
11287                           public comx_expansion_slot_interface,
11388                           public device_slot_interface
r15813r15814
148123};
149124
150125
126// ======================> device_comx_expansion_card_interface
127
128// class representing interface-specific live comx_expansion card
129class device_comx_expansion_card_interface : public device_slot_card_interface
130{
131   friend class comx_expansion_slot_device;
132
133public:
134   // construction/destruction
135   device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device);
136   virtual ~device_comx_expansion_card_interface();
137
138protected:
139   // signals
140   virtual void comx_ds_w(int state) { };
141   virtual void comx_q_w(int state) { };
142
143   // memory access
144   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom) { return 0; };
145   virtual void comx_mwr_w(offs_t offset, UINT8 data) { };
146
147   // I/O access
148   virtual UINT8 comx_io_r(offs_t offset) { return 0; };
149   virtual void comx_io_w(offs_t offset, UINT8 data) { };
150
151   // video
152   virtual UINT32 comx_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { return false; }
153
154   comx_expansion_slot_device *m_slot;
155};
156
157
151158// device type definition
152159extern const device_type COMX_EXPANSION_SLOT;
153160
src/mess/machine/comx_joy.h
r15813r15814
4242
4343   // device_comx_expansion_card_interface overrides
4444   virtual UINT8 comx_io_r(offs_t offset);
45
46private:
47   // internal state
48   comx_expansion_slot_device *m_slot;
4945};
5046
5147
src/mess/machine/comx_epr.c
r15813r15814
7171
7272void comx_epr_device::device_start()
7373{
74   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
75
7674   m_rom = memregion("f800")->base();
7775   m_eprom = memregion("eprom")->base();
7876
src/mess/machine/comx_epr.h
r15813r15814
4545   virtual void comx_io_w(offs_t offset, UINT8 data);
4646
4747private:
48   // internal state
49   comx_expansion_slot_device *m_slot;
50
5148   UINT8 m_select;
5249   UINT8 *m_rom;            // program ROM
5350   UINT8 *m_eprom;            // EPROMs
src/mess/machine/comx_clm.c
r15813r15814
216216
217217void comx_clm_device::device_start()
218218{
219   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
220
221219   m_rom = memregion("c000")->base();
222220   m_char_rom = memregion(MC6845_TAG)->base();
223221   m_video_ram = auto_alloc_array(machine(), UINT8, VIDEORAM_SIZE);
src/mess/machine/comx_clm.h
r15813r15814
5252   virtual void comx_mwr_w(offs_t offset, UINT8 data);
5353
5454private:
55   // internal state
56   comx_expansion_slot_device *m_slot;
57
5855   required_device<mc6845_device> m_crtc;
5956
6057   int m_ds;            // device select
src/mess/machine/comx_prn.c
r15813r15814
7171
7272void comx_prn_device::device_start()
7373{
74   m_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
75
7674   m_rom = memregion("c000")->base();
7775}
7876
src/mess/machine/comx_prn.h
r15813r15814
4646   virtual void comx_io_w(offs_t offset, UINT8 data);
4747
4848private:
49   // internal state
50   comx_expansion_slot_device *m_slot;
51
5249   UINT8 *m_rom;            // program ROM
5350};
5451
src/mess/machine/comx_eb.c
r15813r15814
7575
7676ROM_START( comx_eb )
7777   ROM_REGION( 0x1000, "e000", 0 )
78   ROM_LOAD( "expansion.e5",        0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9) )
79
80   ROM_REGION( 0x1000, "fm31", 0 )
81   ROM_LOAD( "f&m.expansion.3.1.e5", 0x0000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045) )
82
83   ROM_REGION( 0x1000, "fm32", 0 )
84   ROM_LOAD( "f&m.expansion.3.2.e5", 0x0000, 0x1000, CRC(0f0fc960) SHA1(eb6b6e7bc9e761d13554482025d8cb5e260c0619) )
78   ROM_SYSTEM_BIOS( 0, "comx", "Original" )
79   ROMX_LOAD( "expansion.e5",         0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9), ROM_BIOS(1) )
80   ROM_SYSTEM_BIOS( 1, "fm31", "F&M 3.1" )
81   ROMX_LOAD( "f&m.expansion.3.1.e5", 0x0000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045), ROM_BIOS(2) )
82   ROM_SYSTEM_BIOS( 2, "fm32", "F&M 3.2" )
83   ROMX_LOAD( "f&m.expansion.3.2.e5", 0x0000, 0x1000, CRC(0f0fc960) SHA1(eb6b6e7bc9e761d13554482025d8cb5e260c0619), ROM_BIOS(3) )
8584ROM_END
8685
8786
r15813r15814
180179
181180   for (slot = 0; slot < MAX_EB_SLOTS; slot++)
182181   {
183      if (!strcmp(tag, m_slot[slot]->tag())) break;
182      if (!strcmp(tag, m_expansion_slot[slot]->tag())) break;
184183   }
185184
186185   assert(slot < MAX_EB_SLOTS);
r15813r15814
194193      irq |= m_int[slot];
195194   }
196195
197   m_owner_slot->int_w(irq);
196   m_slot->int_w(irq);
198197}
199198
200199
r15813r15814
208207
209208   for (slot = 0; slot < MAX_EB_SLOTS; slot++)
210209   {
211      if (!strcmp(tag, m_slot[slot]->tag())) break;
210      if (!strcmp(tag, m_expansion_slot[slot]->tag())) break;
212211   }
213212
214213   assert(slot < MAX_EB_SLOTS);
r15813r15814
222221      ef4 |= m_ef4[slot];
223222   }
224223
225   m_owner_slot->ef4_w(ef4);
224   m_slot->ef4_w(ef4);
226225}
227226
228227
r15813r15814
249248
250249void comx_eb_device::device_start()
251250{
252   m_owner_slot = dynamic_cast<comx_expansion_slot_device *>(owner());
251   m_expansion_slot[0] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT1_TAG));
252   m_expansion_slot[1] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT2_TAG));
253   m_expansion_slot[2] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT3_TAG));
254   m_expansion_slot[3] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT4_TAG));
253255
254   m_slot[0] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT1_TAG));
255   m_slot[1] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT2_TAG));
256   m_slot[2] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT3_TAG));
257   m_slot[3] = dynamic_cast<comx_expansion_slot_device *>(subdevice(SLOT4_TAG));
258
259256   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
260257   {
261258      m_int[slot] = CLEAR_LINE;
r15813r15814
283280{
284281   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
285282   {
286      if (BIT(m_select, slot) && m_slot[slot] != NULL)
283      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
287284      {
288         m_slot[slot]->q_w(state);
285         m_expansion_slot[slot]->q_w(state);
289286      }
290287   }
291288}
r15813r15814
312309   {
313310      for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
314311      {
315         if (BIT(m_select, slot) && m_slot[slot] != NULL)
312         if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
316313         {
317            data |= m_slot[slot]->mrd_r(offset, extrom);
314            data |= m_expansion_slot[slot]->mrd_r(offset, extrom);
318315         }
319316      }
320317   }
r15813r15814
331328{
332329   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
333330   {
334      if (BIT(m_select, slot) && m_slot[slot] != NULL)
331      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
335332      {
336         m_slot[slot]->mwr_w(offset, data);
333         m_expansion_slot[slot]->mwr_w(offset, data);
337334      }
338335   }
339336}
r15813r15814
349346
350347   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
351348   {
352      if (BIT(m_select, slot) && m_slot[slot] != NULL)
349      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
353350      {
354         data |= m_slot[slot]->io_r(offset);
351         data |= m_expansion_slot[slot]->io_r(offset);
355352      }
356353   }
357354
r15813r15814
371368
372369      for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
373370      {
374         if (m_slot[slot] != NULL)
371         if (m_expansion_slot[slot] != NULL)
375372         {
376            m_slot[slot]->ds_w(BIT(m_select, slot));
373            m_expansion_slot[slot]->ds_w(BIT(m_select, slot));
377374         }
378375      }
379376   }
380377
381378   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
382379   {
383      if (BIT(m_select, slot) && m_slot[slot] != NULL)
380      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
384381      {
385         m_slot[slot]->io_w(offset, data);
382         m_expansion_slot[slot]->io_w(offset, data);
386383      }
387384   }
388385}
r15813r15814
398395
399396   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
400397   {
401      if (BIT(m_select, slot) && m_slot[slot] != NULL)
398      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
402399      {
403         m_slot[slot]->screen_update(screen, bitmap, cliprect);
400         m_expansion_slot[slot]->screen_update(screen, bitmap, cliprect);
404401      }
405402   }
406403
src/mess/machine/comx_eb.h
r15813r15814
6868   virtual void comx_io_w(offs_t offset, UINT8 data);
6969   virtual UINT32 comx_screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
7070
71   // internal state
72   comx_expansion_slot_device *m_owner_slot;
73
71private:
7472   UINT8 *m_rom;            // program ROM
7573
76   comx_expansion_slot_device   *m_slot[MAX_EB_SLOTS];
74   comx_expansion_slot_device   *m_expansion_slot[MAX_EB_SLOTS];
7775   int m_int[MAX_EB_SLOTS];
7876   int m_ef4[MAX_EB_SLOTS];
7977

Previous 15994 Revisions Next


© 1998-2018 The MESS Team