1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria, Ernesto Corvi
3 #ifndef MAME_INCLUDES_IQBLOCK_H
4 #define MAME_INCLUDES_IQBLOCK_H
5 
6 #pragma once
7 
8 #include "machine/timer.h"
9 #include "tilemap.h"
10 
11 class iqblock_state : public driver_device
12 {
13 public:
iqblock_state(const machine_config & mconfig,device_type type,const char * tag)14 	iqblock_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this,"maincpu"),
17 		m_gfxdecode(*this, "gfxdecode"),
18 		m_rambase(*this, "rambase"),
19 		m_bgvideoram(*this, "bgvideoram"),
20 		m_fgvideoram(*this, "fgvideoram")
21 	{ }
22 
23 	void iqblock(machine_config &config);
24 
25 	void init_grndtour();
26 	void init_iqblock();
27 
28 private:
29 	required_device<cpu_device> m_maincpu;
30 	required_device<gfxdecode_device> m_gfxdecode;
31 
32 	required_shared_ptr<uint8_t> m_rambase;
33 	required_shared_ptr<uint8_t> m_bgvideoram;
34 	required_shared_ptr<uint8_t> m_fgvideoram;
35 
36 	int m_videoenable;
37 	int m_video_type;
38 	tilemap_t *m_bg_tilemap;
39 	tilemap_t *m_fg_tilemap;
40 
41 	void iqblock_prot_w(uint8_t data);
42 	void grndtour_prot_w(uint8_t data);
43 	void irqack_w(uint8_t data);
44 	void fgvideoram_w(offs_t offset, uint8_t data);
45 	void bgvideoram_w(offs_t offset, uint8_t data);
46 	void fgscroll_w(offs_t offset, uint8_t data);
47 	void port_C_w(uint8_t data);
48 
49 	TIMER_DEVICE_CALLBACK_MEMBER(irq);
50 
51 	virtual void video_start() override;
52 
53 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
54 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
55 
56 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
57 	void main_map(address_map &map);
58 	void main_portmap(address_map &map);
59 };
60 
61 #endif // MAME_INCLUDES_IQBLOCK_H
62