1 // license:BSD-3-Clause
2 // copyright-holders:Olivier Galibert
3 /*************************************************************************
4 
5     Asterix
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_ASTERIX_H
9 #define MAME_INCLUDES_ASTERIX_H
10 
11 #pragma once
12 
13 #include "video/k053251.h"
14 #include "video/k054156_k054157_k056832.h"
15 #include "video/k053244_k053245.h"
16 #include "video/konami_helper.h"
17 
18 class asterix_state : public driver_device
19 {
20 public:
21 	enum
22 	{
23 		TIMER_NMI
24 	};
25 
asterix_state(const machine_config & mconfig,device_type type,const char * tag)26 	asterix_state(const machine_config &mconfig, device_type type, const char *tag) :
27 		driver_device(mconfig, type, tag),
28 		m_maincpu(*this, "maincpu"),
29 		m_audiocpu(*this, "audiocpu"),
30 		m_k056832(*this, "k056832"),
31 		m_k053244(*this, "k053244"),
32 		m_k053251(*this, "k053251")
33 	{ }
34 
35 	/* video-related */
36 	int         m_sprite_colorbase;
37 	int         m_layer_colorbase[4];
38 	int         m_layerpri[3];
39 	uint16_t      m_spritebank;
40 	int         m_tilebanks[4];
41 	int         m_spritebanks[4];
42 
43 	/* misc */
44 	uint8_t       m_cur_control2;
45 	uint16_t      m_prot[2];
46 
47 	/* devices */
48 	required_device<cpu_device> m_maincpu;
49 	required_device<cpu_device> m_audiocpu;
50 	required_device<k056832_device> m_k056832;
51 	required_device<k05324x_device> m_k053244;
52 	required_device<k053251_device> m_k053251;
53 	void control2_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
54 	void sound_arm_nmi_w(uint8_t data);
55 	void sound_irq_w(uint16_t data);
56 	void protection_w(address_space &space, offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
57 	void asterix_spritebank_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
58 	void init_asterix();
59 	virtual void machine_start() override;
60 	virtual void machine_reset() override;
61 	uint32_t screen_update_asterix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
62 	INTERRUPT_GEN_MEMBER(asterix_interrupt);
63 	K05324X_CB_MEMBER(sprite_callback);
64 	K056832_CB_MEMBER(tile_callback);
65 	void reset_spritebank();
66 
67 	void asterix(machine_config &config);
68 	void main_map(address_map &map);
69 	void sound_map(address_map &map);
70 protected:
71 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
72 };
73 
74 #endif // MAME_INCLUDES_ASTERIX_H
75