1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari
3 /*************************************************************************
4 
5     Epos games
6 
7 **************************************************************************/
8 #ifndef MAME_INCLUDES_EPOS_H
9 #define MAME_INCLUDES_EPOS_H
10 
11 #pragma once
12 
13 #include "emupal.h"
14 
15 class epos_state : public driver_device
16 {
17 public:
epos_state(const machine_config & mconfig,device_type type,const char * tag)18 	epos_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_videoram(*this, "videoram"),
21 		m_inputs(*this, { "INPUTS", "INPUTS2" }),
22 		m_maincpu(*this, "maincpu"),
23 		m_palette(*this, "palette"),
24 		m_leds(*this, "led%u", 0U)
25 	{ }
26 
27 	void epos(machine_config &config);
28 	void dealer(machine_config &config);
29 
30 	void init_dealer();
31 
32 protected:
machine_start()33 	virtual void machine_start() override { m_leds.resolve(); }
34 	virtual void machine_reset() override;
35 
36 private:
37 	void dealer_decrypt_rom(offs_t offset, uint8_t data);
38 	void port_1_w(uint8_t data);
39 	uint8_t i8255_porta_r();
40 	void i8255_portc_w(uint8_t data);
41 	uint8_t ay_porta_mpx_r();
42 	void flip_screen_w(uint8_t data);
43 	void dealer_pal_w(offs_t offset, uint8_t data);
44 	DECLARE_MACHINE_START(epos);
45 	DECLARE_MACHINE_START(dealer);
46 	void epos_palette(palette_device &palette) const;
47 	uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
48 	static void set_pal_color(palette_device &palette, uint8_t offset, uint8_t data); // TODO: convert to an RGB converter and set_format
49 	void dealer_io_map(address_map &map);
50 	void dealer_map(address_map &map);
51 	void epos_io_map(address_map &map);
52 	void epos_map(address_map &map);
53 
54 	/* memory pointers */
55 	required_shared_ptr<uint8_t> m_videoram;
56 	optional_ioport_array<2> m_inputs;
57 
58 	/* video-related */
59 	uint8_t    m_palette_bank;
60 
61 	/* misc */
62 	int      m_counter;
63 	int      m_input_multiplex;
64 	bool     m_ay_porta_multiplex;
65 	required_device<cpu_device> m_maincpu;
66 	required_device<palette_device> m_palette;
67 	output_finder<2> m_leds;
68 };
69 
70 #endif // MAME_INCLUDES_EPOS_H
71