1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 #ifndef MAME_INCLUDES_FLSTORY_H
4 #define MAME_INCLUDES_FLSTORY_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "machine/input_merger.h"
10 #include "sound/msm5232.h"
11 #include "machine/taito68705interface.h"
12 #include "sound/ta7630.h"
13 #include "sound/ay8910.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 class flstory_state : public driver_device
18 {
19 public:
flstory_state(const machine_config & mconfig,device_type type,const char * tag)20 	flstory_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_videoram(*this, "videoram"),
23 		m_spriteram(*this, "spriteram"),
24 		m_scrlram(*this, "scrlram"),
25 		m_workram(*this, "workram"),
26 		m_maincpu(*this, "maincpu"),
27 		m_audiocpu(*this, "audiocpu"),
28 		m_bmcu(*this, "bmcu"),
29 		m_msm(*this, "msm"),
30 		m_ay(*this, "aysnd"),
31 		m_ta7630(*this, "ta7630"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_palette(*this, "palette"),
34 		m_soundlatch(*this, "soundlatch"),
35 		m_soundlatch2(*this, "soundlatch2"),
36 		m_soundnmi(*this, "soundnmi"),
37 		m_extraio1(*this, "EXTRA_P1")
38 	{ }
39 
40 	void common(machine_config &config);
41 	void flstory(machine_config &config);
42 	void rumba(machine_config &config);
43 	void onna34ro(machine_config &config);
44 	void victnine(machine_config &config);
45 	void onna34ro_mcu(machine_config &config);
46 
47 protected:
48 	virtual void machine_start() override;
49 
50 private:
51 	/* memory pointers */
52 	required_shared_ptr<uint8_t> m_videoram;
53 	required_shared_ptr<uint8_t> m_spriteram;
54 	required_shared_ptr<uint8_t> m_scrlram;
55 	optional_shared_ptr<uint8_t> m_workram;
56 
57 	/* video-related */
58 	tilemap_t  *m_bg_tilemap;
59 	std::vector<uint8_t> m_paletteram;
60 	std::vector<uint8_t> m_paletteram_ext;
61 	uint8_t    m_gfxctrl;
62 	uint8_t    m_char_bank;
63 	uint8_t    m_palette_bank;
64 
65 	/* sound-related */
66 	uint8_t    m_snd_ctrl0;
67 	uint8_t    m_snd_ctrl1;
68 	uint8_t    m_snd_ctrl2;
69 	uint8_t    m_snd_ctrl3;
70 
71 	/* protection sims */
72 	uint8_t m_from_mcu;
73 	int      m_mcu_select;
74 
75 	/* devices */
76 	required_device<cpu_device> m_maincpu;
77 	required_device<cpu_device> m_audiocpu;
78 	optional_device<taito68705_mcu_device> m_bmcu;
79 	required_device<msm5232_device> m_msm;
80 	required_device<ay8910_device> m_ay;
81 	required_device<ta7630_device> m_ta7630;
82 	required_device<gfxdecode_device> m_gfxdecode;
83 	required_device<palette_device> m_palette;
84 	required_device<generic_latch_8_device> m_soundlatch;
85 	required_device<generic_latch_8_device> m_soundlatch2;
86 	required_device<input_merger_device> m_soundnmi;
87 	optional_ioport m_extraio1;
88 
89 	uint8_t snd_flag_r();
90 	void snd_reset_w(uint8_t data);
91 	uint8_t flstory_mcu_status_r();
92 	uint8_t victnine_mcu_status_r();
93 	void flstory_videoram_w(offs_t offset, uint8_t data);
94 	void flstory_palette_w(offs_t offset, uint8_t data);
95 	uint8_t flstory_palette_r(offs_t offset);
96 	void flstory_gfxctrl_w(uint8_t data);
97 	uint8_t victnine_gfxctrl_r();
98 	void victnine_gfxctrl_w(uint8_t data);
99 	void flstory_scrlram_w(offs_t offset, uint8_t data);
100 	void sound_control_0_w(uint8_t data);
101 	void sound_control_1_w(uint8_t data);
102 	void sound_control_2_w(uint8_t data);
103 	void sound_control_3_w(uint8_t data);
104 	TILE_GET_INFO_MEMBER(get_tile_info);
105 	TILE_GET_INFO_MEMBER(victnine_get_tile_info);
106 	TILE_GET_INFO_MEMBER(get_rumba_tile_info);
107 	DECLARE_MACHINE_RESET(flstory);
108 	DECLARE_VIDEO_START(flstory);
109 	DECLARE_VIDEO_START(victnine);
110 	DECLARE_MACHINE_RESET(rumba);
111 	DECLARE_VIDEO_START(rumba);
112 	DECLARE_MACHINE_RESET(ta7630);
113 	uint32_t screen_update_flstory(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
114 	uint32_t screen_update_victnine(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
115 	uint32_t screen_update_rumba(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
116 	void flstory_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
117 	void victnine_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
118 	void base_map(address_map &map);
119 	void flstory_map(address_map &map);
120 	void onna34ro_map(address_map &map);
121 	void onna34ro_mcu_map(address_map &map);
122 	void rumba_map(address_map &map);
123 	void sound_map(address_map &map);
124 	void victnine_map(address_map &map);
125 };
126 
127 #endif // MAME_INCLUDES_FLSTORY_H
128