branches/new_menus/src/emu/sound/tms5110.c
| r29572 | r29573 | |
| 110 | 110 | |
| 111 | 111 | void tms5110_device::new_int_write(UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr) |
| 112 | 112 | { |
| 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()) |
| 113 | if (!m_m0_cb.isnull()) |
| 114 | m_m0_cb(m0); |
| 115 | if (!m_m1_cb.isnull()) |
| 116 | m_m1_cb(m1); |
| 117 | if (!m_addr_cb.isnull()) |
| 118 | m_addr_cb((offs_t)0, addr); |
| 119 | if (!m_romclk_cb.isnull()) |
| 120 | 120 | { |
| 121 | 121 | //printf("rc %d\n", rc); |
| 122 | | m_romclk_func(rc); |
| 122 | m_romclk_cb(rc); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| r29572 | r29573 | |
| 137 | 137 | new_int_write(0, 1, 0, 0); |
| 138 | 138 | new_int_write(1, 0, 0, 0); |
| 139 | 139 | new_int_write(0, 0, 0, 0); |
| 140 | | if (!m_data_func.isnull()) |
| 141 | | return m_data_func(); |
| 140 | if (!m_data_cb.isnull()) |
| 141 | return m_data_cb(); |
| 142 | 142 | return 0; |
| 143 | 143 | } |
| 144 | 144 | |
| r29572 | r29573 | |
| 232 | 232 | |
| 233 | 233 | void tms5110_device::request_bits(int no) |
| 234 | 234 | { |
| 235 | | for (int i=0; i<no; i++) |
| 235 | for (int i = 0; i < no; i++) |
| 236 | 236 | { |
| 237 | | if (m_M0_callback) |
| 238 | | { |
| 239 | | int data = (*m_M0_callback)(this); |
| 240 | | FIFO_data_write(data); |
| 241 | | } |
| 242 | | else |
| 243 | | { |
| 244 | | //if (DEBUG_5110) logerror("-->ERROR: TMS5110 missing M0 callback function\n"); |
| 245 | | UINT8 data = new_int_read(); |
| 246 | | FIFO_data_write(data); |
| 247 | | } |
| 237 | UINT8 data = new_int_read(); |
| 238 | FIFO_data_write(data); |
| 248 | 239 | } |
| 249 | 240 | } |
| 250 | 241 | |
| r29572 | r29573 | |
| 252 | 243 | { |
| 253 | 244 | if (m_schedule_dummy_read) |
| 254 | 245 | { |
| 255 | | if (m_M0_callback) |
| 256 | | { |
| 257 | | int data = (*m_M0_callback)(this); |
| 258 | | |
| 259 | | if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1); |
| 260 | | } |
| 261 | | else |
| 262 | | { |
| 263 | | int data = new_int_read(); |
| 264 | | |
| 265 | | if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data&1); |
| 266 | | //if (DEBUG_5110) logerror("-->ERROR: TMS5110 missing M0 callback function\n"); |
| 267 | | } |
| 246 | int data = new_int_read(); |
| 247 | if (DEBUG_5110) logerror("TMS5110 performing dummy read; value read = %1i\n", data & 1); |
| 268 | 248 | m_schedule_dummy_read = FALSE; |
| 269 | 249 | } |
| 270 | 250 | } |
| r29572 | r29573 | |
| 621 | 601 | m_address = m_address | ((m_CTL_pins & 0x0F)<<m_addr_bit); |
| 622 | 602 | m_addr_bit = (m_addr_bit + 4) % 12; |
| 623 | 603 | m_schedule_dummy_read = TRUE; |
| 624 | | if (m_set_load_address) |
| 625 | | m_set_load_address(this, m_address); |
| 626 | 604 | new_int_write_addr(m_CTL_pins & 0x0F); |
| 627 | 605 | } |
| 628 | 606 | else |
| r29572 | r29573 | |
| 838 | 816 | #endif |
| 839 | 817 | |
| 840 | 818 | |
| 841 | | static int speech_rom_read_bit(device_t *device) |
| 842 | | { |
| 843 | | tms5110_device *tms5110 = (tms5110_device *) device; |
| 844 | | return tms5110->_speech_rom_read_bit(); |
| 845 | | } |
| 846 | | |
| 847 | | int tms5110_device::_speech_rom_read_bit() |
| 848 | | { |
| 849 | | int r; |
| 850 | | |
| 851 | | if (m_speech_rom_bitnum<0) |
| 852 | | r = 0; |
| 853 | | else |
| 854 | | r = (m_table[m_speech_rom_bitnum >> 3] >> (0x07 - (m_speech_rom_bitnum & 0x07))) & 1; |
| 855 | | |
| 856 | | m_speech_rom_bitnum++; |
| 857 | | |
| 858 | | return r; |
| 859 | | } |
| 860 | | |
| 861 | | static void speech_rom_set_addr(device_t *device, int addr) |
| 862 | | { |
| 863 | | tms5110_device *tms5110 = (tms5110_device *) device; |
| 864 | | tms5110->_speech_rom_set_addr(addr); |
| 865 | | } |
| 866 | | |
| 867 | | void tms5110_device::_speech_rom_set_addr(int addr) |
| 868 | | { |
| 869 | | m_speech_rom_bitnum = addr * 8 - 1; |
| 870 | | } |
| 871 | | |
| 872 | 819 | //------------------------------------------------- |
| 873 | 820 | // device_start - device-specific startup |
| 874 | 821 | //------------------------------------------------- |
| 875 | 822 | |
| 876 | 823 | void tms5110_device::device_start() |
| 877 | 824 | { |
| 878 | | static const tms5110_interface dummy = { NULL, NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL}; |
| 879 | | |
| 880 | | assert_always(static_config() != NULL, "No config"); |
| 881 | | |
| 882 | | m_intf = static_config() ? (const tms5110_interface *)static_config() : &dummy; |
| 883 | 825 | m_table = *region(); |
| 884 | 826 | |
| 885 | 827 | set_variant(TMS5110_IS_5110A); |
| 886 | 828 | |
| 887 | 829 | /* resolve lines */ |
| 888 | | m_m0_func.resolve(m_intf->m0_func, *this); |
| 889 | | m_m1_func.resolve(m_intf->m1_func, *this); |
| 890 | | m_romclk_func.resolve(m_intf->romclk_func, *this); |
| 891 | | m_addr_func.resolve(m_intf->addr_func, *this); |
| 892 | | m_data_func.resolve(m_intf->data_func, *this); |
| 830 | m_m0_cb.resolve(); |
| 831 | m_m1_cb.resolve(); |
| 832 | m_romclk_cb.resolve(); |
| 833 | m_addr_cb.resolve(); |
| 834 | m_data_cb.resolve(); |
| 893 | 835 | |
| 894 | 836 | /* initialize a stream */ |
| 895 | 837 | m_stream = machine().sound().stream_alloc(*this, 0, 1, clock() / 80); |
| 896 | 838 | |
| 897 | | if (m_table == NULL) |
| 898 | | { |
| 899 | | #if 0 |
| 900 | | 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"); |
| 901 | | #endif |
| 902 | | m_M0_callback = m_intf->M0_callback; |
| 903 | | m_set_load_address = m_intf->load_address; |
| 904 | | } |
| 905 | | else |
| 906 | | { |
| 907 | | m_M0_callback = speech_rom_read_bit; |
| 908 | | m_set_load_address = speech_rom_set_addr; |
| 909 | | } |
| 910 | | |
| 911 | 839 | m_state = CTL_STATE_INPUT; /* most probably not defined */ |
| 912 | 840 | m_romclk_hack_timer = timer_alloc(0); |
| 913 | 841 | |
| r29572 | r29573 | |
| 1003 | 931 | memset(m_x, 0, sizeof(m_x)); |
| 1004 | 932 | m_next_is_address = FALSE; |
| 1005 | 933 | m_address = 0; |
| 1006 | | if (m_table != NULL || m_M0_callback != NULL) |
| 934 | if (m_table != NULL) |
| 1007 | 935 | { |
| 1008 | 936 | /* legacy interface */ |
| 1009 | 937 | m_schedule_dummy_read = TRUE; |
| r29572 | r29573 | |
| 1356 | 1284 | |
| 1357 | 1285 | tms5110_device::tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 1358 | 1286 | : device_t(mconfig, TMS5110, "TMS5110", tag, owner, clock, "tms5110", __FILE__), |
| 1359 | | device_sound_interface(mconfig, *this) |
| 1287 | device_sound_interface(mconfig, *this), |
| 1288 | m_m0_cb(*this), |
| 1289 | m_m1_cb(*this), |
| 1290 | m_addr_cb(*this), |
| 1291 | m_data_cb(*this), |
| 1292 | m_romclk_cb(*this) |
| 1360 | 1293 | { |
| 1361 | 1294 | } |
| 1362 | 1295 | |
| 1363 | 1296 | tms5110_device::tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 1364 | 1297 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 1365 | | device_sound_interface(mconfig, *this) |
| 1298 | device_sound_interface(mconfig, *this), |
| 1299 | m_m0_cb(*this), |
| 1300 | m_m1_cb(*this), |
| 1301 | m_addr_cb(*this), |
| 1302 | m_data_cb(*this), |
| 1303 | m_romclk_cb(*this) |
| 1366 | 1304 | { |
| 1367 | 1305 | } |
| 1368 | 1306 | |
| 1369 | | //------------------------------------------------- |
| 1370 | | // device_config_complete - perform any |
| 1371 | | // operations now that the configuration is |
| 1372 | | // complete |
| 1373 | | //------------------------------------------------- |
| 1374 | 1307 | |
| 1375 | | void tms5110_device::device_config_complete() |
| 1376 | | { |
| 1377 | | } |
| 1378 | | |
| 1379 | 1308 | const device_type TMS5100 = &device_creator<tms5100_device>; |
| 1380 | 1309 | |
| 1381 | 1310 | |
branches/new_menus/src/emu/sound/tms5110.h
| r29572 | r29573 | |
| 23 | 23 | /* usually 640000 for 8000 Hz sample rate or */ |
| 24 | 24 | /* usually 800000 for 10000 Hz sample rate. */ |
| 25 | 25 | |
| 26 | | struct tms5110_interface |
| 27 | | { |
| 28 | | /* legacy interface */ |
| 29 | | int (*M0_callback)(device_t *device); /* function to be called when chip requests another bit */ |
| 30 | | void (*load_address)(device_t *device, int addr); /* speech ROM load address callback */ |
| 31 | | /* new rom controller interface */ |
| 32 | | devcb_write_line m0_func; /* the M0 line */ |
| 33 | | devcb_write_line m1_func; /* the M1 line */ |
| 34 | | devcb_write8 addr_func; /* Write to ADD1,2,4,8 - 4 address bits */ |
| 35 | | devcb_read_line data_func; /* Read one bit from ADD8/Data - voice data */ |
| 36 | | /* on a real chip rom_clk is running all the time |
| 37 | | * Here, we only use it to properly emulate the protocol. |
| 38 | | * Do not rely on it to be a timed signal. |
| 39 | | */ |
| 40 | | devcb_write_line romclk_func; /* rom clock - Only used to drive the data lines */ |
| 41 | | }; |
| 26 | #define MCFG_TMS5110_M0_CB(_devcb) \ |
| 27 | devcb = &tms5110_device::set_m0_callback(*device, DEVCB2_##_devcb); |
| 42 | 28 | |
| 29 | #define MCFG_TMS5110_M1_CB(_devcb) \ |
| 30 | devcb = &tms5110_device::set_m1_callback(*device, DEVCB2_##_devcb); |
| 31 | |
| 32 | #define MCFG_TMS5110_ADDR_CB(_devcb) \ |
| 33 | devcb = &tms5110_device::set_addr_callback(*device, DEVCB2_##_devcb); |
| 34 | |
| 35 | #define MCFG_TMS5110_DATA_CB(_devcb) \ |
| 36 | devcb = &tms5110_device::set_data_callback(*device, DEVCB2_##_devcb); |
| 37 | |
| 38 | #define MCFG_TMS5110_ROMCLK_CB(_devcb) \ |
| 39 | devcb = &tms5110_device::set_romclk_callback(*device, DEVCB2_##_devcb); |
| 40 | |
| 41 | |
| 43 | 42 | class tms5110_device : public device_t, |
| 44 | | public device_sound_interface |
| 43 | public device_sound_interface |
| 45 | 44 | { |
| 46 | 45 | public: |
| 47 | 46 | tms5110_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 48 | 47 | tms5110_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source); |
| 49 | 48 | |
| 49 | template<class _Object> static devcb2_base &set_m0_callback(device_t &device, _Object object) { return downcast<tms5110_device &>(device).m_m0_cb.set_callback(object); } |
| 50 | template<class _Object> static devcb2_base &set_m1_callback(device_t &device, _Object object) { return downcast<tms5110_device &>(device).m_m1_cb.set_callback(object); } |
| 51 | template<class _Object> static devcb2_base &set_addr_callback(device_t &device, _Object object) { return downcast<tms5110_device &>(device).m_addr_cb.set_callback(object); } |
| 52 | template<class _Object> static devcb2_base &set_data_callback(device_t &device, _Object object) { return downcast<tms5110_device &>(device).m_data_cb.set_callback(object); } |
| 53 | template<class _Object> static devcb2_base &set_romclk_callback(device_t &device, _Object object) { return downcast<tms5110_device &>(device).m_romclk_cb.set_callback(object); } |
| 54 | |
| 50 | 55 | DECLARE_WRITE8_MEMBER( ctl_w ); |
| 51 | 56 | DECLARE_READ8_MEMBER( ctl_r ); |
| 52 | 57 | DECLARE_WRITE_LINE_MEMBER( pdc_w ); |
| r29572 | r29573 | |
| 65 | 70 | |
| 66 | 71 | protected: |
| 67 | 72 | // device-level overrides |
| 68 | | virtual void device_config_complete(); |
| 69 | 73 | virtual void device_start(); |
| 70 | 74 | virtual void device_reset(); |
| 71 | 75 | |
| r29572 | r29573 | |
| 76 | 80 | |
| 77 | 81 | void set_variant(int variant); |
| 78 | 82 | |
| 83 | UINT8 m_talk_status; |
| 84 | sound_stream *m_stream; |
| 85 | |
| 79 | 86 | private: |
| 80 | 87 | void new_int_write(UINT8 rc, UINT8 m0, UINT8 m1, UINT8 addr); |
| 81 | 88 | void new_int_write_addr(UINT8 addr); |
| r29572 | r29573 | |
| 99 | 106 | UINT8 m_PDC; |
| 100 | 107 | UINT8 m_CTL_pins; |
| 101 | 108 | UINT8 m_speaking_now; |
| 102 | | protected: UINT8 m_talk_status; private: |
| 109 | |
| 110 | |
| 103 | 111 | UINT8 m_state; |
| 104 | 112 | |
| 105 | 113 | /* Rom interface */ |
| r29572 | r29573 | |
| 108 | 116 | UINT8 m_schedule_dummy_read; |
| 109 | 117 | UINT8 m_addr_bit; |
| 110 | 118 | |
| 111 | | /* external callback */ |
| 112 | | int (*m_M0_callback)(device_t *); |
| 113 | | void (*m_set_load_address)(device_t *, int); |
| 114 | | |
| 115 | 119 | /* callbacks */ |
| 116 | | devcb_resolved_write_line m_m0_func; /* the M0 line */ |
| 117 | | devcb_resolved_write_line m_m1_func; /* the M1 line */ |
| 118 | | devcb_resolved_write8 m_addr_func; /* Write to ADD1,2,4,8 - 4 address bits */ |
| 119 | | devcb_resolved_read_line m_data_func; /* Read one bit from ADD8/Data - voice data */ |
| 120 | | devcb_resolved_write_line m_romclk_func; /* rom clock - Only used to drive the data lines */ |
| 120 | devcb2_write_line m_m0_cb; // the M0 line |
| 121 | devcb2_write_line m_m1_cb; // the M1 line |
| 122 | devcb2_write8 m_addr_cb; // Write to ADD1,2,4,8 - 4 address bits |
| 123 | devcb2_read_line m_data_cb; // Read one bit from ADD8/Data - voice data |
| 124 | // On a real chip rom_clk is running all the time |
| 125 | // Here, we only use it to properly emulate the protocol. |
| 126 | // Do not rely on it to be a timed signal. |
| 127 | devcb2_write_line m_romclk_cb; // rom clock - Only used to drive the data lines |
| 121 | 128 | |
| 122 | 129 | /* these contain data describing the current and previous voice frames */ |
| 123 | 130 | UINT16 m_old_energy; |
| r29572 | r29573 | |
| 157 | 164 | /* coefficient tables */ |
| 158 | 165 | const struct tms5100_coeffs *m_coeff; |
| 159 | 166 | |
| 160 | | protected: sound_stream *m_stream; private: |
| 161 | 167 | emu_timer *m_romclk_hack_timer; |
| 162 | | const tms5110_interface *m_intf; |
| 163 | 168 | const UINT8 *m_table; |
| 164 | 169 | }; |
| 165 | 170 | |
branches/new_menus/src/emu/sound/tms36xx.c
| r29572 | r29573 | |
| 265 | 265 | static const int *const tunes[] = {NULL,tune1,tune2,tune3,tune4}; |
| 266 | 266 | |
| 267 | 267 | #define DECAY(voice) \ |
| 268 | | if( m_vol[voice] > VMIN ) \ |
| 268 | if( m_vol[voice] > TMS36XX_VMIN ) \ |
| 269 | 269 | { \ |
| 270 | 270 | /* decay of first voice */ \ |
| 271 | 271 | m_vol_counter[voice] -= m_decay[voice]; \ |
| 272 | 272 | while( m_vol_counter[voice] <= 0 ) \ |
| 273 | 273 | { \ |
| 274 | 274 | m_vol_counter[voice] += samplerate; \ |
| 275 | | if( m_vol[voice]-- <= VMIN ) \ |
| 275 | if( m_vol[voice]-- <= TMS36XX_VMIN ) \ |
| 276 | 276 | { \ |
| 277 | 277 | m_frequency[voice] = 0; \ |
| 278 | | m_vol[voice] = VMIN; \ |
| 278 | m_vol[voice] = TMS36XX_VMIN; \ |
| 279 | 279 | break; \ |
| 280 | 280 | } \ |
| 281 | 281 | } \ |
| r29572 | r29573 | |
| 287 | 287 | m_frequency[m_shift+voice] = \ |
| 288 | 288 | tunes[m_tune_num][m_tune_ofs*6+voice] * \ |
| 289 | 289 | (m_basefreq << m_octave) / FSCALE; \ |
| 290 | | m_vol[m_shift+voice] = VMAX; \ |
| 290 | m_vol[m_shift+voice] = TMS36XX_VMAX; \ |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | #define TONE(voice) \ |
| r29572 | r29573 | |
| 361 | 361 | { |
| 362 | 362 | if (m_decay_time[j] > 0) |
| 363 | 363 | { |
| 364 | | m_decay[j+0] = m_decay[j+6] = VMAX / m_decay_time[j]; |
| 364 | m_decay[j+0] = m_decay[j+6] = TMS36XX_VMAX / m_decay_time[j]; |
| 365 | 365 | enable |= 0x41 << j; |
| 366 | 366 | } |
| 367 | 367 | } |
| r29572 | r29573 | |
| 410 | 410 | |
| 411 | 411 | if( (m_note_counter -= n) <= 0 ) |
| 412 | 412 | { |
| 413 | | m_note_counter += VMAX; |
| 413 | m_note_counter += TMS36XX_VMAX; |
| 414 | 414 | if (m_tune_ofs < m_tune_max) |
| 415 | 415 | { |
| 416 | 416 | /* shift to the other 'bank' of voices */ |
branches/new_menus/src/mame/audio/scramble.c
| r29572 | r29573 | |
| 325 | 325 | DEVCB_DEVICE_MEMBER("tms", tms5110_device, ctl_w) /* tms ctl func */ |
| 326 | 326 | }; |
| 327 | 327 | |
| 328 | | static const tms5110_interface ad2083_tms5110_interface = |
| 329 | | { |
| 330 | | /* legacy interface */ |
| 331 | | NULL, /* function to be called when chip requests another bit */ |
| 332 | | NULL, /* speech ROM load address callback */ |
| 333 | | /* new rom controller interface */ |
| 334 | | DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, m0_w), /* the M0 line */ |
| 335 | | DEVCB_NULL, /* the M1 line */ |
| 336 | | DEVCB_NULL, /* Write to ADD1,2,4,8 - 4 address bits */ |
| 337 | | DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, data_r), /* Read one bit from ADD8/Data - voice data */ |
| 338 | | DEVCB_NULL /* rom clock - Only used to drive the data lines */ |
| 339 | | }; |
| 340 | 328 | |
| 341 | | |
| 342 | | |
| 343 | 329 | MACHINE_CONFIG_FRAGMENT( ad2083_audio ) |
| 344 | 330 | |
| 345 | 331 | MCFG_CPU_ADD("audiocpu", Z80, 14318000/8) /* 1.78975 MHz */ |
| r29572 | r29573 | |
| 359 | 345 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) |
| 360 | 346 | |
| 361 | 347 | MCFG_SOUND_ADD("tms", TMS5110A, AD2083_TMS5110_CLOCK) |
| 362 | | MCFG_SOUND_CONFIG(ad2083_tms5110_interface) |
| 348 | MCFG_TMS5110_M0_CB(DEVWRITELINE("tmsprom", tmsprom_device, m0_w)) |
| 349 | MCFG_TMS5110_DATA_CB(DEVREADLINE("tmsprom", tmsprom_device, data_r)) |
| 363 | 350 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 364 | 351 | MACHINE_CONFIG_END |
branches/new_menus/src/mame/audio/dkong.c
| r29572 | r29573 | |
| 1330 | 1330 | |
| 1331 | 1331 | /************************************* |
| 1332 | 1332 | * |
| 1333 | | * Sound interfaces |
| 1334 | | * |
| 1335 | | *************************************/ |
| 1336 | | |
| 1337 | | const tms5110_interface tms_interface = { |
| 1338 | | NULL, |
| 1339 | | NULL, |
| 1340 | | DEVCB_DEVICE_LINE_MEMBER("m58819", tms6100_device, tms6100_m0_w), |
| 1341 | | DEVCB_DEVICE_LINE_MEMBER("m58819", tms6100_device, tms6100_m1_w), |
| 1342 | | DEVCB_DEVICE_MEMBER("m58819", tms6100_device, tms6100_addr_w), |
| 1343 | | DEVCB_DEVICE_LINE_MEMBER("m58819", tms6100_device, tms6100_data_r), |
| 1344 | | DEVCB_DEVICE_LINE_MEMBER("m58819", tms6100_device, tms6100_romclock_w) |
| 1345 | | }; |
| 1346 | | |
| 1347 | | /************************************* |
| 1348 | | * |
| 1349 | 1333 | * Machine driver |
| 1350 | 1334 | * |
| 1351 | 1335 | *************************************/ |
| r29572 | r29573 | |
| 1408 | 1392 | MCFG_DEVICE_ADD("m58819", M58819, 0) |
| 1409 | 1393 | |
| 1410 | 1394 | MCFG_SOUND_ADD("tms", M58817, XTAL_640kHz) |
| 1411 | | MCFG_DEVICE_CONFIG(tms_interface) |
| 1395 | MCFG_TMS5110_M0_CB(DEVWRITELINE("m58819", tms6100_device, tms6100_m0_w)) |
| 1396 | MCFG_TMS5110_M1_CB(DEVWRITELINE("m58819", tms6100_device, tms6100_m1_w)) |
| 1397 | MCFG_TMS5110_ADDR_CB(DEVWRITE8("m58819", tms6100_device, tms6100_addr_w)) |
| 1398 | MCFG_TMS5110_DATA_CB(DEVREADLINE("m58819", tms6100_device, tms6100_data_r)) |
| 1399 | MCFG_TMS5110_ROMCLK_CB(DEVWRITELINE("m58819", tms6100_device, tms6100_romclock_w)) |
| 1412 | 1400 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1413 | | |
| 1414 | 1401 | MACHINE_CONFIG_END |
| 1415 | 1402 | |
| 1416 | 1403 | MACHINE_CONFIG_FRAGMENT( dkongjr_audio ) |
branches/new_menus/src/mame/drivers/cvs.c
| r29572 | r29573 | |
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | |
| 409 | | static int speech_rom_read_bit( device_t *device ) |
| 409 | READ_LINE_MEMBER(cvs_state::speech_rom_read_bit) |
| 410 | 410 | { |
| 411 | | cvs_state *state = device->machine().driver_data<cvs_state>(); |
| 412 | | UINT8 *ROM = state->memregion("speechdata")->base(); |
| 413 | 411 | int bit; |
| 412 | UINT8 *ROM = memregion("speechdata")->base(); |
| 414 | 413 | |
| 415 | 414 | /* before reading the bit, clamp the address to the region length */ |
| 416 | | state->m_speech_rom_bit_address = state->m_speech_rom_bit_address & ((state->memregion("speechdata")->bytes() * 8) - 1); |
| 417 | | bit = (ROM[state->m_speech_rom_bit_address >> 3] >> (state->m_speech_rom_bit_address & 0x07)) & 0x01; |
| 415 | m_speech_rom_bit_address &= ((memregion("speechdata")->bytes() * 8) - 1); |
| 416 | bit = BIT(ROM[m_speech_rom_bit_address >> 3], m_speech_rom_bit_address & 0x07); |
| 418 | 417 | |
| 419 | 418 | /* prepare for next bit */ |
| 420 | | state->m_speech_rom_bit_address = state->m_speech_rom_bit_address + 1; |
| 419 | m_speech_rom_bit_address++; |
| 421 | 420 | |
| 422 | 421 | return bit; |
| 423 | 422 | } |
| 424 | 423 | |
| 425 | 424 | |
| 426 | | static const tms5110_interface tms5100_interface = |
| 427 | | { |
| 428 | | speech_rom_read_bit, /* M0 callback function. Called whenever chip requests a single bit of data */ |
| 429 | | NULL |
| 430 | | }; |
| 431 | | |
| 432 | | |
| 433 | | |
| 434 | 425 | /************************************* |
| 435 | 426 | * |
| 436 | 427 | * Inter-CPU communications |
| r29572 | r29573 | |
| 1061 | 1052 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1062 | 1053 | |
| 1063 | 1054 | MCFG_SOUND_ADD("tms", TMS5100, XTAL_640kHz) |
| 1064 | | MCFG_SOUND_CONFIG(tms5100_interface) |
| 1055 | MCFG_TMS5110_DATA_CB(READLINE(cvs_state, speech_rom_read_bit)) |
| 1065 | 1056 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 1066 | 1057 | MACHINE_CONFIG_END |
| 1067 | 1058 | |
branches/new_menus/src/mame/drivers/bagman.c
| r29572 | r29573 | |
| 448 | 448 | DEVCB_DEVICE_MEMBER("tms", tms5110_device, ctl_w) /* tms ctl func */ |
| 449 | 449 | }; |
| 450 | 450 | |
| 451 | | static const tms5110_interface bagman_tms5110_interface = |
| 452 | | { |
| 453 | | /* legacy interface */ |
| 454 | | NULL, /* function to be called when chip requests another bit */ |
| 455 | | NULL, /* speech ROM load address callback */ |
| 456 | | /* new rom controller interface */ |
| 457 | | DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, m0_w), /* the M0 line */ |
| 458 | | DEVCB_NULL, /* the M1 line */ |
| 459 | | DEVCB_NULL, /* Write to ADD1,2,4,8 - 4 address bits */ |
| 460 | | DEVCB_DEVICE_LINE_MEMBER("tmsprom", tmsprom_device, data_r), /* Read one bit from ADD8/Data - voice data */ |
| 461 | | DEVCB_NULL /* rom clock - Only used to drive the data lines */ |
| 462 | | }; |
| 463 | | |
| 464 | 451 | INTERRUPT_GEN_MEMBER(bagman_state::vblank_irq) |
| 465 | 452 | { |
| 466 | 453 | if(m_irq_mask) |
| r29572 | r29573 | |
| 501 | 488 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) |
| 502 | 489 | |
| 503 | 490 | MCFG_SOUND_ADD("tms", TMS5110A, 640000) |
| 504 | | MCFG_SOUND_CONFIG(bagman_tms5110_interface) |
| 491 | MCFG_TMS5110_M0_CB(DEVWRITELINE("tmsprom", tmsprom_device, m0_w)) |
| 492 | MCFG_TMS5110_DATA_CB(DEVREADLINE("tmsprom", tmsprom_device, data_r)) |
| 505 | 493 | MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) |
| 506 | 494 | MACHINE_CONFIG_END |
| 507 | 495 | |