~ubuntu-branches/ubuntu/precise/mame/precise-proposed

« back to all changes in this revision

Viewing changes to src/mame/machine/scudsp.c

  • Committer: Package Import Robot
  • Author(s): Cesare Falco
  • Date: 2011-11-30 18:50:10 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20111130185010-02hcxybht1mn082w
Tags: 0.144-0ubuntu1
* New upstream release (LP: #913550)
* mame.install:
  - Added artwork/ images to be used with -effect switch
  - Be more selective with hash/ contents
* contrib/mame.ini: added /usr/share/games/mame/artwork/ to artpath

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/******************************************************************************************
2
 
System Control Unit - DSP emulator version 0.06
 
2
System Control Unit - DSP emulator version 0.09
3
3
 
4
4
Written by Angelo Salese & Mariusz Wojcieszek
5
5
 
6
6
Changelog:
 
7
110807: Angelo Salese
 
8
- Allow the Program Counter to be read-backable from SH-2, needed by Virtua Fighter to not
 
9
  get stuck on "round 1" announcement;
 
10
 
 
11
110806: Angelo Salese
 
12
- Allows reading from non-work ram h areas;
 
13
- Fixed DMA add values;
 
14
- Fixed a MVI condition shift flag bug, now Sega Saturn produces sound during splash screen;
 
15
- Removed left-over IRQ;
 
16
 
 
17
110722: Angelo Salese
 
18
- Added DSP IRQ command, tested with "The King of Boxing"
 
19
 
7
20
110527: Angelo Salese
8
21
- Fixed incorrectly setted execute flag clearance, allows animation of the Sega Saturn
9
22
  splash screen;
320
333
        return 0;
321
334
}
322
335
 
323
 
void dsp_prg_ctrl(address_space *space, UINT32 data)
324
 
{
325
 
        saturn_state *state = space->machine().driver_data<saturn_state>();
 
336
UINT32 dsp_prg_ctrl_r(address_space *space)
 
337
{
 
338
        saturn_state *state = space->machine().driver_data<saturn_state>();
 
339
 
 
340
        return (state->m_scu_regs[0x80/4] & 0x06ff8000) | (dsp_reg.pc & 0xff);
 
341
}
 
342
 
 
343
void dsp_prg_ctrl_w(address_space *space, UINT32 data)
 
344
{
 
345
        saturn_state *state = space->machine().driver_data<saturn_state>();
 
346
 
326
347
        if(LEF) dsp_reg.pc = (data & 0xff);
327
348
        if(EXF) dsp_execute_program(space);
328
 
        if(EF && (!(state->m_scu_regs[40] & 0x0020)))
329
 
                cputag_set_input_line_and_vector(space->machine(), "maincpu", 0xa, HOLD_LINE , 0x45);
330
349
}
331
350
 
332
351
void dsp_prg_data(UINT32 data)
584
603
 
585
604
        if ( opcode & 0x2000000 )
586
605
        {
587
 
                if ( dsp_compute_condition( space, (opcode & 0x3F80000 ) >> 18 ) )
 
606
                if ( dsp_compute_condition( space, (opcode & 0x3F80000 ) >> 19 ) )
588
607
                {
589
608
                        value = opcode & 0x7ffff;
590
609
                        if ( value & 0x40000 ) value |= 0xfff80000;
609
628
        UINT32 dir_from_D0 = (opcode & 0x1000 ) >> 12;
610
629
        UINT32 transfer_cnt = 0;
611
630
        UINT32 source = 0, dest = 0;
612
 
        UINT32 dsp_mem = (opcode & 0x700) >> 8;
 
631
        UINT32 dsp_mem = (opcode & 0x300) >> 8;
613
632
        UINT32 counter = 0;
614
633
        UINT32 data;
615
634
 
619
638
        if ( opcode & 0x2000 )
620
639
        {
621
640
                transfer_cnt = dsp_get_source_mem_value( opcode & 0xf );
622
 
                switch ( add & 0x1 )
 
641
                switch ( add & 0x7 )
623
642
                {
624
 
                  case 0: add = 2; break;
625
 
                  case 1: add = 4; break;
 
643
                        case 0: add = 0; break;
 
644
                        case 1: add = 4; break;
 
645
                        default: add = 4; break;
626
646
                }
627
647
        }
628
648
        else
665
685
                        }
666
686
                        else
667
687
                        {
668
 
                                data = 0;
 
688
                                data = (space->read_word(source)<<16) | space->read_word(source+2);
669
689
                                //popmessage( "Bad DSP DMA mem read = %08X", source );
670
690
#if DEBUG_DSP
671
 
                                fprintf( log_file, "/*Bad DSP DMA mem read = %08X*/\n", source );
 
691
                                //fprintf( log_file, "/*Bad DSP DMA mem read = %08X*/\n", source );
672
692
#endif
673
693
                        }
674
694
 
675
695
#if DEBUG_DSP
676
696
            fprintf( log_file, "%08X,\n", data );
677
697
#endif
678
 
 
679
698
                        dsp_set_dest_dma_mem( dsp_mem, data, counter );
680
699
                        source += add;
681
700
                }
709
728
                }
710
729
        }
711
730
 
 
731
        /* TODO: move this behind a timer */
712
732
        T0F_0;
713
733
}
714
734
 
729
749
        }
730
750
}
731
751
 
 
752
static TIMER_CALLBACK( dsp_ended )
 
753
{
 
754
        saturn_state *state = machine.driver_data<saturn_state>();
 
755
 
 
756
        if(!(state->m_scu.ism & IRQ_DSP_END))
 
757
                device_set_input_line_and_vector(state->m_maincpu, 0xa, HOLD_LINE, 0x45);
 
758
        else
 
759
                state->m_scu.ist |= (IRQ_DSP_END);
 
760
 
 
761
        EF_1;
 
762
}
 
763
 
732
764
static void dsp_end( address_space *dmaspace )
733
765
{
734
766
        saturn_state *state = dmaspace->machine().driver_data<saturn_state>();
736
768
        if(opcode & 0x08000000)
737
769
        {
738
770
                /*ENDI*/
739
 
                EF_1;
 
771
                dmaspace->machine().scheduler().timer_set(attotime::from_usec(300), FUNC(dsp_ended));
740
772
        }
741
773
 
742
774
        EXF_0; /* END / ENDI */
1189
1221
        {
1190
1222
                data[0] = op & 0x7FFFF;
1191
1223
                data[1] = (op & 0x3C000000) >> 26;
1192
 
                data[2] = (op & 0x3F80000 ) >> 18;
 
1224
                data[2] = (op & 0x3F80000 ) >> 19;
1193
1225
                dsp_dasm_prefix( MVI_Command[1], buffer, data ); /* TODO: bad mem*/
1194
1226
        }
1195
1227
        else