summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio/m72.h
blob: be4a31ce2fba34ce278e00cea9c6922281dd58f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria
/***************************************************************************

    M72 audio interface

****************************************************************************/
#ifndef MAME_AUDIO_M72_H
#define MAME_AUDIO_M72_H

#pragma once

#include "dirom.h"
#include "sound/dac.h"

class m72_audio_device : public device_t, public device_rom_interface<32> // unknown address bits
{
public:
	m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
	~m72_audio_device() {}

	template <typename T> void set_dac_tag(T &&tag) { m_dac.set_tag(std::forward<T>(tag)); }
	u8 sample_r();
	void sample_w(u8 data);

	/* the port goes to different address bits depending on the game */
	void set_sample_start(int start);
	void vigilant_sample_addr_w(offs_t offset, u8 data);
	void shisen_sample_addr_w(offs_t offset, u8 data);
	void rtype2_sample_addr_w(offs_t offset, u8 data);
	void poundfor_sample_addr_w(offs_t offset, u8 data);

protected:
	// device-level overrides
	virtual void device_start() override;

	// device_rom_interface overrides
	virtual void rom_bank_updated() override;

private:
	// internal state
	uint32_t m_sample_addr;
	optional_device<dac_byte_interface> m_dac;
};

DECLARE_DEVICE_TYPE(IREM_M72_AUDIO, m72_audio_device)

#endif // MAME_AUDIO_M72_H