1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 #ifndef MAME_INCLUDES_SPBACTN_H
4 #define MAME_INCLUDES_SPBACTN_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "video/tecmo_spr.h"
10 #include "video/tecmo_mix.h"
11 #include "emupal.h"
12 #include "screen.h"
13 #include "tilemap.h"
14 
15 class spbactn_state : public driver_device
16 {
17 public:
spbactn_state(const machine_config & mconfig,device_type type,const char * tag)18 	spbactn_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_gfxdecode(*this, "gfxdecode"),
23 		m_screen(*this, "screen"),
24 		m_palette(*this, "palette"),
25 		m_sprgen(*this, "spritegen"),
26 		m_mixer(*this, "mixer"),
27 		m_soundlatch(*this, "soundlatch"),
28 		m_bgvideoram(*this, "bgvideoram"),
29 		m_fgvideoram(*this, "fgvideoram"),
30 		m_spvideoram(*this, "spvideoram"),
31 		m_extraram(*this, "extraram"),
32 		m_extraram2(*this, "extraram2")
33 	{ }
34 
35 	void spbactn(machine_config &config);
36 	void spbactnp(machine_config &config);
37 
38 private:
39 	required_device<cpu_device> m_maincpu;
40 	required_device<cpu_device> m_audiocpu;
41 	required_device<gfxdecode_device> m_gfxdecode;
42 	required_device<screen_device> m_screen;
43 	required_device<palette_device> m_palette;
44 	required_device<tecmo_spr_device> m_sprgen;
45 	required_device<tecmo_mix_device> m_mixer;
46 	required_device<generic_latch_8_device> m_soundlatch;
47 
48 	required_shared_ptr<uint16_t> m_bgvideoram;
49 	required_shared_ptr<uint16_t> m_fgvideoram;
50 	required_shared_ptr<uint16_t> m_spvideoram;
51 	optional_shared_ptr<uint8_t> m_extraram;
52 	optional_shared_ptr<uint8_t> m_extraram2;
53 
54 	tilemap_t    *m_bg_tilemap;
55 	tilemap_t    *m_fg_tilemap;
56 
57 	tilemap_t    *m_extra_tilemap;
58 
59 	void main_irq_ack_w(uint16_t data);
60 
61 	void bg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
62 	void fg_videoram_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
63 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
64 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
65 
66 	void extraram_w(offs_t offset, uint8_t data, uint8_t mem_mask = ~0);
67 	TILE_GET_INFO_MEMBER(get_extra_tile_info);
68 
69 	bitmap_ind16 m_tile_bitmap_bg;
70 	bitmap_ind16 m_tile_bitmap_fg;
71 	bitmap_ind16 m_sprite_bitmap;
72 
73 	void spbatnp_90006_w(uint16_t data);
74 	void spbatnp_9000a_w(uint16_t data);
75 	void spbatnp_9000c_w(uint16_t data);
76 	void spbatnp_9000e_w(uint16_t data);
77 
78 	void spbatnp_90124_w(uint16_t data);
79 	void spbatnp_9012c_w(uint16_t data);
80 
81 	DECLARE_VIDEO_START(spbactn);
82 	DECLARE_VIDEO_START(spbactnp);
83 
84 	//virtual void video_start();
85 	uint32_t screen_update_spbactn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
86 	uint32_t screen_update_spbactnp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
87 	int draw_video(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, bool alt_sprites);
88 
89 	// temp hack
temp_read_handler_r()90 	uint16_t temp_read_handler_r()
91 	{
92 		return 0xffff;
93 	}
94 
95 	void spbactn_map(address_map &map);
96 	void spbactn_sound_map(address_map &map);
97 	void spbactnp_extra_map(address_map &map);
98 	void spbactnp_map(address_map &map);
99 };
100 
101 #endif // MAME_INCLUDES_SPBACTN_H
102