1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari, Curt Coder
3 #ifndef MAME_INCLUDES_LVCARDS_H
4 #define MAME_INCLUDES_LVCARDS_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 class lvcards_state : public driver_device
12 {
13 public:
lvcards_state(const machine_config & mconfig,device_type type,const char * tag)14 	lvcards_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_videoram(*this, "videoram"),
18 		m_colorram(*this, "colorram"),
19 		m_gfxdecode(*this, "gfxdecode"),
20 		m_decrypted_opcodes(*this, "decrypted_opcodes")
21 	{ }
22 
23 	void lvcards(machine_config &config);
24 	void lvcardsa(machine_config &config);
25 
26 	void init_lvcardsa();
27 
28 protected:
29 	virtual void video_start() override;
30 
31 	void videoram_w(offs_t offset, uint8_t data);
32 	void colorram_w(offs_t offset, uint8_t data);
33 
34 	required_device<cpu_device> m_maincpu;
35 
36 private:
37 	required_shared_ptr<uint8_t> m_videoram;
38 	required_shared_ptr<uint8_t> m_colorram;
39 	required_device<gfxdecode_device> m_gfxdecode;
40 	optional_shared_ptr<uint8_t> m_decrypted_opcodes;
41 	tilemap_t *m_bg_tilemap;
42 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
43 	void lvcards_palette(palette_device &palette) const;
44 	uint32_t screen_update_lvcards(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
45 	void lvcards_io_map(address_map &map);
46 	void lvcards_map(address_map &map);
47 	void lvcardsa_decrypted_opcodes_map(address_map &map);
48 };
49 
50 
51 class lvpoker_state : public lvcards_state
52 {
53 public:
54 	using lvcards_state::lvcards_state;
55 
56 	void lvpoker(machine_config &config);
57 	void ponttehk(machine_config &config);
58 
59 protected:
60 	virtual void machine_start() override;
61 	virtual void machine_reset() override;
62 
63 private:
64 	void control_port_2_w(uint8_t data);
65 	void control_port_2a_w(uint8_t data);
66 	uint8_t payout_r();
67 
68 	void lvpoker_map(address_map &map);
69 	void ponttehk_map(address_map &map);
70 
71 	uint8_t m_payout;
72 	uint8_t m_pulse;
73 	uint8_t m_result;
74 };
75 
76 #endif // MAME_INCLUDES_LVCARDS_H
77