trunk/src/emu/sound/tms5110.c
| r22848 | r22849 | |
| 64 | 64 | #include "tms5110.h" |
| 65 | 65 | |
| 66 | 66 | #define MAX_SAMPLE_CHUNK 512 |
| 67 | | #define FIFO_SIZE 64 // TODO: technically the tms51xx chips don't have a fifo at all |
| 68 | 67 | |
| 69 | 68 | /* Variants */ |
| 70 | 69 | |
| r22848 | r22849 | |
| 84 | 83 | #define CTL_STATE_OUTPUT (1) |
| 85 | 84 | #define CTL_STATE_NEXT_OUTPUT (2) |
| 86 | 85 | |
| 87 | | struct tms5110_state |
| 88 | | { |
| 89 | | /* coefficient tables */ |
| 90 | | int variant; /* Variant of the 5110 - see tms5110.h */ |
| 91 | | |
| 92 | | /* coefficient tables */ |
| 93 | | const struct tms5100_coeffs *coeff; |
| 94 | | |
| 95 | | /* these contain data that describes the 64 bits FIFO */ |
| 96 | | UINT8 fifo[FIFO_SIZE]; |
| 97 | | UINT8 fifo_head; |
| 98 | | UINT8 fifo_tail; |
| 99 | | UINT8 fifo_count; |
| 100 | | |
| 101 | | /* these contain global status bits */ |
| 102 | | UINT8 PDC; |
| 103 | | UINT8 CTL_pins; |
| 104 | | UINT8 speaking_now; |
| 105 | | UINT8 talk_status; |
| 106 | | UINT8 state; |
| 107 | | |
| 108 | | /* Rom interface */ |
| 109 | | UINT32 address; |
| 110 | | UINT8 next_is_address; |
| 111 | | UINT8 schedule_dummy_read; |
| 112 | | UINT8 addr_bit; |
| 113 | | |
| 114 | | /* external callback */ |
| 115 | | int (*M0_callback)(device_t *); |
| 116 | | void (*set_load_address)(device_t *, int); |
| 117 | | |
| 118 | | /* callbacks */ |
| 119 | | devcb_resolved_write_line m0_func; /* the M0 line */ |
| 120 | | devcb_resolved_write_line m1_func; /* the M1 line */ |
| 121 | | devcb_resolved_write8 addr_func; /* Write to ADD1,2,4,8 - 4 address bits */ |
| 122 | | devcb_resolved_read_line data_func; /* Read one bit from ADD8/Data - voice data */ |
| 123 | | devcb_resolved_write_line romclk_func; /* rom clock - Only used to drive the data lines */ |
| 124 | | |
| 125 | | |
| 126 | | device_t *device; |
| 127 | | |
| 128 | | /* these contain data describing the current and previous voice frames */ |
| 129 | | UINT16 old_energy; |
| 130 | | UINT16 old_pitch; |
| 131 | | INT32 old_k[10]; |
| 132 | | |
| 133 | | UINT16 new_energy; |
| 134 | | UINT16 new_pitch; |
| 135 | | INT32 new_k[10]; |
| 136 | | |
| 137 | | |
| 138 | | /* these are all used to contain the current state of the sound generation */ |
| 139 | | UINT16 current_energy; |
| 140 | | UINT16 current_pitch; |
| 141 | | INT32 current_k[10]; |
| 142 | | |
| 143 | | UINT16 target_energy; |
| 144 | | UINT16 target_pitch; |
| 145 | | INT32 target_k[10]; |
| 146 | | |
| 147 | | UINT8 interp_count; /* number of interp periods (0-7) */ |
| 148 | | UINT8 sample_count; /* sample number within interp (0-24) */ |
| 149 | | INT32 pitch_count; |
| 150 | | |
| 151 | | INT32 x[11]; |
| 152 | | |
| 153 | | INT32 RNG; /* the random noise generator configuration is: 1 + x + x^3 + x^4 + x^13 */ |
| 154 | | |
| 155 | | const tms5110_interface *intf; |
| 156 | | const UINT8 *table; |
| 157 | | sound_stream *stream; |
| 158 | | INT32 speech_rom_bitnum; |
| 159 | | |
| 160 | | emu_timer *romclk_hack_timer; |
| 161 | | UINT8 romclk_hack_timer_started; |
| 162 | | UINT8 romclk_hack_state; |
| 163 | | }; |
| 164 | | |
| 165 | | struct tmsprom_state |
| 166 | | { |
| 167 | | /* Rom interface */ |
| 168 | | UINT32 address; |
| 169 | | /* ctl lines */ |
| 170 | | UINT8 m0; |
| 171 | | UINT8 enable; |
| 172 | | UINT32 base_address; |
| 173 | | UINT8 bit; |
| 174 | | |
| 175 | | int prom_cnt; |
| 176 | | |
| 177 | | int clock; |
| 178 | | const UINT8 *rom; |
| 179 | | const UINT8 *prom; |
| 180 | | |
| 181 | | devcb_resolved_write_line pdc_func; /* tms pdc func */ |
| 182 | | devcb_resolved_write8 ctl_func; /* tms ctl func */ |
| 183 | | |
| 184 | | device_t *device; |
| 185 | | emu_timer *romclk_timer; |
| 186 | | |
| 187 | | const tmsprom_interface *intf; |
| 188 | | }; |
| 189 | | |
| 190 | 86 | /* Pull in the ROM tables */ |
| 191 | 87 | #include "tms5110r.c" |
| 192 | 88 | |
| 193 | | |
| 194 | | |
| 195 | | INLINE tms5110_state *get_safe_token(device_t *device) |
| 196 | | { |
| 197 | | assert(device != NULL); |
| 198 | | assert(device->type() == TMS5110 || |
| 199 | | device->type() == TMS5100 || |
| 200 | | device->type() == TMS5110A || |
| 201 | | device->type() == CD2801 || |
| 202 | | device->type() == TMC0281 || |
| 203 | | device->type() == CD2802 || |
| 204 | | device->type() == M58817); |
| 205 | | return (tms5110_state *)downcast<tms5110_device *>(device)->token(); |
| 206 | | } |
| 207 | | |
| 208 | | INLINE tmsprom_state *get_safe_token_prom(device_t *device) |
| 209 | | { |
| 210 | | assert(device != NULL); |
| 211 | | assert(device->type() == TMSPROM); |
| 212 | | return (tmsprom_state *)downcast<tmsprom_device *>(device)->token(); |
| 213 | | } |
| 214 | | |
| 215 | | /* Static function prototypes */ |
| 216 | | static void tms5110_set_variant(tms5110_state *tms, int variant); |
| 217 | | static void tms5110_PDC_set(tms5110_state *tms, int data); |
| 218 | | static void tms5110_process(tms5110_state *tms, INT16 *buffer, unsigned int size); |
| 219 | | static void parse_frame(tms5110_state *tms); |
| 220 | | static STREAM_UPDATE( tms5110_update ); |
| 221 | | static TIMER_CALLBACK( romclk_hack_timer_cb ); |
| 222 | | |
| 223 | | |
| 224 | 89 | #define DEBUG_5110 0 |
| 225 | 90 | |
| 226 | | void tms5110_set_variant(tms5110_state *tms, int variant) |
| 91 | void tms5110_device::set_variant(int variant) |
| 227 | 92 | { |
| 228 | 93 | switch (variant) |
| 229 | 94 | { |
| 230 | 95 | case TMS5110_IS_5110A: |
| 231 | | tms->coeff = &tms5110a_coeff; |
| 96 | m_coeff = &tms5110a_coeff; |
| 232 | 97 | break; |
| 233 | 98 | case TMS5110_IS_5100: |
| 234 | | tms->coeff = &pat4209836_coeff; |
| 99 | m_coeff = &pat4209836_coeff; |
| 235 | 100 | break; |
| 236 | 101 | case TMS5110_IS_5110: |
| 237 | | tms->coeff = &pat4403965_coeff; |
| 102 | m_coeff = &pat4403965_coeff; |
| 238 | 103 | break; |
| 239 | 104 | default: |
| 240 | 105 | fatalerror("Unknown variant in tms5110_create\n"); |
| 241 | 106 | } |
| 242 | 107 | |
| 243 | | tms->variant = variant; |
| 108 | m_variant = variant; |
| 244 | 109 | } |
| 245 | 110 | |
| 246 | | static void new_int_write(tms5110_state *tms, UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr) |
| 111 | void tms5110_device::new_int_write(UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr) |
| 247 | 112 | { |
| 248 | | if (!tms->m0_func.isnull()) |
| 249 | | tms->m0_func(m0); |
| 250 | | if (!tms->m1_func.isnull()) |
| 251 | | tms->m1_func(m1); |
| 252 | | if (!tms->addr_func.isnull()) |
| 253 | | tms->addr_func(0, addr); |
| 254 | | if (!tms->romclk_func.isnull()) |
| 113 | if (!m_m0_func.isnull()) |
| 114 | m_m0_func(m0); |
| 115 | if (!m_m1_func.isnull()) |
| 116 | m_m1_func(m1); |
| 117 | if (!m_addr_func.isnull()) |
| 118 | m_addr_func(0, addr); |
| 119 | if (!m_romclk_func.isnull()) |
| 255 | 120 | { |
| 256 | 121 | //printf("rc %d\n", rc); |
| 257 | | tms->romclk_func(rc); |
| 122 | m_romclk_func(rc); |
| 258 | 123 | } |
| 259 | 124 | } |
| 260 | 125 | |
| 261 | | static void new_int_write_addr(tms5110_state *tms, UINT8 addr) |
| 126 | void tms5110_device::new_int_write_addr(UINT8 addr) |
| 262 | 127 | { |
| 263 | | new_int_write(tms, 1, 0, 1, addr); |
| 264 | | new_int_write(tms, 0, 0, 1, addr); |
| 265 | | new_int_write(tms, 1, 0, 0, addr); |
| 266 | | new_int_write(tms, 0, 0, 0, addr); |
| 128 | new_int_write(1, 0, 1, addr); |
| 129 | new_int_write(0, 0, 1, addr); |
| 130 | new_int_write(1, 0, 0, addr); |
| 131 | new_int_write(0, 0, 0, addr); |
| 267 | 132 | } |
| 268 | 133 | |
| 269 | | static UINT8 new_int_read(tms5110_state *tms) |
| 134 | UINT8 tms5110_device::new_int_read() |
| 270 | 135 | { |
| 271 | | new_int_write(tms, 1, 1, 0, 0); |
| 272 | | new_int_write(tms, 0, 1, 0, 0); |
| 273 | | new_int_write(tms, 1, 0, 0, 0); |
| 274 | | new_int_write(tms, 0, 0, 0, 0); |
| 275 | | if (!tms->data_func.isnull()) |
| 276 | | return tms->data_func(); |
| 136 | new_int_write(1, 1, 0, 0); |
| 137 | new_int_write(0, 1, 0, 0); |
| 138 | new_int_write(1, 0, 0, 0); |
| 139 | new_int_write(0, 0, 0, 0); |
| 140 | if (!m_data_func.isnull()) |
| 141 | return m_data_func(); |
| 277 | 142 | return 0; |
| 278 | 143 | } |
| 279 | 144 | |
| 280 | | static void register_for_save_states(tms5110_state *tms) |
| 145 | void tms5110_device::register_for_save_states() |
| 281 | 146 | { |
| 282 | | tms->device->save_item(NAME(tms->fifo)); |
| 283 | | tms->device->save_item(NAME(tms->fifo_head)); |
| 284 | | tms->device->save_item(NAME(tms->fifo_tail)); |
| 285 | | tms->device->save_item(NAME(tms->fifo_count)); |
| 147 | save_item(NAME(m_fifo)); |
| 148 | save_item(NAME(m_fifo_head)); |
| 149 | save_item(NAME(m_fifo_tail)); |
| 150 | save_item(NAME(m_fifo_count)); |
| 286 | 151 | |
| 287 | | tms->device->save_item(NAME(tms->PDC)); |
| 288 | | tms->device->save_item(NAME(tms->CTL_pins)); |
| 289 | | tms->device->save_item(NAME(tms->speaking_now)); |
| 290 | | tms->device->save_item(NAME(tms->talk_status)); |
| 291 | | tms->device->save_item(NAME(tms->state)); |
| 152 | save_item(NAME(m_PDC)); |
| 153 | save_item(NAME(m_CTL_pins)); |
| 154 | save_item(NAME(m_speaking_now)); |
| 155 | save_item(NAME(m_talk_status)); |
| 156 | save_item(NAME(m_state)); |
| 292 | 157 | |
| 293 | | tms->device->save_item(NAME(tms->old_energy)); |
| 294 | | tms->device->save_item(NAME(tms->old_pitch)); |
| 295 | | tms->device->save_item(NAME(tms->old_k)); |
| 158 | save_item(NAME(m_old_energy)); |
| 159 | save_item(NAME(m_old_pitch)); |
| 160 | save_item(NAME(m_old_k)); |
| 296 | 161 | |
| 297 | | tms->device->save_item(NAME(tms->new_energy)); |
| 298 | | tms->device->save_item(NAME(tms->new_pitch)); |
| 299 | | tms->device->save_item(NAME(tms->new_k)); |
| 162 | save_item(NAME(m_new_energy)); |
| 163 | save_item(NAME(m_new_pitch)); |
| 164 | save_item(NAME(m_new_k)); |
| 300 | 165 | |
| 301 | | tms->device->save_item(NAME(tms->current_energy)); |
| 302 | | tms->device->save_item(NAME(tms->current_pitch)); |
| 303 | | tms->device->save_item(NAME(tms->current_k)); |
| 166 | save_item(NAME(m_current_energy)); |
| 167 | save_item(NAME(m_current_pitch)); |
| 168 | save_item(NAME(m_current_k)); |
| 304 | 169 | |
| 305 | | tms->device->save_item(NAME(tms->target_energy)); |
| 306 | | tms->device->save_item(NAME(tms->target_pitch)); |
| 307 | | tms->device->save_item(NAME(tms->target_k)); |
| 170 | save_item(NAME(m_target_energy)); |
| 171 | save_item(NAME(m_target_pitch)); |
| 172 | save_item(NAME(m_target_k)); |
| 308 | 173 | |
| 309 | | tms->device->save_item(NAME(tms->interp_count)); |
| 310 | | tms->device->save_item(NAME(tms->sample_count)); |
| 311 | | tms->device->save_item(NAME(tms->pitch_count)); |
| 174 | save_item(NAME(m_interp_count)); |
| 175 | save_item(NAME(m_sample_count)); |
| 176 | save_item(NAME(m_pitch_count)); |
| 312 | 177 | |
| 313 | | tms->device->save_item(NAME(tms->next_is_address)); |
| 314 | | tms->device->save_item(NAME(tms->address)); |
| 315 | | tms->device->save_item(NAME(tms->schedule_dummy_read)); |
| 316 | | tms->device->save_item(NAME(tms->addr_bit)); |
| 178 | save_item(NAME(m_next_is_address)); |
| 179 | save_item(NAME(m_address)); |
| 180 | save_item(NAME(m_schedule_dummy_read)); |
| 181 | save_item(NAME(m_addr_bit)); |
| 317 | 182 | |
| 318 | | tms->device->save_item(NAME(tms->x)); |
| 183 | save_item(NAME(m_x)); |
| 319 | 184 | |
| 320 | | tms->device->save_item(NAME(tms->RNG)); |
| 185 | save_item(NAME(m_RNG)); |
| 321 | 186 | } |
| 322 | 187 | |
| 323 | 188 | |
| r22848 | r22849 | |
| 328 | 193 | FIFO_data_write -- handle bit data write to the TMS5110 (as a result of toggling M0 pin) |
| 329 | 194 | |
| 330 | 195 | ******************************************************************************************/ |
| 331 | | static void FIFO_data_write(tms5110_state *tms, int data) |
| 196 | void tms5110_device::FIFO_data_write(int data) |
| 332 | 197 | { |
| 333 | 198 | /* add this bit to the FIFO */ |
| 334 | | if (tms->fifo_count < FIFO_SIZE) |
| 199 | if (m_fifo_count < FIFO_SIZE) |
| 335 | 200 | { |
| 336 | | tms->fifo[tms->fifo_tail] = (data&1); /* set bit to 1 or 0 */ |
| 201 | m_fifo[m_fifo_tail] = (data&1); /* set bit to 1 or 0 */ |
| 337 | 202 | |
| 338 | | tms->fifo_tail = (tms->fifo_tail + 1) % FIFO_SIZE; |
| 339 | | tms->fifo_count++; |
| 203 | m_fifo_tail = (m_fifo_tail + 1) % FIFO_SIZE; |
| 204 | m_fifo_count++; |
| 340 | 205 | |
| 341 | | if (DEBUG_5110) logerror("Added bit to FIFO (size=%2d)\n", tms->fifo_count); |
| 206 | if (DEBUG_5110) logerror("Added bit to FIFO (size=%2d)\n", m_fifo_count); |
| 342 | 207 | } |
| 343 | 208 | else |
| 344 | 209 | { |
| r22848 | r22849 | |
| 352 | 217 | |
| 353 | 218 | ******************************************************************************************/ |
| 354 | 219 | |
| 355 | | static int extract_bits(tms5110_state *tms, int count) |
| 220 | int tms5110_device::extract_bits(int count) |
| 356 | 221 | { |
| 357 | 222 | int val = 0; |
| 358 | 223 | |
| 359 | 224 | while (count--) |
| 360 | 225 | { |
| 361 | | val = (val << 1) | (tms->fifo[tms->fifo_head] & 1); |
| 362 | | tms->fifo_count--; |
| 363 | | tms->fifo_head = (tms->fifo_head + 1) % FIFO_SIZE; |
| 226 | val = (val << 1) | (m_fifo[m_fifo_head] & 1); |
| 227 | m_fifo_count--; |
| 228 | m_fifo_head = (m_fifo_head + 1) % FIFO_SIZE; |
| 364 | 229 | } |
| 365 | 230 | return val; |
| 366 | 231 | } |
| 367 | 232 | |
| 368 | | static void request_bits(tms5110_state *tms, int no) |
| 233 | void tms5110_device::request_bits(int no) |
| 369 | 234 | { |
| 370 | | int i; |
| 371 | | for (i=0; i<no; i++) |
| 235 | for (int i=0; i<no; i++) |
| 372 | 236 | { |
| 373 | | if (tms->M0_callback) |
| 237 | if (m_M0_callback) |
| 374 | 238 | { |
| 375 | | int data = (*tms->M0_callback)(tms->device); |
| 376 | | FIFO_data_write(tms, data); |
| 239 | int data = (*m_M0_callback)(this); |
| 240 | FIFO_data_write(data); |
| 377 | 241 | } |
| 378 | 242 | else |
| 379 | 243 | { |
| 380 | 244 | //if (DEBUG_5110) logerror("-->ERROR: TMS5110 missing M0 callback function\n"); |
| 381 | | UINT8 data = new_int_read(tms); |
| 382 | | FIFO_data_write(tms, data); |
| 245 | UINT8 data = new_int_read(); |
| 246 | FIFO_data_write(data); |
| 383 | 247 | } |
| 384 | 248 | } |
| 385 | 249 | } |
| 386 | 250 | |
| 387 | | static void perform_dummy_read(tms5110_state *tms) |
| 251 | void tms5110_device::perform_dummy_read() |
| 388 | 252 | { |
| 389 | | if (tms->schedule_dummy_read) |
| 253 | if (m_schedule_dummy_read) |
| 390 | 254 | { |
| 391 | | if (tms->M0_callback) |
| 255 | if (m_M0_callback) |
| 392 | 256 | { |
| 393 | | int data = (*tms->M0_callback)(tms->device); |
| 257 | int data = (*m_M0_callback)(this); |
| 394 | 258 | |
| 395 | 259 | if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1); |
| 396 | 260 | } |
| 397 | 261 | else |
| 398 | 262 | { |
| 399 | | int data = new_int_read(tms); |
| 263 | int data = new_int_read(); |
| 400 | 264 | |
| 401 | 265 | if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1); |
| 402 | 266 | //if (DEBUG_5110) logerror("-->ERROR: TMS5110 missing M0 callback function\n"); |
| 403 | 267 | } |
| 404 | | tms->schedule_dummy_read = FALSE; |
| 268 | m_schedule_dummy_read = FALSE; |
| 405 | 269 | } |
| 406 | 270 | } |
| 407 | 271 | |
| r22848 | r22849 | |
| 414 | 278 | |
| 415 | 279 | ***********************************************************************************************/ |
| 416 | 280 | |
| 417 | | void tms5110_process(tms5110_state *tms, INT16 *buffer, unsigned int size) |
| 281 | void tms5110_device::process(INT16 *buffer, unsigned int size) |
| 418 | 282 | { |
| 419 | 283 | int buf_count=0; |
| 420 | 284 | int i, interp_period, bitout; |
| 421 | 285 | INT16 Y11, cliptemp; |
| 422 | 286 | |
| 423 | 287 | /* if we're not speaking, fill with nothingness */ |
| 424 | | if (!tms->speaking_now) |
| 288 | if (!m_speaking_now) |
| 425 | 289 | goto empty; |
| 426 | 290 | |
| 427 | 291 | /* if we're to speak, but haven't started */ |
| 428 | | if (!tms->talk_status) |
| 292 | if (!m_talk_status) |
| 429 | 293 | { |
| 430 | 294 | /* a "dummy read" is mentioned in the tms5200 datasheet */ |
| 431 | 295 | /* The Bagman speech roms data are organized in such a way that |
| r22848 | r22849 | |
| 433 | 297 | ** is the speech data. It seems that the tms5110 performs a dummy read |
| 434 | 298 | ** just before it executes a SPEAK command. |
| 435 | 299 | ** This has been moved to command logic ... |
| 436 | | ** perform_dummy_read(tms); |
| 300 | ** perform_dummy_read(); |
| 437 | 301 | */ |
| 438 | 302 | |
| 439 | 303 | /* clear out the new frame parameters (it will become old frame just before the first call to parse_frame() ) */ |
| 440 | | tms->new_energy = 0; |
| 441 | | tms->new_pitch = 0; |
| 442 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 443 | | tms->new_k[i] = 0; |
| 304 | m_new_energy = 0; |
| 305 | m_new_pitch = 0; |
| 306 | for (i = 0; i < m_coeff->num_k; i++) |
| 307 | m_new_k[i] = 0; |
| 444 | 308 | |
| 445 | | tms->talk_status = 1; |
| 309 | m_talk_status = 1; |
| 446 | 310 | } |
| 447 | 311 | |
| 448 | 312 | |
| 449 | 313 | /* loop until the buffer is full or we've stopped speaking */ |
| 450 | | while ((size > 0) && tms->speaking_now) |
| 314 | while ((size > 0) && m_speaking_now) |
| 451 | 315 | { |
| 452 | 316 | int current_val; |
| 453 | 317 | |
| 454 | 318 | /* if we're ready for a new frame */ |
| 455 | | if ((tms->interp_count == 0) && (tms->sample_count == 0)) |
| 319 | if ((m_interp_count == 0) && (m_sample_count == 0)) |
| 456 | 320 | { |
| 457 | 321 | /* remember previous frame */ |
| 458 | | tms->old_energy = tms->new_energy; |
| 459 | | tms->old_pitch = tms->new_pitch; |
| 460 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 461 | | tms->old_k[i] = tms->new_k[i]; |
| 322 | m_old_energy = m_new_energy; |
| 323 | m_old_pitch = m_new_pitch; |
| 324 | for (i = 0; i < m_coeff->num_k; i++) |
| 325 | m_old_k[i] = m_new_k[i]; |
| 462 | 326 | |
| 463 | 327 | |
| 464 | 328 | /* if the old frame was a stop frame, exit and do not process any more frames */ |
| 465 | | if (tms->old_energy == COEFF_ENERGY_SENTINEL) |
| 329 | if (m_old_energy == COEFF_ENERGY_SENTINEL) |
| 466 | 330 | { |
| 467 | 331 | if (DEBUG_5110) logerror("processing frame: stop frame\n"); |
| 468 | | tms->target_energy = tms->current_energy = 0; |
| 469 | | tms->speaking_now = tms->talk_status = 0; |
| 470 | | tms->interp_count = tms->sample_count = tms->pitch_count = 0; |
| 332 | m_target_energy = m_current_energy = 0; |
| 333 | m_speaking_now = m_talk_status = 0; |
| 334 | m_interp_count = m_sample_count = m_pitch_count = 0; |
| 471 | 335 | goto empty; |
| 472 | 336 | } |
| 473 | 337 | |
| 474 | 338 | |
| 475 | 339 | /* Parse a new frame into the new_energy, new_pitch and new_k[] */ |
| 476 | | parse_frame(tms); |
| 340 | parse_frame(); |
| 477 | 341 | |
| 478 | 342 | |
| 479 | 343 | /* Set old target as new start of frame */ |
| 480 | | tms->current_energy = tms->old_energy; |
| 481 | | tms->current_pitch = tms->old_pitch; |
| 344 | m_current_energy = m_old_energy; |
| 345 | m_current_pitch = m_old_pitch; |
| 482 | 346 | |
| 483 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 484 | | tms->current_k[i] = tms->old_k[i]; |
| 347 | for (i = 0; i < m_coeff->num_k; i++) |
| 348 | m_current_k[i] = m_old_k[i]; |
| 485 | 349 | |
| 486 | 350 | |
| 487 | 351 | /* is this the stop (ramp down) frame? */ |
| 488 | | if (tms->new_energy == COEFF_ENERGY_SENTINEL) |
| 352 | if (m_new_energy == COEFF_ENERGY_SENTINEL) |
| 489 | 353 | { |
| 490 | 354 | /*logerror("processing frame: ramp down\n");*/ |
| 491 | | tms->target_energy = 0; |
| 492 | | tms->target_pitch = tms->old_pitch; |
| 493 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 494 | | tms->target_k[i] = tms->old_k[i]; |
| 355 | m_target_energy = 0; |
| 356 | m_target_pitch = m_old_pitch; |
| 357 | for (i = 0; i < m_coeff->num_k; i++) |
| 358 | m_target_k[i] = m_old_k[i]; |
| 495 | 359 | } |
| 496 | | else if ((tms->old_energy == 0) && (tms->new_energy != 0)) /* was the old frame a zero-energy frame? */ |
| 360 | else if ((m_old_energy == 0) && (m_new_energy != 0)) /* was the old frame a zero-energy frame? */ |
| 497 | 361 | { |
| 498 | 362 | /* if so, and if the new frame is non-zero energy frame then the new parameters |
| 499 | 363 | should become our current and target parameters immediately, |
| r22848 | r22849 | |
| 501 | 365 | */ |
| 502 | 366 | |
| 503 | 367 | /*logerror("processing non-zero energy frame after zero-energy frame\n");*/ |
| 504 | | tms->target_energy = tms->new_energy; |
| 505 | | tms->target_pitch = tms->current_pitch = tms->new_pitch; |
| 506 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 507 | | tms->target_k[i] = tms->current_k[i] = tms->new_k[i]; |
| 368 | m_target_energy = m_new_energy; |
| 369 | m_target_pitch = m_current_pitch = m_new_pitch; |
| 370 | for (i = 0; i < m_coeff->num_k; i++) |
| 371 | m_target_k[i] = m_current_k[i] = m_new_k[i]; |
| 508 | 372 | } |
| 509 | | else if ((tms->old_pitch == 0) && (tms->new_pitch != 0)) /* is this a change from unvoiced to voiced frame ? */ |
| 373 | else if ((m_old_pitch == 0) && (m_new_pitch != 0)) /* is this a change from unvoiced to voiced frame ? */ |
| 510 | 374 | { |
| 511 | 375 | /* if so, then the new parameters should become our current and target parameters immediately, |
| 512 | 376 | i.e. we should NOT interpolate them slowly in. |
| 513 | 377 | */ |
| 514 | 378 | /*if (DEBUG_5110) logerror("processing frame: UNVOICED->VOICED frame change\n");*/ |
| 515 | | tms->target_energy = tms->new_energy; |
| 516 | | tms->target_pitch = tms->current_pitch = tms->new_pitch; |
| 517 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 518 | | tms->target_k[i] = tms->current_k[i] = tms->new_k[i]; |
| 379 | m_target_energy = m_new_energy; |
| 380 | m_target_pitch = m_current_pitch = m_new_pitch; |
| 381 | for (i = 0; i < m_coeff->num_k; i++) |
| 382 | m_target_k[i] = m_current_k[i] = m_new_k[i]; |
| 519 | 383 | } |
| 520 | | else if ((tms->old_pitch != 0) && (tms->new_pitch == 0)) /* is this a change from voiced to unvoiced frame ? */ |
| 384 | else if ((m_old_pitch != 0) && (m_new_pitch == 0)) /* is this a change from voiced to unvoiced frame ? */ |
| 521 | 385 | { |
| 522 | 386 | /* if so, then the new parameters should become our current and target parameters immediately, |
| 523 | 387 | i.e. we should NOT interpolate them slowly in. |
| 524 | 388 | */ |
| 525 | 389 | /*if (DEBUG_5110) logerror("processing frame: VOICED->UNVOICED frame change\n");*/ |
| 526 | | tms->target_energy = tms->new_energy; |
| 527 | | tms->target_pitch = tms->current_pitch = tms->new_pitch; |
| 528 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 529 | | tms->target_k[i] = tms->current_k[i] = tms->new_k[i]; |
| 390 | m_target_energy = m_new_energy; |
| 391 | m_target_pitch = m_current_pitch = m_new_pitch; |
| 392 | for (i = 0; i < m_coeff->num_k; i++) |
| 393 | m_target_k[i] = m_current_k[i] = m_new_k[i]; |
| 530 | 394 | } |
| 531 | 395 | else |
| 532 | 396 | { |
| r22848 | r22849 | |
| 534 | 398 | /*logerror("*** Energy = %d\n",current_energy);*/ |
| 535 | 399 | /*logerror("proc: %d %d\n",last_fbuf_head,fbuf_head);*/ |
| 536 | 400 | |
| 537 | | tms->target_energy = tms->new_energy; |
| 538 | | tms->target_pitch = tms->new_pitch; |
| 539 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 540 | | tms->target_k[i] = tms->new_k[i]; |
| 401 | m_target_energy = m_new_energy; |
| 402 | m_target_pitch = m_new_pitch; |
| 403 | for (i = 0; i < m_coeff->num_k; i++) |
| 404 | m_target_k[i] = m_new_k[i]; |
| 541 | 405 | } |
| 542 | 406 | } |
| 543 | 407 | else |
| 544 | 408 | { |
| 545 | | interp_period = tms->sample_count / 25; |
| 546 | | switch(tms->interp_count) |
| 409 | interp_period = m_sample_count / 25; |
| 410 | switch(m_interp_count) |
| 547 | 411 | { |
| 548 | 412 | /* PC=X X cycle, rendering change (change for next cycle which chip is actually doing) */ |
| 549 | 413 | case 0: /* PC=0, A cycle, nothing happens (calc energy) */ |
| r22848 | r22849 | |
| 551 | 415 | case 1: /* PC=0, B cycle, nothing happens (update energy) */ |
| 552 | 416 | break; |
| 553 | 417 | case 2: /* PC=1, A cycle, update energy (calc pitch) */ |
| 554 | | tms->current_energy += ((tms->target_energy - tms->current_energy) >> tms->coeff->interp_coeff[interp_period]); |
| 418 | m_current_energy += ((m_target_energy - m_current_energy) >> m_coeff->interp_coeff[interp_period]); |
| 555 | 419 | break; |
| 556 | 420 | case 3: /* PC=1, B cycle, nothing happens (update pitch) */ |
| 557 | 421 | break; |
| 558 | 422 | case 4: /* PC=2, A cycle, update pitch (calc K1) */ |
| 559 | | tms->current_pitch += ((tms->target_pitch - tms->current_pitch) >> tms->coeff->interp_coeff[interp_period]); |
| 423 | m_current_pitch += ((m_target_pitch - m_current_pitch) >> m_coeff->interp_coeff[interp_period]); |
| 560 | 424 | break; |
| 561 | 425 | case 5: /* PC=2, B cycle, nothing happens (update K1) */ |
| 562 | 426 | break; |
| 563 | 427 | case 6: /* PC=3, A cycle, update K1 (calc K2) */ |
| 564 | | tms->current_k[0] += ((tms->target_k[0] - tms->current_k[0]) >> tms->coeff->interp_coeff[interp_period]); |
| 428 | m_current_k[0] += ((m_target_k[0] - m_current_k[0]) >> m_coeff->interp_coeff[interp_period]); |
| 565 | 429 | break; |
| 566 | 430 | case 7: /* PC=3, B cycle, nothing happens (update K2) */ |
| 567 | 431 | break; |
| 568 | 432 | case 8: /* PC=4, A cycle, update K2 (calc K3) */ |
| 569 | | tms->current_k[1] += ((tms->target_k[1] - tms->current_k[1]) >> tms->coeff->interp_coeff[interp_period]); |
| 433 | m_current_k[1] += ((m_target_k[1] - m_current_k[1]) >> m_coeff->interp_coeff[interp_period]); |
| 570 | 434 | break; |
| 571 | 435 | case 9: /* PC=4, B cycle, nothing happens (update K3) */ |
| 572 | 436 | break; |
| 573 | 437 | case 10: /* PC=5, A cycle, update K3 (calc K4) */ |
| 574 | | tms->current_k[2] += ((tms->target_k[2] - tms->current_k[2]) >> tms->coeff->interp_coeff[interp_period]); |
| 438 | m_current_k[2] += ((m_target_k[2] - m_current_k[2]) >> m_coeff->interp_coeff[interp_period]); |
| 575 | 439 | break; |
| 576 | 440 | case 11: /* PC=5, B cycle, nothing happens (update K4) */ |
| 577 | 441 | break; |
| 578 | 442 | case 12: /* PC=6, A cycle, update K4 (calc K5) */ |
| 579 | | tms->current_k[3] += ((tms->target_k[3] - tms->current_k[3]) >> tms->coeff->interp_coeff[interp_period]); |
| 443 | m_current_k[3] += ((m_target_k[3] - m_current_k[3]) >> m_coeff->interp_coeff[interp_period]); |
| 580 | 444 | break; |
| 581 | 445 | case 13: /* PC=6, B cycle, nothing happens (update K5) */ |
| 582 | 446 | break; |
| 583 | 447 | case 14: /* PC=7, A cycle, update K5 (calc K6) */ |
| 584 | | tms->current_k[4] += ((tms->target_k[4] - tms->current_k[4]) >> tms->coeff->interp_coeff[interp_period]); |
| 448 | m_current_k[4] += ((m_target_k[4] - m_current_k[4]) >> m_coeff->interp_coeff[interp_period]); |
| 585 | 449 | break; |
| 586 | 450 | case 15: /* PC=7, B cycle, nothing happens (update K6) */ |
| 587 | 451 | break; |
| 588 | 452 | case 16: /* PC=8, A cycle, update K6 (calc K7) */ |
| 589 | | tms->current_k[5] += ((tms->target_k[5] - tms->current_k[5]) >> tms->coeff->interp_coeff[interp_period]); |
| 453 | m_current_k[5] += ((m_target_k[5] - m_current_k[5]) >> m_coeff->interp_coeff[interp_period]); |
| 590 | 454 | break; |
| 591 | 455 | case 17: /* PC=8, B cycle, nothing happens (update K7) */ |
| 592 | 456 | break; |
| 593 | 457 | case 18: /* PC=9, A cycle, update K7 (calc K8) */ |
| 594 | | tms->current_k[6] += ((tms->target_k[6] - tms->current_k[6]) >> tms->coeff->interp_coeff[interp_period]); |
| 458 | m_current_k[6] += ((m_target_k[6] - m_current_k[6]) >> m_coeff->interp_coeff[interp_period]); |
| 595 | 459 | break; |
| 596 | 460 | case 19: /* PC=9, B cycle, nothing happens (update K8) */ |
| 597 | 461 | break; |
| 598 | 462 | case 20: /* PC=10, A cycle, update K8 (calc K9) */ |
| 599 | | tms->current_k[7] += ((tms->target_k[7] - tms->current_k[7]) >> tms->coeff->interp_coeff[interp_period]); |
| 463 | m_current_k[7] += ((m_target_k[7] - m_current_k[7]) >> m_coeff->interp_coeff[interp_period]); |
| 600 | 464 | break; |
| 601 | 465 | case 21: /* PC=10, B cycle, nothing happens (update K9) */ |
| 602 | 466 | break; |
| 603 | 467 | case 22: /* PC=11, A cycle, update K9 (calc K10) */ |
| 604 | | tms->current_k[8] += ((tms->target_k[8] - tms->current_k[8]) >> tms->coeff->interp_coeff[interp_period]); |
| 468 | m_current_k[8] += ((m_target_k[8] - m_current_k[8]) >> m_coeff->interp_coeff[interp_period]); |
| 605 | 469 | break; |
| 606 | 470 | case 23: /* PC=11, B cycle, nothing happens (update K10) */ |
| 607 | 471 | break; |
| 608 | 472 | case 24: /* PC=12, A cycle, update K10 (do nothing) */ |
| 609 | | tms->current_k[9] += ((tms->target_k[9] - tms->current_k[9]) >> tms->coeff->interp_coeff[interp_period]); |
| 473 | m_current_k[9] += ((m_target_k[9] - m_current_k[9]) >> m_coeff->interp_coeff[interp_period]); |
| 610 | 474 | break; |
| 611 | 475 | } |
| 612 | 476 | } |
| r22848 | r22849 | |
| 614 | 478 | |
| 615 | 479 | /* calculate the output */ |
| 616 | 480 | |
| 617 | | if (tms->current_energy == 0) |
| 481 | if (m_current_energy == 0) |
| 618 | 482 | { |
| 619 | 483 | /* generate silent samples here */ |
| 620 | 484 | current_val = 0x00; |
| 621 | 485 | } |
| 622 | | else if (tms->old_pitch == 0) |
| 486 | else if (m_old_pitch == 0) |
| 623 | 487 | { |
| 624 | 488 | /* generate unvoiced samples here */ |
| 625 | | if (tms->RNG&1) |
| 489 | if (m_RNG&1) |
| 626 | 490 | current_val = -64; /* according to the patent it is (either + or -) half of the maximum value in the chirp table */ |
| 627 | 491 | else |
| 628 | 492 | current_val = 64; |
| r22848 | r22849 | |
| 639 | 503 | * (address 50d holds zeroes) |
| 640 | 504 | */ |
| 641 | 505 | |
| 642 | | /*if (tms->coeff->subtype & (SUBTYPE_TMS5100 | SUBTYPE_M58817))*/ |
| 506 | /*if (m_coeff->subtype & (SUBTYPE_TMS5100 | SUBTYPE_M58817))*/ |
| 643 | 507 | |
| 644 | | if (tms->pitch_count > 50) |
| 645 | | current_val = tms->coeff->chirptable[50]; |
| 508 | if (m_pitch_count > 50) |
| 509 | current_val = m_coeff->chirptable[50]; |
| 646 | 510 | else |
| 647 | | current_val = tms->coeff->chirptable[tms->pitch_count]; |
| 511 | current_val = m_coeff->chirptable[m_pitch_count]; |
| 648 | 512 | } |
| 649 | 513 | |
| 650 | 514 | /* Update LFSR *20* times every sample, like patent shows */ |
| 651 | 515 | for (i=0; i<20; i++) |
| 652 | 516 | { |
| 653 | | bitout = ((tms->RNG>>12)&1) ^ |
| 654 | | ((tms->RNG>>10)&1) ^ |
| 655 | | ((tms->RNG>> 9)&1) ^ |
| 656 | | ((tms->RNG>> 0)&1); |
| 657 | | tms->RNG >>= 1; |
| 658 | | tms->RNG |= (bitout<<12); |
| 517 | bitout = ((m_RNG>>12)&1) ^ |
| 518 | ((m_RNG>>10)&1) ^ |
| 519 | ((m_RNG>> 9)&1) ^ |
| 520 | ((m_RNG>> 0)&1); |
| 521 | m_RNG >>= 1; |
| 522 | m_RNG |= (bitout<<12); |
| 659 | 523 | } |
| 660 | 524 | |
| 661 | 525 | /* Lattice filter here */ |
| 662 | 526 | |
| 663 | | Y11 = (current_val * 64 * tms->current_energy) / 512; |
| 527 | Y11 = (current_val * 64 * m_current_energy) / 512; |
| 664 | 528 | |
| 665 | | for (i = tms->coeff->num_k - 1; i >= 0; i--) |
| 529 | for (i = m_coeff->num_k - 1; i >= 0; i--) |
| 666 | 530 | { |
| 667 | | Y11 = Y11 - ((tms->current_k[i] * tms->x[i]) / 512); |
| 668 | | tms->x[i+1] = tms->x[i] + ((tms->current_k[i] * Y11) / 512); |
| 531 | Y11 = Y11 - ((m_current_k[i] * m_x[i]) / 512); |
| 532 | m_x[i+1] = m_x[i] + ((m_current_k[i] * Y11) / 512); |
| 669 | 533 | } |
| 670 | 534 | |
| 671 | | tms->x[0] = Y11; |
| 535 | m_x[0] = Y11; |
| 672 | 536 | |
| 673 | 537 | |
| 674 | 538 | /* clipping & wrapping, just like the patent */ |
| r22848 | r22849 | |
| 677 | 541 | cliptemp = Y11 / 16; |
| 678 | 542 | |
| 679 | 543 | /* M58817 seems to be different */ |
| 680 | | if (tms->coeff->subtype & (SUBTYPE_M58817)) |
| 544 | if (m_coeff->subtype & (SUBTYPE_M58817)) |
| 681 | 545 | cliptemp = cliptemp / 2; |
| 682 | 546 | |
| 683 | 547 | if (cliptemp > 511) cliptemp = -512 + (cliptemp-511); |
| r22848 | r22849 | |
| 692 | 556 | |
| 693 | 557 | /* Update all counts */ |
| 694 | 558 | |
| 695 | | tms->sample_count = (tms->sample_count + 1) % 200; |
| 559 | m_sample_count = (m_sample_count + 1) % 200; |
| 696 | 560 | |
| 697 | | if (tms->current_pitch != 0) |
| 561 | if (m_current_pitch != 0) |
| 698 | 562 | { |
| 699 | | tms->pitch_count++; |
| 700 | | if (tms->pitch_count >= tms->current_pitch) |
| 701 | | tms->pitch_count = 0; |
| 563 | m_pitch_count++; |
| 564 | if (m_pitch_count >= m_current_pitch) |
| 565 | m_pitch_count = 0; |
| 702 | 566 | } |
| 703 | 567 | else |
| 704 | | tms->pitch_count = 0; |
| 568 | m_pitch_count = 0; |
| 705 | 569 | |
| 706 | | tms->interp_count = (tms->interp_count + 1) % 25; |
| 570 | m_interp_count = (m_interp_count + 1) % 25; |
| 707 | 571 | |
| 708 | 572 | buf_count++; |
| 709 | 573 | size--; |
| r22848 | r22849 | |
| 713 | 577 | |
| 714 | 578 | while (size > 0) |
| 715 | 579 | { |
| 716 | | tms->sample_count = (tms->sample_count + 1) % 200; |
| 717 | | tms->interp_count = (tms->interp_count + 1) % 25; |
| 580 | m_sample_count = (m_sample_count + 1) % 200; |
| 581 | m_interp_count = (m_interp_count + 1) % 25; |
| 718 | 582 | |
| 719 | 583 | buffer[buf_count] = 0x00; |
| 720 | 584 | buf_count++; |
| r22848 | r22849 | |
| 730 | 594 | |
| 731 | 595 | ******************************************************************************************/ |
| 732 | 596 | |
| 733 | | void tms5110_PDC_set(tms5110_state *tms, int data) |
| 597 | void tms5110_device::PDC_set(int data) |
| 734 | 598 | { |
| 735 | | if (tms->PDC != (data & 0x1) ) |
| 599 | if (m_PDC != (data & 0x1) ) |
| 736 | 600 | { |
| 737 | | tms->PDC = data & 0x1; |
| 738 | | if (tms->PDC == 0) /* toggling 1->0 processes command on CTL_pins */ |
| 601 | m_PDC = data & 0x1; |
| 602 | if (m_PDC == 0) /* toggling 1->0 processes command on CTL_pins */ |
| 739 | 603 | { |
| 740 | 604 | /* first pdc toggles output, next toggles input */ |
| 741 | | switch (tms->state) |
| 605 | switch (m_state) |
| 742 | 606 | { |
| 743 | 607 | case CTL_STATE_INPUT: |
| 744 | 608 | /* continue */ |
| 745 | 609 | break; |
| 746 | 610 | case CTL_STATE_NEXT_OUTPUT: |
| 747 | | tms->state = CTL_STATE_OUTPUT; |
| 611 | m_state = CTL_STATE_OUTPUT; |
| 748 | 612 | return; |
| 749 | 613 | case CTL_STATE_OUTPUT: |
| 750 | | tms->state = CTL_STATE_INPUT; |
| 614 | m_state = CTL_STATE_INPUT; |
| 751 | 615 | return; |
| 752 | 616 | } |
| 753 | 617 | /* the only real commands we handle now are SPEAK and RESET */ |
| 754 | | if (tms->next_is_address) |
| 618 | if (m_next_is_address) |
| 755 | 619 | { |
| 756 | | tms->next_is_address = FALSE; |
| 757 | | tms->address = tms->address | ((tms->CTL_pins & 0x0F)<<tms->addr_bit); |
| 758 | | tms->addr_bit = (tms->addr_bit + 4) % 12; |
| 759 | | tms->schedule_dummy_read = TRUE; |
| 760 | | if (tms->set_load_address) |
| 761 | | tms->set_load_address(tms->device, tms->address); |
| 762 | | new_int_write_addr(tms, tms->CTL_pins & 0x0F); |
| 620 | m_next_is_address = FALSE; |
| 621 | m_address = m_address | ((m_CTL_pins & 0x0F)<<m_addr_bit); |
| 622 | m_addr_bit = (m_addr_bit + 4) % 12; |
| 623 | m_schedule_dummy_read = TRUE; |
| 624 | if (m_set_load_address) |
| 625 | m_set_load_address(this, m_address); |
| 626 | new_int_write_addr(m_CTL_pins & 0x0F); |
| 763 | 627 | } |
| 764 | 628 | else |
| 765 | 629 | { |
| 766 | | switch (tms->CTL_pins & 0xe) /*CTL1 - don't care*/ |
| 630 | switch (m_CTL_pins & 0xe) /*CTL1 - don't care*/ |
| 767 | 631 | { |
| 768 | 632 | case TMS5110_CMD_SPEAK: |
| 769 | | perform_dummy_read(tms); |
| 770 | | tms->speaking_now = 1; |
| 633 | perform_dummy_read(); |
| 634 | m_speaking_now = 1; |
| 771 | 635 | |
| 772 | 636 | //should FIFO be cleared now ????? |
| 773 | 637 | break; |
| 774 | 638 | |
| 775 | 639 | case TMS5110_CMD_RESET: |
| 776 | | perform_dummy_read(tms); |
| 777 | | tms->device->reset(); |
| 640 | perform_dummy_read(); |
| 641 | reset(); |
| 778 | 642 | break; |
| 779 | 643 | |
| 780 | 644 | case TMS5110_CMD_READ_BIT: |
| 781 | | if (tms->schedule_dummy_read) |
| 782 | | perform_dummy_read(tms); |
| 645 | if (m_schedule_dummy_read) |
| 646 | perform_dummy_read(); |
| 783 | 647 | else |
| 784 | 648 | { |
| 785 | | request_bits(tms, 1); |
| 786 | | tms->CTL_pins = (tms->CTL_pins & 0x0E) | extract_bits(tms, 1); |
| 649 | request_bits(1); |
| 650 | m_CTL_pins = (m_CTL_pins & 0x0E) | extract_bits(1); |
| 787 | 651 | } |
| 788 | 652 | break; |
| 789 | 653 | |
| 790 | 654 | case TMS5110_CMD_LOAD_ADDRESS: |
| 791 | | tms->next_is_address = TRUE; |
| 655 | m_next_is_address = TRUE; |
| 792 | 656 | break; |
| 793 | 657 | |
| 794 | 658 | case TMS5110_CMD_READ_BRANCH: |
| 795 | | new_int_write(tms, 0,1,1,0); |
| 796 | | new_int_write(tms, 1,1,1,0); |
| 797 | | new_int_write(tms, 0,1,1,0); |
| 798 | | new_int_write(tms, 0,0,0,0); |
| 799 | | new_int_write(tms, 1,0,0,0); |
| 800 | | new_int_write(tms, 0,0,0,0); |
| 801 | | tms->schedule_dummy_read = FALSE; |
| 659 | new_int_write(0,1,1,0); |
| 660 | new_int_write(1,1,1,0); |
| 661 | new_int_write(0,1,1,0); |
| 662 | new_int_write(0,0,0,0); |
| 663 | new_int_write(1,0,0,0); |
| 664 | new_int_write(0,0,0,0); |
| 665 | m_schedule_dummy_read = FALSE; |
| 802 | 666 | break; |
| 803 | 667 | |
| 804 | 668 | case TMS5110_CMD_TEST_TALK: |
| 805 | | tms->state = CTL_STATE_NEXT_OUTPUT; |
| 669 | m_state = CTL_STATE_NEXT_OUTPUT; |
| 806 | 670 | break; |
| 807 | 671 | |
| 808 | 672 | default: |
| 809 | | logerror("tms5110.c: unknown command: 0x%02x\n", tms->CTL_pins); |
| 673 | logerror("tms5110.c: unknown command: 0x%02x\n", m_CTL_pins); |
| 810 | 674 | break; |
| 811 | 675 | } |
| 812 | 676 | |
| r22848 | r22849 | |
| 823 | 687 | |
| 824 | 688 | ******************************************************************************************/ |
| 825 | 689 | |
| 826 | | static void parse_frame(tms5110_state *tms) |
| 690 | void tms5110_device::parse_frame() |
| 827 | 691 | { |
| 828 | 692 | int bits, indx, i, rep_flag; |
| 829 | 693 | #if (DEBUG_5110) |
| r22848 | r22849 | |
| 831 | 695 | #endif |
| 832 | 696 | |
| 833 | 697 | /* count the total number of bits available */ |
| 834 | | bits = tms->fifo_count; |
| 698 | bits = m_fifo_count; |
| 835 | 699 | |
| 836 | 700 | |
| 837 | 701 | /* attempt to extract the energy index */ |
| 838 | | bits -= tms->coeff->energy_bits; |
| 702 | bits -= m_coeff->energy_bits; |
| 839 | 703 | if (bits < 0) |
| 840 | 704 | { |
| 841 | | request_bits( tms,-bits ); /* toggle M0 to receive needed bits */ |
| 705 | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 842 | 706 | bits = 0; |
| 843 | 707 | } |
| 844 | | indx = extract_bits(tms,tms->coeff->energy_bits); |
| 845 | | tms->new_energy = tms->coeff->energytable[indx]; |
| 708 | indx = extract_bits(m_coeff->energy_bits); |
| 709 | m_new_energy = m_coeff->energytable[indx]; |
| 846 | 710 | #if (DEBUG_5110) |
| 847 | 711 | ene = indx; |
| 848 | 712 | #endif |
| r22848 | r22849 | |
| 851 | 715 | |
| 852 | 716 | if ((indx == 0) || (indx == 15)) |
| 853 | 717 | { |
| 854 | | if (DEBUG_5110) logerror(" (4-bit energy=%d frame)\n",tms->new_energy); |
| 718 | if (DEBUG_5110) logerror(" (4-bit energy=%d frame)\n",m_new_energy); |
| 855 | 719 | |
| 856 | 720 | /* clear the k's */ |
| 857 | 721 | if (indx == 0) |
| 858 | 722 | { |
| 859 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 860 | | tms->new_k[i] = 0; |
| 723 | for (i = 0; i < m_coeff->num_k; i++) |
| 724 | m_new_k[i] = 0; |
| 861 | 725 | } |
| 862 | 726 | |
| 863 | 727 | /* clear fifo if stop frame encountered */ |
| 864 | 728 | if (indx == 15) |
| 865 | 729 | { |
| 866 | | if (DEBUG_5110) logerror(" (4-bit energy=%d STOP frame)\n",tms->new_energy); |
| 867 | | tms->fifo_head = tms->fifo_tail = tms->fifo_count = 0; |
| 730 | if (DEBUG_5110) logerror(" (4-bit energy=%d STOP frame)\n",m_new_energy); |
| 731 | m_fifo_head = m_fifo_tail = m_fifo_count = 0; |
| 868 | 732 | } |
| 869 | 733 | return; |
| 870 | 734 | } |
| r22848 | r22849 | |
| 874 | 738 | bits -= 1; |
| 875 | 739 | if (bits < 0) |
| 876 | 740 | { |
| 877 | | request_bits( tms,-bits ); /* toggle M0 to receive needed bits */ |
| 741 | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 878 | 742 | bits = 0; |
| 879 | 743 | } |
| 880 | | rep_flag = extract_bits(tms,1); |
| 744 | rep_flag = extract_bits(1); |
| 881 | 745 | |
| 882 | 746 | /* attempt to extract the pitch */ |
| 883 | | bits -= tms->coeff->pitch_bits; |
| 747 | bits -= m_coeff->pitch_bits; |
| 884 | 748 | if (bits < 0) |
| 885 | 749 | { |
| 886 | | request_bits( tms,-bits ); /* toggle M0 to receive needed bits */ |
| 750 | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 887 | 751 | bits = 0; |
| 888 | 752 | } |
| 889 | | indx = extract_bits(tms,tms->coeff->pitch_bits); |
| 890 | | tms->new_pitch = tms->coeff->pitchtable[indx]; |
| 753 | indx = extract_bits(m_coeff->pitch_bits); |
| 754 | m_new_pitch = m_coeff->pitchtable[indx]; |
| 891 | 755 | |
| 892 | 756 | /* if this is a repeat frame, just copy the k's */ |
| 893 | 757 | if (rep_flag) |
| 894 | 758 | { |
| 895 | 759 | //actually, we do nothing because the k's were already loaded (on parsing the previous frame) |
| 896 | 760 | |
| 897 | | if (DEBUG_5110) logerror(" (10-bit energy=%d pitch=%d rep=%d frame)\n", tms->new_energy, tms->new_pitch, rep_flag); |
| 761 | if (DEBUG_5110) logerror(" (10-bit energy=%d pitch=%d rep=%d frame)\n", m_new_energy, m_new_pitch, rep_flag); |
| 898 | 762 | return; |
| 899 | 763 | } |
| 900 | 764 | |
| r22848 | r22849 | |
| 906 | 770 | bits -= 18; |
| 907 | 771 | if (bits < 0) |
| 908 | 772 | { |
| 909 | | request_bits( tms,-bits ); /* toggle M0 to receive needed bits */ |
| 773 | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 910 | 774 | bits = 0; |
| 911 | 775 | } |
| 912 | 776 | for (i = 0; i < 4; i++) |
| 913 | | tms->new_k[i] = tms->coeff->ktable[i][extract_bits(tms,tms->coeff->kbits[i])]; |
| 777 | m_new_k[i] = m_coeff->ktable[i][extract_bits(m_coeff->kbits[i])]; |
| 914 | 778 | |
| 915 | 779 | /* and clear the rest of the new_k[] */ |
| 916 | | for (i = 4; i < tms->coeff->num_k; i++) |
| 917 | | tms->new_k[i] = 0; |
| 780 | for (i = 4; i < m_coeff->num_k; i++) |
| 781 | m_new_k[i] = 0; |
| 918 | 782 | |
| 919 | | if (DEBUG_5110) logerror(" (28-bit energy=%d pitch=%d rep=%d 4K frame)\n", tms->new_energy, tms->new_pitch, rep_flag); |
| 783 | if (DEBUG_5110) logerror(" (28-bit energy=%d pitch=%d rep=%d 4K frame)\n", m_new_energy, m_new_pitch, rep_flag); |
| 920 | 784 | return; |
| 921 | 785 | } |
| 922 | 786 | |
| r22848 | r22849 | |
| 924 | 788 | bits -= 39; |
| 925 | 789 | if (bits < 0) |
| 926 | 790 | { |
| 927 | | request_bits( tms,-bits ); /* toggle M0 to receive needed bits */ |
| 791 | request_bits( -bits ); /* toggle M0 to receive needed bits */ |
| 928 | 792 | bits = 0; |
| 929 | 793 | } |
| 930 | 794 | #if (DEBUG_5110) |
| 931 | 795 | printf("FrameDump %02d ", ene); |
| 932 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 796 | for (i = 0; i < m_coeff->num_k; i++) |
| 933 | 797 | { |
| 934 | 798 | int x; |
| 935 | | x = extract_bits(tms, tms->coeff->kbits[i]); |
| 936 | | tms->new_k[i] = tms->coeff->ktable[i][x]; |
| 799 | x = extract_bits( m_coeff->kbits[i]); |
| 800 | m_new_k[i] = m_coeff->ktable[i][x]; |
| 937 | 801 | printf("%02d ", x); |
| 938 | 802 | } |
| 939 | 803 | printf("\n"); |
| 940 | 804 | #else |
| 941 | | for (i = 0; i < tms->coeff->num_k; i++) |
| 805 | for (i = 0; i < m_coeff->num_k; i++) |
| 942 | 806 | { |
| 943 | 807 | int x; |
| 944 | | x = extract_bits(tms, tms->coeff->kbits[i]); |
| 945 | | tms->new_k[i] = tms->coeff->ktable[i][x]; |
| 808 | x = extract_bits( m_coeff->kbits[i]); |
| 809 | m_new_k[i] = m_coeff->ktable[i][x]; |
| 946 | 810 | } |
| 947 | 811 | #endif |
| 948 | | if (DEBUG_5110) logerror(" (49-bit energy=%d pitch=%d rep=%d 10K frame)\n", tms->new_energy, tms->new_pitch, rep_flag); |
| 812 | if (DEBUG_5110) logerror(" (49-bit energy=%d pitch=%d rep=%d 10K frame)\n", m_new_energy, m_new_pitch, rep_flag); |
| 949 | 813 | |
| 950 | 814 | } |
| 951 | 815 | |
| r22848 | r22849 | |
| 976 | 840 | |
| 977 | 841 | static int speech_rom_read_bit(device_t *device) |
| 978 | 842 | { |
| 979 | | tms5110_state *tms = get_safe_token(device); |
| 843 | tms5110_device *tms5110 = (tms5110_device *) device; |
| 844 | return tms5110->_speech_rom_read_bit(); |
| 845 | } |
| 980 | 846 | |
| 847 | int tms5110_device::_speech_rom_read_bit() |
| 848 | { |
| 981 | 849 | int r; |
| 982 | 850 | |
| 983 | | if (tms->speech_rom_bitnum<0) |
| 851 | if (m_speech_rom_bitnum<0) |
| 984 | 852 | r = 0; |
| 985 | 853 | else |
| 986 | | r = (tms->table[tms->speech_rom_bitnum >> 3] >> (0x07 - (tms->speech_rom_bitnum & 0x07))) & 1; |
| 854 | r = (m_table[m_speech_rom_bitnum >> 3] >> (0x07 - (m_speech_rom_bitnum & 0x07))) & 1; |
| 987 | 855 | |
| 988 | | tms->speech_rom_bitnum++; |
| 856 | m_speech_rom_bitnum++; |
| 989 | 857 | |
| 990 | 858 | return r; |
| 991 | 859 | } |
| 992 | 860 | |
| 993 | 861 | static void speech_rom_set_addr(device_t *device, int addr) |
| 994 | 862 | { |
| 995 | | tms5110_state *tms = get_safe_token(device); |
| 863 | tms5110_device *tms5110 = (tms5110_device *) device; |
| 864 | tms5110->_speech_rom_set_addr(addr); |
| 865 | } |
| 996 | 866 | |
| 997 | | tms->speech_rom_bitnum = addr * 8 - 1; |
| 867 | void tms5110_device::_speech_rom_set_addr(int addr) |
| 868 | { |
| 869 | m_speech_rom_bitnum = addr * 8 - 1; |
| 998 | 870 | } |
| 999 | 871 | |
| 1000 | 872 | /****************************************************************************** |
| r22848 | r22849 | |
| 1004 | 876 | ******************************************************************************/ |
| 1005 | 877 | |
| 1006 | 878 | |
| 1007 | | static DEVICE_START( tms5110 ) |
| 879 | //------------------------------------------------- |
| 880 | // device_start - device-specific startup |
| 881 | //------------------------------------------------- |
| 882 | |
| 883 | void tms5110_device::device_start() |
| 1008 | 884 | { |
| 1009 | 885 | static const tms5110_interface dummy = { NULL, NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL}; |
| 1010 | | tms5110_state *tms = get_safe_token(device); |
| 1011 | 886 | |
| 1012 | | assert_always(tms != NULL, "Error creating TMS5110 chip"); |
| 887 | assert_always(static_config() != NULL, "No config"); |
| 1013 | 888 | |
| 1014 | | assert_always(device->static_config() != NULL, "No config"); |
| 889 | m_intf = static_config() ? (const tms5110_interface *)static_config() : &dummy; |
| 890 | m_table = *region(); |
| 1015 | 891 | |
| 1016 | | tms->intf = device->static_config() ? (const tms5110_interface *)device->static_config() : &dummy; |
| 1017 | | tms->table = *device->region(); |
| 892 | set_variant(TMS5110_IS_5110A); |
| 1018 | 893 | |
| 1019 | | tms->device = device; |
| 1020 | | tms5110_set_variant(tms, TMS5110_IS_5110A); |
| 1021 | | |
| 1022 | 894 | /* resolve lines */ |
| 1023 | | tms->m0_func.resolve(tms->intf->m0_func, *device); |
| 1024 | | tms->m1_func.resolve(tms->intf->m1_func, *device); |
| 1025 | | tms->romclk_func.resolve(tms->intf->romclk_func, *device); |
| 1026 | | tms->addr_func.resolve(tms->intf->addr_func, *device); |
| 1027 | | tms->data_func.resolve(tms->intf->data_func, *device); |
| 895 | m_m0_func.resolve(m_intf->m0_func, *this); |
| 896 | m_m1_func.resolve(m_intf->m1_func, *this); |
| 897 | m_romclk_func.resolve(m_intf->romclk_func, *this); |
| 898 | m_addr_func.resolve(m_intf->addr_func, *this); |
| 899 | m_data_func.resolve(m_intf->data_func, *this); |
| 1028 | 900 | |
| 1029 | 901 | /* initialize a stream */ |
| 1030 | | tms->stream = device->machine().sound().stream_alloc(*device, 0, 1, device->clock() / 80, tms, tms5110_update); |
| 902 | m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 80); |
| 1031 | 903 | |
| 1032 | | if (tms->table == NULL) |
| 904 | if (m_table == NULL) |
| 1033 | 905 | { |
| 1034 | 906 | #if 0 |
| 1035 | | assert_always(tms->intf->M0_callback != NULL, "Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n This function is used by TMS5110 to call for a single bits\n needed to generate the speech\n Aborting startup...\n"); |
| 907 | assert_always(m_intf->M0_callback != NULL, "Missing _mandatory_ 'M0_callback' function pointer in the TMS5110 interface\n This function is used by TMS5110 to call for a single bits\n needed to generate the speech\n Aborting startup...\n"); |
| 1036 | 908 | #endif |
| 1037 | | tms->M0_callback = tms->intf->M0_callback; |
| 1038 | | tms->set_load_address = tms->intf->load_address; |
| 909 | m_M0_callback = m_intf->M0_callback; |
| 910 | m_set_load_address = m_intf->load_address; |
| 1039 | 911 | } |
| 1040 | 912 | else |
| 1041 | 913 | { |
| 1042 | | tms->M0_callback = speech_rom_read_bit; |
| 1043 | | tms->set_load_address = speech_rom_set_addr; |
| 914 | m_M0_callback = speech_rom_read_bit; |
| 915 | m_set_load_address = speech_rom_set_addr; |
| 1044 | 916 | } |
| 1045 | 917 | |
| 1046 | | tms->state = CTL_STATE_INPUT; /* most probably not defined */ |
| 1047 | | tms->romclk_hack_timer = device->machine().scheduler().timer_alloc(FUNC(romclk_hack_timer_cb), (void *) device); |
| 918 | m_state = CTL_STATE_INPUT; /* most probably not defined */ |
| 919 | m_romclk_hack_timer = timer_alloc(0); |
| 1048 | 920 | |
| 1049 | | register_for_save_states(tms); |
| 921 | register_for_save_states(); |
| 1050 | 922 | } |
| 1051 | 923 | |
| 1052 | | static DEVICE_START( tms5100 ) |
| 924 | //------------------------------------------------- |
| 925 | // device_start - device-specific startup |
| 926 | //------------------------------------------------- |
| 927 | |
| 928 | void tms5100_device::device_start() |
| 1053 | 929 | { |
| 1054 | | tms5110_state *tms = get_safe_token(device); |
| 1055 | | DEVICE_START_CALL( tms5110 ); |
| 1056 | | tms5110_set_variant(tms, TMS5110_IS_5100); |
| 930 | tms5110_device::device_start(); |
| 931 | set_variant(TMS5110_IS_5100); |
| 1057 | 932 | } |
| 1058 | 933 | |
| 1059 | | static DEVICE_START( tms5110a ) |
| 934 | //------------------------------------------------- |
| 935 | // device_start - device-specific startup |
| 936 | //------------------------------------------------- |
| 937 | |
| 938 | void tms5110a_device::device_start() |
| 1060 | 939 | { |
| 1061 | | tms5110_state *tms = get_safe_token(device); |
| 1062 | | DEVICE_START_CALL( tms5110 ); |
| 1063 | | tms5110_set_variant(tms, TMS5110_IS_5110A); |
| 940 | tms5110_device::device_start(); |
| 941 | set_variant(TMS5110_IS_5110A); |
| 1064 | 942 | } |
| 1065 | 943 | |
| 1066 | | static DEVICE_START( cd2801 ) |
| 944 | //------------------------------------------------- |
| 945 | // device_start - device-specific startup |
| 946 | //------------------------------------------------- |
| 947 | |
| 948 | void cd2801_device::device_start() |
| 1067 | 949 | { |
| 1068 | | tms5110_state *tms = get_safe_token(device); |
| 1069 | | DEVICE_START_CALL( tms5110 ); |
| 1070 | | tms5110_set_variant(tms, TMS5110_IS_CD2801); |
| 950 | tms5110_device::device_start(); |
| 951 | set_variant(TMS5110_IS_CD2801); |
| 1071 | 952 | } |
| 1072 | 953 | |
| 1073 | | static DEVICE_START( tmc0281 ) |
| 954 | //------------------------------------------------- |
| 955 | // device_start - device-specific startup |
| 956 | //------------------------------------------------- |
| 957 | |
| 958 | void tmc0281_device::device_start() |
| 1074 | 959 | { |
| 1075 | | tms5110_state *tms = get_safe_token(device); |
| 1076 | | DEVICE_START_CALL( tms5110 ); |
| 1077 | | tms5110_set_variant(tms, TMS5110_IS_TMC0281); |
| 960 | tms5110_device::device_start(); |
| 961 | set_variant(TMS5110_IS_TMC0281); |
| 1078 | 962 | } |
| 1079 | 963 | |
| 1080 | | static DEVICE_START( cd2802 ) |
| 964 | //------------------------------------------------- |
| 965 | // device_start - device-specific startup |
| 966 | //------------------------------------------------- |
| 967 | |
| 968 | void cd2802_device::device_start() |
| 1081 | 969 | { |
| 1082 | | tms5110_state *tms = get_safe_token(device); |
| 1083 | | DEVICE_START_CALL( tms5110 ); |
| 1084 | | tms5110_set_variant(tms, TMS5110_IS_CD2802); |
| 970 | tms5110_device::device_start(); |
| 971 | set_variant(TMS5110_IS_CD2802); |
| 1085 | 972 | } |
| 1086 | 973 | |
| 1087 | | static DEVICE_START( m58817 ) |
| 974 | //------------------------------------------------- |
| 975 | // device_start - device-specific startup |
| 976 | //------------------------------------------------- |
| 977 | |
| 978 | void m58817_device::device_start() |
| 1088 | 979 | { |
| 1089 | | tms5110_state *tms = get_safe_token(device); |
| 1090 | | DEVICE_START_CALL( tms5110 ); |
| 1091 | | tms5110_set_variant(tms, TMS5110_IS_M58817); |
| 980 | tms5110_device::device_start(); |
| 981 | set_variant(TMS5110_IS_M58817); |
| 1092 | 982 | } |
| 1093 | 983 | |
| 1094 | 984 | |
| 1095 | | static DEVICE_RESET( tms5110 ) |
| 1096 | | { |
| 1097 | | tms5110_state *tms = get_safe_token(device); |
| 985 | //------------------------------------------------- |
| 986 | // device_reset - device-specific reset |
| 987 | //------------------------------------------------- |
| 1098 | 988 | |
| 989 | void tms5110_device::device_reset() |
| 990 | { |
| 1099 | 991 | /* initialize the FIFO */ |
| 1100 | | memset(tms->fifo, 0, sizeof(tms->fifo)); |
| 1101 | | tms->fifo_head = tms->fifo_tail = tms->fifo_count = 0; |
| 992 | memset(m_fifo, 0, sizeof(m_fifo)); |
| 993 | m_fifo_head = m_fifo_tail = m_fifo_count = 0; |
| 1102 | 994 | |
| 1103 | 995 | /* initialize the chip state */ |
| 1104 | | tms->speaking_now = tms->talk_status = 0; |
| 1105 | | tms->CTL_pins = 0; |
| 1106 | | tms->RNG = 0x1fff; |
| 996 | m_speaking_now = m_talk_status = 0; |
| 997 | m_CTL_pins = 0; |
| 998 | m_RNG = 0x1fff; |
| 1107 | 999 | |
| 1108 | 1000 | /* initialize the energy/pitch/k states */ |
| 1109 | | tms->old_energy = tms->new_energy = tms->current_energy = tms->target_energy = 0; |
| 1110 | | tms->old_pitch = tms->new_pitch = tms->current_pitch = tms->target_pitch = 0; |
| 1111 | | memset(tms->old_k, 0, sizeof(tms->old_k)); |
| 1112 | | memset(tms->new_k, 0, sizeof(tms->new_k)); |
| 1113 | | memset(tms->current_k, 0, sizeof(tms->current_k)); |
| 1114 | | memset(tms->target_k, 0, sizeof(tms->target_k)); |
| 1001 | m_old_energy = m_new_energy = m_current_energy = m_target_energy = 0; |
| 1002 | m_old_pitch = m_new_pitch = m_current_pitch = m_target_pitch = 0; |
| 1003 | memset(m_old_k, 0, sizeof(m_old_k)); |
| 1004 | memset(m_new_k, 0, sizeof(m_new_k)); |
| 1005 | memset(m_current_k, 0, sizeof(m_current_k)); |
| 1006 | memset(m_target_k, 0, sizeof(m_target_k)); |
| 1115 | 1007 | |
| 1116 | 1008 | /* initialize the sample generators */ |
| 1117 | | tms->interp_count = tms->sample_count = tms->pitch_count = 0; |
| 1118 | | memset(tms->x, 0, sizeof(tms->x)); |
| 1119 | | tms->next_is_address = FALSE; |
| 1120 | | tms->address = 0; |
| 1121 | | if (tms->table != NULL || tms->M0_callback != NULL) |
| 1009 | m_interp_count = m_sample_count = m_pitch_count = 0; |
| 1010 | memset(m_x, 0, sizeof(m_x)); |
| 1011 | m_next_is_address = FALSE; |
| 1012 | m_address = 0; |
| 1013 | if (m_table != NULL || m_M0_callback != NULL) |
| 1122 | 1014 | { |
| 1123 | 1015 | /* legacy interface */ |
| 1124 | | tms->schedule_dummy_read = TRUE; |
| 1016 | m_schedule_dummy_read = TRUE; |
| 1125 | 1017 | |
| 1126 | 1018 | } |
| 1127 | 1019 | else |
| r22848 | r22849 | |
| 1129 | 1021 | /* no dummy read! This makes bagman and ad2083 speech fail |
| 1130 | 1022 | * with the new cycle and transition exact interfaces |
| 1131 | 1023 | */ |
| 1132 | | tms->schedule_dummy_read = FALSE; |
| 1024 | m_schedule_dummy_read = FALSE; |
| 1133 | 1025 | } |
| 1134 | | tms->addr_bit = 0; |
| 1026 | m_addr_bit = 0; |
| 1135 | 1027 | } |
| 1136 | 1028 | |
| 1137 | 1029 | |
| r22848 | r22849 | |
| 1143 | 1035 | |
| 1144 | 1036 | ******************************************************************************/ |
| 1145 | 1037 | |
| 1146 | | WRITE8_DEVICE_HANDLER( tms5110_ctl_w ) |
| 1038 | WRITE8_MEMBER( tms5110_device::ctl_w ) |
| 1147 | 1039 | { |
| 1148 | | tms5110_state *tms = get_safe_token(device); |
| 1149 | | |
| 1150 | 1040 | /* bring up to date first */ |
| 1151 | | tms->stream->update(); |
| 1152 | | tms->CTL_pins = data & 0xf; |
| 1041 | m_stream->update(); |
| 1042 | m_CTL_pins = data & 0xf; |
| 1153 | 1043 | } |
| 1154 | 1044 | |
| 1155 | 1045 | |
| r22848 | r22849 | |
| 1159 | 1049 | |
| 1160 | 1050 | ******************************************************************************/ |
| 1161 | 1051 | |
| 1162 | | WRITE_LINE_DEVICE_HANDLER( tms5110_pdc_w ) |
| 1052 | WRITE_LINE_MEMBER( tms5110_device::pdc_w ) |
| 1163 | 1053 | { |
| 1164 | | tms5110_state *tms = get_safe_token(device); |
| 1165 | | |
| 1166 | 1054 | /* bring up to date first */ |
| 1167 | | tms->stream->update(); |
| 1168 | | tms5110_PDC_set(tms, state); |
| 1055 | m_stream->update(); |
| 1056 | PDC_set(state); |
| 1169 | 1057 | } |
| 1170 | 1058 | |
| 1171 | 1059 | |
| r22848 | r22849 | |
| 1185 | 1073 | |
| 1186 | 1074 | ******************************************************************************/ |
| 1187 | 1075 | |
| 1188 | | READ8_DEVICE_HANDLER( tms5110_ctl_r ) |
| 1076 | READ8_MEMBER( tms5110_device::ctl_r ) |
| 1189 | 1077 | { |
| 1190 | | tms5110_state *tms = get_safe_token(device); |
| 1191 | | |
| 1192 | 1078 | /* bring up to date first */ |
| 1193 | | tms->stream->update(); |
| 1194 | | if (tms->state == CTL_STATE_OUTPUT) |
| 1079 | m_stream->update(); |
| 1080 | if (m_state == CTL_STATE_OUTPUT) |
| 1195 | 1081 | { |
| 1196 | | //if (DEBUG_5110) logerror("Status read (status=%2d)\n", tms->talk_status); |
| 1197 | | return (tms->talk_status << 0); /*CTL1 = still talking ? */ |
| 1082 | //if (DEBUG_5110) logerror("Status read (status=%2d)\n", m_talk_status); |
| 1083 | return (m_talk_status << 0); /*CTL1 = still talking ? */ |
| 1198 | 1084 | } |
| 1199 | 1085 | else |
| 1200 | 1086 | { |
| r22848 | r22849 | |
| 1203 | 1089 | } |
| 1204 | 1090 | } |
| 1205 | 1091 | |
| 1206 | | READ8_DEVICE_HANDLER( m58817_status_r ) |
| 1092 | READ8_MEMBER( m58817_device::status_r ) |
| 1207 | 1093 | { |
| 1208 | | tms5110_state *tms = get_safe_token(device); |
| 1209 | | |
| 1210 | 1094 | /* bring up to date first */ |
| 1211 | | tms->stream->update(); |
| 1212 | | return (tms->talk_status << 0); /*CTL1 = still talking ? */ |
| 1095 | m_stream->update(); |
| 1096 | return (m_talk_status << 0); /*CTL1 = still talking ? */ |
| 1213 | 1097 | } |
| 1214 | 1098 | |
| 1215 | 1099 | /****************************************************************************** |
| r22848 | r22849 | |
| 1218 | 1102 | |
| 1219 | 1103 | ******************************************************************************/ |
| 1220 | 1104 | |
| 1221 | | static TIMER_CALLBACK( romclk_hack_timer_cb ) |
| 1105 | void tms5110_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 1222 | 1106 | { |
| 1223 | | tms5110_state *tms = get_safe_token((device_t *) ptr); |
| 1224 | | tms->romclk_hack_state = !tms->romclk_hack_state; |
| 1107 | m_romclk_hack_state = !m_romclk_hack_state; |
| 1225 | 1108 | } |
| 1226 | 1109 | |
| 1227 | | READ8_DEVICE_HANDLER( tms5110_romclk_hack_r ) |
| 1110 | READ8_MEMBER( tms5110_device::romclk_hack_r ) |
| 1228 | 1111 | { |
| 1229 | | tms5110_state *tms = get_safe_token(device); |
| 1230 | | |
| 1231 | 1112 | /* bring up to date first */ |
| 1232 | | tms->stream->update(); |
| 1113 | m_stream->update(); |
| 1233 | 1114 | |
| 1234 | 1115 | /* create and start timer if necessary */ |
| 1235 | | if (!tms->romclk_hack_timer_started) |
| 1116 | if (!m_romclk_hack_timer_started) |
| 1236 | 1117 | { |
| 1237 | | tms->romclk_hack_timer_started = TRUE; |
| 1238 | | tms->romclk_hack_timer->adjust(attotime::from_hz(device->clock() / 40), 0, attotime::from_hz(device->clock() / 40)); |
| 1118 | m_romclk_hack_timer_started = TRUE; |
| 1119 | m_romclk_hack_timer->adjust(attotime::from_hz(clock() / 40), 0, attotime::from_hz(clock() / 40)); |
| 1239 | 1120 | } |
| 1240 | | return tms->romclk_hack_state; |
| 1121 | return m_romclk_hack_state; |
| 1241 | 1122 | } |
| 1242 | 1123 | |
| 1243 | 1124 | |
| r22848 | r22849 | |
| 1248 | 1129 | |
| 1249 | 1130 | ******************************************************************************/ |
| 1250 | 1131 | |
| 1251 | | int tms5110_ready_r(device_t *device) |
| 1132 | int tms5110_device::ready_r() |
| 1252 | 1133 | { |
| 1253 | | tms5110_state *tms = get_safe_token(device); |
| 1254 | | |
| 1255 | 1134 | /* bring up to date first */ |
| 1256 | | tms->stream->update(); |
| 1257 | | return (tms->fifo_count < FIFO_SIZE-1); |
| 1135 | m_stream->update(); |
| 1136 | return (m_fifo_count < FIFO_SIZE-1); |
| 1258 | 1137 | } |
| 1259 | 1138 | |
| 1260 | 1139 | |
| r22848 | r22849 | |
| 1265 | 1144 | |
| 1266 | 1145 | ******************************************************************************/ |
| 1267 | 1146 | |
| 1268 | | static STREAM_UPDATE( tms5110_update ) |
| 1147 | //------------------------------------------------- |
| 1148 | // sound_stream_update - handle a stream update |
| 1149 | //------------------------------------------------- |
| 1150 | |
| 1151 | void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1269 | 1152 | { |
| 1270 | | tms5110_state *tms = (tms5110_state *)param; |
| 1271 | 1153 | INT16 sample_data[MAX_SAMPLE_CHUNK]; |
| 1272 | 1154 | stream_sample_t *buffer = outputs[0]; |
| 1273 | 1155 | |
| r22848 | r22849 | |
| 1278 | 1160 | int index; |
| 1279 | 1161 | |
| 1280 | 1162 | /* generate the samples and copy to the target buffer */ |
| 1281 | | tms5110_process(tms, sample_data, length); |
| 1163 | process(sample_data, length); |
| 1282 | 1164 | for (index = 0; index < length; index++) |
| 1283 | 1165 | *buffer++ = sample_data[index]; |
| 1284 | 1166 | |
| r22848 | r22849 | |
| 1295 | 1177 | |
| 1296 | 1178 | ******************************************************************************/ |
| 1297 | 1179 | |
| 1298 | | void tms5110_set_frequency(device_t *device, int frequency) |
| 1180 | void tms5110_device::set_frequency(int frequency) |
| 1299 | 1181 | { |
| 1300 | | tms5110_state *tms = get_safe_token(device); |
| 1301 | | tms->stream->set_sample_rate(frequency / 80); |
| 1182 | m_stream->set_sample_rate(frequency / 80); |
| 1302 | 1183 | } |
| 1303 | 1184 | |
| 1304 | | |
| 1305 | 1185 | /* |
| 1306 | 1186 | * |
| 1307 | 1187 | * General Interface design (Bagman) |
| r22848 | r22849 | |
| 1346 | 1226 | |
| 1347 | 1227 | ******************************************************************************/ |
| 1348 | 1228 | |
| 1349 | | static void register_for_save_states_prom(tmsprom_state *tms) |
| 1229 | void tmsprom_device::register_for_save_states() |
| 1350 | 1230 | { |
| 1351 | | tms->device->save_item(NAME(tms->address)); |
| 1352 | | tms->device->save_item(NAME(tms->base_address)); |
| 1353 | | tms->device->save_item(NAME(tms->bit)); |
| 1354 | | tms->device->save_item(NAME(tms->enable)); |
| 1355 | | tms->device->save_item(NAME(tms->prom_cnt)); |
| 1356 | | tms->device->save_item(NAME(tms->m0)); |
| 1231 | save_item(NAME(m_address)); |
| 1232 | save_item(NAME(m_base_address)); |
| 1233 | save_item(NAME(m_bit)); |
| 1234 | save_item(NAME(m_enable)); |
| 1235 | save_item(NAME(m_prom_cnt)); |
| 1236 | save_item(NAME(m_m0)); |
| 1357 | 1237 | } |
| 1358 | 1238 | |
| 1359 | | |
| 1360 | | static void update_prom_cnt(tmsprom_state *tms) |
| 1239 | void tmsprom_device::update_prom_cnt() |
| 1361 | 1240 | { |
| 1362 | | UINT8 prev_val = tms->prom[tms->prom_cnt] | 0x0200; |
| 1363 | | if (tms->enable && (prev_val & (1<<tms->intf->stop_bit))) |
| 1364 | | tms->prom_cnt |= 0x10; |
| 1241 | UINT8 prev_val = m_prom[m_prom_cnt] | 0x0200; |
| 1242 | if (m_enable && (prev_val & (1<<m_intf->stop_bit))) |
| 1243 | m_prom_cnt |= 0x10; |
| 1365 | 1244 | else |
| 1366 | | tms->prom_cnt &= 0x0f; |
| 1245 | m_prom_cnt &= 0x0f; |
| 1367 | 1246 | } |
| 1368 | 1247 | |
| 1369 | | static TIMER_CALLBACK( tmsprom_step ) |
| 1248 | void tmsprom_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) |
| 1370 | 1249 | { |
| 1371 | | device_t *device = (device_t *)ptr; |
| 1372 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1373 | | |
| 1374 | 1250 | /* only 16 bytes needed ... The original dump is bad. This |
| 1375 | 1251 | * is what is needed to get speech to work. The prom data has |
| 1376 | 1252 | * been updated and marked as BAD_DUMP. The information below |
| r22848 | r22849 | |
| 1381 | 1257 | */ |
| 1382 | 1258 | UINT16 ctrl; |
| 1383 | 1259 | |
| 1384 | | update_prom_cnt(tms); |
| 1385 | | ctrl = (tms->prom[tms->prom_cnt] | 0x200); |
| 1260 | update_prom_cnt(); |
| 1261 | ctrl = (m_prom[m_prom_cnt] | 0x200); |
| 1386 | 1262 | |
| 1387 | | //if (tms->enable && tms->prom_cnt < 0x10) printf("ctrl %04x, enable %d cnt %d\n", ctrl, tms->enable, tms->prom_cnt); |
| 1388 | | tms->prom_cnt = ((tms->prom_cnt + 1) & 0x0f) | (tms->prom_cnt & 0x10); |
| 1263 | //if (m_enable && m_prom_cnt < 0x10) printf("ctrl %04x, enable %d cnt %d\n", ctrl, m_enable, m_prom_cnt); |
| 1264 | m_prom_cnt = ((m_prom_cnt + 1) & 0x0f) | (m_prom_cnt & 0x10); |
| 1389 | 1265 | |
| 1390 | | if (ctrl & (1 << tms->intf->reset_bit)) |
| 1391 | | tms->address = 0; |
| 1266 | if (ctrl & (1 << m_intf->reset_bit)) |
| 1267 | m_address = 0; |
| 1392 | 1268 | |
| 1393 | | tms->ctl_func(0, BITSWAP8(ctrl,0,0,0,0,tms->intf->ctl8_bit, |
| 1394 | | tms->intf->ctl4_bit,tms->intf->ctl2_bit,tms->intf->ctl1_bit)); |
| 1269 | m_ctl_func(0, BITSWAP8(ctrl,0,0,0,0,m_intf->ctl8_bit, |
| 1270 | m_intf->ctl4_bit,m_intf->ctl2_bit,m_intf->ctl1_bit)); |
| 1395 | 1271 | |
| 1396 | | tms->pdc_func((ctrl >> tms->intf->pdc_bit) & 0x01); |
| 1272 | m_pdc_func((ctrl >> m_intf->pdc_bit) & 0x01); |
| 1397 | 1273 | } |
| 1398 | 1274 | |
| 1399 | | static DEVICE_START( tmsprom ) |
| 1275 | //------------------------------------------------- |
| 1276 | // device_start - device-specific startup |
| 1277 | //------------------------------------------------- |
| 1278 | |
| 1279 | void tmsprom_device::device_start() |
| 1400 | 1280 | { |
| 1401 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1281 | m_intf = (const tmsprom_interface *) static_config(); |
| 1282 | assert_always(m_intf != NULL, "Error creating TMSPROM chip: No configuration"); |
| 1402 | 1283 | |
| 1403 | | assert_always(tms != NULL, "Error creating TMSPROM chip"); |
| 1404 | | |
| 1405 | | tms->intf = (const tmsprom_interface *) device->static_config(); |
| 1406 | | assert_always(tms->intf != NULL, "Error creating TMSPROM chip: No configuration"); |
| 1407 | | |
| 1408 | 1284 | /* resolve lines */ |
| 1409 | | tms->pdc_func.resolve(tms->intf->pdc_func, *device); |
| 1410 | | tms->ctl_func.resolve(tms->intf->ctl_func, *device); |
| 1285 | m_pdc_func.resolve(m_intf->pdc_func, *this); |
| 1286 | m_ctl_func.resolve(m_intf->ctl_func, *this); |
| 1411 | 1287 | |
| 1412 | | tms->rom = *device->region(); |
| 1413 | | assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No rom region found"); |
| 1414 | | tms->prom = device->machine().root_device().memregion(tms->intf->prom_region)->base(); |
| 1415 | | assert_always(tms->rom != NULL, "Error creating TMSPROM chip: No prom region found"); |
| 1288 | m_rom = *region(); |
| 1289 | assert_always(m_rom != NULL, "Error creating TMSPROM chip: No rom region found"); |
| 1290 | m_prom = machine().root_device().memregion(m_intf->prom_region)->base(); |
| 1291 | assert_always(m_rom != NULL, "Error creating TMSPROM chip: No prom region found"); |
| 1416 | 1292 | |
| 1417 | | tms->device = device; |
| 1418 | | tms->clock = device->clock(); |
| 1293 | m_clock = clock(); |
| 1419 | 1294 | |
| 1420 | | tms->romclk_timer = device->machine().scheduler().timer_alloc(FUNC(tmsprom_step), device); |
| 1421 | | tms->romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(tms->clock)); |
| 1295 | m_romclk_timer = timer_alloc(0); |
| 1296 | m_romclk_timer->adjust(attotime::zero, 0, attotime::from_hz(m_clock)); |
| 1422 | 1297 | |
| 1423 | | tms->bit = 0; |
| 1424 | | tms->base_address = 0; |
| 1425 | | tms->address = 0; |
| 1426 | | tms->enable = 0; |
| 1427 | | tms->m0 = 0; |
| 1428 | | tms->prom_cnt = 0; |
| 1429 | | register_for_save_states_prom(tms); |
| 1298 | m_bit = 0; |
| 1299 | m_base_address = 0; |
| 1300 | m_address = 0; |
| 1301 | m_enable = 0; |
| 1302 | m_m0 = 0; |
| 1303 | m_prom_cnt = 0; |
| 1304 | |
| 1305 | register_for_save_states(); |
| 1430 | 1306 | } |
| 1431 | 1307 | |
| 1432 | | WRITE_LINE_DEVICE_HANDLER( tmsprom_m0_w ) |
| 1308 | WRITE_LINE_MEMBER( tmsprom_device::m0_w ) |
| 1433 | 1309 | { |
| 1434 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1435 | | |
| 1436 | 1310 | /* falling edge counts */ |
| 1437 | | if (tms->m0 && !state) |
| 1311 | if (m_m0 && !state) |
| 1438 | 1312 | { |
| 1439 | | tms->address += 1; |
| 1440 | | tms->address &= (tms->intf->rom_size-1); |
| 1313 | m_address += 1; |
| 1314 | m_address &= (m_intf->rom_size-1); |
| 1441 | 1315 | } |
| 1442 | | tms->m0 = state; |
| 1316 | m_m0 = state; |
| 1443 | 1317 | } |
| 1444 | 1318 | |
| 1445 | | READ_LINE_DEVICE_HANDLER( tmsprom_data_r ) |
| 1319 | READ_LINE_MEMBER( tmsprom_device::data_r ) |
| 1446 | 1320 | { |
| 1447 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1448 | | |
| 1449 | | return (tms->rom[tms->base_address + tms->address] >> tms->bit) & 0x01; |
| 1321 | return (m_rom[m_base_address + m_address] >> m_bit) & 0x01; |
| 1450 | 1322 | } |
| 1451 | 1323 | |
| 1452 | 1324 | |
| 1453 | | WRITE8_DEVICE_HANDLER( tmsprom_rom_csq_w ) |
| 1325 | WRITE8_MEMBER( tmsprom_device::rom_csq_w ) |
| 1454 | 1326 | { |
| 1455 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1456 | | |
| 1457 | 1327 | if (!data) |
| 1458 | | tms->base_address = offset * tms->intf->rom_size; |
| 1328 | m_base_address = offset * m_intf->rom_size; |
| 1459 | 1329 | } |
| 1460 | 1330 | |
| 1461 | | WRITE8_DEVICE_HANDLER( tmsprom_bit_w ) |
| 1331 | WRITE8_MEMBER( tmsprom_device::bit_w ) |
| 1462 | 1332 | { |
| 1463 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1464 | | |
| 1465 | | tms->bit = data; |
| 1333 | m_bit = data; |
| 1466 | 1334 | } |
| 1467 | 1335 | |
| 1468 | | WRITE_LINE_DEVICE_HANDLER( tmsprom_enable_w ) |
| 1336 | WRITE_LINE_MEMBER( tmsprom_device::enable_w ) |
| 1469 | 1337 | { |
| 1470 | | tmsprom_state *tms = get_safe_token_prom(device); |
| 1471 | | |
| 1472 | | if (state != tms->enable) |
| 1338 | if (state != m_enable) |
| 1473 | 1339 | { |
| 1474 | | tms->enable = state; |
| 1475 | | update_prom_cnt(tms); |
| 1340 | m_enable = state; |
| 1341 | update_prom_cnt(); |
| 1476 | 1342 | |
| 1477 | 1343 | /* the following is needed for ad2084. |
| 1478 | 1344 | * It is difficult to derive the actual connections from |
| r22848 | r22849 | |
| 1484 | 1350 | * counter bits are 0! |
| 1485 | 1351 | */ |
| 1486 | 1352 | if (state) |
| 1487 | | tms->prom_cnt &= 0x10; |
| 1353 | m_prom_cnt &= 0x10; |
| 1488 | 1354 | } |
| 1489 | 1355 | } |
| 1490 | 1356 | |
| r22848 | r22849 | |
| 1499 | 1365 | : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock), |
| 1500 | 1366 | device_sound_interface(mconfig, *this) |
| 1501 | 1367 | { |
| 1502 | | m_token = global_alloc_clear(tms5110_state); |
| 1503 | 1368 | } |
| 1369 | |
| 1504 | 1370 | tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) |
| 1505 | 1371 | : device_t(mconfig, type, name, tag, owner, clock), |
| 1506 | 1372 | device_sound_interface(mconfig, *this) |
| 1507 | 1373 | { |
| 1508 | | m_token = global_alloc_clear(tms5110_state); |
| 1509 | 1374 | } |
| 1510 | 1375 | |
| 1511 | 1376 | //------------------------------------------------- |
| r22848 | r22849 | |
| 1518 | 1383 | { |
| 1519 | 1384 | } |
| 1520 | 1385 | |
| 1521 | | //------------------------------------------------- |
| 1522 | | // device_start - device-specific startup |
| 1523 | | //------------------------------------------------- |
| 1524 | | |
| 1525 | | void tms5110_device::device_start() |
| 1526 | | { |
| 1527 | | DEVICE_START_NAME( tms5110 )(this); |
| 1528 | | } |
| 1529 | | |
| 1530 | | //------------------------------------------------- |
| 1531 | | // device_reset - device-specific reset |
| 1532 | | //------------------------------------------------- |
| 1533 | | |
| 1534 | | void tms5110_device::device_reset() |
| 1535 | | { |
| 1536 | | DEVICE_RESET_NAME( tms5110 )(this); |
| 1537 | | } |
| 1538 | | |
| 1539 | | //------------------------------------------------- |
| 1540 | | // sound_stream_update - handle a stream update |
| 1541 | | //------------------------------------------------- |
| 1542 | | |
| 1543 | | void tms5110_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1544 | | { |
| 1545 | | // should never get here |
| 1546 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1547 | | } |
| 1548 | | |
| 1549 | | |
| 1550 | 1386 | const device_type TMS5100 = &device_creator<tms5100_device>; |
| 1551 | 1387 | |
| 1388 | |
| 1552 | 1389 | tms5100_device::tms5100_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1553 | 1390 | : tms5110_device(mconfig, TMS5100, "TMS5100", tag, owner, clock) |
| 1554 | 1391 | { |
| 1555 | 1392 | } |
| 1556 | 1393 | |
| 1557 | | //------------------------------------------------- |
| 1558 | | // device_start - device-specific startup |
| 1559 | | //------------------------------------------------- |
| 1560 | 1394 | |
| 1561 | | void tms5100_device::device_start() |
| 1562 | | { |
| 1563 | | DEVICE_START_NAME( tms5100 )(this); |
| 1564 | | } |
| 1565 | | |
| 1566 | | //------------------------------------------------- |
| 1567 | | // sound_stream_update - handle a stream update |
| 1568 | | //------------------------------------------------- |
| 1569 | | |
| 1570 | | void tms5100_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1571 | | { |
| 1572 | | // should never get here |
| 1573 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1574 | | } |
| 1575 | | |
| 1576 | | |
| 1577 | 1395 | const device_type TMS5110A = &device_creator<tms5110a_device>; |
| 1578 | 1396 | |
| 1579 | 1397 | tms5110a_device::tms5110a_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r22848 | r22849 | |
| 1581 | 1399 | { |
| 1582 | 1400 | } |
| 1583 | 1401 | |
| 1584 | | //------------------------------------------------- |
| 1585 | | // device_start - device-specific startup |
| 1586 | | //------------------------------------------------- |
| 1587 | 1402 | |
| 1588 | | void tms5110a_device::device_start() |
| 1589 | | { |
| 1590 | | DEVICE_START_NAME( tms5110a )(this); |
| 1591 | | } |
| 1592 | | |
| 1593 | | //------------------------------------------------- |
| 1594 | | // sound_stream_update - handle a stream update |
| 1595 | | //------------------------------------------------- |
| 1596 | | |
| 1597 | | void tms5110a_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1598 | | { |
| 1599 | | // should never get here |
| 1600 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1601 | | } |
| 1602 | | |
| 1603 | | |
| 1604 | 1403 | const device_type CD2801 = &device_creator<cd2801_device>; |
| 1605 | 1404 | |
| 1606 | 1405 | cd2801_device::cd2801_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r22848 | r22849 | |
| 1608 | 1407 | { |
| 1609 | 1408 | } |
| 1610 | 1409 | |
| 1611 | | //------------------------------------------------- |
| 1612 | | // device_start - device-specific startup |
| 1613 | | //------------------------------------------------- |
| 1614 | 1410 | |
| 1615 | | void cd2801_device::device_start() |
| 1616 | | { |
| 1617 | | DEVICE_START_NAME( cd2801 )(this); |
| 1618 | | } |
| 1619 | | |
| 1620 | | //------------------------------------------------- |
| 1621 | | // sound_stream_update - handle a stream update |
| 1622 | | //------------------------------------------------- |
| 1623 | | |
| 1624 | | void cd2801_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1625 | | { |
| 1626 | | // should never get here |
| 1627 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1628 | | } |
| 1629 | | |
| 1630 | | |
| 1631 | 1411 | const device_type TMC0281 = &device_creator<tmc0281_device>; |
| 1632 | 1412 | |
| 1633 | 1413 | tmc0281_device::tmc0281_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r22848 | r22849 | |
| 1635 | 1415 | { |
| 1636 | 1416 | } |
| 1637 | 1417 | |
| 1638 | | //------------------------------------------------- |
| 1639 | | // device_start - device-specific startup |
| 1640 | | //------------------------------------------------- |
| 1641 | 1418 | |
| 1642 | | void tmc0281_device::device_start() |
| 1643 | | { |
| 1644 | | DEVICE_START_NAME( tmc0281 )(this); |
| 1645 | | } |
| 1646 | | |
| 1647 | | //------------------------------------------------- |
| 1648 | | // sound_stream_update - handle a stream update |
| 1649 | | //------------------------------------------------- |
| 1650 | | |
| 1651 | | void tmc0281_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1652 | | { |
| 1653 | | // should never get here |
| 1654 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1655 | | } |
| 1656 | | |
| 1657 | | |
| 1658 | 1419 | const device_type CD2802 = &device_creator<cd2802_device>; |
| 1659 | 1420 | |
| 1660 | 1421 | cd2802_device::cd2802_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r22848 | r22849 | |
| 1662 | 1423 | { |
| 1663 | 1424 | } |
| 1664 | 1425 | |
| 1665 | | //------------------------------------------------- |
| 1666 | | // device_start - device-specific startup |
| 1667 | | //------------------------------------------------- |
| 1668 | 1426 | |
| 1669 | | void cd2802_device::device_start() |
| 1670 | | { |
| 1671 | | DEVICE_START_NAME( cd2802 )(this); |
| 1672 | | } |
| 1673 | | |
| 1674 | | //------------------------------------------------- |
| 1675 | | // sound_stream_update - handle a stream update |
| 1676 | | //------------------------------------------------- |
| 1677 | | |
| 1678 | | void cd2802_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1679 | | { |
| 1680 | | // should never get here |
| 1681 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1682 | | } |
| 1683 | | |
| 1684 | | |
| 1685 | 1427 | const device_type M58817 = &device_creator<m58817_device>; |
| 1686 | 1428 | |
| 1687 | 1429 | m58817_device::m58817_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| r22848 | r22849 | |
| 1689 | 1431 | { |
| 1690 | 1432 | } |
| 1691 | 1433 | |
| 1692 | | //------------------------------------------------- |
| 1693 | | // device_start - device-specific startup |
| 1694 | | //------------------------------------------------- |
| 1695 | 1434 | |
| 1696 | | void m58817_device::device_start() |
| 1697 | | { |
| 1698 | | DEVICE_START_NAME( m58817 )(this); |
| 1699 | | } |
| 1700 | | |
| 1701 | | //------------------------------------------------- |
| 1702 | | // sound_stream_update - handle a stream update |
| 1703 | | //------------------------------------------------- |
| 1704 | | |
| 1705 | | void m58817_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 1706 | | { |
| 1707 | | // should never get here |
| 1708 | | fatalerror("sound_stream_update called; not applicable to legacy sound devices\n"); |
| 1709 | | } |
| 1710 | | |
| 1711 | | |
| 1712 | | |
| 1713 | 1435 | const device_type TMSPROM = &device_creator<tmsprom_device>; |
| 1714 | 1436 | |
| 1715 | 1437 | tmsprom_device::tmsprom_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1716 | 1438 | : device_t(mconfig, TMSPROM, "TMSPROM", tag, owner, clock) |
| 1717 | 1439 | { |
| 1718 | | m_token = global_alloc_clear(tmsprom_state); |
| 1719 | 1440 | } |
| 1720 | 1441 | |
| 1721 | 1442 | //------------------------------------------------- |
| r22848 | r22849 | |
| 1727 | 1448 | void tmsprom_device::device_config_complete() |
| 1728 | 1449 | { |
| 1729 | 1450 | } |
| 1730 | | |
| 1731 | | //------------------------------------------------- |
| 1732 | | // device_start - device-specific startup |
| 1733 | | //------------------------------------------------- |
| 1734 | | |
| 1735 | | void tmsprom_device::device_start() |
| 1736 | | { |
| 1737 | | DEVICE_START_NAME( tmsprom )(this); |
| 1738 | | } |