1 // license:BSD-3-Clause
2 // copyright-holders:Manuel Abadia
3 #ifndef MAME_INCLUDES_TARGETH_H
4 #define MAME_INCLUDES_TARGETH_H
5 
6 #pragma once
7 
8 #include "machine/74259.h"
9 #include "emupal.h"
10 #include "screen.h"
11 #include "tilemap.h"
12 
13 class targeth_state : public driver_device
14 {
15 public:
targeth_state(const machine_config & mconfig,device_type type,const char * tag)16 	targeth_state(const machine_config &mconfig, device_type type, const char *tag) :
17 		driver_device(mconfig, type, tag),
18 		m_maincpu(*this,"maincpu"),
19 		m_gfxdecode(*this, "gfxdecode"),
20 		m_screen(*this, "screen"),
21 		m_palette(*this, "palette"),
22 		m_outlatch(*this, "outlatch"),
23 		m_videoram(*this, "videoram"),
24 		m_vregs(*this, "vregs"),
25 		m_spriteram(*this, "spriteram"),
26 		m_shareram(*this, "shareram"),
27 		m_okibank(*this, "okibank")
28 	{ }
29 
30 	void targeth(machine_config &config);
31 
32 private:
33 	void oki_bankswitch_w(uint8_t data);
34 	void output_latch_w(offs_t offset, uint16_t data);
35 	DECLARE_WRITE_LINE_MEMBER(coin1_counter_w);
36 	DECLARE_WRITE_LINE_MEMBER(coin2_counter_w);
37 	void shareram_w(offs_t offset, uint8_t data);
38 	uint8_t shareram_r(offs_t offset);
39 
40 	void vram_w(offs_t offset, uint16_t data);
41 
42 	template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
43 
44 	TIMER_CALLBACK_MEMBER(gun1_irq);
45 	TIMER_CALLBACK_MEMBER(gun2_irq);
46 
47 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48 
49 	void main_map(address_map &map);
50 	void mcu_hostmem_map(address_map &map);
51 	void oki_map(address_map &map);
52 
53 	virtual void video_start() override;
54 	virtual void machine_start() override;
55 
56 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
57 
58 	required_device<cpu_device> m_maincpu;
59 	required_device<gfxdecode_device> m_gfxdecode;
60 	required_device<screen_device> m_screen;
61 	required_device<palette_device> m_palette;
62 	required_device<ls259_device> m_outlatch;
63 
64 	required_shared_ptr<uint16_t> m_videoram;
65 	required_shared_ptr<uint16_t> m_vregs;
66 	required_shared_ptr<uint16_t> m_spriteram;
67 	required_shared_ptr<uint16_t> m_shareram;
68 
69 	required_memory_bank m_okibank;
70 
71 	emu_timer       *m_gun_irq_timer[2];
72 
73 	tilemap_t *m_pant[2];
74 };
75 
76 #endif // MAME_INCLUDES_TARGETH_H
77