Previous 199869 Revisions Next

r18251 Tuesday 2nd October, 2012 at 19:37:08 UTC by Wilbert Pol
(MESS) a2600: Changed some more c functions into members. (nw)
[src/mess/drivers]a2600.c

trunk/src/mess/drivers/a2600.c
r18250r18251
136136   void mode3E_RAM_switch(UINT16 offset, UINT8 data);
137137   void modeFV_switch(UINT16 offset, UINT8 data);
138138   void modeJVP_switch(UINT16 offset, UINT8 data);
139   void modeFE_switch(UINT16 offset, UINT8 data);
140   void install_banks(int count, unsigned init);
139141
140142   UINT8   *m_cart;
141143};
r18250r18251
11601162   return address;
11611163}
11621164
1163static void modeFE_switch(running_machine &machine,UINT16 offset, UINT8 data)
1165void a2600_state::modeFE_switch(UINT16 offset, UINT8 data)
11641166{
1165   a2600_state *state = machine.driver_data<a2600_state>();
1166   address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM);
1167   address_space& space = machine().device("maincpu")->memory().space(AS_PROGRAM);
11671168   /* Retrieve last byte read by the cpu (for this mapping scheme this
11681169       should be the last byte that was on the data bus
11691170    */
1170   state->m_FETimer = 1;
1171   state->m_FE_old_opbase_handler = space.set_direct_update_handler(direct_update_delegate(FUNC(a2600_state::modeFE_opbase_handler), state));
1171   m_FETimer = 1;
1172   m_FE_old_opbase_handler = space.set_direct_update_handler(direct_update_delegate(FUNC(a2600_state::modeFE_opbase_handler), this));
11721173}
11731174
11741175READ8_MEMBER(a2600_state::modeFE_switch_r)
11751176{
1176   modeFE_switch(machine(),offset, 0 );
1177   modeFE_switch(offset, 0 );
11771178   return space.read_byte(0xFE );
11781179}
11791180
11801181WRITE8_MEMBER(a2600_state::modeFE_switch_w)
11811182{
11821183   space.write_byte(0xFE, data );
1183   modeFE_switch(machine(),offset, 0 );
1184   modeFE_switch(offset, 0 );
11841185}
11851186
11861187READ8_MEMBER(a2600_state::current_bank_r)
r18250r18251
12911292};
12921293
12931294
1294static void install_banks(running_machine &machine, int count, unsigned init)
1295void a2600_state::install_banks(int count, unsigned init)
12951296{
1296   a2600_state *state = machine.driver_data<a2600_state>();
12971297   int i;
1298   UINT8 *cart = CART;
12991298
13001299   for (i = 0; i < count; i++)
13011300   {
r18250r18251
13071306         "bank4",
13081307      };
13091308
1310      machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(
1309      machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(
13111310         0x1000 + (i + 0) * 0x1000 / count - 0,
13121311         0x1000 + (i + 1) * 0x1000 / count - 1, handler[i]);
13131312
1314      state->m_bank_base[i + 1] = cart + init;
1315      state->membank(handler[i])->set_base(state->m_bank_base[i + 1]);
1313      m_bank_base[i + 1] = m_cart + init;
1314      membank(handler[i])->set_base(m_bank_base[i + 1]);
13161315   }
13171316}
13181317
r18250r18251
18241823   switch (m_banking_mode)
18251824   {
18261825   case mode2K:
1827      install_banks(machine(), 2, 0x0000);
1826      install_banks(2, 0x0000);
18281827      break;
18291828
18301829   case mode4K:
1831      install_banks(machine(), 1, 0x0000);
1830      install_banks(1, 0x0000);
18321831      break;
18331832
18341833   case modeF8:
18351834      if (!memcmp(&CART_MEMBER[0x1ffc],snowwhite,sizeof(snowwhite)))
18361835      {
1837         install_banks(machine(), 1, 0x0000);
1836         install_banks(1, 0x0000);
18381837      }
18391838      else
18401839      {
1841         install_banks(machine(), 1, 0x1000);
1840         install_banks(1, 0x1000);
18421841      }
18431842      break;
18441843
18451844   case modeFA:
1846      install_banks(machine(), 1, 0x2000);
1845      install_banks(1, 0x2000);
18471846      break;
18481847
18491848   case modeF6:
1850      install_banks(machine(), 1, 0x0000);
1849      install_banks(1, 0x0000);
18511850      break;
18521851
18531852   case modeF4:
1854      install_banks(machine(), 1, 0x7000);
1853      install_banks(1, 0x7000);
18551854      break;
18561855
18571856   case modeFE:
1858      install_banks(machine(), 1, 0x0000);
1857      install_banks(1, 0x0000);
18591858      break;
18601859
18611860   case modeE0:
1862      install_banks(machine(), 4, 0x1c00);
1861      install_banks(4, 0x1c00);
18631862      break;
18641863
18651864   case mode3F:
1866      install_banks(machine(), 2, m_cart_size - 0x800);
1865      install_banks(2, m_cart_size - 0x800);
18671866      m_number_banks = m_cart_size / 0x800;
18681867      break;
18691868
18701869   case modeUA:
1871      install_banks(machine(), 1, 0x1000);
1870      install_banks(1, 0x1000);
18721871      break;
18731872
18741873   case modeE7:
1875      install_banks(machine(), 2, 0x3800);
1874      install_banks(2, 0x3800);
18761875      break;
18771876
18781877   case modeDC:
1879      install_banks(machine(), 1, 0x1000 * m_current_bank);
1878      install_banks(1, 0x1000 * m_current_bank);
18801879      break;
18811880
18821881   case modeCV:
1883      install_banks(machine(), 2, 0x0000);
1882      install_banks(2, 0x0000);
18841883      break;
18851884
18861885   case mode3E:
1887      install_banks(machine(), 2, m_cart_size - 0x800);
1886      install_banks(2, m_cart_size - 0x800);
18881887      m_number_banks = m_cart_size / 0x800;
18891888      m_mode3E_ram_enabled = 0;
18901889      break;
18911890
18921891   case modeSS:
1893      install_banks(machine(), 2, 0x0000);
1892      install_banks(2, 0x0000);
18941893      break;
18951894
18961895   case modeFV:
1897      install_banks(machine(), 1, 0x0000);
1896      install_banks(1, 0x0000);
18981897      m_current_bank = 0;
18991898      break;
19001899
19011900   case modeDPC:
1902      install_banks(machine(), 1, 0x0000);
1901      install_banks(1, 0x0000);
19031902      break;
19041903
19051904   case mode32in1:
1906      install_banks(machine(), 2, 0x0000);
1905      install_banks(2, 0x0000);
19071906      m_current_reset_bank_counter = m_current_reset_bank_counter & 0x1F;
19081907      break;
19091908
r18250r18251
19121911      if ( m_cart_size == 0x2000 )
19131912         m_current_reset_bank_counter = 0;
19141913      m_current_bank = m_current_reset_bank_counter * 2;
1915      install_banks(machine(), 1, 0x1000 * m_current_bank);
1914      install_banks(1, 0x1000 * m_current_bank);
19161915      break;
19171916   }
19181917

Previous 199869 Revisions Next


© 1997-2024 The MAME Team