Previous 199869 Revisions Next

r32218 Friday 19th September, 2014 at 20:33:08 UTC by Wilbert Pol
(MESS) mz3500.c: Reduce some tagmap lookups (nw)
[src/mess/drivers]mz3500.c

trunk/src/mess/drivers/mz3500.c
r32217r32218
5050         m_fdc(*this, "upd765a"),
5151         m_video_ram(*this, "video_ram"),
5252         m_beeper(*this, "beeper"),
53         m_palette(*this, "palette")
53         m_palette(*this, "palette"),
54         m_system_dsw(*this, "SYSTEM_DSW"),
55         m_fd_dsw(*this, "FD_DSW")
5456   { }
5557
5658   // devices
r32217r32218
106108   virtual void machine_reset();
107109
108110   virtual void video_start();
111
112private:
113   required_ioport m_system_dsw;
114   required_ioport m_fd_dsw;
115   floppy_connector *m_floppy_connector[4];
109116};
110117
111118void mz3500_state::video_start()
r32217r32218
473480   switch(offset)
474481   {
475482      case 2:
476         return ((ioport("SYSTEM_DSW")->read() & 0x0f) << 1) | ((ioport("FD_DSW")->read() & 0x8) >> 3);
483         return ((m_system_dsw->read() & 0x0f) << 1) | ((m_fd_dsw->read() & 0x8) >> 3);
477484      case 3:
478         return ((ioport("FD_DSW")->read() & 0x7)<<5) | (m_srdy << 4);
485         return ((m_fd_dsw->read() & 0x7)<<5) | (m_srdy << 4);
479486   }
480487
481488   return 0;
r32217r32218
534541
535542READ8_MEMBER(mz3500_state::mz3500_fdc_r)
536543{
537   static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"};
538
539544   /*
540545   ---- -x-- Motor
541546   ---- --x- Index
542547   ---- ---x Drq
543548   */
544   floppy_image_device *floppy;
545   floppy = machine().device<floppy_connector>(m_fddnames[m_fdd_sel])->get_device();
546549
550   floppy_image_device *floppy = m_floppy_connector[m_fdd_sel]->get_device();
551
547552   return (floppy->mon_r() << 2) | (floppy->idx_r() << 1) | (m_fdc->get_drq() & 1);
548553}
549554
r32217r32218
556561   ---x ---- motor on signal
557562   ---- xxxx Select FDD 0-3 (bit-wise)
558563   */
559   static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"};
560564
561565   if(data & 0x40)
562566   {
r32217r32218
570574      }
571575   }
572576
573   machine().device<floppy_connector>(m_fddnames[m_fdd_sel])->get_device()->mon_w(data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
577   m_floppy_connector[m_fdd_sel]->get_device()->mon_w(data & 0x10 ? CLEAR_LINE : ASSERT_LINE);
574578
575579}
576580
r32217r32218
740744   m_char_rom = memregion("gfx1")->base();
741745   m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0x40000);
742746   m_shared_ram = auto_alloc_array_clear(machine(), UINT8, 0x800);
747
748   static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"};
749
750   for (int i = 0; i < 4; i++)
751   {
752      m_floppy_connector[i] = machine().device<floppy_connector>(m_fddnames[i]);
753   }
743754}
744755
745756void mz3500_state::machine_reset()
r32217r32218
760771   {
761772      m_fdd_sel = 0;
762773      {
763         static const char *const m_fddnames[4] = { "upd765a:0", "upd765a:1", "upd765a:2", "upd765a:3"};
764
765774         for(int i=0;i<4;i++)
766775         {
767            machine().device<floppy_connector>(m_fddnames[i])->get_device()->mon_w(ASSERT_LINE);
768            machine().device<floppy_connector>(m_fddnames[i])->get_device()->set_rpm(300);
776            m_floppy_connector[i]->get_device()->mon_w(ASSERT_LINE);
777            m_floppy_connector[i]->get_device()->set_rpm(300);
769778         }
770779
771780         machine().device<upd765a_device>("upd765a")->set_rate(250000);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team