Previous 199869 Revisions Next

r20861 Saturday 9th February, 2013 at 12:36:51 UTC by Wilbert Pol
(MESS) okean240.c: Reduce tagmap lookups (nw)
[src/mess/drivers]okean240.c

trunk/src/mess/drivers/okean240.c
r20860r20861
6161   m_term_data(0),
6262   m_j(0),
6363   m_scroll(0),
64   m_p_videoram(*this, "p_videoram"){ }
64   m_p_videoram(*this, "p_videoram"),
65   m_io_modifiers(*this, "MODIFIERS")
66   { }
6567
6668   DECLARE_READ8_MEMBER(okean240_kbd_status_r);
6769   DECLARE_READ8_MEMBER(okean240a_kbd_status_r);
r20860r20861
7678   UINT8 m_j;
7779   UINT8 m_scroll;
7880   required_shared_ptr<UINT8> m_p_videoram;
81   virtual void machine_start();
7982   virtual void machine_reset();
8083   virtual void video_start();
8184   DECLARE_DRIVER_INIT(okean240);
8285   UINT32 screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
8386   TIMER_CALLBACK_MEMBER(okean240_boot);
87
88protected:
89   optional_ioport m_io_modifiers;
90   ioport_port *m_io_port[11];
8491};
8592
8693// okean240 requires bit 4 to change
r20860r20861
95102// see if a key is pressed and indicate status
96103READ8_MEMBER( okean240_state::okean240a_kbd_status_r )
97104{
98   char kbdrow[6];
99105   UINT8 i,j;
100106
101107   for (i = 0; i < 11; i++)
102108   {
103      sprintf(kbdrow,"X%X",i);
104      j = ioport(kbdrow)->read();
109      j = m_io_port[i]->read();
105110      if (j)
106111         return (machine().rand() & 0x10) | 2;
107112   }
r20860r20861
130135
131136READ8_MEMBER( okean240_state::okean240a_keyboard_r )
132137{
133   char kbdrow[6];
134138   UINT8 i,j;
135139
136140   if (offset == 0) // port 40 (get a column)
137141   {
138142      for (i = 0; i < 11; i++)
139143      {
140         sprintf(kbdrow,"X%X",i);
141         j = ioport(kbdrow)->read();
144         j = m_io_port[i]->read();
142145         if (j)
143146         {
144147            if (j==m_j) return 0;
r20860r20861
152155   else
153156   if (offset == 1) // port 41 bits 6&7 (modifier keys), and bit 1 (test rom status bit)
154157   {
155      return (machine().rand() & 2) | ioport("MODIFIERS")->read();
158      return (machine().rand() & 2) | m_io_modifiers->read();
156159   }
157160   else // port 42 (get a row)
158161   {
159162      for (i = 0; i < 11; i++)
160163      {
161         sprintf(kbdrow,"X%X",i);
162         if (ioport(kbdrow)->read() )
164         if (m_io_port[i]->read() )
163165            return i;
164166      }
165167   }
r20860r20861
362364   membank("boot")->set_entry(0);
363365}
364366
367
368void okean240_state::machine_start()
369{
370   char kbdrow[6];
371
372   for (int i = 0; i < 11; i++)
373   {
374      sprintf(kbdrow,"X%X",i);
375      m_io_port[i] = ioport(kbdrow);
376   }
377}
378
379
365380void okean240_state::machine_reset()
366381{
367382   machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(okean240_state::okean240_boot),this));

Previous 199869 Revisions Next


© 1997-2024 The MAME Team