Previous 199869 Revisions Next

r19906 Friday 28th December, 2012 at 21:26:58 UTC by Andrew Gardner
Modernize Gaelco sound devices. [Andrew Gardner]

Out of whatsnew:
These are really simple to do between the inevitable holiday distractions.  Zen.
Etc.
[src/emu/sound]gaelco.c gaelco.h
[src/mame/drivers]gaelco2.c

trunk/src/mame/drivers/gaelco2.c
r19905r19906
5555  ============================================================================*/
5656
5757static ADDRESS_MAP_START( maniacsq_map, AS_PROGRAM, 16, gaelco2_state )
58   AM_RANGE(0x000000, 0x03ffff) AM_ROM                                                            /* ROM */
59   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w)      /* Sound Registers */
60   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")      /* Video RAM */
61   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                        /* Palette */
62   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                          /* Video Registers */
63   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                                /* DSW #1 + Input 1P */
64   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                                /* DSW #2 + Input 2P */
65   AM_RANGE(0x30004a, 0x30004b) AM_WRITENOP                                                      /* Sound muting? */
66   AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN")                                                /* COINSW + SERVICESW */
67   AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w)                                             /* Coin lockout + counters */
68   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                            /* Work RAM */
58   AM_RANGE(0x000000, 0x03ffff) AM_ROM                                                      /* ROM */
59   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w)   /* Sound Registers */
60   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")                     /* Video RAM */
61   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                  /* Palette */
62   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                       /* Video Registers */
63   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                          /* DSW #1 + Input 1P */
64   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                          /* DSW #2 + Input 2P */
65   AM_RANGE(0x30004a, 0x30004b) AM_WRITENOP                                                /* Sound muting? */
66   AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN")                                          /* COINSW + SERVICESW */
67   AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w)                                       /* Coin lockout + counters */
68   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                      /* Work RAM */
6969ADDRESS_MAP_END
7070
7171
r19905r19906
178178   /* sound hardware */
179179   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
180180
181   MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0)
181   MCFG_GAELCO_GAE1_ADD("gaelco", 0)
182182   MCFG_SOUND_CONFIG(maniacsq_snd_interface)
183183   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
184184   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
r19905r19906
212212READ16_MEMBER(gaelco2_state::p2_gun_y){return (ioport("LIGHT1_Y")->read() * 240 / 0x100) - 4;}
213213
214214static ADDRESS_MAP_START( bang_map, AS_PROGRAM, 16, gaelco2_state )
215    AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                         /* ROM */
216    AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w)   /* Sound Registers */
217    AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")   /* Video RAM */
218    AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                     /* Palette */
215   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                      /* ROM */
216   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_cg1v_device, gaelcosnd_r, gaelcosnd_w)   /* Sound Registers */
217   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")                     /* Video RAM */
218   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                  /* Palette */
219219    AM_RANGE(0x218004, 0x218009) AM_READONLY                                                /* Video Registers */
220   AM_RANGE(0x218004, 0x218007) AM_WRITEONLY AM_SHARE("vregs")                              /* Video Registers */
221   AM_RANGE(0x218008, 0x218009) AM_WRITENOP                                                   /* CLR INT Video */
220   AM_RANGE(0x218004, 0x218007) AM_WRITEONLY AM_SHARE("vregs")                                    /* Video Registers */
221   AM_RANGE(0x218008, 0x218009) AM_WRITENOP                                                /* CLR INT Video */
222222    AM_RANGE(0x300000, 0x300001) AM_READ_PORT("P1")
223    AM_RANGE(0x300002, 0x300003) AM_READNOP                                                    /* Random number generator? */
224   AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w)                                          /* Coin Counters */
225   AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w)                                    /* EEPROM data */
226   AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w)                                       /* EEPROM serial clock */
227   AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w)                                       /* EEPROM chip select */
223   AM_RANGE(0x300002, 0x300003) AM_READNOP                                                 /* Random number generator? */
224   AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w)                                       /* Coin Counters */
225   AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w)                                 /* EEPROM data */
226   AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w)                                    /* EEPROM serial clock */
227   AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w)                                    /* EEPROM chip select */
228228    AM_RANGE(0x300010, 0x300011) AM_READ_PORT("P2")
229229    AM_RANGE(0x300020, 0x300021) AM_READ_PORT("COIN")
230    AM_RANGE(0x310000, 0x310001) AM_READ(p1_gun_x) AM_WRITE(bang_clr_gun_int_w)                           /* Gun 1P X */ /* CLR INT Gun */
231    AM_RANGE(0x310002, 0x310003) AM_READ(p2_gun_x)                                                /* Gun 2P X */
232    AM_RANGE(0x310004, 0x310005) AM_READ(p1_gun_y)                                                /* Gun 1P Y */
233    AM_RANGE(0x310006, 0x310007) AM_READ(p2_gun_y)                                                /* Gun 2P Y */
234    AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                         /* Work RAM */
230   AM_RANGE(0x310000, 0x310001) AM_READ(p1_gun_x) AM_WRITE(bang_clr_gun_int_w)                        /* Gun 1P X */ /* CLR INT Gun */
231   AM_RANGE(0x310002, 0x310003) AM_READ(p2_gun_x)                                             /* Gun 2P X */
232   AM_RANGE(0x310004, 0x310005) AM_READ(p1_gun_y)                                             /* Gun 1P Y */
233   AM_RANGE(0x310006, 0x310007) AM_READ(p2_gun_y)                                             /* Gun 2P Y */
234   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                      /* Work RAM */
235235ADDRESS_MAP_END
236236
237237
r19905r19906
311311   /* sound hardware */
312312   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
313313
314   MCFG_SOUND_ADD("gaelco", GAELCO_CG1V, 0)
314   MCFG_GAELCO_CG1V_ADD("gaelco", 0)
315315   MCFG_SOUND_CONFIG(bang_snd_interface)
316316   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
317317   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
r19905r19906
430430
431431
432432static ADDRESS_MAP_START( alighunt_map, AS_PROGRAM, 16, gaelco2_state )
433   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                            /* ROM */
434   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w)      /* Sound Registers */
435   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")      /* Video RAM */
436   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                        /* Palette */
433   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                         /* ROM */
434   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w)      /* Sound Registers */
435   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")                        /* Video RAM */
436   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                     /* Palette */
437437   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                          /* Video Registers */
438   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                                /* DSW #1 + Input 1P */
439   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                                /* DSW #2 + Input 2P */
440   AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN")                                                /* COINSW + SERVICESW */
441   AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w)                                             /* Coin lockout + counters */
442   AM_RANGE(0x500006, 0x500007) AM_WRITENOP                                                      /* ??? */
443   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                            /* Work RAM */
438   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                             /* DSW #1 + Input 1P */
439   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                             /* DSW #2 + Input 2P */
440   AM_RANGE(0x320000, 0x320001) AM_READ_PORT("COIN")                                             /* COINSW + SERVICESW */
441   AM_RANGE(0x500000, 0x500001) AM_WRITE(gaelco2_coin_w)                                          /* Coin lockout + counters */
442   AM_RANGE(0x500006, 0x500007) AM_WRITENOP                                                   /* ??? */
443   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                         /* Work RAM */
444444ADDRESS_MAP_END
445445
446446
r19905r19906
552552   /* sound hardware */
553553   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
554554
555   MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0)
555   MCFG_GAELCO_GAE1_ADD("gaelco", 0)
556556   MCFG_SOUND_CONFIG(alighunt_snd_interface)
557557   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
558558   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
r19905r19906
641641}
642642
643643static ADDRESS_MAP_START( touchgo_map, AS_PROGRAM, 16, gaelco2_state )
644   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                               /* ROM */
645   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w)         /* Sound Registers */
646   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")         /* Video RAM */
647   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                           /* Palette */
648   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                             /* Video Registers */
649   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                                   /* DSW #1 + Input 1P */
650   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                                   /* DSW #2 + Input 2P */
651   AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2")                                                   /* COINSW + Input 3P */
652   AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3")                                                   /* SERVICESW + Input 4P */
653   AM_RANGE(0x500000, 0x50001f) AM_WRITE(touchgo_coin_w)                                                /* Coin counters */
654   AM_RANGE(0xfefffa, 0xfefffb) AM_RAM_READ(dallas_kludge_r)                                             /* DS5002FP related patch */
655   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                               /* Work RAM */
644   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                         /* ROM */
645   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w)      /* Sound Registers */
646   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")                        /* Video RAM */
647   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                     /* Palette */
648   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                          /* Video Registers */
649   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                             /* DSW #1 + Input 1P */
650   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                             /* DSW #2 + Input 2P */
651   AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2")                                             /* COINSW + Input 3P */
652   AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3")                                             /* SERVICESW + Input 4P */
653   AM_RANGE(0x500000, 0x50001f) AM_WRITE(touchgo_coin_w)                                          /* Coin counters */
654   AM_RANGE(0xfefffa, 0xfefffb) AM_RAM_READ(dallas_kludge_r)                                       /* DS5002FP related patch */
655   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                         /* Work RAM */
656656ADDRESS_MAP_END
657657
658658
r19905r19906
802802   /* the chip is stereo, but the game sound is mono because the right channel
803803       output is for cabinet 1 and the left channel output is for cabinet 2 */
804804   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
805   MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0)
805   MCFG_GAELCO_GAE1_ADD("gaelco", 0)
806806   MCFG_SOUND_CONFIG(touchgo_snd_interface)
807807   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
808808   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
r19905r19906
905905  ============================================================================*/
906906
907907static ADDRESS_MAP_START( snowboar_map, AS_PROGRAM, 16, gaelco2_state )
908   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                                  /* ROM */
909   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w)            /* Sound Registers */
910   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")            /* Video RAM */
911   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                              /* Palette */
912   AM_RANGE(0x212000, 0x213fff) AM_RAM                                                                  /* Extra RAM */
913   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                                /* Video Registers */
908   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                         /* ROM */
909   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_cg1v_device, gaelcosnd_r, gaelcosnd_w)      /* Sound Registers */
910   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")                        /* Video RAM */
911   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                     /* Palette */
912   AM_RANGE(0x212000, 0x213fff) AM_RAM                                                         /* Extra RAM */
913   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                          /* Video Registers */
914914   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("P1")
915   AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w)                                                   /* Coin Counters */
916   AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w)                                             /* EEPROM data */
917   AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w)                                                /* EEPROM serial clock */
918   AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w)                                                /* EEPROM chip select */
915   AM_RANGE(0x300000, 0x300003) AM_WRITE(gaelco2_coin2_w)                                          /* Coin Counters */
916   AM_RANGE(0x300008, 0x300009) AM_WRITE(gaelco2_eeprom_data_w)                                    /* EEPROM data */
917   AM_RANGE(0x30000a, 0x30000b) AM_WRITE(gaelco2_eeprom_sk_w)                                       /* EEPROM serial clock */
918   AM_RANGE(0x30000c, 0x30000d) AM_WRITE(gaelco2_eeprom_cs_w)                                       /* EEPROM chip select */
919919   AM_RANGE(0x300010, 0x300011) AM_READ_PORT("P2")
920920   AM_RANGE(0x300020, 0x300021) AM_READ_PORT("COIN")
921921   AM_RANGE(0x310000, 0x31ffff) AM_READWRITE(snowboar_protection_r,snowboar_protection_w) AM_SHARE("snowboar_prot")   /* Protection */
922   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                                  /* Work RAM */
922   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                               /* Work RAM */
923923ADDRESS_MAP_END
924924
925925
r19905r19906
988988   /* sound hardware */
989989   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
990990
991   MCFG_SOUND_ADD("gaelco", GAELCO_CG1V, 0)
991   MCFG_GAELCO_CG1V_ADD("gaelco", 0)
992992   MCFG_SOUND_CONFIG(snowboar_snd_interface)
993993   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
994994   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
r19905r19906
10901090  ============================================================================*/
10911091
10921092static ADDRESS_MAP_START( wrally2_map, AS_PROGRAM, 16, gaelco2_state )
1093   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                         /* ROM */
1094   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE_LEGACY("gaelco", gaelcosnd_r, gaelcosnd_w)   /* Sound Registers */
1095   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")   /* Video RAM */
1096   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                     /* Palette */
1097   AM_RANGE(0x212000, 0x213fff) AM_RAM                                                         /* Extra RAM */
1093   AM_RANGE(0x000000, 0x0fffff) AM_ROM                                                      /* ROM */
1094   AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w)   /* Sound Registers */
1095   AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram")                     /* Video RAM */
1096   AM_RANGE(0x210000, 0x211fff) AM_RAM_WRITE(gaelco2_palette_w) AM_SHARE("paletteram")                  /* Palette */
1097   AM_RANGE(0x212000, 0x213fff) AM_RAM                                                      /* Extra RAM */
10981098   AM_RANGE(0x218004, 0x218009) AM_RAM AM_SHARE("vregs")                                       /* Video Registers */
1099   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                             /* DIPSW #2 + Inputs 1P */
1100   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                             /* DIPSW #1 */
1101   AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2")                                             /* Inputs 2P + COINSW */
1102   AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3")                                             /* SERVICESW */
1103   AM_RANGE(0x400000, 0x400011) AM_WRITE(wrally2_coin_w)                                          /* Coin Counters */
1104   AM_RANGE(0x400028, 0x400029) AM_WRITE(wrally2_adc_clk)                                          /* ADCs clock-in line */
1105   AM_RANGE(0x400030, 0x400031) AM_WRITE(wrally2_adc_cs)                                          /* ADCs chip select line */
1106   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                         /* Work RAM */
1099   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("IN0")                                          /* DIPSW #2 + Inputs 1P */
1100   AM_RANGE(0x300002, 0x300003) AM_READ_PORT("IN1")                                          /* DIPSW #1 */
1101   AM_RANGE(0x300004, 0x300005) AM_READ_PORT("IN2")                                          /* Inputs 2P + COINSW */
1102   AM_RANGE(0x300006, 0x300007) AM_READ_PORT("IN3")                                          /* SERVICESW */
1103   AM_RANGE(0x400000, 0x400011) AM_WRITE(wrally2_coin_w)                                       /* Coin Counters */
1104   AM_RANGE(0x400028, 0x400029) AM_WRITE(wrally2_adc_clk)                                       /* ADCs clock-in line */
1105   AM_RANGE(0x400030, 0x400031) AM_WRITE(wrally2_adc_cs)                                       /* ADCs chip select line */
1106   AM_RANGE(0xfe0000, 0xfeffff) AM_RAM                                                      /* Work RAM */
11071107ADDRESS_MAP_END
11081108
11091109
r19905r19906
12381238   /* the chip is stereo, but the game sound is mono because the right channel
12391239       output is for cabinet 1 and the left channel output is for cabinet 2 */
12401240   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
1241   MCFG_SOUND_ADD("gaelco", GAELCO_GAE1, 0)
1241   MCFG_GAELCO_GAE1_ADD("gaelco", 0)
12421242   MCFG_SOUND_CONFIG(wrally2_snd_interface)
12431243   MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
12441244   MCFG_SOUND_ROUTE(1, "rspeaker", 1.0)
r19905r19906
14391439
14401440GAME( 1994, aligator,  0,       alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
14411441GAME( 1994, aligatorun,aligator,alighunt, alighunt, gaelco2_state, alighunt, ROT0, "Gaelco", "Alligator Hunt (unprotected)", 0 )
1442GAME( 1995, touchgo,  0,        touchgo,  touchgo, gaelco2_state,  touchgo,  ROT0, "Gaelco", "Touch & Go (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1443GAME( 1995, touchgon, touchgo,  touchgo,  touchgo, gaelco2_state,  touchgo,  ROT0, "Gaelco", "Touch & Go (Non North America)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1444GAME( 1995, touchgoe, touchgo,  touchgo,  touchgo, gaelco2_state,  touchgo,  ROT0, "Gaelco", "Touch & Go (earlier revision)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1445GAME( 1995, wrally2,  0,        wrally2,  wrally2, driver_device,  0,        ROT0, "Gaelco", "World Rally 2: Twin Racing", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1442GAME( 1995, touchgo,  0,        touchgo,  touchgo,  gaelco2_state, touchgo,  ROT0, "Gaelco", "Touch & Go (World)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1443GAME( 1995, touchgon, touchgo,  touchgo,  touchgo,  gaelco2_state, touchgo,  ROT0, "Gaelco", "Touch & Go (Non North America)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1444GAME( 1995, touchgoe, touchgo,  touchgo,  touchgo,  gaelco2_state, touchgo,  ROT0, "Gaelco", "Touch & Go (earlier revision)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1445GAME( 1995, wrally2,  0,        wrally2,  wrally2,  driver_device, 0,        ROT0, "Gaelco", "World Rally 2: Twin Racing", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
14461446GAME( 1996, maniacsq, 0,        maniacsq, maniacsq, driver_device, 0,        ROT0, "Gaelco", "Maniac Square (unprotected)", 0 )
14471447GAME( 1996, snowboar, 0,        snowboar, snowboar, driver_device, 0,        ROT0, "Gaelco", "Snow Board Championship (Version 2.1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
14481448GAME( 1996, snowboara,snowboar, snowboar, snowboar, gaelco2_state, snowboar, ROT0, "Gaelco", "Snow Board Championship (Version 2.0)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
1449GAME( 1998, bang,     0,        bang,     bang, gaelco2_state,     bang,     ROT0, "Gaelco", "Bang!", 0 )
1450GAME( 1998, bangj,    bang,     bang,     bang, gaelco2_state,     bang,     ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 )
1449GAME( 1998, bang,     0,        bang,     bang,     gaelco2_state, bang,     ROT0, "Gaelco", "Bang!", 0 )
1450GAME( 1998, bangj,    bang,     bang,     bang,     gaelco2_state, bang,     ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 )
14511451GAME( 1999, grtesoro,  0,       maniacsq, maniacsq, driver_device, 0,        ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v5.01) (Italy)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
14521452GAME( 1999, grtesoro4, grtesoro,maniacsq, maniacsq, driver_device, 0,        ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v4.0) (Italy)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING )
trunk/src/emu/sound/gaelco.c
r19905r19906
4242#define LOG_SOUND(x) do { if (VERBOSE_SOUND) logerror x; } while (0)
4343#define LOG_READ_WRITES(x) do { if (VERBOSE_READ_WRITES) logerror x; } while (0)
4444
45#define LOG_WAVE  0
4645//#define ALT_MIX
4746
48#define GAELCO_NUM_CHANNELS    0x07
49#define VOLUME_LEVELS         0x10
47#define LOG_WAVE  0
48static wav_file* wavraw; // Raw waveform
5049
51/* this structure defines a channel */
52struct gaelco_sound_channel
53{
54   int active;         /* is it playing? */
55   int loop;         /* = 0 no looping, = 1 looping */
56   int chunkNum;      /* current chunk if looping */
57};
5850
59/* this structure defines the Gaelco custom sound chip */
60struct gaelco_sound_state
61{
62   sound_stream *stream;                           /* our stream */
63   UINT8 *snd_data;                              /* PCM data */
64   int banks[4];                                 /* start of each ROM bank */
65   gaelco_sound_channel channel[GAELCO_NUM_CHANNELS];   /* 7 stereo channels */
51/*============================================================================
52                  Gaelco GAE1 sound device
53  ============================================================================*/
6654
67   UINT16 sndregs[0x38];
55const device_type GAELCO_GAE1 = &device_creator<gaelco_gae1_device>;
6856
69   /* table for converting from 8 to 16 bits with volume control */
70   INT16 volume_table[VOLUME_LEVELS][256];
71};
57gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
58   : device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock),
59     device_sound_interface(mconfig, *this),
60     m_stream(NULL),
61     m_snd_data(NULL)
62{
63}
7264
73static wav_file *   wavraw;               /* raw waveform */
74
75INLINE gaelco_sound_state *get_safe_token(device_t *device)
65gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
66   : device_t(mconfig, type, name, tag, owner, clock),
67     device_sound_interface(mconfig, *this),
68     m_stream(NULL),
69     m_snd_data(NULL)
7670{
77   assert(device != NULL);
78   assert(device->type() == GAELCO_GAE1 || device->type() == GAELCO_CG1V);
79   return (gaelco_sound_state *)downcast<gaelco_gae1_device *>(device)->token();
8071}
8172
73
8274/*============================================================================
8375                        CG-1V/GAE1 Sound Update
8476
8577            Writes length bytes to the sound buffer
8678  ============================================================================*/
8779
88static STREAM_UPDATE( gaelco_update )
80void gaelco_gae1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
8981{
90   gaelco_sound_state *info = (gaelco_sound_state *)param;
9182   int j, ch;
9283
9384    /* fill all data needed */
r19905r19906
9788      /* for each channel */
9889      for (ch = 0; ch < GAELCO_NUM_CHANNELS; ch ++){
9990         int ch_data_l = 0, ch_data_r = 0;
100         gaelco_sound_channel *channel = &info->channel[ch];
91         gaelco_sound_channel *channel = &m_channel[ch];
10192
10293         /* if the channel is playing */
10394         if (channel->active == 1){
r19905r19906
112103            base_offset = ch*8 + chunkNum*4;
113104
114105            /* get channel parameters */
115            type = ((info->sndregs[base_offset + 1] >> 4) & 0x0f);
116            bank = info->banks[((info->sndregs[base_offset + 1] >> 0) & 0x03)];
117            vol_l = ((info->sndregs[base_offset + 1] >> 12) & 0x0f);
118            vol_r = ((info->sndregs[base_offset + 1] >> 8) & 0x0f);
119            end_pos = info->sndregs[base_offset + 2] << 8;
106            type = ((m_sndregs[base_offset + 1] >> 4) & 0x0f);
107            bank = m_banks[((m_sndregs[base_offset + 1] >> 0) & 0x03)];
108            vol_l = ((m_sndregs[base_offset + 1] >> 12) & 0x0f);
109            vol_r = ((m_sndregs[base_offset + 1] >> 8) & 0x0f);
110            end_pos = m_sndregs[base_offset + 2] << 8;
120111
121112            /* generates output data (range 0x00000..0xffff) */
122113            if (type == 0x08){
123114               /* PCM, 8 bits mono */
124               data = info->snd_data[bank + end_pos + info->sndregs[base_offset + 3]];
125               ch_data_l = info->volume_table[vol_l][data];
126               ch_data_r = info->volume_table[vol_r][data];
115               data = m_snd_data[bank + end_pos + m_sndregs[base_offset + 3]];
116               ch_data_l = m_volume_table[vol_l][data];
117               ch_data_r = m_volume_table[vol_r][data];
127118
128               info->sndregs[base_offset + 3]--;
119               m_sndregs[base_offset + 3]--;
129120            } else if (type == 0x0c){
130121               /* PCM, 8 bits stereo */
131               data = info->snd_data[bank + end_pos + info->sndregs[base_offset + 3]];
132               ch_data_l = info->volume_table[vol_l][data];
122               data = m_snd_data[bank + end_pos + m_sndregs[base_offset + 3]];
123               ch_data_l = m_volume_table[vol_l][data];
133124
134               info->sndregs[base_offset + 3]--;
125               m_sndregs[base_offset + 3]--;
135126
136               if (info->sndregs[base_offset + 3] > 0){
137                  data = info->snd_data[bank + end_pos + info->sndregs[base_offset + 3]];
138                  ch_data_r = info->volume_table[vol_r][data];
127               if (m_sndregs[base_offset + 3] > 0){
128                  data = m_snd_data[bank + end_pos + m_sndregs[base_offset + 3]];
129                  ch_data_r = m_volume_table[vol_r][data];
139130
140                  info->sndregs[base_offset + 3]--;
131                  m_sndregs[base_offset + 3]--;
141132               }
142133            } else {
143               LOG_SOUND(("(GAE1) Playing unknown sample format in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", ch, type, bank, end_pos, info->sndregs[base_offset + 3]));
134               LOG_SOUND(("(GAE1) Playing unknown sample format in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", ch, type, bank, end_pos, m_sndregs[base_offset + 3]));
144135               channel->active = 0;
145136            }
146137
147138            /* check if the current sample has finished playing */
148            if (info->sndregs[base_offset + 3] == 0){
139            if (m_sndregs[base_offset + 3] == 0){
149140               if (channel->loop == 0){   /* if no looping, we're done */
150141                  channel->active = 0;
151142               } else {               /* if we're looping, swap chunks */
152143                  channel->chunkNum = (channel->chunkNum + 1) & 0x01;
153144
154145                  /* if the length of the next chunk is 0, we're done */
155                  if (info->sndregs[ch*8 + channel->chunkNum*4 + 3] == 0){
146                  if (m_sndregs[ch*8 + channel->chunkNum*4 + 3] == 0){
156147                     channel->active = 0;
157148                  }
158149               }
r19905r19906
189180                        CG-1V/GAE1 Read Handler
190181  ============================================================================*/
191182
192READ16_DEVICE_HANDLER( gaelcosnd_r )
183READ16_MEMBER( gaelco_gae1_device::gaelcosnd_r )
193184{
194   gaelco_sound_state *info = get_safe_token(device);
185   LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", machine().describe_context(), offset));
195186
196   LOG_READ_WRITES(("%s: (GAE1): read from %04x\n", device->machine().describe_context(), offset));
197
198   return info->sndregs[offset];
187   return m_sndregs[offset];
199188}
200189
201190/*============================================================================
202191                        CG-1V/GAE1 Write Handler
203192  ============================================================================*/
204193
205WRITE16_DEVICE_HANDLER( gaelcosnd_w )
194WRITE16_MEMBER( gaelco_gae1_device::gaelcosnd_w )
206195{
207   gaelco_sound_state *info = get_safe_token(device);
208   gaelco_sound_channel *channel = &info->channel[offset >> 3];
196   gaelco_sound_channel *channel = &m_channel[offset >> 3];
209197
210   LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", device->machine().describe_context(), data, offset));
198   LOG_READ_WRITES(("%s: (GAE1): write %04x to %04x\n", machine().describe_context(), data, offset));
211199
212200   /* first update the stream to this point in time */
213   info->stream->update();
201   m_stream->update();
214202
215   COMBINE_DATA(&info->sndregs[offset]);
203   COMBINE_DATA(&m_sndregs[offset]);
216204
217205   switch(offset & 0x07){
218206      case 0x03:
219207         /* trigger sound */
220         if ((info->sndregs[offset - 1] != 0) && (data != 0)){
208         if ((m_sndregs[offset - 1] != 0) && (data != 0)){
221209            if (!channel->active){
222210               channel->active = 1;
223211               channel->chunkNum = 0;
224212               channel->loop = 0;
225               LOG_SOUND(("(GAE1) Playing sample channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (info->sndregs[offset - 2] >> 4) & 0x0f, info->sndregs[offset - 2] & 0x03, info->sndregs[offset - 1] << 8, data));
213               LOG_SOUND(("(GAE1) Playing sample channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (m_sndregs[offset - 2] >> 4) & 0x0f, m_sndregs[offset - 2] & 0x03, m_sndregs[offset - 1] << 8, data));
226214            }
227215         } else {
228216            channel->active = 0;
r19905r19906
231219         break;
232220
233221      case 0x07: /* enable/disable looping */
234         if ((info->sndregs[offset - 1] != 0) && (data != 0)){
235            LOG_SOUND(("(GAE1) Looping in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (info->sndregs[offset - 2] >> 4) & 0x0f, info->sndregs[offset - 2] & 0x03, info->sndregs[offset - 1] << 8, data));
222         if ((m_sndregs[offset - 1] != 0) && (data != 0)){
223            LOG_SOUND(("(GAE1) Looping in channel: %02d, type: %02x, bank: %02x, end: %08x, Length: %04x\n", offset >> 3, (m_sndregs[offset - 2] >> 4) & 0x0f, m_sndregs[offset - 2] & 0x03, m_sndregs[offset - 1] << 8, data));
236224            channel->loop = 1;
237225         } else {
238226            channel->loop = 0;
r19905r19906
243231}
244232
245233/*============================================================================
246                        CG-1V/GAE1 Init
234                  CG-1V/GAE1 Init / Close
247235  ============================================================================*/
248236
249static DEVICE_START( gaelco )
237void gaelco_gae1_device::device_start()
250238{
251239   int j, vol;
252   const gaelcosnd_interface *intf = (const gaelcosnd_interface *)device->static_config();
240   const gaelcosnd_interface *intf = (const gaelcosnd_interface *)static_config();
253241
254   gaelco_sound_state *info = get_safe_token(device);
255
256242   /* copy rom banks */
257243   for (j = 0; j < 4; j++){
258      info->banks[j] = intf->banks[j];
244      m_banks[j] = intf->banks[j];
259245   }
260   info->stream = device->machine().sound().stream_alloc(*device, 0, 2, 8000, info, gaelco_update);
261   info->snd_data = (UINT8 *)device->machine().root_device().memregion(intf->gfxregion)->base();
262   if (info->snd_data == NULL)
263      info->snd_data = *device->region();
246   m_stream = stream_alloc(0, 2, 8000);
247   m_snd_data = (UINT8 *)machine().root_device().memregion(intf->gfxregion)->base();
248   if (m_snd_data == NULL)
249      m_snd_data = *region();
264250
265251   /* init volume table */
266252   for (vol = 0; vol < VOLUME_LEVELS; vol++){
267253      for (j = -128; j <= 127; j++){
268         info->volume_table[vol][(j ^ 0x80) & 0xff] = (vol*j*256)/(VOLUME_LEVELS - 1);
254         m_volume_table[vol][(j ^ 0x80) & 0xff] = (vol*j*256)/(VOLUME_LEVELS - 1);
269255      }
270256   }
271257
r19905r19906
274260}
275261
276262
277static DEVICE_STOP( gaelco )
263void gaelco_gae1_device::device_stop()
278264{
279265   if (wavraw)
280266      wav_close(wavraw);
r19905r19906
282268}
283269
284270
285const device_type GAELCO_GAE1 = &device_creator<gaelco_gae1_device>;
286271
287gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
288   : device_t(mconfig, GAELCO_GAE1, "Gaelco GAE1", tag, owner, clock),
289     device_sound_interface(mconfig, *this)
290{
291   m_token = global_alloc_clear(gaelco_sound_state);
292}
293272
294gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock)
295   : device_t(mconfig, type, name, tag, owner, clock),
296     device_sound_interface(mconfig, *this)
297{
298   m_token = global_alloc_clear(gaelco_sound_state);
299}
273/*============================================================================
274                  Gaelco CG-1V sound device
275  ============================================================================*/
300276
301//-------------------------------------------------
302//  device_config_complete - perform any
303//  operations now that the configuration is
304//  complete
305//-------------------------------------------------
306
307void gaelco_gae1_device::device_config_complete()
308{
309}
310
311//-------------------------------------------------
312//  device_start - device-specific startup
313//-------------------------------------------------
314
315void gaelco_gae1_device::device_start()
316{
317   DEVICE_START_NAME( gaelco )(this);
318}
319
320//-------------------------------------------------
321//  device_stop - device-specific stop
322//-------------------------------------------------
323
324void gaelco_gae1_device::device_stop()
325{
326   DEVICE_STOP_NAME( gaelco )(this);
327}
328
329//-------------------------------------------------
330//  sound_stream_update - handle a stream update
331//-------------------------------------------------
332
333void gaelco_gae1_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples)
334{
335   // should never get here
336   fatalerror("sound_stream_update called; not applicable to legacy sound devices\n");
337}
338
339
340277const device_type GAELCO_CG1V = &device_creator<gaelco_cg1v_device>;
341278
342279gaelco_cg1v_device::gaelco_cg1v_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
trunk/src/emu/sound/gaelco.h
r19905r19906
33#ifndef __GALELCO_H__
44#define __GALELCO_H__
55
6#include "devlegcy.h"
6#define GAELCO_NUM_CHANNELS    0x07
7#define VOLUME_LEVELS         0x10
78
9
10//**************************************************************************
11//  INTERFACE CONFIGURATION MACROS
12//**************************************************************************
13
14#define MCFG_GAELCO_GAE1_ADD(_tag, _clock) \
15   MCFG_DEVICE_ADD(_tag, GAELCO_GAE1, _clock) \
16
17#define MCFG_GAELCO_GAE1_REPLACE(_tag, _clock) \
18   MCFG_DEVICE_REPLACE(_tag, GAELCO_GAE1, _clock) \
19
20#define MCFG_GAELCO_CG1V_ADD(_tag, _clock) \
21   MCFG_DEVICE_ADD(_tag, GAELCO_CG1V, _clock) \
22
23#define MCFG_GAELCO_CG1V_REPLACE(_tag, _clock) \
24   MCFG_DEVICE_REPLACE(_tag, GAELCO_CG1V, _clock) \
25
26
27//**************************************************************************
28//  TYPE DEFINITIONS
29//**************************************************************************
30
31// ======================> Sound Channel
32
33struct gaelco_sound_channel
34{
35   int active;         // is it playing?
36   int loop;         // = 0 no looping, = 1 looping
37   int chunkNum;      // current chunk if looping
38};
39
40
41// ======================> External interface
42
843struct gaelcosnd_interface
944{
1045   const char *gfxregion;   /* shared gfx region name */
1146   int banks[4];         /* start of each ROM bank */
1247};
1348
14DECLARE_WRITE16_DEVICE_HANDLER( gaelcosnd_w );
15DECLARE_READ16_DEVICE_HANDLER( gaelcosnd_r );
1649
50// ======================> gaelco_gae1_device
51
1752class gaelco_gae1_device : public device_t,
18                                  public device_sound_interface
53                     public device_sound_interface
1954{
2055public:
2156   gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
2257   gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock);
23   ~gaelco_gae1_device() { global_free(m_token); }
58   ~gaelco_gae1_device() { }
2459
25   // access to legacy token
26   void *token() const { assert(m_token != NULL); return m_token; }
2760protected:
2861   // device-level overrides
29   virtual void device_config_complete();
3062   virtual void device_start();
3163   virtual void device_stop();
3264
3365   // sound stream update overrides
3466   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
67
68public:
69   DECLARE_WRITE16_MEMBER( gaelcosnd_w );
70   DECLARE_READ16_MEMBER( gaelcosnd_r );
71
3572private:
36   // internal state
37   void *m_token;
73   sound_stream *m_stream;                           /* our stream */
74   UINT8 *m_snd_data;                              /* PCM data */
75   int m_banks[4];                                 /* start of each ROM bank */
76   gaelco_sound_channel m_channel[GAELCO_NUM_CHANNELS];   /* 7 stereo channels */
77
78   UINT16 m_sndregs[0x38];
79
80   // Table for converting from 8 to 16 bits with volume control
81   INT16 m_volume_table[VOLUME_LEVELS][256];
3882};
3983
4084extern const device_type GAELCO_GAE1;
4185
86
87
88// ======================> gaelco_cg1v_device
89
4290class gaelco_cg1v_device : public gaelco_gae1_device
4391{
4492public:

Previous 199869 Revisions Next


© 1997-2024 The MAME Team