diff options
Diffstat (limited to 'src/devices/sound/ay8910.h')
-rw-r--r-- | src/devices/sound/ay8910.h | 85 |
1 files changed, 43 insertions, 42 deletions
diff --git a/src/devices/sound/ay8910.h b/src/devices/sound/ay8910.h index c1bbf718245..29a7ae674d4 100644 --- a/src/devices/sound/ay8910.h +++ b/src/devices/sound/ay8910.h @@ -62,7 +62,7 @@ public: }; // construction/destruction - ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ay8910_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration helpers void set_flags(int flags) { m_flags = flags; } @@ -73,21 +73,24 @@ public: auto port_a_write_callback() { return m_port_a_write_cb.bind(); } auto port_b_write_callback() { return m_port_b_write_cb.bind(); } - u8 data_r() { return ay8910_read_ym(); } - void address_w(u8 data); - void data_w(u8 data); + DECLARE_READ8_MEMBER( data_r ); + DECLARE_WRITE8_MEMBER( address_w ); + DECLARE_WRITE8_MEMBER( data_w ); + u8 read_data() { return ay8910_read_ym(); } + void write_address(u8 data) { ay8910_write_ym(0, data); } + void write_data(u8 data) { ay8910_write_ym(1, data); } /* /RES */ - void reset_w(u8 data = 0) { ay8910_reset_ym(); } + DECLARE_WRITE8_MEMBER( reset_w ) { ay8910_reset_ym(); } // use this when BC1 == A0; here, BC1=0 selects 'data' and BC1=1 selects 'latch address' - void data_address_w(offs_t offset, u8 data) { ay8910_write_ym(~offset & 1, data); } // note that directly connecting BC1 to A0 puts data on 0 and address on 1 + DECLARE_WRITE8_MEMBER( data_address_w ) { ay8910_write_ym(~offset & 1, data); } // note that directly connecting BC1 to A0 puts data on 0 and address on 1 // use this when BC1 == !A0; here, BC1=0 selects 'latch address' and BC1=1 selects 'data' - void address_data_w(offs_t offset, u8 data) { ay8910_write_ym(offset & 1, data); } + DECLARE_WRITE8_MEMBER( address_data_w ) { ay8910_write_ym(offset & 1, data); } // bc1=a0, bc2=a1 - void write_bc1_bc2(offs_t offset, u8 data); + DECLARE_WRITE8_MEMBER(write_bc1_bc2); void set_volume(int channel,int volume); void ay_set_clock(int clock); @@ -110,10 +113,13 @@ public: // internal interface for PSG component of YM device // FIXME: these should be private, but vector06 accesses them directly + void ay8910_write_ym(int addr, uint8_t data); + uint8_t ay8910_read_ym(); + void ay8910_reset_ym(); protected: ay8910_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, - u32 clock, psg_type_t psg_type, int streams, int ioports); + uint32_t clock, psg_type_t psg_type, int streams, int ioports); // device-level overrides virtual void device_start() override; @@ -134,15 +140,11 @@ private: // internal helpers void set_type(psg_type_t psg_type); - inline u16 mix_3D(); + inline uint16_t mix_3D(); void ay8910_write_reg(int r, int v); void build_mixer_table(); void ay8910_statesave(); - void ay8910_write_ym(int addr, u8 data); - u8 ay8910_read_ym(); - void ay8910_reset_ym(); - // internal state psg_type_t m_type; int m_streams; @@ -150,29 +152,28 @@ private: int m_ready; sound_stream *m_channel; bool m_active; - s32 m_register_latch; - u8 m_regs[16]; - s32 m_last_enable; - s32 m_count[NUM_CHANNELS]; - u8 m_output[NUM_CHANNELS]; - u8 m_prescale_noise; - s32 m_count_noise; - s32 m_count_env; - s8 m_env_step; - u32 m_env_volume; - u8 m_hold,m_alternate,m_attack,m_holding; - s32 m_rng; - u8 m_mode; - u8 m_env_step_mask; + int32_t m_register_latch; + uint8_t m_regs[16]; + int32_t m_last_enable; + int32_t m_count[NUM_CHANNELS]; + uint8_t m_output[NUM_CHANNELS]; + uint8_t m_prescale_noise; + int32_t m_count_noise; + int32_t m_count_env; + int8_t m_env_step; + uint32_t m_env_volume; + uint8_t m_hold,m_alternate,m_attack,m_holding; + int32_t m_rng; + uint8_t m_env_step_mask; /* init parameters ... */ int m_step; int m_zero_is_off; - u8 m_vol_enabled[NUM_CHANNELS]; + uint8_t m_vol_enabled[NUM_CHANNELS]; const ay_ym_param *m_par; const ay_ym_param *m_par_env; - s32 m_vol_table[NUM_CHANNELS][16]; - s32 m_env_table[NUM_CHANNELS][32]; - std::unique_ptr<s32[]> m_vol3d_table; + int32_t m_vol_table[NUM_CHANNELS][16]; + int32_t m_env_table[NUM_CHANNELS][32]; + std::unique_ptr<int32_t[]> m_vol3d_table; int m_flags; /* Flags */ int m_res_load[3]; /* Load on channel in ohms */ devcb_read8 m_port_a_read_cb; @@ -186,7 +187,7 @@ DECLARE_DEVICE_TYPE(AY8910, ay8910_device) class ay8912_device : public ay8910_device { public: - ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ay8912_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(AY8912, ay8912_device) @@ -194,7 +195,7 @@ DECLARE_DEVICE_TYPE(AY8912, ay8912_device) class ay8913_device : public ay8910_device { public: - ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ay8913_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(AY8913, ay8913_device) @@ -202,11 +203,11 @@ DECLARE_DEVICE_TYPE(AY8913, ay8913_device) class ay8914_device : public ay8910_device { public: - ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ay8914_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); /* AY8914 handlers needed due to different register map */ - u8 read(offs_t offset); - void write(offs_t offset, u8 data); + DECLARE_READ8_MEMBER( read ); + DECLARE_WRITE8_MEMBER( write ); }; DECLARE_DEVICE_TYPE(AY8914, ay8914_device) @@ -214,7 +215,7 @@ DECLARE_DEVICE_TYPE(AY8914, ay8914_device) class ay8930_device : public ay8910_device { public: - ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ay8930_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(AY8930, ay8930_device) @@ -222,7 +223,7 @@ DECLARE_DEVICE_TYPE(AY8930, ay8930_device) class ym2149_device : public ay8910_device { public: - ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ym2149_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(YM2149, ym2149_device) @@ -230,7 +231,7 @@ DECLARE_DEVICE_TYPE(YM2149, ym2149_device) class ym3439_device : public ay8910_device { public: - ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ym3439_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(YM3439, ym3439_device) @@ -238,7 +239,7 @@ DECLARE_DEVICE_TYPE(YM3439, ym3439_device) class ymz284_device : public ay8910_device { public: - ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ymz284_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(YMZ284, ymz284_device) @@ -246,7 +247,7 @@ DECLARE_DEVICE_TYPE(YMZ284, ymz284_device) class ymz294_device : public ay8910_device { public: - ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); + ymz294_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); }; DECLARE_DEVICE_TYPE(YMZ294, ymz294_device) |