1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 /*************************************************************************
4 
5     Hana Yayoi & other Dynax games (using 1st version of their blitter)
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_HNAYAYOI_H
9 #define MAME_INCLUDES_HNAYAYOI_H
10 
11 #pragma once
12 
13 #include "machine/74259.h"
14 #include "sound/msm5205.h"
15 #include "video/mc6845.h"
16 #include "emupal.h"
17 
18 class hnayayoi_state : public driver_device
19 {
20 public:
hnayayoi_state(const machine_config & mconfig,device_type type,const char * tag)21 	hnayayoi_state(const machine_config &mconfig, device_type type, const char *tag) :
22 		driver_device(mconfig, type, tag),
23 		m_maincpu(*this, "maincpu"),
24 		m_mainlatch(*this, "mainlatch"),
25 		m_msm(*this, "msm"),
26 		m_palette(*this, "palette")
27 	{ }
28 
29 	void untoucha(machine_config &config);
30 	void hnayayoi(machine_config &config);
31 	void hnfubuki(machine_config &config);
32 
33 	void init_hnfubuki();
34 
35 private:
36 	/* video-related */
37 	std::unique_ptr<uint8_t[]> m_pixmap[8];
38 	int        m_palbank;
39 	uint8_t      m_blit_layer;
40 	uint16_t     m_blit_dest;
41 	uint32_t     m_blit_src;
42 
43 	/* misc */
44 	int        m_keyb;
45 	bool m_nmi_enable;
46 
47 	uint8_t keyboard_0_r();
48 	uint8_t keyboard_1_r();
49 	void keyboard_w(uint8_t data);
50 	void dynax_blitter_rev1_param_w(offs_t offset, uint8_t data);
51 	void dynax_blitter_rev1_start_w(uint8_t data);
52 	void dynax_blitter_rev1_clear_w(uint8_t data);
53 	void hnayayoi_palbank_w(offs_t offset, uint8_t data);
54 	void adpcm_data_w(uint8_t data);
55 	DECLARE_WRITE_LINE_MEMBER(coin_counter_w);
56 	DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
57 	DECLARE_WRITE_LINE_MEMBER(nmi_clock_w);
58 	virtual void machine_start() override;
59 	virtual void machine_reset() override;
60 	virtual void video_start() override;
61 	DECLARE_VIDEO_START(untoucha);
62 	MC6845_UPDATE_ROW(hnayayoi_update_row);
63 	MC6845_UPDATE_ROW(untoucha_update_row);
64 	void common_vh_start( int num_pixmaps );
65 	void copy_pixel( int x, int y, int pen );
66 	void draw_layer_interleaved(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint16_t row, uint16_t y, uint8_t x_count, int left_pixmap, int right_pixmap, int palbase, bool transp);
67 	DECLARE_WRITE_LINE_MEMBER(irqhandler);
68 	required_device<cpu_device> m_maincpu;
69 	required_device<ls259_device> m_mainlatch;
70 	required_device<msm5205_device> m_msm;
71 	required_device<palette_device> m_palette;
72 	void hnayayoi_io_map(address_map &map);
73 	void hnayayoi_map(address_map &map);
74 	void hnfubuki_map(address_map &map);
75 	void untoucha_io_map(address_map &map);
76 	void untoucha_map(address_map &map);
77 };
78 
79 #endif // MAME_INCLUDES_HNAYAYOI_H
80