Previous 15994 Revisions Next

r841 Friday 17th August, 2007 at 20:04:26 UTC by Wilbert Pol
[A2600] Renamed mode12 to modeFA; mode32 to modeF4; modeAV to modeFE; modeTV to mode3F; modeMN to modeE7
[src/mess/drivers]a2600.c

src/mess/drivers/a2600.c
r840r841
2525   mode2K,
2626   mode4K,
2727   modeF8,
28   mode12,
28   modeFA,
2929   modeF6,
30   mode32,
31   modeAV,
32   modePB,
33   modeTV,
30   modeF4,
31   modeFE,
32   modeE0,
33   mode3F,
3434   modeUA,
35   modeMN,
35   modeE7,
3636   modeDC,
3737   modeCV,
3838   mode3E,
r840r841
240240   return 0;
241241}
242242
243static int detect_modeAV(void)
243static int detect_modeFE(void)
244244{
245245   int i,j,numfound = 0;
246246   unsigned char signatures[][5] =  {
r840r841
265265   return 0;
266266}
267267
268static int detect_modePB(void)
268static int detect_modeE0(void)
269269{
270270   int i,j,numfound = 0;
271271   unsigned char signatures[][3] =  {
r840r841
361361   return 0;
362362}
363363
364static int detect_modeMN(void)
364static int detect_modeE7(void)
365365{
366366   int i,j,numfound = 0;
367367   unsigned char signatures[][3] = {
r840r841
402402   return 0;
403403}
404404
405static int detect_8K_modeTV(void)
405static int detect_8K_mode3F(void)
406406{
407407   int i,numfound = 0;
408408   unsigned char signature1[4] = { 0xa9, 0x01, 0x85, 0x3f };
r840r841
426426   return 0;
427427}
428428
429static int detect_32K_modeTV(void)
429static int detect_32K_mode3F(void)
430430{
431431   int i,numfound = 0;
432432   unsigned char signature[4] = { 0xa9, 0x0e, 0x85, 0x3f };
r840r841
529529   bank_base[1] = CART + 0x1000 * offset;
530530   memory_set_bankptr(1, bank_base[1]);
531531}
532void mode12_switch(UINT16 offset, UINT8 data)
532void modeFA_switch(UINT16 offset, UINT8 data)
533533{
534534   bank_base[1] = CART + 0x1000 * offset;
535535   memory_set_bankptr(1, bank_base[1]);
r840r841
539539   bank_base[1] = CART + 0x1000 * offset;
540540   memory_set_bankptr(1, bank_base[1]);
541541}
542void mode32_switch(UINT16 offset, UINT8 data)
542void modeF4_switch(UINT16 offset, UINT8 data)
543543{
544544   bank_base[1] = CART + 0x1000 * offset;
545545   memory_set_bankptr(1, bank_base[1]);
546546}
547void modeTV_switch(UINT16 offset, UINT8 data)
547void mode3F_switch(UINT16 offset, UINT8 data)
548548{
549549   bank_base[1] = CART + 0x800 * (data & (number_banks - 1));
550550   memory_set_bankptr(1, bank_base[1]);
r840r841
554554   bank_base[1] = CART + (offset >> 6) * 0x1000;
555555   memory_set_bankptr(1, bank_base[1]);
556556}
557void modePB_switch(UINT16 offset, UINT8 data)
557void modeE0_switch(UINT16 offset, UINT8 data)
558558{
559559   int bank = 1 + (offset >> 3);
560560   bank_base[bank] = CART + 0x400 * (offset & 7);
561561   memory_set_bankptr(bank, bank_base[bank]);
562562}
563void modeMN_switch(UINT16 offset, UINT8 data)
563void modeE7_switch(UINT16 offset, UINT8 data)
564564{
565565   bank_base[1] = CART + 0x800 * offset;
566566   memory_set_bankptr(1, bank_base[1]);
567567}
568void modeMN_RAM_switch(UINT16 offset, UINT8 data)
568void modeE7_RAM_switch(UINT16 offset, UINT8 data)
569569{
570570   memory_set_bankptr(9, extra_RAM + (4 + offset) * 256 );
571571}
r840r841
614614
615615/* These read handlers will return the byte from the new bank */
616616static  READ8_HANDLER(modeF8_switch_r) { modeF8_switch(offset, 0); return bank_base[1][0xff8 + offset]; }
617static  READ8_HANDLER(mode12_switch_r) { mode12_switch(offset, 0); return bank_base[1][0xff8 + offset]; }
617static  READ8_HANDLER(modeFA_switch_r) { modeFA_switch(offset, 0); return bank_base[1][0xff8 + offset]; }
618618static  READ8_HANDLER(modeF6_switch_r) { modeF6_switch(offset, 0); return bank_base[1][0xff6 + offset]; }
619static  READ8_HANDLER(mode32_switch_r) { mode32_switch(offset, 0); return bank_base[1][0xff4 + offset]; }
620static  READ8_HANDLER(modePB_switch_r) { modePB_switch(offset, 0); return bank_base[4][0x3e0 + offset]; }
621static  READ8_HANDLER(modeMN_switch_r) { modeMN_switch(offset, 0); return bank_base[1][0xfe0 + offset]; }
622static  READ8_HANDLER(modeMN_RAM_switch_r) { modeMN_RAM_switch(offset, 0); return 0; }
619static  READ8_HANDLER(modeF4_switch_r) { modeF4_switch(offset, 0); return bank_base[1][0xff4 + offset]; }
620static  READ8_HANDLER(modeE0_switch_r) { modeE0_switch(offset, 0); return bank_base[4][0x3e0 + offset]; }
621static  READ8_HANDLER(modeE7_switch_r) { modeE7_switch(offset, 0); return bank_base[1][0xfe0 + offset]; }
622static  READ8_HANDLER(modeE7_RAM_switch_r) { modeE7_RAM_switch(offset, 0); return 0; }
623623static  READ8_HANDLER(modeUA_switch_r) { modeUA_switch(offset, 0); return 0; }
624624static  READ8_HANDLER(modeDC_switch_r) { modeDC_switch(offset, 0); return bank_base[1][0xff0 + offset]; }
625625static  READ8_HANDLER(modeFV_switch_r) { modeFV_switch(offset, 0); return bank_base[1][0xfd0 + offset]; }
r840r841
627627
628628
629629static WRITE8_HANDLER(modeF8_switch_w) { modeF8_switch(offset, data); }
630static WRITE8_HANDLER(mode12_switch_w) { mode12_switch(offset, data); }
630static WRITE8_HANDLER(modeFA_switch_w) { modeFA_switch(offset, data); }
631631static WRITE8_HANDLER(modeF6_switch_w) { modeF6_switch(offset, data); }
632static WRITE8_HANDLER(mode32_switch_w) { mode32_switch(offset, data); }
633static WRITE8_HANDLER(modePB_switch_w) { modePB_switch(offset, data); }
634static WRITE8_HANDLER(modeMN_switch_w) { modeMN_switch(offset, data); }
635static WRITE8_HANDLER(modeMN_RAM_switch_w) { modeMN_RAM_switch(offset, data); }
636static WRITE8_HANDLER(modeTV_switch_w) { modeTV_switch(offset, data); }
632static WRITE8_HANDLER(modeF4_switch_w) { modeF4_switch(offset, data); }
633static WRITE8_HANDLER(modeE0_switch_w) { modeE0_switch(offset, data); }
634static WRITE8_HANDLER(modeE7_switch_w) { modeE7_switch(offset, data); }
635static WRITE8_HANDLER(modeE7_RAM_switch_w) { modeE7_RAM_switch(offset, data); }
636static WRITE8_HANDLER(mode3F_switch_w) { mode3F_switch(offset, data); }
637637static WRITE8_HANDLER(modeUA_switch_w) { modeUA_switch(offset, data); }
638638static WRITE8_HANDLER(modeDC_switch_w) { modeDC_switch(offset, data); }
639639static WRITE8_HANDLER(mode3E_switch_w) { mode3E_switch(offset, data); }
r840r841
941941
942942 */
943943
944static opbase_handler AV_old_opbase_handler;
945static int AVTimer;
944static opbase_handler FE_old_opbase_handler;
945static int FETimer;
946946
947OPBASE_HANDLER(modeAV_opbase_handler)
947OPBASE_HANDLER(modeFE_opbase_handler)
948948{
949   if ( ! AVTimer )
949   if ( ! FETimer )
950950   {
951951      /* Still cheating a bit here by looking bit 13 of the address..., but the high byte of the
952952         cpu should be the last byte that was on the data bus and so should determine the bank
r840r841
954954      bank_base[1] = CART + 0x1000 * ( ( address & 0x2000 ) ? 0 : 1 );
955955      memory_set_bankptr( 1, bank_base[1] );
956956      /* and restore old opbase handler */
957      memory_set_opbase_handler(0, AV_old_opbase_handler);
957      memory_set_opbase_handler(0, FE_old_opbase_handler);
958958   }
959959   else
960960   {
961961      /* Wait for one memory access to have passed (reading of new PCH either from code or from stack) */
962      AVTimer--;
962      FETimer--;
963963   }
964964   return address;
965965}
966966
967void modeAV_switch(UINT16 offset, UINT8 data)
967void modeFE_switch(UINT16 offset, UINT8 data)
968968{
969969   /* Retrieve last byte read by the cpu (for this mapping scheme this
970970      should be the last byte that was on the data bus
971971   */
972   AVTimer = 1;
973   AV_old_opbase_handler = memory_set_opbase_handler(0, modeAV_opbase_handler);
972   FETimer = 1;
973   FE_old_opbase_handler = memory_set_opbase_handler(0, modeFE_opbase_handler);
974974   catch_nextBranch();
975975}
976976
977static READ8_HANDLER(modeAV_switch_r)
977static READ8_HANDLER(modeFE_switch_r)
978978{
979   modeAV_switch(offset, 0 );
979   modeFE_switch(offset, 0 );
980980   return program_read_byte_8( 0xFE );
981981}
982982
983static WRITE8_HANDLER(modeAV_switch_w)
983static WRITE8_HANDLER(modeFE_switch_w)
984984{
985985   program_write_byte_8( 0xFE, data );
986   modeAV_switch(offset, 0 );
986   modeFE_switch(offset, 0 );
987987}
988988
989989static  READ8_HANDLER(current_bank_r)
r840r841
13721372
13731373   if (detect_modeDC()) mode = modeDC;
13741374   if (mode == 0xff) if (detect_mode3E()) mode = mode3E;
1375   if (mode == 0xff) if (detect_modeAV()) mode = modeAV;
1375   if (mode == 0xff) if (detect_modeFE()) mode = modeFE;
13761376   if (mode == 0xff) if (detect_modeSS()) mode = modeSS;
1377   if (mode == 0xff) if (detect_modePB()) mode = modePB;
1377   if (mode == 0xff) if (detect_modeE0()) mode = modeE0;
13781378   if (mode == 0xff) if (detect_modeCV()) mode = modeCV;
13791379   if (mode == 0xff) if (detect_modeFV()) mode = modeFV;
13801380   if (mode == 0xff) if (detect_modeJVP()) mode = modeJVP;
13811381   if (mode == 0xff) if (detect_modeUA()) mode = modeUA;
1382   if (mode == 0xff) if (detect_8K_modeTV()) mode = modeTV;
1383   if (mode == 0xff) if (detect_32K_modeTV()) mode = modeTV;
1384   if (mode == 0xff) if (detect_modeMN()) mode = modeMN;
1382   if (mode == 0xff) if (detect_8K_mode3F()) mode = mode3F;
1383   if (mode == 0xff) if (detect_32K_mode3F()) mode = mode3F;
1384   if (mode == 0xff) if (detect_modeE7()) mode = modeE7;
13851385
13861386   if (mode == 0xff) {
13871387      switch (cart_size)
r840r841
14001400         mode = modeDPC;
14011401         break;
14021402      case 0x3000:
1403         mode = mode12;
1403         mode = modeFA;
14041404         break;
14051405      case 0x4000:
14061406         mode = modeF6;
14071407         break;
14081408      case 0x8000:
1409         mode = mode32;
1409         mode = modeF4;
14101410         break;
14111411      case 0x10000:
14121412         mode = mode32in1;
14131413         break;
14141414      case 0x80000:
1415         mode = modeTV;
1415         mode = mode3F;
14161416         break;
14171417      }
14181418   }
r840r841
14521452      }
14531453      break;
14541454
1455   case mode12:
1455   case modeFA:
14561456      install_banks(1, 0x2000);
14571457      break;
14581458
r840r841
14601460      install_banks(1, 0x0000);
14611461      break;
14621462
1463   case mode32:
1463   case modeF4:
14641464      install_banks(1, 0x7000);
14651465      break;
14661466
1467   case modeAV:
1467   case modeFE:
14681468      install_banks(1, 0x0000);
14691469      break;
14701470
1471   case modePB:
1471   case modeE0:
14721472      install_banks(4, 0x1c00);
14731473      break;
14741474
1475   case modeTV:
1475   case mode3F:
14761476      install_banks(2, cart_size - 0x800);
14771477      number_banks = cart_size / 0x800;
14781478      break;
r840r841
14811481      install_banks(1, 0x1000);
14821482      break;
14831483
1484   case modeMN:
1484   case modeE7:
14851485      install_banks(2, 0x3800);
14861486      break;
14871487
r840r841
15421542      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ff9, 0, 0, modeF8_switch_r);
15431543      break;
15441544
1545   case mode12:
1546      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ffa, 0, 0, mode12_switch_w);
1547      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ffa, 0, 0, mode12_switch_r);
1545   case modeFA:
1546      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ffa, 0, 0, modeFA_switch_w);
1547      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff8, 0x1ffa, 0, 0, modeFA_switch_r);
15481548      break;
15491549
15501550   case modeF6:
r840r841
15531553      memory_set_opbase_handler( 0, modeF6_opbase );
15541554      break;
15551555
1556   case mode32:
1557      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff4, 0x1ffb, 0, 0, mode32_switch_w);
1558      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff4, 0x1ffb, 0, 0, mode32_switch_r);
1556   case modeF4:
1557      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff4, 0x1ffb, 0, 0, modeF4_switch_w);
1558      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff4, 0x1ffb, 0, 0, modeF4_switch_r);
15591559      break;
15601560
1561   case modePB:
1562      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1ff8, 0, 0, modePB_switch_w);
1563      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1ff8, 0, 0, modePB_switch_r);
1561   case modeE0:
1562      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1ff8, 0, 0, modeE0_switch_w);
1563      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1ff8, 0, 0, modeE0_switch_r);
15641564      break;
15651565
1566   case modeTV:
1567      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x00, 0x3f, 0, 0, modeTV_switch_w);
1566   case mode3F:
1567      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x00, 0x3f, 0, 0, mode3F_switch_w);
15681568      break;
15691569
15701570   case modeUA:
r840r841
15721572      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x200, 0x27f, 0, 0, modeUA_switch_r);
15731573      break;
15741574
1575   case modeMN:
1576      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1fe7, 0, 0, modeMN_switch_w);
1577      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1fe7, 0, 0, modeMN_switch_r);
1578      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe8, 0x1feb, 0, 0, modeMN_RAM_switch_w);
1579      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe8, 0x1feb, 0, 0, modeMN_RAM_switch_r);
1575   case modeE7:
1576      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1fe7, 0, 0, modeE7_switch_w);
1577      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe0, 0x1fe7, 0, 0, modeE7_switch_r);
1578      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe8, 0x1feb, 0, 0, modeE7_RAM_switch_w);
1579      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1fe8, 0x1feb, 0, 0, modeE7_RAM_switch_r);
15801580      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1800, 0x18ff, 0, 0, MWA8_BANK9);
15811581      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1900, 0x19ff, 0, 0, MRA8_BANK9);
15821582      memory_set_bankptr( 9, extra_RAM + 4 * 256 );
r840r841
15871587      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1ff0, 0x1ff0, 0, 0, modeDC_switch_r);
15881588      break;
15891589
1590   case modeAV:
1591      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x01fe, 0x01fe, 0, 0, modeAV_switch_w);
1592      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x01fe, 0x01fe, 0, 0, modeAV_switch_r);
1590   case modeFE:
1591      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x01fe, 0x01fe, 0, 0, modeFE_switch_w);
1592      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x01fe, 0x01fe, 0, 0, modeFE_switch_r);
15931593      break;
15941594
15951595   case mode3E:
r840r841
16471647
16481648   /* set up extra RAM */
16491649
1650   if (mode == mode12)
1650   if (mode == modeFA)
16511651   {
16521652      memory_install_write8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1000, 0x10ff, 0, 0, MWA8_BANK9);
16531653      memory_install_read8_handler(0, ADDRESS_SPACE_PROGRAM, 0x1100, 0x11ff, 0, 0, MRA8_BANK9);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team