~ubuntu-branches/ubuntu/lucid/sdlmame/lucid

« back to all changes in this revision

Viewing changes to src/mame/audio/atarijsa.c

  • Committer: Bazaar Package Importer
  • Author(s): Cesare Falco
  • Date: 2009-11-03 17:10:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20091103171015-6hop4ory5lxnumpn
Tags: 0.135-0ubuntu1
* New upstream release - Closes (LP: #403212)
* debian/watch: unstable releases are no longer detected
* mame.ini: added the cheat subdirectories to cheatpath so zipped
  cheatfiles will be searched too
* renamed crsshair subdirectory to crosshair to reflect upstream change
* mame.ini: renamed references to crosshair subdirectory (see above)

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
 
33
33
#include "driver.h"
34
34
#include "cpu/m6502/m6502.h"
35
 
#include "sound/5220intf.h"
 
35
#include "sound/tms5220.h"
36
36
#include "sound/2151intf.h"
37
37
#include "sound/okim6295.h"
38
38
#include "sound/pokey.h"
59
59
static const device_config *oki6295;
60
60
static const device_config *oki6295_l, *oki6295_r;
61
61
 
62
 
static UINT32 oki6295_bank_base;
63
 
 
64
62
static UINT8 overall_volume;
65
63
static UINT8 pokey_volume;
66
64
static UINT8 ym2151_volume;
79
77
 
80
78
/*************************************
81
79
 *
 
80
 *  OKI banked address map
 
81
 *
 
82
 *************************************/
 
83
 
 
84
static ADDRESS_MAP_START( jsa3_oki_map, 0, 8 )
 
85
        AM_RANGE(0x00000, 0x1ffff) AM_ROMBANK(12)
 
86
        AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK(13)
 
87
ADDRESS_MAP_END
 
88
 
 
89
static ADDRESS_MAP_START( jsa3_oki2_map, 0, 8 )
 
90
        AM_RANGE(0x00000, 0x1ffff) AM_ROMBANK(14)
 
91
        AM_RANGE(0x20000, 0x3ffff) AM_ROMBANK(15)
 
92
ADDRESS_MAP_END
 
93
 
 
94
 
 
95
 
 
96
/*************************************
 
97
 *
82
98
 *  State save
83
99
 *
84
100
 *************************************/
88
104
        state_save_register_global(machine, speech_data);
89
105
        state_save_register_global(machine, last_ctl);
90
106
 
91
 
        state_save_register_global(machine, oki6295_bank_base);
92
 
 
93
107
        state_save_register_global(machine, overall_volume);
94
108
        state_save_register_global(machine, pokey_volume);
95
109
        state_save_register_global(machine, ym2151_volume);
137
151
 
138
152
        /* initialize JSA III ADPCM */
139
153
        {
140
 
                static const char *const regions[] = { "adpcm", "adcpml", "adpcmr" };
 
154
                static const char *const regions[] = { "adpcm", "adpcml", "adpcmr" };
141
155
                int rgn;
142
156
 
143
157
                /* expand the ADPCM data to avoid lots of memcpy's during gameplay */
145
159
                for (rgn = 0; rgn < ARRAY_LENGTH(regions); rgn++)
146
160
                {
147
161
                        UINT8 *base = memory_region(machine, regions[rgn]);
148
 
                        if (base != NULL && memory_region_length(machine, regions[rgn]) >= 0x100000)
 
162
                        if (base != NULL && memory_region_length(machine, regions[rgn]) >= 0x80000)
149
163
                        {
150
 
                                memcpy(&base[0x00000], &base[0x80000], 0x20000);
151
 
                                memcpy(&base[0x40000], &base[0x80000], 0x20000);
152
 
                                memcpy(&base[0x80000], &base[0xa0000], 0x20000);
153
 
 
154
 
                                memcpy(&base[0x20000], &base[0xe0000], 0x20000);
155
 
                                memcpy(&base[0x60000], &base[0xe0000], 0x20000);
156
 
                                memcpy(&base[0xa0000], &base[0xe0000], 0x20000);
 
164
                                int banknum = (rgn != 2) ? 12 : 14;
 
165
                                memory_configure_bank(machine, banknum, 0, 2, base + 0x00000, 0x00000);
 
166
                                memory_configure_bank(machine, banknum, 2, 2, base + 0x20000, 0x20000);
 
167
                                memory_set_bankptr(machine, banknum + 1, base + 0x60000);
157
168
                        }
158
169
                }
159
170
        }
168
179
        /* reset the static states */
169
180
        speech_data = 0;
170
181
        last_ctl = 0;
171
 
        oki6295_bank_base = 0x00000;
172
182
        overall_volume = 100;
173
183
        pokey_volume = 100;
174
184
        ym2151_volume = 100;
216
226
                        if (!(input_port_read(space->machine, test_port) & test_mask)) result ^= 0x80;
217
227
                        if (atarigen_cpu_to_sound_ready) result ^= 0x40;
218
228
                        if (atarigen_sound_to_cpu_ready) result ^= 0x20;
219
 
                        if (tms5220 == NULL || tms5220_ready_r(tms5220)) result ^= 0x10;
 
229
                        if (tms5220 == NULL || !tms5220_readyq_r(tms5220)) result ^= 0x10;
220
230
                        break;
221
231
 
222
232
                case 0x006:             /* /IRQACK */
520
530
            */
521
531
 
522
532
                        /* update the OKI bank */
523
 
                        oki6295_bank_base = (0x40000 * ((data >> 1) & 1)) | (oki6295_bank_base & 0x80000);
524
 
                        if (oki6295 != NULL) okim6295_set_bank_base(oki6295, oki6295_bank_base);
 
533
                        if (oki6295 != NULL)
 
534
                                memory_set_bank(space->machine, 12, (memory_get_bank(space->machine, 12) & 2) | ((data >> 1) & 1));
525
535
 
526
536
                        /* update the bank */
527
537
                        memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
545
555
            */
546
556
 
547
557
                        /* update the OKI bank */
548
 
                        oki6295_bank_base = (0x80000 * ((data >> 4) & 1)) | (oki6295_bank_base & 0x40000);
549
 
                        if (oki6295 != NULL) okim6295_set_bank_base(oki6295, oki6295_bank_base);
 
558
                        if (oki6295 != NULL)
 
559
                                memory_set_bank(space->machine, 12, (memory_get_bank(space->machine, 12) & 1) | ((data >> 3) & 2));
550
560
 
551
561
                        /* update the volumes */
552
562
                        ym2151_volume = ((data >> 1) & 7) * 100 / 7;
651
661
            */
652
662
 
653
663
                        /* update the OKI bank */
654
 
                        oki6295_bank_base = (0x40000 * ((data >> 1) & 1)) | (oki6295_bank_base & 0x80000);
655
 
                        okim6295_set_bank_base(devtag_get_device(space->machine, "adpcml"), oki6295_bank_base);
 
664
                        memory_set_bank(space->machine, 12, (memory_get_bank(space->machine, 12) & 2) | ((data >> 1) & 1));
656
665
 
657
666
                        /* update the bank */
658
667
                        memcpy(bank_base, &bank_source_data[0x1000 * ((data >> 6) & 3)], 0x1000);
677
686
            */
678
687
 
679
688
                        /* update the OKI bank */
680
 
                        oki6295_bank_base = (0x80000 * ((data >> 4) & 1)) | (oki6295_bank_base & 0x40000);
681
 
                        okim6295_set_bank_base(devtag_get_device(space->machine, "adpcml"), oki6295_bank_base);
682
 
                        okim6295_set_bank_base(devtag_get_device(space->machine, "adpcmr"), 0x40000 * (data >> 6));
 
689
                        memory_set_bank(space->machine, 12, (memory_get_bank(space->machine, 12) & 1) | ((data >> 3) & 2));
 
690
                        memory_set_bank(space->machine, 14, data >> 6);
683
691
 
684
692
                        /* update the volumes */
685
693
                        ym2151_volume = ((data >> 1) & 7) * 100 / 7;
854
862
MACHINE_DRIVER_END
855
863
 
856
864
 
857
 
/* Used by Batman, Guardians of the 'Hood, Road Riot 4WD */
 
865
/* Used by Batman, Guardians of the 'Hood, Road Riot 4WD, Steel Talons */
858
866
MACHINE_DRIVER_START( jsa_iii_mono )
859
867
 
860
868
        /* basic machine hardware */
861
869
        MDRV_IMPORT_FROM(jsa_ii_mono)
862
870
        MDRV_CPU_MODIFY("jsa")
863
871
        MDRV_CPU_PROGRAM_MAP(atarijsa3_map)
 
872
 
 
873
        MDRV_DEVICE_MODIFY("adpcm")
 
874
        MDRV_DEVICE_ADDRESS_MAP(0, jsa3_oki_map)
864
875
MACHINE_DRIVER_END
865
876
 
866
877
 
875
886
MACHINE_DRIVER_END
876
887
 
877
888
 
878
 
/* Used by Space Lords, Moto Frenzy, Steel Talons, Road Riot's Revenge Rally */
 
889
/* Used by Space Lords, Moto Frenzy, Road Riot's Revenge Rally */
879
890
MACHINE_DRIVER_START( jsa_iiis_stereo )
880
891
 
881
892
        /* basic machine hardware */
894
905
        MDRV_SOUND_ADD("adpcml", OKIM6295, JSA_MASTER_CLOCK/3)
895
906
        MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
896
907
        MDRV_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.75)
 
908
        MDRV_DEVICE_ADDRESS_MAP(0, jsa3_oki_map)
897
909
 
898
910
        MDRV_SOUND_ADD("adpcmr", OKIM6295, JSA_MASTER_CLOCK/3)
899
911
        MDRV_SOUND_CONFIG(okim6295_interface_pin7high)
900
912
        MDRV_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.75)
 
913
        MDRV_DEVICE_ADDRESS_MAP(0, jsa3_oki2_map)
901
914
MACHINE_DRIVER_END
902
915
 
903
916