trunk/src/mame/drivers/astrocde.c
| r26042 | r26043 | |
| 117 | 117 | #include "includes/astrocde.h" |
| 118 | 118 | #include "machine/z80ctc.h" |
| 119 | 119 | #include "machine/nvram.h" |
| 120 | | #include "sound/samples.h" |
| 121 | | #include "sound/votrax.h" |
| 122 | | #include "sound/astrocde.h" |
| 123 | 120 | #include "sound/ay8910.h" |
| 124 | 121 | |
| 125 | 122 | #include "gorf.lh" |
| r26042 | r26043 | |
| 311 | 308 | case 4: m_sparkle[2] = data; break; |
| 312 | 309 | case 5: m_sparkle[3] = data; break; |
| 313 | 310 | 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); |
| 315 | 312 | #if USE_FAKE_VOTRAX |
| 316 | 313 | m_samples->set_output_gain(0, data ? 1.0 : 0.0); |
| 317 | 314 | #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); |
| 319 | 316 | #endif |
| 320 | 317 | break; |
| 321 | 318 | case 7: mame_printf_debug("io_1:%d\n", data); break; |
| r26042 | r26043 | |
| 411 | 408 | |
| 412 | 409 | /* bank 0 reads video RAM in the 4000-7FFF range */ |
| 413 | 410 | 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)); |
| 415 | 412 | |
| 416 | 413 | /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */ |
| 417 | 414 | if ((data & 0x80) && memregion("user2")->base() != NULL) |
| r26042 | r26043 | |
| 793 | 790 | PORT_DIPUNUSED_DIPLOC( 0x80, 0x00, "S1:8" ) |
| 794 | 791 | |
| 795 | 792 | 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) |
| 797 | 794 | |
| 798 | 795 | PORT_START("TRACKX1") |
| 799 | 796 | PORT_BIT( 0xff, 0x00, IPT_TRACKBALL_X ) PORT_SENSITIVITY(50) PORT_KEYDELTA(10) PORT_RESET |
| r26042 | r26043 | |
| 908 | 905 | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 ) |
| 909 | 906 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 910 | 907 | 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) |
| 912 | 909 | |
| 913 | 910 | PORT_START("P4HANDLE") |
| 914 | 911 | /* "If S1:1,2,3 are all ON or all OFF, only coin meter number 1 will count." */ |
| r26042 | r26043 | |
| 978 | 975 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY |
| 979 | 976 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) |
| 980 | 977 | 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) |
| 982 | 979 | |
| 983 | 980 | PORT_START("P4HANDLE") |
| 984 | 981 | PORT_DIPNAME( 0x01, 0x01, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("S1:1") |
| r26042 | r26043 | |
| 1717 | 1714 | DRIVER_INIT_MEMBER(astrocde_state,seawolf2) |
| 1718 | 1715 | { |
| 1719 | 1716 | 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)); |
| 1723 | 1720 | } |
| 1724 | 1721 | |
| 1725 | 1722 | |
| 1726 | 1723 | DRIVER_INIT_MEMBER(astrocde_state,ebases) |
| 1727 | 1724 | { |
| 1728 | 1725 | 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)); |
| 1731 | 1728 | } |
| 1732 | 1729 | |
| 1733 | 1730 | |
| 1734 | 1731 | DRIVER_INIT_MEMBER(astrocde_state,spacezap) |
| 1735 | 1732 | { |
| 1736 | 1733 | 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)); |
| 1738 | 1735 | } |
| 1739 | 1736 | |
| 1740 | 1737 | |
| 1741 | 1738 | DRIVER_INIT_MEMBER(astrocde_state,wow) |
| 1742 | 1739 | { |
| 1743 | 1740 | 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)); |
| 1746 | 1743 | } |
| 1747 | 1744 | |
| 1748 | 1745 | |
| 1749 | 1746 | DRIVER_INIT_MEMBER(astrocde_state,gorf) |
| 1750 | 1747 | { |
| 1751 | 1748 | 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)); |
| 1755 | 1752 | } |
| 1756 | 1753 | |
| 1757 | 1754 | |
| 1758 | 1755 | DRIVER_INIT_MEMBER(astrocde_state,robby) |
| 1759 | 1756 | { |
| 1760 | 1757 | 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)); |
| 1762 | 1759 | } |
| 1763 | 1760 | |
| 1764 | 1761 | |
| r26042 | r26043 | |
| 1767 | 1764 | address_space &iospace = m_maincpu->space(AS_IO); |
| 1768 | 1765 | |
| 1769 | 1766 | 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)); |
| 1772 | 1769 | |
| 1773 | 1770 | /* reset banking */ |
| 1774 | 1771 | profpac_banksw_w(iospace, 0, 0); |
| r26042 | r26043 | |
| 1781 | 1778 | address_space &iospace = m_maincpu->space(AS_IO); |
| 1782 | 1779 | |
| 1783 | 1780 | 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)); |
| 1785 | 1782 | iospace.install_read_port(0x1c, 0x1c, 0x0000, 0xff00, "FIREX"); |
| 1786 | 1783 | 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)); |
| 1788 | 1785 | |
| 1789 | 1786 | /* reset banking */ |
| 1790 | 1787 | profpac_banksw_w(iospace, 0, 0); |
| r26042 | r26043 | |
| 1802 | 1799 | iospace.install_read_port(0x62, 0x62, 0x0000, 0xff00, "P62"); |
| 1803 | 1800 | iospace.install_read_port(0x63, 0x63, 0x0000, 0xff00, "P63"); |
| 1804 | 1801 | 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)); |
| 1809 | 1806 | |
| 1810 | 1807 | /* reset banking */ |
| 1811 | 1808 | profpac_banksw_w(iospace, 0, 0); |
trunk/src/mame/audio/wow.c
| r26042 | r26043 | |
| 20 | 20 | |
| 21 | 21 | #include "emu.h" |
| 22 | 22 | #include "cpu/z80/z80.h" |
| 23 | | #include "sound/samples.h" |
| 24 | | #include "sound/votrax.h" |
| 25 | 23 | #include "includes/astrocde.h" |
| 26 | 24 | |
| 27 | 25 | |
| r26042 | r26043 | |
| 101 | 99 | }; |
| 102 | 100 | |
| 103 | 101 | |
| 104 | | READ8_HANDLER( wow_speech_r ) |
| 102 | READ8_MEMBER( astrocde_state::wow_speech_r ) |
| 105 | 103 | { |
| 106 | 104 | UINT8 data = offset >> 8; |
| 107 | 105 | #if USE_FAKE_VOTRAX |
| 108 | | astrocde_state *state = space.machine().driver_data<astrocde_state>(); |
| 109 | | samples_device *samples = space.machine().device<samples_device>("samples"); |
| 110 | 106 | int Phoneme/*, Intonation*/; |
| 111 | 107 | int i = 0; |
| 112 | 108 | offset &= 0xff; |
| 113 | 109 | |
| 114 | | state->m_totalword_ptr = state->m_totalword; |
| 110 | m_totalword_ptr = m_totalword; |
| 115 | 111 | |
| 116 | 112 | Phoneme = data & 0x3F; |
| 117 | 113 | //Intonation = data >> 6; |
| r26042 | r26043 | |
| 119 | 115 | //logerror("Data : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation); |
| 120 | 116 | |
| 121 | 117 | 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 */ |
| 125 | 121 | return data; |
| 126 | 122 | } |
| 127 | 123 | 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 */ |
| 129 | 125 | |
| 130 | 126 | /* Phoneme to word translation */ |
| 131 | 127 | |
| 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 */ |
| 141 | 137 | return data; |
| 142 | 138 | } else { |
| 143 | | state->m_plural=0; |
| 139 | m_plural=0; |
| 144 | 140 | } |
| 145 | 141 | } |
| 146 | 142 | } else |
| 147 | | strcat(state->m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */ |
| 143 | strcat(m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */ |
| 148 | 144 | |
| 149 | | //logerror("Total word = %s\n",state->m_totalword); |
| 145 | //logerror("Total word = %s\n",m_totalword); |
| 150 | 146 | |
| 151 | 147 | 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 */ |
| 153 | 149 | /* 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); |
| 158 | 154 | } else { |
| 159 | | state->m_plural=0; |
| 155 | m_plural=0; |
| 160 | 156 | } |
| 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 */ |
| 163 | 159 | //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 */ |
| 165 | 161 | return data; |
| 166 | 162 | } |
| 167 | 163 | } |
| 168 | 164 | #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); |
| 172 | 167 | #endif |
| 173 | 168 | |
| 174 | 169 | /* Note : We should really also use volume in this as well as frequency */ |
| r26042 | r26043 | |
| 176 | 171 | } |
| 177 | 172 | |
| 178 | 173 | |
| 179 | | CUSTOM_INPUT( wow_speech_status_r ) |
| 174 | CUSTOM_INPUT_MEMBER( astrocde_state::wow_speech_status_r ) |
| 180 | 175 | { |
| 181 | 176 | #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); |
| 184 | 178 | #else |
| 185 | | votrax_sc01_device *votrax = field.machine().device<votrax_sc01_device>("votrax"); |
| 186 | | return votrax->request(); |
| 179 | return m_votrax->request(); |
| 187 | 180 | #endif |
| 188 | 181 | } |
trunk/src/mame/audio/gorf.c
| r26042 | r26043 | |
| 19 | 19 | |
| 20 | 20 | #include "emu.h" |
| 21 | 21 | #include "cpu/z80/z80.h" |
| 22 | | #include "sound/samples.h" |
| 23 | | #include "sound/votrax.h" |
| 24 | 22 | #include "includes/astrocde.h" |
| 25 | 23 | |
| 26 | 24 | |
| r26042 | r26043 | |
| 110 | 108 | }; |
| 111 | 109 | |
| 112 | 110 | |
| 113 | | READ8_HANDLER( gorf_speech_r ) |
| 111 | READ8_MEMBER( astrocde_state::gorf_speech_r ) |
| 114 | 112 | { |
| 115 | 113 | UINT8 data = offset >> 8; |
| 116 | 114 | #if USE_FAKE_VOTRAX |
| 117 | | astrocde_state *state = space.machine().driver_data<astrocde_state>(); |
| 118 | | int Phoneme, Intonation; |
| 115 | int Phoneme, Intonation; |
| 119 | 116 | int i = 0; |
| 120 | 117 | offset &= 0xff; |
| 121 | 118 | |
| 122 | | state->m_totalword_ptr = state->m_totalword; |
| 119 | m_totalword_ptr = m_totalword; |
| 123 | 120 | |
| 124 | 121 | Phoneme = data & 0x3F; |
| 125 | 122 | Intonation = data >> 6; |
| r26042 | r26043 | |
| 127 | 124 | logerror("Date : %d Speech : %s at intonation %d\n",Phoneme, PhonemeTable[Phoneme],Intonation); |
| 128 | 125 | |
| 129 | 126 | 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 */ |
| 133 | 130 | return data; |
| 134 | 131 | } |
| 135 | 132 | |
| 136 | 133 | /* Phoneme to word translation */ |
| 137 | 134 | |
| 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 */ |
| 147 | 144 | return data; |
| 148 | 145 | } else { |
| 149 | | state->m_plural=0; |
| 146 | m_plural=0; |
| 150 | 147 | } |
| 151 | 148 | } |
| 152 | 149 | } else |
| 153 | | strcat(state->m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */ |
| 150 | strcat(m_totalword,PhonemeTable[Phoneme]); /* Copy over the first phoneme */ |
| 154 | 151 | |
| 155 | | logerror("Total word = %s\n",state->m_totalword); |
| 152 | logerror("Total word = %s\n",m_totalword); |
| 156 | 153 | |
| 157 | 154 | 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); |
| 163 | 160 | } else { |
| 164 | | state->m_plural=0; |
| 161 | m_plural=0; |
| 165 | 162 | } |
| 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 */ |
| 168 | 165 | 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 */ |
| 170 | 167 | return data; |
| 171 | 168 | } |
| 172 | 169 | } |
| 173 | 170 | #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); |
| 177 | 173 | #endif |
| 178 | 174 | |
| 179 | 175 | /* Note : We should really also use volume in this as well as frequency */ |
| r26042 | r26043 | |
| 181 | 177 | } |
| 182 | 178 | |
| 183 | 179 | |
| 184 | | CUSTOM_INPUT( gorf_speech_status_r ) |
| 180 | CUSTOM_INPUT_MEMBER( astrocde_state::gorf_speech_status_r ) |
| 185 | 181 | { |
| 186 | 182 | #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); |
| 189 | 184 | #else |
| 190 | | votrax_sc01_device *votrax = field.machine().device<votrax_sc01_device>("votrax"); |
| 191 | | return votrax->request(); |
| 185 | return m_votrax->request(); |
| 192 | 186 | #endif |
| 193 | 187 | } |
trunk/src/mame/includes/astrocde.h
| r26042 | r26043 | |
| 3 | 3 | Bally Astrocade-based hardware |
| 4 | 4 | |
| 5 | 5 | ***************************************************************************/ |
| 6 | #include "sound/astrocde.h" |
| 6 | 7 | #include "sound/samples.h" |
| 8 | #include "sound/votrax.h" |
| 9 | |
| 7 | 10 | #define ASTROCADE_CLOCK (XTAL_14_31818MHz/2) |
| 8 | 11 | |
| 9 | 12 | #define AC_SOUND_PRESENT (0x01) |
| r26042 | r26043 | |
| 25 | 28 | |
| 26 | 29 | astrocde_state(const machine_config &mconfig, device_type type, const char *tag) |
| 27 | 30 | : driver_device(mconfig, type, tag), |
| 28 | | m_videoram(*this, "videoram"), |
| 29 | | m_protected_ram(*this, "protected_ram"), |
| 30 | 31 | m_maincpu(*this, "maincpu"), |
| 31 | 32 | 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") { } |
| 33 | 38 | |
| 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; |
| 34 | 44 | optional_shared_ptr<UINT8> m_videoram; |
| 45 | optional_shared_ptr<UINT8> m_protected_ram; |
| 46 | |
| 35 | 47 | UINT8 m_video_config; |
| 36 | 48 | UINT8 m_sparkle[4]; |
| 37 | 49 | char m_totalword[256]; |
| 38 | 50 | char *m_totalword_ptr; |
| 39 | 51 | char m_oldword[256]; |
| 40 | 52 | int m_plural; |
| 41 | | optional_shared_ptr<UINT8> m_protected_ram; |
| 42 | 53 | UINT8 m_port_1_last; |
| 43 | 54 | UINT8 m_port_2_last; |
| 44 | 55 | UINT8 m_ram_write_enable; |
| r26042 | r26043 | |
| 141 | 152 | void execute_blit(address_space &space); |
| 142 | 153 | void init_sparklestar(); |
| 143 | 154 | 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 ); |
| 147 | 163 | |
| 148 | 164 | protected: |
| 149 | 165 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| r26042 | r26043 | |
| 153 | 169 | |
| 154 | 170 | extern const char *const wow_sample_names[]; |
| 155 | 171 | |
| 156 | | DECLARE_READ8_HANDLER( wow_speech_r ); |
| 157 | | CUSTOM_INPUT( wow_speech_status_r ); |
| 158 | | |
| 159 | 172 | /*----------- defined in audio/gorf.c -----------*/ |
| 160 | 173 | |
| 161 | 174 | extern const char *const gorf_sample_names[]; |
| 162 | | |
| 163 | | DECLARE_READ8_HANDLER( gorf_speech_r ); |
| 164 | | CUSTOM_INPUT( gorf_speech_status_r ); |