1 // license:BSD-3-Clause
2 // copyright-holders:Aaron Giles
3 #ifndef MAME_INCLUDES_RPUNCH_H
4 #define MAME_INCLUDES_RPUNCH_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "sound/upd7759.h"
10 #include "video/vsystem_gga.h"
11 #include "emupal.h"
12 #include "screen.h"
13 #include "tilemap.h"
14 
15 class rpunch_state : public driver_device
16 {
17 public:
rpunch_state(const machine_config & mconfig,device_type type,const char * tag)18 	rpunch_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_maincpu(*this, "maincpu"),
21 		m_audiocpu(*this, "audiocpu"),
22 		m_soundlatch(*this, "soundlatch"),
23 		m_upd7759(*this, "upd"),
24 		m_gfxdecode(*this, "gfxdecode"),
25 		m_screen(*this, "screen"),
26 		m_palette(*this, "palette"),
27 		m_gga(*this, "gga"),
28 		m_videoram(*this, "videoram"),
29 		m_spriteram(*this, "spriteram")
30 	{ }
31 
32 	void svolley(machine_config &config);
33 	void rpunch(machine_config &config);
34 	void svolleybl(machine_config &config);
35 
36 	void init_rabiolep();
37 	void init_svolley();
38 
39 	DECLARE_CUSTOM_INPUT_MEMBER(hi_bits_r);
40 
41 protected:
42 	virtual void machine_start() override;
43 	virtual void machine_reset() override;
44 
45 private:
46 	required_device<cpu_device> m_maincpu;
47 	required_device<cpu_device> m_audiocpu;
48 	required_device<generic_latch_8_device> m_soundlatch;
49 	optional_device<upd7759_device> m_upd7759;
50 	required_device<gfxdecode_device> m_gfxdecode;
51 	required_device<screen_device> m_screen;
52 	required_device<palette_device> m_palette;
53 	required_device<vsystem_gga_device> m_gga;
54 
55 	required_shared_ptr<u16> m_videoram;
56 	required_shared_ptr<u16> m_spriteram;
57 
58 	u8 m_upd_rom_bank;
59 	int m_sprite_palette;
60 	int m_sprite_xoffs;
61 	u16 m_videoflags;
62 	u8 m_sprite_pri;
63 	u8 m_sprite_num;
64 	tilemap_t *m_background[2];
65 	std::unique_ptr<bitmap_ind16> m_pixmap;
66 	emu_timer *m_crtc_timer;
67 
68 	u16 sound_busy_r();
69 	u8 pixmap_r(offs_t offset);
70 	void pixmap_w(offs_t offset, u8 data);
71 	void videoram_w(offs_t offset, u16 data, u16 mem_mask = ~0);
72 	void videoreg_w(offs_t offset, u16 data, u16 mem_mask = ~0);
73 	void scrollreg_w(offs_t offset, u16 data, u16 mem_mask = ~0);
74 	void gga_w(offs_t offset, u8 data);
75 	void gga_data_w(offs_t offset, u8 data);
76 	void sprite_ctrl_w(offs_t offset, u8 data);
77 	void upd_control_w(u8 data);
78 	void upd_data_w(u8 data);
79 	TILE_GET_INFO_MEMBER(get_bg0_tile_info);
80 	TILE_GET_INFO_MEMBER(get_bg1_tile_info);
81 
82 	DECLARE_VIDEO_START(rpunch);
83 	DECLARE_VIDEO_START(svolley);
84 
85 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
86 	TIMER_CALLBACK_MEMBER(crtc_interrupt_gen);
87 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
88 	void draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
89 	void sound_map(address_map &map);
90 	void rpunch_map(address_map &map);
91 	void svolley_map(address_map &map);
92 	void svolleybl_main_map(address_map &map);
93 	void svolleybl_sound_map(address_map &map);
94 };
95 
96 #endif // MAME_INCLUDES_RPUNCH_H
97