Previous 199869 Revisions Next

r20504 Saturday 26th January, 2013 at 19:43:13 UTC by Phil Bennett
missile.c - Tag lookup reduction -nw-
[src/mame/drivers]missile.c

trunk/src/mame/drivers/missile.c
r20503r20504
358358   missile_state(const machine_config &mconfig, device_type type, const char *tag)
359359      : driver_device(mconfig, type, tag),
360360      m_maincpu(*this,"maincpu"),
361      m_videoram(*this, "videoram")
361      m_videoram(*this, "videoram"),
362      m_pokey(*this, "pokey"),
363      m_in0(*this, "IN0"),
364      m_in1(*this, "IN1"),
365      m_r10(*this, "R10"),
366      m_r8(*this, "R8"),
367      m_track0_x(*this, "TRACK0_X"),
368      m_track0_y(*this, "TRACK0_Y"),
369      m_track1_x(*this, "TRACK1_X"),
370      m_track1_y(*this, "TRACK1_Y")
362371   { }
363372
364373   required_device<m6502_device> m_maincpu;
365374   required_shared_ptr<UINT8> m_videoram;
375   required_device<pokey_device> m_pokey;
376   required_ioport m_in0;
377   required_ioport m_in1;
378   required_ioport m_r10;
379   required_ioport m_r8;
380   required_ioport m_track0_x;
381   required_ioport m_track0_y;
382   required_ioport m_track1_x;
383   required_ioport m_track1_y;
366384
385   const UINT8 *m_mainrom;
367386   const UINT8 *m_writeprom;
368387   emu_timer *m_irq_timer;
369388   emu_timer *m_cpu_timer;
r20503r20504
494513void missile_state::machine_start()
495514{
496515   /* initialize globals */
516   m_mainrom = memregion("maincpu")->base();   
497517   m_writeprom = memregion("proms")->base();
498518   m_flipscreen = 0;
499519
r20503r20504
696716   /* POKEY */
697717   else if (offset < 0x4800)
698718   {
699      pokey_device *pokey_dev = downcast<pokey_device *>(machine().device("pokey"));
700      pokey_dev->write(machine().firstcpu->space(), offset, data, 0xff);
719      m_pokey->write(m_maincpu->space(), offset, data, 0xff);
701720   }
702721
703722   /* OUT0 */
r20503r20504
754773
755774   /* ROM */
756775   else if (offset >= 0x5000)
757      result = memregion("maincpu")->base()[offset];
776      result = m_mainrom[offset];
758777
759778   /* POKEY */
760779   else if (offset < 0x4800)
761   {
762      pokey_device *pokey_dev = downcast<pokey_device *>(machine().device("pokey"));
763      result = pokey_dev->read(machine().firstcpu->space(), offset & 0x0f, 0xff);
764   }
780      result = m_pokey->read(m_maincpu->space(), offset & 0x0f, 0xff);
765781
766782   /* IN0 */
767783   else if (offset < 0x4900)
r20503r20504
769785      if (m_ctrld)    /* trackball */
770786      {
771787         if (!m_flipscreen)
772            result = ((ioport("TRACK0_Y")->read() << 4) & 0xf0) | (ioport("TRACK0_X")->read() & 0x0f);
788            result = ((m_track0_y->read() << 4) & 0xf0) | (m_track0_x->read() & 0x0f);
773789         else
774            result = ((ioport("TRACK1_Y")->read() << 4) & 0xf0) | (ioport("TRACK1_X")->read() & 0x0f);
790            result = ((m_track1_y->read() << 4) & 0xf0) | (m_track1_x->read() & 0x0f);
775791      }
776792      else    /* buttons */
777         result = ioport("IN0")->read();
793         result = m_in0->read();
778794   }
779795
780796   /* IN1 */
781797   else if (offset < 0x4a00)
782      result = ioport("IN1")->read();
798      result = m_in1->read();
783799
784800   /* IN2 */
785801   else if (offset < 0x4b00)
786      result = ioport("R10")->read();
802      result = m_r10->read();
787803
788804   /* anything else */
789805   else

Previous 199869 Revisions Next


© 1997-2024 The MAME Team