1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Peter Wilhelmsen, Kevtris
3 
4 #ifndef MAME_VIDEO_GAMATE_H
5 #define MAME_VIDEO_GAMATE_H
6 
7 #pragma once
8 
9 #include "emupal.h"
10 
DECLARE_DEVICE_TYPE(GAMATE_VIDEO,gamate_video_device)11 DECLARE_DEVICE_TYPE(GAMATE_VIDEO, gamate_video_device)
12 
13 class gamate_video_device : public device_t,
14 	public device_memory_interface
15 {
16 public:
17 	// construction/destruction
18 	gamate_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
19 
20 	void lcdcon_w(uint8_t data);
21 	void xscroll_w(uint8_t data);
22 	void yscroll_w(uint8_t data);
23 	void xpos_w(uint8_t data);
24 	void ypos_w(uint8_t data);
25 	uint8_t vram_r();
26 	void vram_w(uint8_t data);
27 
28 	void regs_map(address_map &map);
29 	void vram_map(address_map &map);
30 
31 protected:
32 	virtual void device_add_mconfig(machine_config &config) override;
33 	virtual void device_start() override;
34 	virtual void device_reset() override;
35 
36 	virtual space_config_vector memory_space_config() const override;
37 
38 	address_space *m_vramspace;
39 
40 private:
41 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
42 	void gamate_palette(palette_device &palette) const;
43 	const address_space_config m_vram_space_config;
44 	required_shared_ptr<uint8_t> m_vram;
45 
46 	void set_vram_addr_lower_5bits(uint8_t data);
47 	void set_vram_addr_upper_8bits(uint8_t data);
48 	void increment_vram_address();
49 
50 	void get_real_x_and_y(int &ret_x, int &ret_y, int scanline);
51 	int get_pixel_from_vram(int x, int y);
52 
53 	int m_vramaddress;
54 	int m_bitplaneselect;
55 	int m_scrollx;
56 	int m_scrolly;
57 	int m_window;
58 	int m_swapplanes;
59 	int m_incrementdir;
60 	int m_displayblank;
61 };
62 
63 #endif // MAME_VIDEO_GAMATE_H
64