1 // license:BSD-3-Clause
2 // copyright-holders:Manuel Abadia
3 /*************************************************************************
4 
5     Flak Attack / MX5000
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_FLKATCK_H
9 #define MAME_INCLUDES_FLKATCK_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "machine/watchdog.h"
15 #include "sound/k007232.h"
16 #include "video/k007121.h"
17 #include "tilemap.h"
18 
19 class flkatck_state : public driver_device
20 {
21 public:
flkatck_state(const machine_config & mconfig,device_type type,const char * tag)22 	flkatck_state(const machine_config &mconfig, device_type type, const char *tag) :
23 		driver_device(mconfig, type, tag),
24 		m_vram(*this, "vram"),
25 		m_spriteram(*this, "spriteram"),
26 		m_maincpu(*this, "maincpu"),
27 		m_audiocpu(*this, "audiocpu"),
28 		m_k007121(*this, "k007121"),
29 		m_k007232(*this, "k007232"),
30 		m_watchdog(*this, "watchdog"),
31 		m_gfxdecode(*this, "gfxdecode"),
32 		m_soundlatch(*this, "soundlatch")
33 	{ }
34 
35 	void flkatck(machine_config &config);
36 
37 private:
38 	/* memory pointers */
39 	required_shared_ptr<uint8_t> m_vram;
40 	required_shared_ptr<uint8_t> m_spriteram;
41 
42 	/* video-related */
43 	tilemap_t    *m_k007121_tilemap[2];
44 	int        m_flipscreen;
45 
46 	/* misc */
47 	int        m_irq_enabled;
48 	int        m_multiply_reg[2];
49 
50 	/* devices */
51 	required_device<cpu_device> m_maincpu;
52 	required_device<cpu_device> m_audiocpu;
53 	required_device<k007121_device> m_k007121;
54 	required_device<k007232_device> m_k007232;
55 	required_device<watchdog_timer_device> m_watchdog;
56 	required_device<gfxdecode_device> m_gfxdecode;
57 	required_device<generic_latch_8_device> m_soundlatch;
58 
59 	void flkatck_bankswitch_w(uint8_t data);
60 	uint8_t flkatck_ls138_r(offs_t offset);
61 	void flkatck_ls138_w(offs_t offset, uint8_t data);
62 	uint8_t multiply_r();
63 	void multiply_w(offs_t offset, uint8_t data);
64 	void vram_w(offs_t offset, uint8_t data);
65 	void flkatck_k007121_regs_w(offs_t offset, uint8_t data);
66 	TILE_GET_INFO_MEMBER(get_tile_info_A);
67 	TILE_GET_INFO_MEMBER(get_tile_info_B);
68 	virtual void machine_start() override;
69 	virtual void machine_reset() override;
70 	virtual void video_start() override;
71 	uint32_t screen_update_flkatck(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
72 	INTERRUPT_GEN_MEMBER(flkatck_interrupt);
73 	void volume_callback(uint8_t data);
74 	void flkatck_map(address_map &map);
75 	void flkatck_sound_map(address_map &map);
76 };
77 
78 #endif // MAME_INCLUDES_FLKATCK_H
79