1 // license:GPL-2.0+
2 // copyright-holders:Juergen Buchmueller
3 /*************************************************************************
4 
5     Meadows S2650 hardware
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_MEADOWS_H
9 #define MAME_INCLUDES_MEADOWS_H
10 
11 #pragma once
12 
13 #include "cpu/s2650/s2650.h"
14 #include "sound/dac.h"
15 #include "sound/samples.h"
16 #include "emupal.h"
17 #include "screen.h"
18 #include "tilemap.h"
19 
20 class meadows_state : public driver_device
21 {
22 public:
meadows_state(const machine_config & mconfig,device_type type,const char * tag)23 	meadows_state(const machine_config &mconfig, device_type type, const char *tag)
24 		: driver_device(mconfig, type, tag),
25 		m_maincpu(*this, "maincpu"),
26 		m_audiocpu(*this, "audiocpu"),
27 		m_dac(*this, "dac"),
28 		m_samples(*this, "samples"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_screen(*this, "screen"),
31 		m_palette(*this, "palette"),
32 		m_spriteram(*this, "spriteram"),
33 		m_videoram(*this, "videoram")
34 	{
35 	}
36 
37 	void bowl3d(machine_config &config);
38 	void meadows(machine_config &config);
39 	void minferno(machine_config &config);
40 
41 	void init_minferno();
42 	void init_gypsyjug();
43 
44 	DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
45 
46 private:
47 	required_device<s2650_device> m_maincpu;
48 	optional_device<s2650_device> m_audiocpu;
49 	optional_device<dac_8bit_r2r_device> m_dac;
50 	optional_device<samples_device> m_samples;
51 	required_device<gfxdecode_device> m_gfxdecode;
52 	required_device<screen_device> m_screen;
53 	required_device<palette_device> m_palette;
54 
55 	optional_shared_ptr<uint8_t> m_spriteram;
56 	required_shared_ptr<uint8_t> m_videoram;
57 
58 	int m_channel;
59 	int m_freq1;
60 	int m_freq2;
61 	uint8_t m_latched_0c01;
62 	uint8_t m_latched_0c02;
63 	uint8_t m_latched_0c03;
64 	uint8_t m_main_sense_state;
65 	uint8_t m_audio_sense_state;
66 	uint8_t m_0c00;
67 	uint8_t m_0c01;
68 	uint8_t m_0c02;
69 	uint8_t m_0c03;
70 	tilemap_t *m_bg_tilemap;
71 	uint8_t hsync_chain_r();
72 	uint8_t vsync_chain_hi_r();
73 	uint8_t vsync_chain_lo_r();
74 	void meadows_audio_w(offs_t offset, uint8_t data);
75 	void audio_hardware_w(offs_t offset, uint8_t data);
76 	uint8_t audio_hardware_r(offs_t offset);
77 	void meadows_videoram_w(offs_t offset, uint8_t data);
78 	void meadows_spriteram_w(offs_t offset, uint8_t data);
79 	TILE_GET_INFO_MEMBER(get_tile_info);
80 	virtual void video_start() override;
81 	uint32_t screen_update_meadows(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
82 	DECLARE_WRITE_LINE_MEMBER(meadows_vblank_irq);
83 	DECLARE_WRITE_LINE_MEMBER(minferno_vblank_irq);
84 	INTERRUPT_GEN_MEMBER(audio_interrupt);
85 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip);
86 	void meadows_sh_update();
87 	SAMPLES_START_CB_MEMBER(meadows_sh_start);
88 	void audio_map(address_map &map);
89 	void bowl3d_main_map(address_map &map);
90 	void meadows_main_map(address_map &map);
91 	void minferno_data_map(address_map &map);
92 	void minferno_main_map(address_map &map);
93 };
94 
95 #endif // MAME_INCLUDES_MEADOWS_H
96