1 // license:BSD-3-Clause
2 // copyright-holders:Olivier Galibert
3 /*************************************************************************
4 
5     GI Joe
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_GIJOE_H
9 #define MAME_INCLUDES_GIJOE_H
10 
11 #pragma once
12 
13 #include "sound/k054539.h"
14 #include "video/k053251.h"
15 #include "video/k054156_k054157_k056832.h"
16 #include "video/k053246_k053247_k055673.h"
17 #include "video/konami_helper.h"
18 #include "machine/k054321.h"
19 #include "emupal.h"
20 
21 class gijoe_state : public driver_device
22 {
23 public:
gijoe_state(const machine_config & mconfig,device_type type,const char * tag)24 	gijoe_state(const machine_config &mconfig, device_type type, const char *tag) :
25 		driver_device(mconfig, type, tag),
26 		m_spriteram(*this, "spriteram"),
27 		m_workram(*this, "workram"),
28 		m_maincpu(*this, "maincpu"),
29 		m_audiocpu(*this, "audiocpu"),
30 		m_k054539(*this, "k054539"),
31 		m_k056832(*this, "k056832"),
32 		m_k053246(*this, "k053246"),
33 		m_k053251(*this, "k053251"),
34 		m_palette(*this, "palette"),
35 		m_k054321(*this, "k054321")
36 	{ }
37 
38 	void gijoe(machine_config &config);
39 
40 private:
41 	/* memory pointers */
42 	required_shared_ptr<uint16_t> m_spriteram;
43 	required_shared_ptr<uint16_t> m_workram;
44 
45 	/* video-related */
46 	int         m_avac_bits[4];
47 	int         m_avac_occupancy[4];
48 	int         m_layer_colorbase[4];
49 	int         m_layer_pri[4];
50 	int         m_avac_vrc;
51 	int         m_sprite_colorbase;
52 
53 	/* misc */
54 	uint16_t      m_cur_control2;
55 	emu_timer   *m_dmadelay_timer;
56 
57 	/* devices */
58 	required_device<cpu_device> m_maincpu;
59 	required_device<cpu_device> m_audiocpu;
60 	required_device<k054539_device> m_k054539;
61 	required_device<k056832_device> m_k056832;
62 	required_device<k053247_device> m_k053246;
63 	required_device<k053251_device> m_k053251;
64 	required_device<palette_device> m_palette;
65 	required_device<k054321_device> m_k054321;
66 
67 	uint16_t control2_r();
68 	void control2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
69 	void sound_irq_w(uint16_t data);
70 	virtual void machine_start() override;
71 	virtual void machine_reset() override;
72 	virtual void video_start() override;
73 	uint32_t screen_update_gijoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
74 	INTERRUPT_GEN_MEMBER(gijoe_interrupt);
75 	TIMER_CALLBACK_MEMBER(dmaend_callback);
76 	void gijoe_objdma();
77 	K056832_CB_MEMBER(tile_callback);
78 	K053246_CB_MEMBER(sprite_callback);
79 	void gijoe_map(address_map &map);
80 	void sound_map(address_map &map);
81 };
82 
83 #endif // MAME_INCLUDES_GIJOE_H
84