1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 /**********************************************************************
4 
5     Commodore SFX Sound Expander cartridge emulation
6 
7 **********************************************************************/
8 
9 #ifndef MAME_BUS_C64_SFX_SOUND_EXPANDER_H
10 #define MAME_BUS_C64_SFX_SOUND_EXPANDER_H
11 
12 #pragma once
13 
14 #include "exp.h"
15 #include "sound/3526intf.h"
16 
17 
18 
19 //**************************************************************************
20 //  TYPE DEFINITIONS
21 //**************************************************************************
22 
23 // ======================> c64_sfx_sound_expander_cartridge_device
24 
25 class c64_sfx_sound_expander_cartridge_device : public device_t,
26 												public device_c64_expansion_card_interface
27 {
28 public:
29 	// construction/destruction
30 	c64_sfx_sound_expander_cartridge_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
31 
32 protected:
33 	// device-level overrides
34 	virtual void device_start() override;
35 	virtual void device_reset() override;
36 
37 	// optional information overrides
38 	virtual void device_add_mconfig(machine_config &config) override;
39 	virtual ioport_constructor device_input_ports() const override;
40 
41 	// device_c64_expansion_card_interface overrides
42 	virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
43 	virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
44 	virtual int c64_game_r(offs_t offset, int sphi2, int ba, int rw) override;
45 	virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override;
46 
47 private:
48 	DECLARE_WRITE_LINE_MEMBER( opl_irq_w );
49 
50 	required_device<ym3526_device> m_opl;
51 	required_device<c64_expansion_slot_device> m_exp;
52 	required_ioport_array<8> m_kb;
53 
54 	inline offs_t get_offset(offs_t offset, int rw);
55 };
56 
57 
58 // device type definition
59 DECLARE_DEVICE_TYPE(C64_SFX_SOUND_EXPANDER, c64_sfx_sound_expander_cartridge_device)
60 
61 
62 #endif // MAME_BUS_C64_SFX_SOUND_EXPANDER_H
63