Previous 199869 Revisions Next

r34305 Saturday 10th January, 2015 at 07:41:59 UTC by Osso
gticlub.c: reduced tagmap lookups (nw)
[src/mame/drivers]gticlub.c

trunk/src/mame/drivers/gticlub.c
r242816r242817
242242public:
243243   gticlub_state(const machine_config &mconfig, device_type type, const char *tag)
244244      : driver_device(mconfig, type, tag),
245      m_work_ram(*this, "work_ram"),
246245      m_maincpu(*this, "maincpu"),
247246      m_audiocpu(*this, "audiocpu"),
248247      m_dsp(*this, "dsp"),
249248      m_dsp2(*this, "dsp2"),
250249      m_k056800(*this, "k056800"),
251250      m_adc1038(*this, "adc1038"),
252      m_analog0(*this, "AN0"),
253      m_analog1(*this, "AN1"),
254      m_analog2(*this, "AN2"),
255      m_analog3(*this, "AN3"),
256251      m_eeprom(*this, "eeprom"),
257252      m_palette(*this, "palette"),
253      m_konppc(*this, "konppc"),
258254      m_k001005(*this, "k001005"),
259255      m_k001006_1(*this, "k001006_1"),
260256      m_k001006_2(*this, "k001006_2"),
257      m_k001604_1(*this, "k001604_1"),
258      m_k001604_2(*this, "k001604_2"),
259      m_work_ram(*this, "work_ram"),
261260      m_generic_paletteram_32(*this, "paletteram"),
262      m_konppc(*this, "konppc") { }
261      m_analog0(*this, "AN0"),
262      m_analog1(*this, "AN1"),
263      m_analog2(*this, "AN2"),
264      m_analog3(*this, "AN3"),
265      m_ports(*this, ports) { }
263266
264267   // TODO: Needs verification on real hardware
265268   static const int m_sound_timer_usec = 2400;
266269
267   required_shared_ptr<UINT32> m_work_ram;
268270   required_device<ppc_device> m_maincpu;
269271   required_device<cpu_device> m_audiocpu;
270272   required_device<adsp21062_device> m_dsp;
271273   optional_device<cpu_device> m_dsp2;
272274   required_device<k056800_device> m_k056800;
273275   required_device<adc1038_device> m_adc1038;
274   optional_ioport m_analog0, m_analog1, m_analog2, m_analog3;
275276   required_device<eeprom_serial_93cxx_device> m_eeprom;
276277   required_device<palette_device> m_palette;
278   required_device<konppc_device> m_konppc;
277279   optional_device<k001005_device> m_k001005;
278280   optional_device<k001006_device> m_k001006_1;
279281   optional_device<k001006_device> m_k001006_2;
282   optional_device<k001604_device> m_k001604_1;
283   optional_device<k001604_device> m_k001604_2;
284   
285   required_shared_ptr<UINT32> m_work_ram;
280286   required_shared_ptr<UINT32> m_generic_paletteram_32;
281   required_device<konppc_device> m_konppc;
287   
288   optional_ioport m_analog0, m_analog1, m_analog2, m_analog3;
289   
290   required_ioport_array<4> m_ports;
291   
292   DECLARE_IOPORT_ARRAY(ports);
282293
283294   DECLARE_WRITE32_MEMBER(paletteram32_w);
284295   DECLARE_READ32_MEMBER(gticlub_k001604_tile_r);
r242816r242817
317328private:
318329   void gticlub_led_setreg(int offset, UINT8 data);
319330
320   UINT8 gticlub_led_reg[2];
331   UINT8 m_gticlub_led_reg[2];
321332   emu_timer *m_sound_irq_timer;
322333   UINT32 *m_sharc_dataram_0;
323334   UINT32 *m_sharc_dataram_1;
r242816r242817
343354
344355READ32_MEMBER(gticlub_state::gticlub_k001604_tile_r)
345356{
346   k001604_device *k001604 = machine().device<k001604_device>(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1");
357   k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1);
347358   return k001604->tile_r(space, offset, mem_mask);
348359}
349360
350361WRITE32_MEMBER(gticlub_state::gticlub_k001604_tile_w)
351362{
352   k001604_device *k001604 = machine().device<k001604_device>(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1");
363   k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1);
353364   k001604->tile_w(space, offset, data, mem_mask);
354365}
355366
356367
357368READ32_MEMBER(gticlub_state::gticlub_k001604_char_r)
358369{
359   k001604_device *k001604 = machine().device<k001604_device>(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1");
370   k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1);
360371   return k001604->char_r(space, offset, mem_mask);
361372}
362373
363374WRITE32_MEMBER(gticlub_state::gticlub_k001604_char_w)
364375{
365   k001604_device *k001604 = machine().device<k001604_device>(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1");
376   k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1);
366377   k001604->char_w(space, offset, data, mem_mask);
367378}
368379
369380READ32_MEMBER(gticlub_state::gticlub_k001604_reg_r)
370381{
371   k001604_device *k001604 = machine().device<k001604_device>(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1");
382   k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1);
372383   return k001604->reg_r(space, offset, mem_mask);
373384}
374385
375386WRITE32_MEMBER(gticlub_state::gticlub_k001604_reg_w)
376387{
377   k001604_device *k001604 = machine().device<k001604_device>(m_konppc->get_cgboard_id() ? "k001604_2" : "k001604_1");
388   k001604_device *k001604 = (m_konppc->get_cgboard_id() ? m_k001604_2 : m_k001604_1);
378389   k001604->reg_w(space, offset, data, mem_mask);
379390}
380391
381392
382393/******************************************************************/
383394
395IOPORT_ARRAY_MEMBER(gticlub_state::ports) { "IN0", "IN1", "IN2", "IN3" };
396
384397READ8_MEMBER(gticlub_state::sysreg_r)
385398{
386   static const char *const portnames[] = { "IN0", "IN1", "IN2", "IN3" };
387399   switch (offset)
388400   {
389401      case 0:
390402      case 1:
391403      case 3:
392         return ioport(portnames[offset])->read();
404         return m_ports[offset]->read();
393405
394406      case 2:
395407         return m_adc1038->sars_read() << 7;
r242816r242817
810822
811823void gticlub_state::gticlub_led_setreg(int offset, UINT8 data)
812824{
813   gticlub_led_reg[offset] = data;
825   m_gticlub_led_reg[offset] = data;
814826}
815827
816828
817829VIDEO_START_MEMBER(gticlub_state,gticlub)
818830{
819   gticlub_led_reg[0] = gticlub_led_reg[1] = 0x7f;
831   m_gticlub_led_reg[0] = m_gticlub_led_reg[1] = 0x7f;
820832   /*
821833   tick = 0;
822834   debug_tex_page = 0;
r242816r242817
826838
827839UINT32 gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
828840{
829   k001604_device *k001604 = machine().device<k001604_device>("k001604_1");
841   m_k001604_1->draw_back_layer(bitmap, cliprect);
830842
831   k001604->draw_back_layer(bitmap, cliprect);
832
833843   m_k001005->draw(bitmap, cliprect);
834844
835   k001604->draw_front_layer(screen, bitmap, cliprect);
845   m_k001604_1->draw_front_layer(screen, bitmap, cliprect);
836846
837847#if 0
838848   tick++;
r242816r242817
884894   }
885895#endif
886896
887   draw_7segment_led(bitmap, 3, 3, gticlub_led_reg[0]);
888   draw_7segment_led(bitmap, 9, 3, gticlub_led_reg[1]);
897   draw_7segment_led(bitmap, 3, 3, m_gticlub_led_reg[0]);
898   draw_7segment_led(bitmap, 9, 3, m_gticlub_led_reg[1]);
889899
890900   //machine().device("dsp")->execute().set_input_line(SHARC_INPUT_FLAG1, ASSERT_LINE);
891901   m_dsp->set_flag_input(1, ASSERT_LINE);
r242816r242817
898908
899909   if (strcmp(screen.tag(), ":lscreen") == 0)
900910   {
901      k001604_device *k001604 = machine().device<k001604_device>("k001604_1");
902911      device_t *voodoo = machine().device("voodoo0");
903912
904   //  k001604->draw_back_layer(bitmap, cliprect);
913   //  m_k001604_1->draw_back_layer(bitmap, cliprect);
905914
906915      voodoo_update(voodoo, bitmap, cliprect);
907916
908      k001604->draw_front_layer(screen, bitmap, cliprect);
917      m_k001604_1->draw_front_layer(screen, bitmap, cliprect);
909918   }
910919   else if (strcmp(screen.tag(), ":rscreen") == 0)
911920   {
912      k001604_device *k001604 = machine().device<k001604_device>("k001604_2");
913921      device_t *voodoo = machine().device("voodoo1");
914922
915   //  k001604->draw_back_layer(bitmap, cliprect);
923   //  m_k001604_2->draw_back_layer(bitmap, cliprect);
916924
917925      voodoo_update(voodoo, bitmap, cliprect);
918926
919      k001604->draw_front_layer(screen, bitmap, cliprect);
927      m_k001604_2->draw_front_layer(screen, bitmap, cliprect);
920928   }
921929
922   draw_7segment_led(bitmap, 3, 3, gticlub_led_reg[0]);
923   draw_7segment_led(bitmap, 9, 3, gticlub_led_reg[1]);
930   draw_7segment_led(bitmap, 3, 3, m_gticlub_led_reg[0]);
931   draw_7segment_led(bitmap, 9, 3, m_gticlub_led_reg[1]);
924932
925933   return 0;
926934}


Previous 199869 Revisions Next


© 1997-2024 The MAME Team