1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina
3 
4 #include "machine/st0016.h"
5 #include "machine/timer.h"
6 #include "screen.h"
7 
8 class st0016_state : public driver_device
9 {
10 public:
st0016_state(const machine_config & mconfig,device_type type,const char * tag)11 	st0016_state(const machine_config &mconfig, device_type type, const char *tag)
12 		: driver_device(mconfig, type, tag),
13 		m_maincpu(*this,"maincpu"),
14 		m_subcpu(*this, "sub"),
15 		m_screen(*this, "screen"),
16 		m_mainbank(*this, "mainbank")
17 	{ }
18 
19 	void st0016(machine_config &config);
20 	void renju(machine_config &config);
21 	void mayjinsn(machine_config &config);
22 
23 	void init_nratechu();
24 	void init_mayjinsn();
25 	void init_mayjisn2();
26 	void init_renju();
27 
28 private:
29 	int mux_port;
30 	// uint32_t m_st0016_rom_bank;
31 
32 	required_device<st0016_cpu_device> m_maincpu;
33 	optional_device<cpu_device> m_subcpu;
34 	required_device<screen_device> m_screen;
35 
36 	required_memory_bank m_mainbank;
37 
38 	uint8_t mux_r();
39 	void mux_select_w(uint8_t data);
40 	uint32_t latch32_r(offs_t offset);
41 	void latch32_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
42 	uint8_t latch8_r(offs_t offset);
43 	void latch8_w(offs_t offset, uint8_t data);
44 
45 	void st0016_rom_bank_w(uint8_t data);
46 
47 	virtual void machine_start() override;
48 	DECLARE_VIDEO_START(st0016);
49 	uint32_t screen_update_st0016(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
50 	TIMER_DEVICE_CALLBACK_MEMBER(st0016_int);
51 
52 	void renju_mem(address_map &map);
53 	void st0016_io(address_map &map);
54 	void st0016_m2_io(address_map &map);
55 	void st0016_mem(address_map &map);
56 	void v810_mem(address_map &map);
57 };
58