trunk/src/emu/sound/st0016.c
| r18007 | r18008 | |
| 9 | 9 | #define VERBOSE (0) |
| 10 | 10 | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 11 | 11 | |
| 12 | | struct st0016_state |
| 12 | struct st0016_device_state |
| 13 | 13 | { |
| 14 | 14 | sound_stream * stream; |
| 15 | 15 | UINT8 **sound_ram; |
| r18007 | r18008 | |
| 17 | 17 | UINT8 regs[0x100]; |
| 18 | 18 | }; |
| 19 | 19 | |
| 20 | | INLINE st0016_state *get_safe_token(device_t *device) |
| 20 | INLINE st0016_device_state *get_safe_token(device_t *device) |
| 21 | 21 | { |
| 22 | 22 | assert(device != NULL); |
| 23 | 23 | assert(device->type() == ST0016); |
| 24 | | return (st0016_state *)downcast<st0016_device *>(device)->token(); |
| 24 | return (st0016_device_state *)downcast<st0016_device *>(device)->token(); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | READ8_DEVICE_HANDLER( st0016_snd_r ) |
| 29 | 29 | { |
| 30 | | st0016_state *info = get_safe_token(device); |
| 30 | st0016_device_state *info = get_safe_token(device); |
| 31 | 31 | return info->regs[offset]; |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | WRITE8_DEVICE_HANDLER( st0016_snd_w ) |
| 35 | 35 | { |
| 36 | | st0016_state *info = get_safe_token(device); |
| 36 | st0016_device_state *info = get_safe_token(device); |
| 37 | 37 | int voice = offset/32; |
| 38 | 38 | int reg = offset & 0x1f; |
| 39 | 39 | int oldreg = info->regs[offset]; |
| r18007 | r18008 | |
| 60 | 60 | |
| 61 | 61 | static STREAM_UPDATE( st0016_update ) |
| 62 | 62 | { |
| 63 | | st0016_state *info = (st0016_state *)param; |
| 63 | st0016_device_state *info = (st0016_device_state *)param; |
| 64 | 64 | UINT8 *sound_ram = *info->sound_ram; |
| 65 | 65 | int v, i, snum; |
| 66 | 66 | unsigned char *slot; |
| r18007 | r18008 | |
| 137 | 137 | static DEVICE_START( st0016 ) |
| 138 | 138 | { |
| 139 | 139 | const st0016_interface *intf = (const st0016_interface *)device->static_config(); |
| 140 | | st0016_state *info = get_safe_token(device); |
| 140 | st0016_device_state *info = get_safe_token(device); |
| 141 | 141 | |
| 142 | 142 | info->sound_ram = intf->p_soundram; |
| 143 | 143 | |
| r18007 | r18008 | |
| 150 | 150 | : device_t(mconfig, ST0016, "ST0016", tag, owner, clock), |
| 151 | 151 | device_sound_interface(mconfig, *this) |
| 152 | 152 | { |
| 153 | | m_token = global_alloc_clear(st0016_state); |
| 153 | m_token = global_alloc_clear(st0016_device_state); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | //------------------------------------------------- |