src/mess/machine/c64_currah_speech.c
| r14929 | r14930 | |
| 60 | 60 | -------------- |
| 61 | 61 | |
| 62 | 62 | INIT Initialize the cartridge |
| 63 | BYE Disable the cartridge |
| 63 | 64 | KON 0 Enable keyvoices, low voice |
| 64 | 65 | KON 1 Enable keyvoices, high voice |
| 65 | 66 | KOFF Disable keyvoices |
| 66 | | SAY "" Say words |
| 67 | SAY 0/1 "" Say words |
| 67 | 68 | |
| 68 | 69 | */ |
| 69 | 70 | |
| r14929 | r14930 | |
| 92 | 93 | |
| 93 | 94 | ROM_START( c64_currah_speech ) |
| 94 | 95 | ROM_REGION( 0x10000, SP0256_TAG, 0 ) |
| 95 | | ROM_LOAD( "sp0256a-al2", 0x000, 0x800, CRC(df8de0b0) SHA1(86fb6d9fef955ac0bc76e0c45c66585946d278a1) ) |
| 96 | ROM_LOAD( "sp0256a-al2", 0x1000, 0x0800, CRC(b504ac15) SHA1(e60fcb5fa16ff3f3b69d36c7a6e955744d3feafc) ) |
| 96 | 97 | ROM_END |
| 97 | 98 | |
| 98 | 99 | |
| r14929 | r14930 | |
| 123 | 124 | |
| 124 | 125 | static MACHINE_CONFIG_FRAGMENT( c64_currah_speech ) |
| 125 | 126 | MCFG_SPEAKER_STANDARD_MONO("mono") |
| 126 | | MCFG_SOUND_ADD(SP0256_TAG, SP0256, 1000000) // ??? |
| 127 | MCFG_SOUND_ADD(SP0256_TAG, SP0256, 4000000) // ??? |
| 127 | 128 | MCFG_SOUND_CONFIG(sp0256_intf) |
| 128 | 129 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 129 | 130 | MACHINE_CONFIG_END |
| r14929 | r14930 | |
| 142 | 143 | |
| 143 | 144 | |
| 144 | 145 | //************************************************************************** |
| 146 | // INLINE HELPERS |
| 147 | //************************************************************************** |
| 148 | |
| 149 | //------------------------------------------------- |
| 150 | // set_osc1 - |
| 151 | //------------------------------------------------- |
| 152 | |
| 153 | void c64_currah_speech_cartridge_device::set_osc1(int voice, int intonation) |
| 154 | { |
| 155 | int dotclock = m_slot->dotclock(); |
| 156 | |
| 157 | // TODO SP0256 does not handle clock change |
| 158 | // TODO intonation |
| 159 | m_nsp->set_unscaled_clock(dotclock / (2 << voice)); |
| 160 | } |
| 161 | |
| 162 | |
| 163 | |
| 164 | //************************************************************************** |
| 145 | 165 | // LIVE DEVICE |
| 146 | 166 | //************************************************************************** |
| 147 | 167 | |
| r14929 | r14930 | |
| 152 | 172 | c64_currah_speech_cartridge_device::c64_currah_speech_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 153 | 173 | device_t(mconfig, C64_CURRAH_SPEECH, "C64 Currah Speech", tag, owner, clock), |
| 154 | 174 | device_c64_expansion_card_interface(mconfig, *this), |
| 155 | | m_nsp(*this, SP0256_TAG), |
| 156 | | m_rom_en(0) |
| 175 | m_nsp(*this, SP0256_TAG) |
| 157 | 176 | { |
| 158 | 177 | } |
| 159 | 178 | |
| r14929 | r14930 | |
| 164 | 183 | |
| 165 | 184 | void c64_currah_speech_cartridge_device::device_start() |
| 166 | 185 | { |
| 167 | | // state saving |
| 168 | | save_item(NAME(m_rom_en)); |
| 169 | 186 | } |
| 170 | 187 | |
| 171 | 188 | |
| r14929 | r14930 | |
| 175 | 192 | |
| 176 | 193 | void c64_currah_speech_cartridge_device::device_reset() |
| 177 | 194 | { |
| 178 | | m_rom_en = 0; |
| 195 | m_game = 1; |
| 196 | m_exrom = 1; |
| 179 | 197 | } |
| 180 | 198 | |
| 181 | 199 | |
| r14929 | r14930 | |
| 210 | 228 | |
| 211 | 229 | data = sp0256_sby_r(m_nsp) << 7; |
| 212 | 230 | } |
| 213 | | else if (offset == 0xa7f0) |
| 231 | |
| 232 | if (!space.debugger_access() && (offset == 0xa7f0)) |
| 214 | 233 | { |
| 215 | | m_rom_en = !m_rom_en; |
| 234 | m_game = !m_game; |
| 235 | m_exrom = !m_exrom; |
| 216 | 236 | } |
| 217 | 237 | |
| 218 | 238 | return data; |
| r14929 | r14930 | |
| 242 | 262 | |
| 243 | 263 | */ |
| 244 | 264 | |
| 245 | | // TODO offset bit 0 = low/high voice |
| 265 | int voice = BIT(offset, 0); |
| 266 | int intonation = BIT(data, 7); |
| 267 | |
| 268 | set_osc1(voice, intonation); |
| 269 | |
| 246 | 270 | sp0256_ALD_w(m_nsp, 0, data & 0x3f); |
| 247 | 271 | } |
| 248 | 272 | } |
| 249 | | |
| 250 | | |
| 251 | | //------------------------------------------------- |
| 252 | | // c64_game_r - GAME read |
| 253 | | //------------------------------------------------- |
| 254 | | |
| 255 | | int c64_currah_speech_cartridge_device::c64_game_r(offs_t offset, int ba, int rw, int hiram) |
| 256 | | { |
| 257 | | return !(m_rom_en && ba && rw && ((offset & 0xe000) == 0xa000)); |
| 258 | | } |
| 259 | | |
| 260 | | |
| 261 | | //------------------------------------------------- |
| 262 | | // c64_exrom_r - EXROM read |
| 263 | | //------------------------------------------------- |
| 264 | | |
| 265 | | int c64_currah_speech_cartridge_device::c64_exrom_r(offs_t offset, int ba, int rw, int hiram) |
| 266 | | { |
| 267 | | return !(m_rom_en && ba && rw && ((offset & 0xe000) == 0xa000)); |
| 268 | | } |
src/mess/machine/c64_currah_speech.h
| r14929 | r14930 | |
| 45 | 45 | // device_c64_expansion_card_interface overrides |
| 46 | 46 | virtual UINT8 c64_cd_r(address_space &space, offs_t offset, int roml, int romh, int io1, int io2); |
| 47 | 47 | virtual void c64_cd_w(address_space &space, offs_t offset, UINT8 data, int roml, int romh, int io1, int io2); |
| 48 | | virtual int c64_game_r(offs_t offset, int ba, int rw, int hiram); |
| 49 | | virtual int c64_exrom_r(offs_t offset, int ba, int rw, int hiram); |
| 50 | 48 | |
| 51 | 49 | private: |
| 52 | | required_device<device_t> m_nsp; |
| 50 | inline void set_osc1(int voice, int intonation); |
| 53 | 51 | |
| 54 | | int m_rom_en; |
| 52 | required_device<device_t> m_nsp; |
| 55 | 53 | }; |
| 56 | 54 | |
| 57 | 55 | |