1 // license:BSD-3-Clause
2 // copyright-holders:Lee Taylor
3 // thanks-to:John Clegg
4 /****************************************************************************
5 
6     Irem M58 hardware
7 
8 ****************************************************************************/
9 #ifndef MAME_INCLUDES_M58_H
10 #define MAME_INCLUDES_M58_H
11 
12 #pragma once
13 
14 #include "emupal.h"
15 #include "screen.h"
16 #include "tilemap.h"
17 
18 class m58_state : public driver_device
19 {
20 public:
m58_state(const machine_config & mconfig,device_type type,const char * tag)21 	m58_state(const machine_config &mconfig, device_type type, const char *tag) :
22 		driver_device(mconfig, type, tag),
23 		m_maincpu(*this, "maincpu"),
24 		m_gfxdecode(*this, "gfxdecode"),
25 		m_screen(*this, "screen"),
26 		m_palette(*this, "palette"),
27 		m_videoram(*this, "videoram"),
28 		m_spriteram(*this, "spriteram"),
29 		m_scroll_x_low(*this, "scroll_x_low"),
30 		m_scroll_x_high(*this, "scroll_x_high"),
31 		m_scroll_y_low(*this, "scroll_y_low"),
32 		m_score_panel_disabled(*this, "score_disable")
33 	{ }
34 
35 	void yard(machine_config &config);
36 
37 private:
38 	/* devices */
39 	required_device<cpu_device> m_maincpu;
40 	required_device<gfxdecode_device> m_gfxdecode;
41 	required_device<screen_device> m_screen;
42 	required_device<palette_device> m_palette;
43 
44 	/* memory pointers */
45 	required_shared_ptr<uint8_t> m_videoram;
46 	required_shared_ptr<uint8_t> m_spriteram;
47 	required_shared_ptr<uint8_t> m_scroll_x_low;
48 	required_shared_ptr<uint8_t> m_scroll_x_high;
49 	required_shared_ptr<uint8_t> m_scroll_y_low;
50 	required_shared_ptr<uint8_t> m_score_panel_disabled;
51 
52 	/* video-related */
53 	tilemap_t* m_bg_tilemap;
54 	bitmap_ind16 m_scroll_panel_bitmap;
55 
56 	void videoram_w(offs_t offset, uint8_t data);
57 	void scroll_panel_w(offs_t offset, uint8_t data);
58 	void flipscreen_w(uint8_t data);
59 
60 	virtual void video_start() override;
61 	void m58_palette(palette_device &palette) const;
62 
63 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
64 	TILEMAP_MAPPER_MEMBER(tilemap_scan_rows);
65 
66 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
67 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
68 	void draw_panel( bitmap_ind16 &bitmap, const rectangle &cliprect );
69 	void yard_map(address_map &map);
70 };
71 
72 #endif // MAME_INCLUDES_M58_H
73