Previous 199869 Revisions Next

r21075 Thursday 14th February, 2013 at 20:07:15 UTC by Wilbert Pol
(MESS) gb.c: Reduce tagmap lookups (nw)
[src/mess/includes]gb.h
[src/mess/machine]gb.c

trunk/src/mess/machine/gb.c
r21074r21075
149149{
150150   address_space &space = m_maincpu->space(AS_PROGRAM);
151151
152   gb_sound_w(machine().device("custom"), space, 0x16, 0x00);       /* Initialize sound hardware */
152   gb_sound_w(m_custom, space, 0x16, 0x00);       /* Initialize sound hardware */
153153
154154   m_divcount = 0;
155155   m_triggering_irq = 0;
r21074r21075
244244   m_bios_disable = TRUE;
245245
246246   /* Initialize the Sound registers */
247   gb_sound_w(machine().device("custom"), generic_space(), 0x16,0x80);
248   gb_sound_w(machine().device("custom"), generic_space(), 0x15,0xF3);
249   gb_sound_w(machine().device("custom"), generic_space(), 0x14,0x77);
247   gb_sound_w(m_custom, generic_space(), 0x16,0x80);
248   gb_sound_w(m_custom, generic_space(), 0x15,0xF3);
249   gb_sound_w(m_custom, generic_space(), 0x14,0x77);
250250
251251   m_divcount = 0xABC8;
252252}
r21074r21075
339339      break;
340340   case 0x0F:                      /* IF - Interrupt flag */
341341      data &= 0x1F;
342      machine().device<lr35902_cpu_device>(":maincpu")->set_if( data );
342      m_maincpu->set_if( data );
343343      break;
344344   }
345345
r21074r21075
893893/* Interrupt Enable register */
894894READ8_MEMBER(gb_state::gb_ie_r)
895895{
896   return machine().device<lr35902_cpu_device>(":maincpu")->get_ie();
896   return m_maincpu->get_ie();
897897}
898898
899899WRITE8_MEMBER(gb_state::gb_ie_w)
900900{
901   machine().device<lr35902_cpu_device>(":maincpu")->set_ie( data & 0x1F );
901   m_maincpu->set_ie( data & 0x1F );
902902}
903903
904904/* IO read */
r21074r21075
918918         return m_gb_io[offset];
919919      case 0x0F:
920920         /* Make sure the internal states are up to date */
921         return 0xE0 | machine().device<lr35902_cpu_device>(":maincpu")->get_if();
921         return 0xE0 | m_maincpu->get_if();
922922      default:
923923         /* It seems unsupported registers return 0xFF */
924924         return 0xFF;
r21074r21075
10031003   switch( offset )
10041004   {
10051005      case 0x0D:  /* KEY1 - Prepare speed switch */
1006         machine().device<lr35902_cpu_device>(":maincpu")->set_speed(data);
1006         m_maincpu->set_speed(data);
10071007         return;
10081008      case 0x10:  /* BFF - Bios disable */
10091009         m_bios_disable = TRUE;
r21074r21075
10271027   switch( offset )
10281028   {
10291029   case 0x0D:  /* KEY1 */
1030      return machine().device<lr35902_cpu_device>(":maincpu")->get_speed();
1030      return m_maincpu->get_speed();
10311031   case 0x16:  /* RP - Infrared port */
10321032      break;
10331033   case 0x30:  /* SVBK - RAM bank select */
r21074r21075
11321132
11331133WRITE8_MEMBER(megaduck_state::megaduck_sound_w1)
11341134{
1135   gb_sound_w(machine().device("custom"), space, megaduck_sound_offsets[offset], data );
1135   gb_sound_w(m_custom, space, megaduck_sound_offsets[offset], data );
11361136}
11371137
11381138READ8_MEMBER(megaduck_state::megaduck_sound_r1)
11391139{
1140   return gb_sound_r( machine().device("custom"), space, megaduck_sound_offsets[offset] );
1140   return gb_sound_r( m_custom, space, megaduck_sound_offsets[offset] );
11411141}
11421142
11431143WRITE8_MEMBER(megaduck_state::megaduck_sound_w2)
11441144{
11451145   switch(offset)
11461146   {
1147      case 0x00:  gb_sound_w(machine().device("custom"), space, 0x10, data ); break;
1148      case 0x01:  gb_sound_w(machine().device("custom"), space, 0x12, data ); break;
1149      case 0x02:  gb_sound_w(machine().device("custom"), space, 0x11, data ); break;
1150      case 0x03:  gb_sound_w(machine().device("custom"), space, 0x13, data ); break;
1151      case 0x04:  gb_sound_w(machine().device("custom"), space, 0x14, data ); break;
1152      case 0x05:  gb_sound_w(machine().device("custom"), space, 0x16, data ); break;
1153      case 0x06:  gb_sound_w(machine().device("custom"), space, 0x15, data ); break;
1147      case 0x00:  gb_sound_w(m_custom, space, 0x10, data ); break;
1148      case 0x01:  gb_sound_w(m_custom, space, 0x12, data ); break;
1149      case 0x02:  gb_sound_w(m_custom, space, 0x11, data ); break;
1150      case 0x03:  gb_sound_w(m_custom, space, 0x13, data ); break;
1151      case 0x04:  gb_sound_w(m_custom, space, 0x14, data ); break;
1152      case 0x05:  gb_sound_w(m_custom, space, 0x16, data ); break;
1153      case 0x06:  gb_sound_w(m_custom, space, 0x15, data ); break;
11541154      case 0x07:
11551155      case 0x08:
11561156      case 0x09:
r21074r21075
11661166
11671167READ8_MEMBER(megaduck_state::megaduck_sound_r2)
11681168{
1169   return gb_sound_r(machine().device("custom"), space, 0x10 + megaduck_sound_offsets[offset]);
1169   return gb_sound_r(m_custom, space, 0x10 + megaduck_sound_offsets[offset]);
11701170}
trunk/src/mess/includes/gb.h
r21074r21075
113113      : driver_device(mconfig, type, tag)
114114      , m_cartslot(*this, "gbslot")
115115      , m_maincpu(*this, "maincpu")
116      , m_custom(*this, "custom")
116117      , m_region_maincpu(*this, "maincpu")
117118      , m_rambank(*this, "cgb_ram")
118119      , m_inputs(*this, "INPUTS")
r21074r21075
208209
209210protected:
210211   required_device<lr35902_cpu_device> m_maincpu;
212   required_device<device_t> m_custom;
211213   required_memory_region m_region_maincpu;
212214   optional_memory_bank m_rambank;   // cgb
213215   required_ioport m_inputs;
r21074r21075
235237{
236238public:
237239   megaduck_state(const machine_config &mconfig, device_type type, const char *tag)
238   : gb_state(mconfig, type, tag)
239   , m_cartslot(*this, "duckslot")
240   , m_maincpu(*this, "maincpu")
241   , m_inputs(*this, "INPUTS")
240      : gb_state(mconfig, type, tag)
241      , m_cartslot(*this, "duckslot")
242242   { }
243243
244244   DECLARE_READ8_MEMBER(megaduck_video_r);
r21074r21075
255255   DECLARE_WRITE8_MEMBER(bank1_w);
256256   DECLARE_WRITE8_MEMBER(bank2_w);
257257   optional_device<megaduck_cart_slot_device> m_cartslot;
258
259protected:
260   required_device<lr35902_cpu_device> m_maincpu;
261   required_ioport m_inputs;
262258};
263259
264260

Previous 199869 Revisions Next


© 1997-2024 The MAME Team