1 // license:BSD-3-Clause
2 // copyright-holders:Ernesto Corvi
3 #ifndef MAME_INCLUDES_TIMELIMT_H
4 #define MAME_INCLUDES_TIMELIMT_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 class timelimt_state : public driver_device
12 {
13 public:
timelimt_state(const machine_config & mconfig,device_type type,const char * tag)14 	timelimt_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_audiocpu(*this, "audiocpu"),
18 		m_gfxdecode(*this, "gfxdecode"),
19 		m_palette(*this, "palette"),
20 		m_videoram(*this, "videoram"),
21 		m_bg_videoram(*this, "bg_videoram"),
22 		m_spriteram(*this, "spriteram")
23 	{ }
24 
25 	void timelimt(machine_config &config);
26 
27 protected:
28 	virtual void machine_start() override;
29 	virtual void video_start() override;
30 
31 	required_device<cpu_device> m_maincpu;
32 	required_device<cpu_device> m_audiocpu;
33 	required_device<gfxdecode_device> m_gfxdecode;
34 	required_device<palette_device> m_palette;
35 
36 	required_shared_ptr<uint8_t> m_videoram;
37 	required_shared_ptr<uint8_t> m_bg_videoram;
38 	required_shared_ptr<uint8_t> m_spriteram;
39 
40 	int m_nmi_enabled;
41 	int m_scrollx;
42 	int m_scrolly;
43 	tilemap_t *m_bg_tilemap;
44 	tilemap_t *m_fg_tilemap;
45 
46 	DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
47 	DECLARE_WRITE_LINE_MEMBER(coin_lockout_w);
48 
49 	void videoram_w(offs_t offset, uint8_t data);
50 	void bg_videoram_w(offs_t offset, uint8_t data);
51 	void scroll_x_lsb_w(uint8_t data);
52 	void scroll_x_msb_w(uint8_t data);
53 	void scroll_y_w(uint8_t data);
54 
55 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
56 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
57 
58 	void timelimt_palette(palette_device &palette) const;
59 
60 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
61 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
62 
63 	INTERRUPT_GEN_MEMBER(irq);
64 
65 	void main_io_map(address_map &map);
66 	void main_map(address_map &map);
67 	void sound_io_map(address_map &map);
68 	void sound_map(address_map &map);
69 };
70 
71 #endif // MAME_INCLUDES_TIMELIMT_H
72