1 // license:BSD-3-Clause
2 // copyright-holders:Barry Rodewald
3 /*
4  * wpc_dot.h
5  *
6  *  Created on: 18/10/2013
7  *      Author: bsr
8  */
9 
10 #ifndef MAME_INCLUDES_WPC_DOT_H
11 #define MAME_INCLUDES_WPC_DOT_H
12 
13 #pragma once
14 
15 #include "cpu/m6809/m6809.h"
16 #include "audio/wpcsnd.h"
17 #include "audio/dcs.h"
18 #include "machine/wpc.h"
19 
20 class wpc_dot_state : public driver_device
21 {
22 public:
wpc_dot_state(const machine_config & mconfig,device_type type,const char * tag)23 	wpc_dot_state(const machine_config &mconfig, device_type type, const char *tag)
24 		: driver_device(mconfig, type, tag)
25 		, m_maincpu(*this, "maincpu")
26 		, m_wpcsnd(*this,"wpcsnd")
27 		, m_wpc(*this,"wpc")
28 		, m_cpubank(*this, "cpubank")
29 		, m_fixedbank(*this, "fixedbank")
30 		, m_dmdbanks(*this, "dmdbank%u", 1U)
31 	{ }
32 
33 	void init_wpc_dot();
34 	void wpc_dot(machine_config &config);
35 
36 protected:
37 	void wpc_dot_map(address_map &map);
38 
39 	// devices
40 	required_device<cpu_device> m_maincpu;
41 	optional_device<wpcsnd_device> m_wpcsnd;
42 	required_device<wpc_device> m_wpc;
43 	required_memory_bank m_cpubank;
44 	required_memory_bank m_fixedbank;
45 	required_memory_bank_array<6> m_dmdbanks;
46 
47 	// driver_device overrides
48 	virtual void machine_reset() override;
49 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
50 	static const device_timer_id TIMER_VBLANK = 0;
51 	static const device_timer_id TIMER_IRQ = 1;
52 
53 	uint8_t ram_r(offs_t offset);
54 	void ram_w(offs_t offset, uint8_t data);
55 	DECLARE_WRITE_LINE_MEMBER(wpcsnd_reply_w);
56 	DECLARE_WRITE_LINE_MEMBER(wpc_irq_w);
57 	DECLARE_WRITE_LINE_MEMBER(wpc_firq_w);
58 	void wpc_rombank_w(uint8_t data);
59 	void wpc_dmdbank_w(offs_t offset, uint8_t data);
60 
61 	uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
62 
63 private:
64 	uint16_t m_vblank_count;
65 	uint32_t m_irq_count;
66 	uint8_t m_bankmask;
67 	uint8_t m_ram[0x3000];
68 	uint8_t m_dmdram[0x2000];
69 	emu_timer* m_vblank_timer;
70 	emu_timer* m_irq_timer;
71 };
72 
73 #endif // MAME_INCLUDES_WPC_DOT_H
74