Previous 199869 Revisions Next

r19869 Thursday 27th December, 2012 at 20:47:12 UTC by Wilbert Pol
(MESS) a2600.c: Fixed supercharger regression. (nw)
[src/emu/cpu/m6502]m6502.h
[src/mess/drivers]a2600.c

trunk/src/emu/cpu/m6502/m6502.h
r19868r19869
5757
5858   UINT64 get_cycle();
5959   bool get_sync() const { return sync; }
60   void disable_direct() { direct_disabled = true; }
6061
6162protected:
6263   class memory_interface {
trunk/src/mess/drivers/a2600.c
r19868r19869
7272   unsigned m_modeSS_write_enabled;
7373   unsigned m_modeSS_high_ram_enabled;
7474   unsigned m_modeSS_diff_adjust;
75   UINT16 m_modeSS_last_address;
7576   unsigned m_FVlocked;
7677   UINT16 m_current_screen_height;
7778   int m_FETimer;
r19868r19869
7980   direct_update_delegate m_FE_old_opbase_handler;
8081
8182   DECLARE_DIRECT_UPDATE_MEMBER(modeF6_opbase);
82   DECLARE_DIRECT_UPDATE_MEMBER(modeSS_opbase);
8383   DECLARE_DIRECT_UPDATE_MEMBER(modeDPC_opbase_handler);
8484   DECLARE_DIRECT_UPDATE_MEMBER(modeFE_opbase_handler);
8585   DECLARE_READ8_MEMBER(modeF8_switch_r);
r19868r19869
888888   return address;
889889}
890890
891DIRECT_UPDATE_MEMBER(a2600_state::modeSS_opbase)
892{
893   if ( address & 0x1000 )
894   {
895      if ( ! direct.space().debugger_access() )
896      {
897         if ( address & 0x800 )
898         {
899            direct.explicit_configure(( address & 0xf800 ), ( address & 0xf800 ) | 0x7ff, 0x7ff, m_bank_base[2]);
900         }
901         else
902         {
903            direct.explicit_configure(( address & 0xf800 ), ( address & 0xf800 ) | 0x7ff, 0x7ff, m_bank_base[1]);
904         }
905         return ~0;
906      }
907   }
908   return address;
909}
910891
911892READ8_MEMBER(a2600_state::modeSS_r)
912893{
913894   UINT8 data = ( offset & 0x800 ) ? m_bank_base[2][offset & 0x7FF] : m_bank_base[1][offset];
914895
896   if ( space.debugger_access() )
897   {
898      return data;
899   }
900
915901   //logerror("%04X: read from modeSS area offset = %04X\n", machine().device("maincpu")->safe_pc(), offset);
916902   /* Check for control register "write" */
917903   if ( offset == 0xFF8 )
r19868r19869
964950      }
965951      membank("bank1")->set_base(m_bank_base[1] );
966952      membank("bank2")->set_base(m_bank_base[2] );
953      // Make sure we do not trigger a spurious RAM write
954      m_modeSS_byte_started -= 5;
967955   }
968956   else if ( offset == 0xFF9 )
969957   {
r19868r19869
978966      {
979967         data = 0x01;
980968      }
969      // Make sure we do not trigger a spurious RAM write
970      m_modeSS_byte_started -= 5;
981971   }
982972   else
983973   {
984974      /* Possible RAM write */
985975      if ( m_modeSS_write_enabled )
986976      {
977         /* Check for dummy read from same address */
978         if ( m_modeSS_last_address == offset )
979         {
980            m_modeSS_diff_adjust += 1;
981         }
982
987983         int diff = machine().device<cpu_device>("maincpu")->total_cycles() - m_modeSS_byte_started;
988984         //logerror("%04X: offset = %04X, %d\n", machine().device("maincpu")->safe_pc(), offset, diff);
989985         if ( diff - m_modeSS_diff_adjust == 5 )
r19868r19869
10071003         {
10081004            m_modeSS_byte = offset;
10091005            m_modeSS_byte_started = machine().device<cpu_device>("maincpu")->total_cycles();
1010         }
1011         /* Check for dummy read from same address */
1012         if ( diff == 2 )
1013         {
1014            m_modeSS_diff_adjust = 1;
1015         }
1016         else
1017         {
10181006            m_modeSS_diff_adjust = 0;
10191007         }
1008         m_modeSS_last_address = offset;
10201009      }
10211010      else if ( offset < 0x0100 )
10221011      {
10231012         m_modeSS_byte = offset;
10241013         m_modeSS_byte_started = machine().device<cpu_device>("maincpu")->total_cycles();
1014         m_modeSS_last_address = offset;
1015         m_modeSS_diff_adjust = 0;
10251016      }
10261017   }
1027   /* Because the mame core caches opcode data and doesn't perform reads like normal */
1028   /* we have to put in this little hack here to get Suicide Mission to work. */
1029   if ( offset != 0xFF8 && ( machine().device("maincpu")->safe_pc() & 0x1FFF ) == 0x1FF8 )
1030   {
1031      modeSS_r( space, 0xFF8 );
1032   }
10331018   return data;
10341019}
10351020
r19868r19869
14811466   m_current_reset_bank_counter = 0xFF;
14821467   m_dpc.oscillator = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_state::modeDPC_timer_callback),this));
14831468   m_cart = CART_MEMBER;
1469   m_modeSS_last_address = 0;
14841470}
14851471
14861472
r19868r19869
18351821      membank("bank2")->set_base(m_bank_base[2] );
18361822      m_modeSS_write_enabled = 0;
18371823      m_modeSS_byte_started = 0;
1838      space.set_direct_update_handler(direct_update_delegate(FUNC(a2600_state::modeSS_opbase), this));
18391824      /* The Supercharger has no motor control so just enable it */
18401825      machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(CASSETTE_MOTOR_ENABLED, CASSETTE_MOTOR_DISABLED );
18411826      break;
r19868r19869
19491934static MACHINE_CONFIG_START( a2600, a2600_state )
19501935   /* basic machine hardware */
19511936   MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_NTSC / 3)   /* actually M6507 */
1937   MCFG_M6502_DISABLE_DIRECT()
19521938   MCFG_CPU_PROGRAM_MAP(a2600_mem)
19531939
19541940   MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600)
r19868r19869
19861972   /* basic machine hardware */
19871973   MCFG_CPU_ADD("maincpu", M6502, MASTER_CLOCK_PAL / 3)    /* actually M6507 */
19881974   MCFG_CPU_PROGRAM_MAP(a2600_mem)
1975   MCFG_M6502_DISABLE_DIRECT()
19891976
19901977   MCFG_MACHINE_START_OVERRIDE(a2600_state,a2600)
19911978

Previous 199869 Revisions Next


© 1997-2024 The MAME Team