1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail
3 #ifndef MAME_INCLUDES_M90_H
4 #define MAME_INCLUDES_M90_H
5 
6 #pragma once
7 
8 #include "audio/m72.h"
9 #include "cpu/nec/v25.h"
10 #include "emupal.h"
11 #include "screen.h"
12 #include "tilemap.h"
13 
14 class m90_state : public driver_device
15 {
16 public:
m90_state(const machine_config & mconfig,device_type type,const char * tag)17 	m90_state(const machine_config &mconfig, device_type type, const char *tag)
18 		: driver_device(mconfig, type, tag)
19 		, m_video_control_data(*this, "video_control")
20 		, m_video_data(*this, "video_data")
21 		, m_spriteram(*this, "spriteram")
22 		, m_mainbank(*this, "mainbank")
23 		, m_maincpu(*this, "maincpu")
24 		, m_soundcpu(*this, "soundcpu")
25 		, m_audio(*this, "m72")
26 		, m_gfxdecode(*this, "gfxdecode")
27 		, m_palette(*this, "palette")
28 		, m_screen(*this, "screen")
29 	{ }
30 
31 	void m90(machine_config &config);
32 	void bbmanw(machine_config &config);
33 	void hasamu(machine_config &config);
34 	void bombrman(machine_config &config);
35 	void riskchal(machine_config &config);
36 	void bomblord(machine_config &config);
37 	void bbmanwj(machine_config &config);
38 	void dynablsb(machine_config &config);
39 	void matchit2(machine_config &config);
40 	void quizf1(machine_config &config);
41 
42 	void init_bomblord();
43 	void init_quizf1();
44 
45 private:
46 	required_shared_ptr<uint16_t> m_video_control_data;
47 	required_shared_ptr<uint16_t> m_video_data;
48 	optional_shared_ptr<uint16_t> m_spriteram;
49 
50 	optional_memory_bank m_mainbank;
51 
52 	required_device<cpu_device> m_maincpu;
53 	required_device<cpu_device> m_soundcpu;
54 	optional_device<m72_audio_device> m_audio;
55 	required_device<gfxdecode_device> m_gfxdecode;
56 	required_device<palette_device> m_palette;
57 	required_device<screen_device> m_screen;
58 
59 	tilemap_t *m_pf_layer[2][2];
60 	uint8_t m_last_pf[2];
61 	void coincounter_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
62 	void quizf1_bankswitch_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
63 	void m90_video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
64 	void bootleg_video_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
65 	TILE_GET_INFO_MEMBER(get_tile_info);
66 	virtual void machine_start() override;
67 	virtual void video_start() override;
68 	void common_tilemap_init();
69 	DECLARE_VIDEO_START(bomblord);
70 	DECLARE_VIDEO_START(dynablsb);
71 	uint32_t screen_update_m90(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
72 	uint32_t screen_update_bomblord(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
73 	uint32_t screen_update_dynablsb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
74 	INTERRUPT_GEN_MEMBER(fake_nmi);
75 	INTERRUPT_GEN_MEMBER(bomblord_fake_nmi);
76 	DECLARE_WRITE_LINE_MEMBER(dynablsb_vblank_int_w);
77 	DECLARE_WRITE_LINE_MEMBER(bomblord_vblank_int_w);
78 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect);
79 	void bomblord_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect);
80 	void dynablsb_draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect);
81 	void bomblord_main_cpu_map(address_map &map);
82 	void dynablsb_main_cpu_io_map(address_map &map);
83 	void dynablsb_main_cpu_map(address_map &map);
84 	void dynablsb_sound_cpu_io_map(address_map &map);
85 	void m90_main_cpu_io_map(address_map &map);
86 	void m90_main_cpu_map(address_map &map);
87 	void m90_sound_cpu_io_map(address_map &map);
88 	void m90_sound_cpu_map(address_map &map);
89 	void m99_sound_cpu_io_map(address_map &map);
90 	void quizf1_main_cpu_io_map(address_map &map);
91 	void quizf1_main_cpu_map(address_map &map);
92 };
93 
94 #endif // MAME_INCLUDES_M90_H
95