1 // license:BSD-3-Clause
2 // copyright-holders:Steve Ellenoff, Pierpaolo Prazzoli
3 #ifndef MAME_INCLUDES_PORTRAIT_H
4 #define MAME_INCLUDES_PORTRAIT_H
5 
6 #pragma once
7 
8 #include "sound/tms5220.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class portrait_state : public driver_device
13 {
14 public:
portrait_state(const machine_config & mconfig,device_type type,const char * tag)15 	portrait_state(const machine_config &mconfig, device_type type, const char *tag)
16 		: driver_device(mconfig, type, tag)
17 		, m_maincpu(*this, "maincpu")
18 		, m_gfxdecode(*this, "gfxdecode")
19 		, m_palette(*this, "palette")
20 		, m_tms(*this, "tms")
21 		, m_bgvideoram(*this, "bgvideoram")
22 		, m_fgvideoram(*this, "fgvideoram")
23 		, m_spriteram(*this, "spriteram")
24 		, m_lamps(*this, "lamp%u", 0U)
25 	{ }
26 
unemulated_features()27 	static constexpr feature_type unemulated_features() { return feature::CAMERA; }
28 
29 	void portrait(machine_config &config);
30 
31 protected:
machine_start()32 	virtual void machine_start() override { m_lamps.resolve(); }
33 	virtual void video_start() override;
34 
35 private:
36 	void ctrl_w(uint8_t data);
37 	void positive_scroll_w(uint8_t data);
38 	void negative_scroll_w(uint8_t data);
39 	void bgvideo_write(offs_t offset, uint8_t data);
40 	void fgvideo_write(offs_t offset, uint8_t data);
41 
42 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
43 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
44 
45 	void portrait_palette(palette_device &palette) const;
46 
47 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48 	inline void get_tile_info( tile_data &tileinfo, int tile_index, const uint8_t *source );
49 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
50 	void portrait_map(address_map &map);
51 	void portrait_sound_map(address_map &map);
52 
53 	required_device<cpu_device> m_maincpu;
54 	required_device<gfxdecode_device> m_gfxdecode;
55 	required_device<palette_device> m_palette;
56 	required_device<tms5200_device> m_tms;
57 
58 	required_shared_ptr<uint8_t> m_bgvideoram;
59 	required_shared_ptr<uint8_t> m_fgvideoram;
60 	required_shared_ptr<uint8_t> m_spriteram;
61 	output_finder<2> m_lamps;
62 
63 	int m_scroll;
64 	tilemap_t *m_foreground;
65 	tilemap_t *m_background;
66 };
67 
68 #endif // MAME_INCLUDES_PORTRAIT_H
69