void y8950_device::device_start() { int rate = clock()/72; m_irq_handler.resolve_safe(); m_keyboard_read_handler.resolve_safe(0); m_keyboard_write_handler.resolve_safe(); m_io_read_handler.resolve_safe(0); m_io_write_handler.resolve_safe(); /* stream system initialize */ m_chip = y8950_init(this,clock(),rate); assert_always(m_chip != NULL, "Error creating Y8950 chip"); /* ADPCM ROM data */ y8950_set_delta_t_memory(m_chip, *region(), region()->bytes()); m_stream = machine().sound().stream_alloc(*this,0,1,rate); /* port and keyboard handler */ y8950_set_port_handler(m_chip, Y8950PortHandler_w, Y8950PortHandler_r, this); y8950_set_keyboard_handler(m_chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, this); /* Y8950 setup */ y8950_set_timer_handler (m_chip, timer_handler, this); y8950_set_irq_handler (m_chip, IRQHandler, this); y8950_set_update_handler(m_chip, y8950_update_request, this); m_timer[0] = timer_alloc(0); m_timer[1] = timer_alloc(1); }
static DEVICE_START( y8950 ) { static const y8950_interface dummy = { DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL }; y8950_state *info = get_safe_token(device); int rate = device->clock()/72; info->intf = device->static_config() ? (const y8950_interface *)device->static_config() : &dummy; info->device = downcast<y8950_device *>(device); /* stream system initialize */ info->chip = y8950_init(device,device->clock(),rate); assert_always(info->chip != NULL, "Error creating Y8950 chip"); /* ADPCM ROM data */ y8950_set_delta_t_memory(info->chip, *device->region(), device->region()->bytes()); info->stream = device->machine().sound().stream_alloc(*device,0,1,rate,info,y8950_stream_update); /* port and keyboard handler */ y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info); y8950_set_keyboard_handler(info->chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, info); /* Y8950 setup */ y8950_set_timer_handler (info->chip, TimerHandler, info); y8950_set_irq_handler (info->chip, IRQHandler, info); y8950_set_update_handler(info->chip, _stream_update, info); info->timer[0] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_0), info); info->timer[1] = device->machine().scheduler().timer_alloc(FUNC(timer_callback_1), info); }
//static DEVICE_START( y8950 ) int device_start_y8950(UINT8 ChipID, int clock) { //static const y8950_interface dummy = { 0 }; //y8950_state *info = get_safe_token(device); y8950_state *info; int rate; if (ChipID >= MAX_CHIPS) return 0; info = &Y8950Data[ChipID]; rate = clock/72; if ((CHIP_SAMPLING_MODE == 0x01 && rate < CHIP_SAMPLE_RATE) || CHIP_SAMPLING_MODE == 0x02) rate = CHIP_SAMPLE_RATE; //info->intf = device->static_config ? (const y8950_interface *)device->static_config : &dummy; //info->intf = &dummy; //info->device = device; /* stream system initialize */ info->chip = y8950_init(clock,rate); //assert_always(info->chip != NULL, "Error creating Y8950 chip"); /* ADPCM ROM data */ //y8950_set_delta_t_memory(info->chip, device->region, device->regionbytes); y8950_set_delta_t_memory(info->chip, NULL, 0x00); //info->stream = stream_create(device,0,1,rate,info,y8950_stream_update); /* port and keyboard handler */ y8950_set_port_handler(info->chip, Y8950PortHandler_w, Y8950PortHandler_r, info); y8950_set_keyboard_handler(info->chip, Y8950KeyboardHandler_w, Y8950KeyboardHandler_r, info); /* Y8950 setup */ y8950_set_timer_handler (info->chip, TimerHandler, info); y8950_set_irq_handler (info->chip, IRQHandler, info); y8950_set_update_handler(info->chip, _stream_update, info); //info->timer[0] = timer_alloc(device->machine, timer_callback_0, info); //info->timer[1] = timer_alloc(device->machine, timer_callback_1, info); return rate; }