diff options
Diffstat (limited to 'src/devices/sound/ics2115.h')
-rw-r--r-- | src/devices/sound/ics2115.h | 99 |
1 files changed, 57 insertions, 42 deletions
diff --git a/src/devices/sound/ics2115.h b/src/devices/sound/ics2115.h index 58373daa5b2..8e99180ca53 100644 --- a/src/devices/sound/ics2115.h +++ b/src/devices/sound/ics2115.h @@ -12,9 +12,12 @@ // ======================> ics2115_device -class ics2115_device : public device_t, public device_sound_interface +class ics2115_device : public device_t, public device_sound_interface, public device_memory_interface { public: + static constexpr feature_type imperfect_features() { return feature::SOUND; } // Incorrect/Unverified interrupt, interpolation; + // current ramping behavior is seems like incorrect? + // construction/destruction ics2115_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); @@ -30,13 +33,27 @@ public: TIMER_CALLBACK_MEMBER(timer_cb_1); protected: + // device-level overrides + virtual void device_start() override ATTR_COLD; + virtual void device_reset() override ATTR_COLD; + virtual void device_clock_changed() override; + + // device_sound_interface overrides + virtual void sound_stream_update(sound_stream &stream) override; + + // device_memory_interface configuration + virtual space_config_vector memory_space_config() const override; + + address_space_config m_data_config; + +private: static constexpr u16 revision = 0x1; struct ics2115_voice { struct { s32 left; - u32 acc, start, end; - u16 fc; + u32 acc, start, end; // address counters (20.9 fixed point) + u16 fc; // frequency (6.9 fixed point) u8 ctl, saddr; } osc; @@ -52,76 +69,70 @@ protected: union { struct { - u8 ulaw : 1; - u8 stop : 1; //stops wave + vol envelope - u8 eightbit : 1; - u8 loop : 1; - u8 loop_bidir : 1; - u8 irq : 1; - u8 invert : 1; - u8 irq_pending: 1; - //IRQ on variable? + u8 ulaw : 1; // compressed sample format + u8 stop : 1; // stops wave + vol envelope + u8 eightbit : 1; // 8 bit sample format + u8 loop : 1; // loop enable + u8 loop_bidir : 1; // bi-directional loop enable + u8 irq : 1; // enable IRQ generation + u8 invert : 1; // invert direction + u8 irq_pending: 1; // (read only?) IRQ pending + // IRQ on variable? } bitflags; u8 value; } osc_conf; union { struct { - u8 done : 1; //indicates ramp has stopped - u8 stop : 1; //stops the ramp - u8 rollover : 1; //rollover (TODO) - u8 loop : 1; - u8 loop_bidir : 1; - u8 irq : 1; //enable IRQ generation - u8 invert : 1; //invert direction - u8 irq_pending: 1; //(read only) IRQ pending - //noenvelope == (done | disable) + u8 done : 1; // indicates ramp has stopped + u8 stop : 1; // stops the ramp + u8 rollover : 1; // rollover (TODO) + u8 loop : 1; // loop enable + u8 loop_bidir : 1; // bi-directional loop enable + u8 irq : 1; // enable IRQ generation + u8 invert : 1; // invert direction + u8 irq_pending: 1; // (read only?) IRQ pending + // noenvelope == (done | stop) } bitflags; u8 value; } vol_ctrl; - //Possibly redundant state. => improvements of wavetable logic - //may lead to its elimination. - union { - struct { - u8 on : 1; - u8 ramp : 7; // 100 0000 = 0x40 maximum - } bitflags; - u8 value; + // Possibly redundant state. => improvements of wavetable logic + // may lead to its elimination. + struct { + bool on; + int ramp; // 100 0000 = 0x40 maximum } state; + u16 regs[0x20]; // channel registers bool playing(); int update_volume_envelope(); int update_oscillator(); void update_ramp(); }; - // device-level overrides - virtual void device_start() override; - virtual void device_reset() override; - - // internal callbacks - virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override; - - //internal register helper functions + // internal register helper functions u16 reg_read(); void reg_write(u16 data, u16 mem_mask); void recalc_timer(int timer); void keyon(); void recalc_irq(); - //stream helper functions - int fill_output(ics2115_voice& voice, stream_sample_t *outputs[2], int samples); - stream_sample_t get_sample(ics2115_voice& voice); + // stream helper functions + int fill_output(ics2115_voice& voice, sound_stream &stream); + s32 get_sample(ics2115_voice& voice); + u8 read_sample(ics2115_voice& voice, u32 addr) { return m_cache.read_byte((voice.osc.saddr << 20) | (addr & 0xfffff)); } sound_stream *m_stream; // internal state + memory_access<24, 0, 0, ENDIANNESS_LITTLE>::cache m_cache; required_region_ptr<u8> m_rom; devcb_write_line m_irq_cb; s16 m_ulaw[256]; u16 m_volume[4096]; + u16 m_panlaw[256]; static const int volume_bits = 15; ics2115_voice m_voice[32]; @@ -137,8 +148,12 @@ protected: u8 m_irq_enabled, m_irq_pending; bool m_irq_on; - //Unknown variable, seems to be effected by 0x12. Further investigation - //Required. + u16 m_regs[0x40]; // global registers + + /* + Unknown variable, seems to be effected by 0x12. Further investigation + Required. + */ u8 m_vmode; }; |