Previous 199869 Revisions Next

r26043 Thursday 7th November, 2013 at 17:38:50 UTC by Osso
Moved gorf and wow sound handlers into the driver state. Updated some commented code (nw)
[src/mame/audio]gorf.c wow.c
[src/mame/drivers]astrocde.c galaxian.c m72.c pturn.c
[src/mame/includes]astrocde.h

trunk/src/mame/drivers/astrocde.c
r26042r26043
117117#include "includes/astrocde.h"
118118#include "machine/z80ctc.h"
119119#include "machine/nvram.h"
120#include "sound/samples.h"
121#include "sound/votrax.h"
122#include "sound/astrocde.h"
123120#include "sound/ay8910.h"
124121
125122#include "gorf.lh"
r26042r26043
311308      case 4: m_sparkle[2] = data;    break;
312309      case 5: m_sparkle[3] = data;    break;
313310      case 6:
314         machine().device<astrocade_device>("astrocade1")->set_output_gain(0, data ? 0.0 : 1.0);
311         m_astrocade_sound1->set_output_gain(0, data ? 0.0 : 1.0);
315312#if USE_FAKE_VOTRAX
316313         m_samples->set_output_gain(0, data ? 1.0 : 0.0);
317314#else
318         machine().device<votrax_sc01_device>("votrax")->set_output_gain(0, data ? 1.0 : 0.0);
315         m_votrax->set_output_gain(0, data ? 1.0 : 0.0);
319316#endif
320317         break;
321318      case 7: mame_printf_debug("io_1:%d\n", data); break;
r26042r26043
411408
412409   /* bank 0 reads video RAM in the 4000-7FFF range */
413410   if (bank == 0)
414      prog_space.install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r),this));
411      prog_space.install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r), this));
415412
416413   /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */
417414   if ((data & 0x80) && memregion("user2")->base() != NULL)
r26042r26043
793790   PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "S1:8" )
794791
795792   PORT_START("P4HANDLE")
796   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrocde_state,ebases_trackball_r, NULL)
793   PORT_BIT( 0xff, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrocde_state, ebases_trackball_r, NULL)
797794
798795   PORT_START("TRACKX1")
799796   PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET
r26042r26043
908905   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 )
909906   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
910907   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
911   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(wow_speech_status_r, NULL)
908   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrocde_state, wow_speech_status_r, NULL)
912909
913910   PORT_START("P4HANDLE")
914911   /* "If S1:1,2,3 are all ON or all OFF, only coin meter number 1 will count." */
r26042r26043
978975   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
979976   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
980977   PORT_BIT( 0x60, IP_ACTIVE_LOW, IPT_UNUSED )
981   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gorf_speech_status_r, NULL)
978   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, astrocde_state, gorf_speech_status_r, NULL)
982979
983980   PORT_START("P4HANDLE")
984981   PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coin_A ) )       PORT_DIPLOCATION("S1:1")
r26042r26043
17171714DRIVER_INIT_MEMBER(astrocde_state,seawolf2)
17181715{
17191716   m_video_config = 0x00;
1720   m_maincpu->space(AS_IO).install_write_handler(0x40, 0x40, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_1_w),this));
1721   m_maincpu->space(AS_IO).install_write_handler(0x41, 0x41, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_2_w),this));
1722   m_maincpu->space(AS_IO).install_write_handler(0x42, 0x43, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_lamps_w),this));
1717   m_maincpu->space(AS_IO).install_write_handler(0x40, 0x40, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_1_w), this));
1718   m_maincpu->space(AS_IO).install_write_handler(0x41, 0x41, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_2_w), this));
1719   m_maincpu->space(AS_IO).install_write_handler(0x42, 0x43, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_lamps_w), this));
17231720}
17241721
17251722
17261723DRIVER_INIT_MEMBER(astrocde_state,ebases)
17271724{
17281725   m_video_config = AC_SOUND_PRESENT | AC_MONITOR_BW;
1729   m_maincpu->space(AS_IO).install_write_handler(0x20, 0x20, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_coin_w),this));
1730   m_maincpu->space(AS_IO).install_write_handler(0x28, 0x28, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_trackball_select_w),this));
1726   m_maincpu->space(AS_IO).install_write_handler(0x20, 0x20, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_coin_w), this));
1727   m_maincpu->space(AS_IO).install_write_handler(0x28, 0x28, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_trackball_select_w), this));
17311728}
17321729
17331730
17341731DRIVER_INIT_MEMBER(astrocde_state,spacezap)
17351732{
17361733   m_video_config = AC_SOUND_PRESENT | AC_MONITOR_BW;
1737   m_maincpu->space(AS_IO).install_read_handler(0x13, 0x13, 0x03ff, 0xff00, read8_delegate(FUNC(astrocde_state::spacezap_io_r),this));
1734   m_maincpu->space(AS_IO).install_read_handler(0x13, 0x13, 0x03ff, 0xff00, read8_delegate(FUNC(astrocde_state::spacezap_io_r), this));
17381735}
17391736
17401737
17411738DRIVER_INIT_MEMBER(astrocde_state,wow)
17421739{
17431740   m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS;
1744   m_maincpu->space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_io_r),this));
1745   m_maincpu->space(AS_IO).install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(wow_speech_r));
1741   m_maincpu->space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_io_r), this));
1742   m_maincpu->space(AS_IO).install_read_handler(0x17, 0x17, 0xffff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_speech_r), this));
17461743}
17471744
17481745
17491746DRIVER_INIT_MEMBER(astrocde_state,gorf)
17501747{
17511748   m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS;
1752   m_maincpu->space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_1_r),this));
1753   m_maincpu->space(AS_IO).install_read_handler(0x16, 0x16, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_2_r),this));
1754   m_maincpu->space(AS_IO).install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(gorf_speech_r));
1749   m_maincpu->space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_1_r), this));
1750   m_maincpu->space(AS_IO).install_read_handler(0x16, 0x16, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_2_r), this));
1751   m_maincpu->space(AS_IO).install_read_handler(0x17, 0x17, 0xffff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_speech_r), this));
17551752}
17561753
17571754
17581755DRIVER_INIT_MEMBER(astrocde_state,robby)
17591756{
17601757   m_video_config = AC_SOUND_PRESENT;
1761   m_maincpu->space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::robby_io_r),this));
1758   m_maincpu->space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::robby_io_r), this));
17621759}
17631760
17641761
r26042r26043
17671764   address_space &iospace = m_maincpu->space(AS_IO);
17681765
17691766   m_video_config = AC_SOUND_PRESENT;
1770   iospace.install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r),this));
1771   iospace.install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r),this));
1767   iospace.install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r), this));
1768   iospace.install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r), this));
17721769
17731770   /* reset banking */
17741771   profpac_banksw_w(iospace, 0, 0);
r26042r26043
17811778   address_space &iospace = m_maincpu->space(AS_IO);
17821779
17831780   m_video_config = 0x00;
1784   iospace.install_read_handler(0x14, 0x14, 0x1fff, 0xff00, read8_delegate(FUNC(astrocde_state::demndrgn_io_r),this));
1781   iospace.install_read_handler(0x14, 0x14, 0x1fff, 0xff00, read8_delegate(FUNC(astrocde_state::demndrgn_io_r), this));
17851782   iospace.install_read_port(0x1c, 0x1c, 0x0000, 0xff00, "FIREX");
17861783   iospace.install_read_port(0x1d, 0x1d, 0x0000, 0xff00, "FIREY");
1787   iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w),this));
1784   iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w), this));
17881785
17891786   /* reset banking */
17901787   profpac_banksw_w(iospace, 0, 0);
r26042r26043
18021799   iospace.install_read_port(0x62, 0x62, 0x0000, 0xff00, "P62");
18031800   iospace.install_read_port(0x63, 0x63, 0x0000, 0xff00, "P63");
18041801   iospace.install_read_port(0x64, 0x64, 0x0000, 0xff00, "P64");
1805   iospace.install_write_handler(0x65, 0x66, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lamp_w),this));
1806   iospace.install_write_handler(0x67, 0x67, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_counter_w),this));
1807   iospace.install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w),this));
1808   iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w),this));
1802   iospace.install_write_handler(0x65, 0x66, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lamp_w), this));
1803   iospace.install_write_handler(0x67, 0x67, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_counter_w), this));
1804   iospace.install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w), this));
1805   iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w), this));
18091806
18101807   /* reset banking */
18111808   profpac_banksw_w(iospace, 0, 0);
trunk/src/mame/drivers/pturn.c
r26042r26043
557557DRIVER_INIT_MEMBER(pturn_state,pturn)
558558{
559559   /*
560   m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xc0dd, 0xc0dd, FUNC(pturn_protection_r));
561   m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xc0db, 0xc0db, FUNC(pturn_protection2_r));
560   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc0dd, 0xc0dd, read8_delegate(FUNC(pturn_state::pturn_protection_r), this));
561   m_maincpu->space(AS_PROGRAM).install_read_handler(0xc0db, 0xc0db, read8_delegate(FUNC(pturn_state::pturn_protection2_r), this));
562562   */
563563}
564564
trunk/src/mame/drivers/m72.c
r26042r26043
356356   program.install_write_handler(0xb0000, 0xb0fff, write16_delegate(FUNC(m72_state::m72_main_mcu_w),this));
357357   membank("bank1")->set_base(m_protection_ram);
358358
359   //io.install_legacy_write_handler(0xc0, 0xc1, FUNC(loht_sample_trigger_w));
359   //io.install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::loht_sample_trigger_w),this));
360360   io.install_write_handler(0xc0, 0xc1, write16_delegate(FUNC(m72_state::m72_main_mcu_sound_w),this));
361361
362362   /* sound cpu */
trunk/src/mame/drivers/galaxian.c
r26042r26043
60716071   //common_init(&galaxian_state::galaxian_draw_bullet, &galaxian_state::galaxian_draw_background, &galaxian_state::batman2_extend_tile_info, &galaxian_state::upper_extend_sprite_info);
60726072
60736073   /* coin lockout replaced by graphics bank */
6074   //space.install_legacy_write_handler(0x6002, 0x6002, 0, 0x7f8, FUNC(galaxian_gfxbank_w));
6074   //space.install_write_handler(0x6002, 0x6002, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::galaxian_gfxbank_w),this));
60756075
60766076
60776077   DRIVER_INIT_CALL(galaxian);
trunk/src/mame/audio/wow.c
r26042r26043
2020
2121#include "emu.h"
2222#include "cpu/z80/z80.h"
23#include "sound/samples.h"
24#include "sound/votrax.h"
2523#include "includes/astrocde.h"
2624
2725
r26042r26043
10199};
102100
103101
104READ8_HANDLER( wow_speech_r )
102READ8_MEMBER( astrocde_state::wow_speech_r )
105103{
106104   UINT8 data = offset >> 8;
107105#if USE_FAKE_VOTRAX
108   astrocde_state *state = space.machine().driver_data<astrocde_state>();
109   samples_device *samples = space.machine().device<samples_device>("samples");
110106   int Phoneme/*, Intonation*/;
111107   int i = 0;
112108   offset &= 0xff;
113109
114   state->m_totalword_ptr = state->m_totalword;
110   m_totalword_ptr = m_totalword;
115111
116112   Phoneme = data & 0x3F;
117113   //Intonation = data >> 6;
r26042r26043
119115   //logerror("Data : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation);
120116
121117   if(Phoneme==63) {
122      samples->stop(0);
123      //logerror("Clearing sample %s\n",state->m_totalword);
124      state->m_totalword[0] = 0;                 /* Clear the total word stack */
118      m_samples->stop(0);
119      //logerror("Clearing sample %s\n",m_totalword);
120      m_totalword[0] = 0;                 /* Clear the total word stack */
125121      return data;
126122   }
127123   if (Phoneme==3)                        /* We know PA0 is never part of a word */
128      state->m_totalword[0] = 0;                 /* Clear the total word stack */
124      m_totalword[0] = 0;                 /* Clear the total word stack */
129125
130126   /* Phoneme to word translation */
131127
132   if (*(state->m_totalword) == 0) {
133      strcpy(state->m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
134      if (state->m_plural != 0) {
135         //logerror("found a possible plural at %d\n",state->m_plural-1);
136         if (!strcmp("S",state->m_totalword)) {         /* Plural check */
137            samples->start(0, num_samples-2);      /* play the sample at position of word */
138            samples->set_frequency(0, 11025);    /* play at correct rate */
139            state->m_totalword[0] = 0;                 /* Clear the total word stack */
140            state->m_oldword[0] = 0;                   /* Clear the total word stack */
128   if (*(m_totalword) == 0) {
129      strcpy(m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
130      if (m_plural != 0) {
131         //logerror("found a possible plural at %d\n",m_plural-1);
132         if (!strcmp("S",m_totalword)) {         /* Plural check */
133            m_samples->start(0, num_samples-2);      /* play the sample at position of word */
134            m_samples->set_frequency(0, 11025);    /* play at correct rate */
135            m_totalword[0] = 0;                 /* Clear the total word stack */
136            m_oldword[0] = 0;                   /* Clear the total word stack */
141137            return data;
142138         } else {
143               state->m_plural=0;
139               m_plural=0;
144140         }
145141      }
146142   } else
147      strcat(state->m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
143      strcat(m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
148144
149   //logerror("Total word = %s\n",state->m_totalword);
145   //logerror("Total word = %s\n",m_totalword);
150146
151147   for (i=0; wowWordTable[i]; i++) {
152      if (!strcmp(wowWordTable[i],state->m_totalword)) {         /* Scan the word (sample) table for the complete word */
148      if (!strcmp(wowWordTable[i],m_totalword)) {         /* Scan the word (sample) table for the complete word */
153149         /* WOW has Dungeon */
154         if ((!strcmp("GDTO1RFYA2N",state->m_totalword)) || (!strcmp("RO1U1BAH1T",state->m_totalword)) || (!strcmp("KO1UH3I3E1N",state->m_totalword))) {        /* May be plural */
155            state->m_plural=i+1;
156            strcpy(state->m_oldword,state->m_totalword);
157            //logerror("Storing sample position %d and copying string %s\n",state->m_plural,state->m_oldword);
150         if ((!strcmp("GDTO1RFYA2N",m_totalword)) || (!strcmp("RO1U1BAH1T",m_totalword)) || (!strcmp("KO1UH3I3E1N",m_totalword))) {        /* May be plural */
151            m_plural=i+1;
152            strcpy(m_oldword,m_totalword);
153            //logerror("Storing sample position %d and copying string %s\n",m_plural,m_oldword);
158154         } else {
159            state->m_plural=0;
155            m_plural=0;
160156         }
161         samples->start(0, i);                      /* play the sample at position of word */
162         samples->set_frequency(0, 11025);         /* play at correct rate */
157         m_samples->start(0, i);                      /* play the sample at position of word */
158         m_samples->set_frequency(0, 11025);         /* play at correct rate */
163159         //logerror("Playing sample %d\n",i);
164         state->m_totalword[0] = 0;                 /* Clear the total word stack */
160         m_totalword[0] = 0;                 /* Clear the total word stack */
165161         return data;
166162      }
167163   }
168164#else
169   votrax_sc01_device *votrax = space.machine().device<votrax_sc01_device>("votrax");
170   votrax->inflection_w(space, 0, data >> 6);
171   votrax->write(space, 0, data);
165   m_votrax->inflection_w(space, 0, data >> 6);
166   m_votrax->write(space, 0, data);
172167#endif
173168
174169   /* Note : We should really also use volume in this as well as frequency */
r26042r26043
176171}
177172
178173
179CUSTOM_INPUT( wow_speech_status_r )
174CUSTOM_INPUT_MEMBER( astrocde_state::wow_speech_status_r )
180175{
181176#if USE_FAKE_VOTRAX
182   samples_device *samples = field.machine().device<samples_device>("samples");
183   return !samples->playing(0);
177   return !m_samples->playing(0);
184178#else
185   votrax_sc01_device *votrax = field.machine().device<votrax_sc01_device>("votrax");
186   return votrax->request();
179   return m_votrax->request();
187180#endif
188181}
trunk/src/mame/audio/gorf.c
r26042r26043
1919
2020#include "emu.h"
2121#include "cpu/z80/z80.h"
22#include "sound/samples.h"
23#include "sound/votrax.h"
2422#include "includes/astrocde.h"
2523
2624
r26042r26043
110108};
111109
112110
113READ8_HANDLER( gorf_speech_r )
111READ8_MEMBER( astrocde_state::gorf_speech_r )
114112{
115113   UINT8 data = offset >> 8;
116114#if USE_FAKE_VOTRAX
117   astrocde_state *state = space.machine().driver_data<astrocde_state>();
118   int Phoneme, Intonation;
115      int Phoneme, Intonation;
119116   int i = 0;
120117   offset &= 0xff;
121118
122   state->m_totalword_ptr = state->m_totalword;
119   m_totalword_ptr = m_totalword;
123120
124121   Phoneme = data & 0x3F;
125122   Intonation = data >> 6;
r26042r26043
127124   logerror("Date : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation);
128125
129126   if(Phoneme==63) {
130      state->m_samples->stop(0);
131      if (strlen(state->m_totalword)>2) logerror("Clearing sample %s\n",state->m_totalword);
132      state->m_totalword[0] = 0;                 /* Clear the total word stack */
127      m_samples->stop(0);
128      if (strlen(m_totalword)>2) logerror("Clearing sample %s\n",m_totalword);
129      m_totalword[0] = 0;                 /* Clear the total word stack */
133130      return data;
134131   }
135132
136133   /* Phoneme to word translation */
137134
138   if (*(state->m_totalword) == 0) {
139      strcpy(state->m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
140      if (state->m_plural != 0) {
141         logerror("found a possible plural at %d\n",state->m_plural-1);
142         if (!strcmp("S",state->m_totalword)) {         /* Plural check */
143            state->m_samples->start(0, num_samples-2);      /* play the sample at position of word */
144            state->m_samples->set_frequency(0, 11025);    /* play at correct rate */
145            state->m_totalword[0] = 0;                 /* Clear the total word stack */
146            state->m_oldword[0] = 0;                   /* Clear the total word stack */
135   if (*(m_totalword) == 0) {
136      strcpy(m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
137      if (m_plural != 0) {
138         logerror("found a possible plural at %d\n",m_plural-1);
139         if (!strcmp("S",m_totalword)) {         /* Plural check */
140            m_samples->start(0, num_samples-2);      /* play the sample at position of word */
141            m_samples->set_frequency(0, 11025);    /* play at correct rate */
142            m_totalword[0] = 0;                 /* Clear the total word stack */
143            m_oldword[0] = 0;                   /* Clear the total word stack */
147144            return data;
148145         } else {
149            state->m_plural=0;
146            m_plural=0;
150147         }
151148      }
152149   } else
153      strcat(state->m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
150      strcat(m_totalword,PhonemeTable[Phoneme]);                      /* Copy over the first phoneme */
154151
155   logerror("Total word = %s\n",state->m_totalword);
152   logerror("Total word = %s\n",m_totalword);
156153
157154   for (i=0; GorfWordTable[i]; i++) {
158      if (!strcmp(GorfWordTable[i],state->m_totalword)) {        /* Scan the word (sample) table for the complete word */
159         if ((!strcmp("GDTO1RFYA2N",state->m_totalword)) || (!strcmp("RO1U1BAH1T",state->m_totalword)) || (!strcmp("KO1UH3I3E1N",state->m_totalword)) || (!strcmp("WORAYY1EH3R",state->m_totalword)) || (!strcmp("IN",state->m_totalword)) ) {              /* May be state->m_plural */
160            state->m_plural=i+1;
161            strcpy(state->m_oldword,state->m_totalword);
162            logerror("Storing sample position %d and copying string %s\n",state->m_plural,state->m_oldword);
155      if (!strcmp(GorfWordTable[i],m_totalword)) {        /* Scan the word (sample) table for the complete word */
156         if ((!strcmp("GDTO1RFYA2N",m_totalword)) || (!strcmp("RO1U1BAH1T",m_totalword)) || (!strcmp("KO1UH3I3E1N",m_totalword)) || (!strcmp("WORAYY1EH3R",m_totalword)) || (!strcmp("IN",m_totalword)) ) {              /* May be m_plural */
157            m_plural=i+1;
158            strcpy(m_oldword,m_totalword);
159            logerror("Storing sample position %d and copying string %s\n",m_plural,m_oldword);
163160         } else {
164            state->m_plural=0;
161            m_plural=0;
165162         }
166         state->m_samples->start(0, i);                      /* play the sample at position of word */
167         state->m_samples->set_frequency(0, 11025);       /* play at correct rate */
163         m_samples->start(0, i);                      /* play the sample at position of word */
164         m_samples->set_frequency(0, 11025);       /* play at correct rate */
168165         logerror("Playing sample %d",i);
169         state->m_totalword[0] = 0;                 /* Clear the total word stack */
166         m_totalword[0] = 0;                 /* Clear the total word stack */
170167         return data;
171168      }
172169   }
173170#else
174   votrax_sc01_device *votrax = space.machine().device<votrax_sc01_device>("votrax");
175   votrax->inflection_w(space, 0, data >> 6);
176   votrax->write(space, 0, data);
171   m_votrax->inflection_w(space, 0, data >> 6);
172   m_votrax->write(space, 0, data);
177173#endif
178174
179175   /* Note : We should really also use volume in this as well as frequency */
r26042r26043
181177}
182178
183179
184CUSTOM_INPUT( gorf_speech_status_r )
180CUSTOM_INPUT_MEMBER( astrocde_state::gorf_speech_status_r )
185181{
186182#if USE_FAKE_VOTRAX
187   samples_device *samples = field.machine().device<samples_device>("samples");
188   return !samples->playing(0);
183   return !m_samples->playing(0);
189184#else
190   votrax_sc01_device *votrax = field.machine().device<votrax_sc01_device>("votrax");
191   return votrax->request();
185   return m_votrax->request();
192186#endif
193187}
trunk/src/mame/includes/astrocde.h
r26042r26043
33    Bally Astrocade-based hardware
44
55***************************************************************************/
6#include "sound/astrocde.h"
67#include "sound/samples.h"
8#include "sound/votrax.h"
9
710#define ASTROCADE_CLOCK     (XTAL_14_31818MHz/2)
811
912#define AC_SOUND_PRESENT    (0x01)
r26042r26043
2528
2629   astrocde_state(const machine_config &mconfig, device_type type, const char *tag)
2730      : driver_device(mconfig, type, tag),
28      m_videoram(*this, "videoram"),
29      m_protected_ram(*this, "protected_ram"),
3031      m_maincpu(*this, "maincpu"),
3132      m_subcpu(*this, "sub"),
32      m_samples(*this, "samples") { }
33      m_samples(*this, "samples"),
34      m_votrax(*this, "votrax"),
35      m_astrocade_sound1(*this, "astrocade1"),
36      m_videoram(*this, "videoram"),
37      m_protected_ram(*this, "protected_ram") { }
3338
39   required_device<cpu_device> m_maincpu;
40   optional_device<cpu_device> m_subcpu;
41   optional_device<samples_device> m_samples;
42   optional_device<votrax_sc01_device> m_votrax;
43   optional_device<astrocade_device> m_astrocade_sound1;
3444   optional_shared_ptr<UINT8> m_videoram;
45   optional_shared_ptr<UINT8> m_protected_ram;
46   
3547   UINT8 m_video_config;
3648   UINT8 m_sparkle[4];
3749   char m_totalword[256];
3850   char *m_totalword_ptr;
3951   char m_oldword[256];
4052   int m_plural;
41   optional_shared_ptr<UINT8> m_protected_ram;
4253   UINT8 m_port_1_last;
4354   UINT8 m_port_2_last;
4455   UINT8 m_ram_write_enable;
r26042r26043
141152   void execute_blit(address_space &space);
142153   void init_sparklestar();
143154   virtual void machine_start();
144   required_device<cpu_device> m_maincpu;
145   optional_device<cpu_device> m_subcpu;
146   optional_device<samples_device> m_samples;
155   
156   /*----------- defined in audio/wow.c -----------*/
157   DECLARE_READ8_MEMBER( wow_speech_r );
158   CUSTOM_INPUT_MEMBER( wow_speech_status_r );
159   
160   /*----------- defined in audio/gorf.c -----------*/
161   DECLARE_READ8_MEMBER( gorf_speech_r );
162   CUSTOM_INPUT_MEMBER( gorf_speech_status_r );
147163
148164protected:
149165   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
r26042r26043
153169
154170extern const char *const wow_sample_names[];
155171
156DECLARE_READ8_HANDLER( wow_speech_r );
157CUSTOM_INPUT( wow_speech_status_r );
158
159172/*----------- defined in audio/gorf.c -----------*/
160173
161174extern const char *const gorf_sample_names[];
162
163DECLARE_READ8_HANDLER( gorf_speech_r );
164CUSTOM_INPUT( gorf_speech_status_r );

Previous 199869 Revisions Next


© 1997-2024 The MAME Team