Previous 199869 Revisions Next

r21101 Friday 15th February, 2013 at 19:59:15 UTC by Wilbert Pol
(MESS) pc4.c: Reduce tagmap lookups (nw)
[src/mess/drivers]pc4.c
[src/mess/includes]pc4.h
[src/mess/video]pc4.c

trunk/src/mess/includes/pc4.h
r21100r21101
1616{
1717public:
1818   pc4_state(const machine_config &mconfig, device_type type, const char *tag)
19      : driver_device(mconfig, type, tag),
20         m_maincpu(*this, "maincpu"),
21         m_beep(*this, BEEPER_TAG)
22      { }
19      : driver_device(mconfig, type, tag)
20      , m_maincpu(*this, "maincpu")
21      , m_beep(*this, BEEPER_TAG)
22      , m_region_charset(*this, "charset")
23      , m_rombank(*this, "rombank")
24   { }
2325
2426   required_device<cpu_device> m_maincpu;
2527   required_device<beep_device> m_beep;
r21100r21101
6365   INT8 m_direction;
6466   UINT8 m_blink;
6567   virtual void palette_init();
68
69protected:
70   required_memory_region m_region_charset;
71   required_memory_bank m_rombank;
72   ioport_port *io_port[8];
6673};
6774
6875#endif  // _PC4_H_
trunk/src/mess/video/pc4.c
r21100r21101
3333                  else
3434                  {
3535                     //draw CGROM characters
36                     bitmap.pix16(l*9 + y, i*6 + x) = BIT(machine().root_device().memregion("charset")->base()[m_ddram[char_pos]*8+y], 4-x);
36                     bitmap.pix16(l*9 + y, i*6 + x) = BIT(m_region_charset->base()[m_ddram[char_pos]*8+y], 4-x);
3737
3838                  }
3939
trunk/src/mess/drivers/pc4.c
r21100r21101
3131
3232READ8_MEMBER( pc4_state::kb_r )
3333{
34   static const char *const bitnames[] = {"LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7"};
3534   UINT8 data = 0xff;
3635
3736   for (int line=0; line<8; line++)
37   {
3838      if (!(offset & (1<<line)))
39         data &= ioport(bitnames[line])->read();
39      {
40         data &= io_port[line]->read();
41      }
42   }
4043
4144   return data;
4245}
r21100r21101
4447WRITE8_MEMBER( pc4_state::bank_w )
4548{
4649   //printf("set bank %x\n", data);
47   membank("rombank")->set_entry(data&0x07);
50   m_rombank->set_entry(data&0x07);
4851}
4952
5053WRITE8_MEMBER( pc4_state::beep_w )
r21100r21101
179182
180183void pc4_state::machine_start()
181184{
182   UINT8* rom_base = (UINT8 *)machine().root_device().memregion("maincpu")->base();
185   static const char *const bitnames[] = {"LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7"};
186   UINT8* rom_base = (UINT8 *)memregion("maincpu")->base();
183187
184   membank("rombank")->configure_entries(0, 8, rom_base, 0x4000);
185   membank("rombank")->set_entry(0);
188   m_rombank->configure_entries(0, 8, rom_base, 0x4000);
189   m_rombank->set_entry(0);
186190
187191   m_busy_timer = timer_alloc(BUSY_TIMER);
188192   m_blink_timer = timer_alloc(BLINKING_TIMER);
189193   m_blink_timer->adjust(attotime::from_msec(409), 0, attotime::from_msec(409));
190194
195    for (int i=0; i<8; i++)
196   {
197      io_port[i] = ioport(bitnames[i]);
198   }
199
191200   m_ac = 0;
192201   m_ac_mode = 0;
193202   m_data_bus_flag = 0;

Previous 199869 Revisions Next


© 1997-2024 The MAME Team