1 // license:BSD-3-Clause
2 // copyright-holders:Wilbert Pol
3 #ifndef MAME_INCLUDES_GAMEPOCK_H
4 #define MAME_INCLUDES_GAMEPOCK_H
5 
6 #pragma once
7 
8 #include "bus/generic/slot.h"
9 #include "sound/spkrdev.h"
10 
11 class gamepock_state : public driver_device
12 {
13 public:
gamepock_state(const machine_config & mconfig,device_type type,const char * tag)14 	gamepock_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_speaker(*this, "speaker"),
18 		m_cart(*this, "cartslot")
19 	{ }
20 
21 	void gamepock(machine_config &config);
22 
23 private:
24 	struct HD44102CH {
25 		uint8_t   enabled;
26 		uint8_t   start_page;
27 		uint8_t   address;
28 		uint8_t   y_inc;
29 		uint8_t   ram[256];   // There are actually 50 x 4 x 8 bits. This just makes addressing easier.
30 	};
31 
32 	virtual void machine_reset() override;
33 
34 	void hd44102ch_w(int which, int c_d, uint8_t data);
35 	void hd44102ch_init(int which);
36 	void lcd_update();
37 
38 	void port_a_w(uint8_t data);
39 	uint8_t port_b_r();
40 	void port_b_w(uint8_t data);
41 	uint8_t port_c_r();
42 	uint32_t screen_update_gamepock(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
43 	DECLARE_WRITE_LINE_MEMBER(gamepock_to_w);
44 	void gamepock_mem(address_map &map);
45 
46 	uint8_t m_port_a;
47 	uint8_t m_port_b;
48 	HD44102CH m_hd44102ch[3];
49 
50 	required_device<cpu_device> m_maincpu;
51 	required_device<speaker_sound_device> m_speaker;
52 	required_device<generic_slot_device> m_cart;
53 };
54 
55 #endif // MAME_INCLUDES_GAMEPOCK_H
56