1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 #ifndef MAME_INCLUDES_TP84
4 #define MAME_INCLUDES_TP84
5 
6 #pragma once
7 
8 #include "sound/flt_rc.h"
9 #include "emupal.h"
10 #include "screen.h"
11 #include "tilemap.h"
12 
13 class tp84_state : public driver_device
14 {
15 public:
tp84_state(const machine_config & mconfig,device_type type,const char * tag)16 	tp84_state(const machine_config &mconfig, device_type type, const char *tag) :
17 		driver_device(mconfig, type, tag),
18 		m_maincpu(*this, "cpu1"),
19 		m_subcpu(*this, "sub"),
20 		m_audiocpu(*this, "audiocpu"),
21 		m_palette_bank(*this, "palette_bank"),
22 		m_scroll_x(*this, "scroll_x"),
23 		m_scroll_y(*this, "scroll_y"),
24 		m_bg_videoram(*this, "bg_videoram"),
25 		m_fg_videoram(*this, "fg_videoram"),
26 		m_bg_colorram(*this, "bg_colorram"),
27 		m_fg_colorram(*this, "fg_colorram"),
28 		m_spriteram(*this, "spriteram"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_screen(*this, "screen"),
31 		m_palette(*this, "palette"),
32 		m_filter(*this, "filter%u", 1U)
33 	{ }
34 
35 	void tp84(machine_config &config);
36 	void tp84b(machine_config &config);
37 
38 private:
39 	required_device<cpu_device> m_maincpu;
40 	required_device<cpu_device> m_subcpu;
41 	required_device<cpu_device> m_audiocpu;
42 	required_shared_ptr<uint8_t> m_palette_bank;
43 	required_shared_ptr<uint8_t> m_scroll_x;
44 	required_shared_ptr<uint8_t> m_scroll_y;
45 	required_shared_ptr<uint8_t> m_bg_videoram;
46 	required_shared_ptr<uint8_t> m_fg_videoram;
47 	required_shared_ptr<uint8_t> m_bg_colorram;
48 	required_shared_ptr<uint8_t> m_fg_colorram;
49 	required_shared_ptr<uint8_t> m_spriteram;
50 	required_device<gfxdecode_device> m_gfxdecode;
51 	required_device<screen_device> m_screen;
52 	required_device<palette_device> m_palette;
53 	required_device_array<filter_rc_device, 3> m_filter;
54 	tilemap_t *m_bg_tilemap;
55 	tilemap_t *m_fg_tilemap;
56 	bool m_flipscreen_x;
57 	bool m_flipscreen_y;
58 
59 	bool m_irq_enable;
60 	bool m_sub_irq_mask;
61 
62 	DECLARE_WRITE_LINE_MEMBER(irq_enable_w);
63 	DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
64 	DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
65 	DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
66 	DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
67 	uint8_t tp84_sh_timer_r();
68 	void tp84_filter_w(offs_t offset, uint8_t data);
69 	void tp84_sh_irqtrigger_w(uint8_t data);
70 	void sub_irq_mask_w(uint8_t data);
71 	void tp84_spriteram_w(offs_t offset, uint8_t data);
72 	uint8_t tp84_scanline_r();
73 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
74 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
75 	virtual void machine_start() override;
76 	virtual void video_start() override;
77 	void tp84_palette(palette_device &palette) const;
78 	uint32_t screen_update_tp84(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
80 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
81 
82 	void audio_map(address_map &map);
83 	void cpu2_map(address_map &map);
84 	void tp84_cpu1_map(address_map &map);
85 	void tp84b_cpu1_map(address_map &map);
86 };
87 
88 #endif // MAME_INCLUDES_TP84
89