Previous 15994 Revisions Next

r12435 Monday 1st August, 2011 at 02:02:51 UTC by Angelo Salese
SMPC hand-shake flag should be in the command timer(s), and yes, Iron Storm / Daisenryaku boots with that
[src/mame/machine]smpc.c

src/mame/machine/smpc.c
r12434r12435
173173//  if (offset == 0x33) //country code
174174//      return_data = input_port_read(machine, "FAKE");
175175
176   //if(LOG_SMPC) logerror ("cpu %s (PC=%08X) SMPC: Read from Byte Offset %02x Returns %02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, return_data);
176   //if(LOG_SMPC) printf ("cpu %s (PC=%08X) SMPC: Read from Byte Offset %02x Returns %02x\n", space->device().tag(), cpu_get_pc(&space->device()), offset, return_data);
177177
178178
179179   return return_data;
r12434r12435
363363   }
364364
365365   //  /*This is for RTC,cartridge code and similar stuff...*/
366   //if(LOG_SMPC) logerror ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline);
366   //if(LOG_SMPC) printf ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline);
367367   if(!(state->m_scu.ism & IRQ_SMPC))
368368      device_set_input_line_and_vector(state->m_maincpu, 8, HOLD_LINE, 0x47);
369369   else
370370      state->m_scu.ist |= (IRQ_SMPC);
371
372   /* clear hand-shake flag */
373   state->m_smpc_ram[0x63] = 0x00;
371374}
372375
373376static void smpc_rtc_write(running_machine &machine)
r12434r12435
413416   system_time systime;
414417   space->machine().base_datetime(systime);
415418
416//  if(LOG_SMPC) logerror ("8-bit SMPC Write to Offset %02x with Data %02x\n", offset, data);
419//  if(LOG_SMPC) printf ("8-bit SMPC Write to Offset %02x with Data %02x\n", offset, data);
417420   state->m_smpc_ram[offset] = data;
418421
419422   if(offset == 0x75)
r12434r12435
444447        */
445448      //popmessage("PDR2 = %02x",state->m_smpc_ram[0x77]);
446449
447      if(LOG_SMPC) logerror("SMPC: M68k %s\n",(state->m_smpc_ram[0x77] & 0x10) ? "off" : "on");
450      if(LOG_SMPC) printf("SMPC: M68k %s\n",(state->m_smpc_ram[0x77] & 0x10) ? "off" : "on");
448451      cputag_set_input_line(space->machine(), "audiocpu", INPUT_LINE_RESET, (state->m_smpc_ram[0x77] & 0x10) ? ASSERT_LINE : CLEAR_LINE);
449452      state->m_en_68k = ((state->m_smpc_ram[0x77] & 0x10) >> 4) ^ 1;
450453
451      //if(LOG_SMPC) logerror("SMPC: ram [0x77] = %02x\n",state->m_smpc_ram[0x77]);
454      //if(LOG_SMPC) printf("SMPC: ram [0x77] = %02x\n",state->m_smpc_ram[0x77]);
452455      state->m_smpc.PDR2 = (data & 0x60);
453456   }
454457
r12434r12435
474477      switch (data)
475478      {
476479         case 0x00:
477            if(LOG_SMPC) logerror ("SMPC: Master ON\n");
480            if(LOG_SMPC) printf ("SMPC: Master ON\n");
478481            smpc_master_on(space->machine());
479482            break;
480483         //in theory 0x01 is for Master OFF,but obviously is not used.
481484         case 0x02:
482485         case 0x03:
483            if(LOG_SMPC) logerror ("SMPC: Slave %s\n",(data & 1) ? "off" : "on");
486            if(LOG_SMPC) printf ("SMPC: Slave %s\n",(data & 1) ? "off" : "on");
484487            smpc_slave_enable(space->machine(),(data & 1));
485488            break;
486489         case 0x06:
487490         case 0x07:
488            if(LOG_SMPC) logerror ("SMPC: Sound %s, ignored\n",(data & 1) ? "off" : "on");
491            if(LOG_SMPC) printf ("SMPC: Sound %s, ignored\n",(data & 1) ? "off" : "on");
489492            break;
490493         /*CD (SH-1) ON/OFF,guess that this is needed for Sports Fishing games...*/
491494         //case 0x08:
492495         //case 0x09:
493496         case 0x0d:
494            if(LOG_SMPC) logerror ("SMPC: System Reset\n");
497            if(LOG_SMPC) printf ("SMPC: System Reset\n");
495498            smpc_system_reset(space->machine());
496499            break;
497500         case 0x0e:
498501         case 0x0f:
499            if(LOG_SMPC) logerror ("SMPC: Change Clock to %s\n",data & 1 ? "320" : "352");
502            if(LOG_SMPC) printf ("SMPC: Change Clock to %s\n",data & 1 ? "320" : "352");
500503            smpc_change_clock(space->machine(),data & 1);
501504            break;
502505         /*"Interrupt Back"*/
503506         case 0x10:
504            if(LOG_SMPC) logerror ("SMPC: Status Acquire\n");
507            if(LOG_SMPC) printf ("SMPC: Status Acquire\n");
505508            space->machine().scheduler().timer_set(attotime::from_msec(16), FUNC(smpc_intback),1); //TODO: variable time
506509            break;
507510         /* RTC write*/
508511         case 0x16:
509            if(LOG_SMPC) logerror("SMPC: RTC write\n");
512            if(LOG_SMPC) printf("SMPC: RTC write\n");
510513            smpc_rtc_write(space->machine());
511514            break;
512515         /* SMPC memory setting*/
513516         case 0x17:
514            if(LOG_SMPC) logerror ("SMPC: memory setting\n");
517            if(LOG_SMPC) printf ("SMPC: memory setting\n");
515518            //smpc_memory_setting(space->machine());
516519            break;
517520         case 0x18:
518            if(LOG_SMPC) logerror ("SMPC: NMI request\n");
521            if(LOG_SMPC) printf ("SMPC: NMI request\n");
519522            smpc_nmi_req(space->machine());
520523            break;
521524         case 0x19:
522525         case 0x1a:
523            if(LOG_SMPC) logerror ("SMPC: NMI %sable\n",data & 1 ? "Dis" : "En");
526            if(LOG_SMPC) printf ("SMPC: NMI %sable\n",data & 1 ? "Dis" : "En");
524527            smpc_nmi_set(space->machine(),data & 1);
525528            break;
526529         default:
r12434r12435
650653      switch (data)
651654      {
652655         case 0x00:
653            if(LOG_SMPC) logerror ("SMPC: Master ON\n");
656            if(LOG_SMPC) printf ("SMPC: Master ON\n");
654657            smpc_master_on(space->machine());
655658            break;
656659         //in theory 0x01 is for Master OFF
657660         case 0x02:
658661         case 0x03:
659            if(LOG_SMPC) logerror ("SMPC: Slave %s\n",(data & 1) ? "off" : "on");
662            if(LOG_SMPC) printf ("SMPC: Slave %s\n",(data & 1) ? "off" : "on");
660663            smpc_slave_enable(space->machine(),data & 1);
661664            break;
662665         case 0x06:
663666         case 0x07:
664            if(LOG_SMPC) logerror ("SMPC: Sound %s\n",(data & 1) ? "off" : "on");
667            if(LOG_SMPC) printf ("SMPC: Sound %s\n",(data & 1) ? "off" : "on");
665668            smpc_sound_enable(space->machine(),data & 1);
666669            break;
667670         /*CD (SH-1) ON/OFF,guess that this is needed for Sports Fishing games...*/
668671         //case 0x08:
669672         //case 0x09:
670673         case 0x0d:
671            if(LOG_SMPC) logerror ("SMPC: System Reset\n");
674            if(LOG_SMPC) printf ("SMPC: System Reset\n");
672675            smpc_system_reset(space->machine());
673676            break;
674677         case 0x0e:
675678         case 0x0f:
676            if(LOG_SMPC) logerror ("SMPC: Change Clock to %s\n",data & 1 ? "320" : "352");
679            if(LOG_SMPC) printf ("SMPC: Change Clock to %s\n",data & 1 ? "320" : "352");
677680            smpc_change_clock(space->machine(),data & 1);
678681            break;
679682         /*"Interrupt Back"*/
680683         case 0x10:
681                if(LOG_SMPC) logerror ("SMPC: Status Acquire (IntBack)\n");
684                if(LOG_SMPC) printf ("SMPC: Status Acquire (IntBack)\n");
682685            space->machine().scheduler().timer_set(attotime::from_msec(16), FUNC(smpc_intback),0); //TODO: variable time
683686            break;
684687         /* RTC write*/
685688         case 0x16:
686            if(LOG_SMPC) logerror("SMPC: RTC write\n");
689            if(LOG_SMPC) printf("SMPC: RTC write\n");
687690            smpc_rtc_write(space->machine());
688691            break;
689692         /* SMPC memory setting*/
690693         case 0x17:
691            if(LOG_SMPC) logerror ("SMPC: memory setting\n");
694            if(LOG_SMPC) printf ("SMPC: memory setting\n");
692695            smpc_memory_setting(space->machine());
693696            break;
694697         case 0x18:
695            if(LOG_SMPC) logerror ("SMPC: NMI request\n");
698            if(LOG_SMPC) printf ("SMPC: NMI request\n");
696699            smpc_nmi_req(space->machine());
697700            break;
698701         case 0x19:
699702         case 0x1a:
700            if(LOG_SMPC) logerror ("SMPC: NMI %sable\n",data & 1 ? "Dis" : "En");
703            if(LOG_SMPC) printf ("SMPC: NMI %sable\n",data & 1 ? "Dis" : "En");
701704            smpc_nmi_set(space->machine(),data & 1);
702705            break;
703706         default:
r12434r12435
706709
707710      // we've processed the command, clear status flag
708711      state->m_smpc_ram[0x5f] = data; //read-back for last command issued
709      state->m_smpc_ram[0x63] = 0x00;
712      if(data != 0x10)
713         state->m_smpc_ram[0x63] = 0x00; //clear hand-shake flag
710714      /*TODO:emulate the timing of each command...*/
711715   }
712716}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team