Previous 199869 Revisions Next

r20414 Wednesday 23rd January, 2013 at 19:40:16 UTC by Angelo Salese
Guessed that if SMPC calls the same state for a CPU reset line it executes less code. Fixes Greatest Nine '97
[src/mame/drivers]saturn.c
[src/mame/includes]stv.h
[src/mame/machine]smpc.c

trunk/src/mame/includes/stv.h
r20413r20414
102102      UINT8 SMEM[4];
103103      UINT8 intback;
104104      UINT8 rtc_data[7];
105      UINT8 slave_on;
105106   }m_smpc;
106107
107108   struct {
trunk/src/mame/drivers/saturn.c
r20413r20414
386386      case 0xa4/4: /* IRQ control */
387387         if(LOG_SCU) logerror("PC=%08x IRQ status reg set:%08x %08x\n",space.device().safe_pc(),m_scu_regs[41],mem_mask);
388388         m_scu.ist &= m_scu_regs[offset];
389         //scu_test_pending_irq();
389390         break;
390391      case 0xa8/4: if(LOG_SCU) logerror("A-Bus IRQ ACK %08x\n",m_scu_regs[42]); break;
391392      case 0xc4/4: if(LOG_SCU) logerror("SCU SDRAM set: %02x\n",m_scu_regs[49]); break;
r20413r20414
19992000
20002001   m_en_68k = 0;
20012002   m_NMI_reset = 0;
2003   m_smpc.slave_on = 0;
20022004
20032005   m_scu_regs[31] = 0; //DMA_STATUS = 0;
20042006
trunk/src/mame/machine/smpc.c
r20413r20414
225225   state->m_slave->set_input_line(INPUT_LINE_RESET, param ? ASSERT_LINE : CLEAR_LINE);
226226   state->m_smpc.OREG[31] = param + 0x02; //read-back for last command issued
227227   state->m_smpc.SF = 0x00; //clear hand-shake flag
228   state->m_smpc.slave_on = param;
229//   printf("%d %d\n",machine.primary_screen->hpos(),machine.primary_screen->vpos());
228230}
229231
230232static TIMER_CALLBACK( smpc_sound_enable )
r20413r20414
612614   state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
613615}
614616
615static void smpc_nmi_set(running_machine &machine,UINT8 cmd)
617static TIMER_CALLBACK( smpc_nmi_set )
616618{
617619   saturn_state *state = machine.driver_data<saturn_state>();
618620
619   state->m_NMI_reset = cmd;
621//   printf("%d %d\n",machine.primary_screen->hpos(),machine.primary_screen->vpos());
622   state->m_NMI_reset = param;
623   /* put issued command in OREG31 */
624   state->m_smpc.OREG[31] = 0x19 + param;
625   /* clear hand-shake flag */
626   state->m_smpc.SF = 0x00;
627
620628   //state->m_smpc.OREG[0] = (0x80) | ((state->m_NMI_reset & 1) << 6);
621629}
622630
r20413r20414
640648      //case 0x01: Master OFF?
641649      case 0x02:
642650      case 0x03:
643         if(LOG_SMPC) printf ("SMPC: Slave %s\n",(data & 1) ? "off" : "on");
644         space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_slave_enable),data & 1);
651         if(LOG_SMPC) printf ("SMPC: Slave %s %d %d\n",(data & 1) ? "off" : "on",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos());
652         if((data & 1) != (state->m_smpc.slave_on & 1))
653            space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_slave_enable),data & 1);
654         else /* guess: if Slave state is equal to the previous one, just execute less code. ask Greatest Nine '97. Unless SMPC is really so fast ... */
655            space.machine().scheduler().timer_set(attotime::from_usec(5), FUNC(smpc_slave_enable),data & 1);
645656         break;
646657      case 0x06:
647658      case 0x07:
r20413r20414
712723         break;
713724      case 0x19:
714725      case 0x1a:
715         if(LOG_SMPC) printf ("SMPC: NMI %sable\n",data & 1 ? "Dis" : "En");
716         smpc_nmi_set(space.machine(),data & 1);
726         if(LOG_SMPC) printf ("SMPC: NMI %sable %d %d\n",data & 1 ? "Dis" : "En",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos());
727         space.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(smpc_nmi_set),data & 1);
717728         break;
718729      default:
719730         printf ("cpu '%s' (PC=%08X) SMPC: undocumented Command %02x\n", space.device().tag(), space.device().safe_pc(), data);
r20413r20414
769780      smpc_comreg_exec(space,data,1);
770781
771782      // we've processed the command, clear status flag
772      if(data != 0x10 && data != 0x02 && data != 0x03 && data != 0xe && data != 0xf)
783      if(data != 0x10 && data != 0x02 && data != 0x03 && data != 0xe && data != 0xf && data != 0x19 && data != 0x1a)
773784      {
774785         state->m_smpc.OREG[31] = data; //read-back command
775786         state->m_smpc.SF = 0x00;
r20413r20414
856867      return_data = state->m_smpc.SR;
857868
858869   if (offset == 0x63)
870   {
871      //printf("SF %d %d\n",space.machine().primary_screen->hpos(),space.machine().primary_screen->vpos());
859872      return_data = state->m_smpc.SF;
873   }
860874
861875   if (offset == 0x75 || offset == 0x77)//PDR1/2 read
862876   {
r20413r20414
926940      smpc_comreg_exec(space,data,0);
927941
928942      // we've processed the command, clear status flag
929      if(data != 0x10 && data != 2 && data != 3 && data != 6 && data != 7 && data != 0x0e && data != 0x0f)
943      if(data != 0x10 && data != 2 && data != 3 && data != 6 && data != 7 && data != 0x0e && data != 0x0f && data != 0x19 && data != 0x1a)
930944      {
931945         state->m_smpc.OREG[31] = data; //read-back for last command issued
932946         state->m_smpc.SF = 0x00; //clear hand-shake flag

Previous 199869 Revisions Next


© 1997-2024 The MAME Team