1 // license: GPL-2.0+
2 // copyright-holders: Dirk Best
3 /***************************************************************************
4 
5     Blue Alpha Sound Sampler for SAM Coupe
6 
7 ***************************************************************************/
8 
9 #ifndef MAME_BUS_SAMCOUPE_EXPANSION_BLUE_SAMPLER_H
10 #define MAME_BUS_SAMCOUPE_EXPANSION_BLUE_SAMPLER_H
11 
12 #pragma once
13 
14 #include "expansion.h"
15 #include "machine/i8255.h"
16 #include "machine/timer.h"
17 #include "sound/dac.h"
18 
19 
20 //**************************************************************************
21 //  TYPE DEFINITIONS
22 //**************************************************************************
23 
24 // ======================> sam_blue_sound_sampler_device
25 
26 class sam_blue_sound_sampler_device : public device_t, public device_samcoupe_expansion_interface
27 {
28 public:
29 	// construction/destruction
30 	sam_blue_sound_sampler_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
31 
32 	// from host
33 	virtual uint8_t iorq_r(offs_t offset) override;
34 	virtual void iorq_w(offs_t offset, uint8_t data) override;
35 
36 protected:
37 	virtual void device_add_mconfig(machine_config &config) override;
38 	virtual void device_start() override;
39 
40 private:
41 	TIMER_DEVICE_CALLBACK_MEMBER(clock_callback);
42 	void ppi_portb_w(uint8_t data);
43 	uint8_t ppi_portc_r();
44 
45 	required_device<i8255_device> m_ppi;
46 	required_device<zn426e_device> m_dac;
47 
48 	uint8_t m_portc;
49 };
50 
51 // device type definition
52 DECLARE_DEVICE_TYPE(SAM_BLUE_SOUND_SAMPLER, sam_blue_sound_sampler_device)
53 
54 #endif // MAME_BUS_SAMCOUPE_EXPANSION_BLUE_SAMPLER_H
55