1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail
3 #ifndef MAME_INCLUDES_LIBERATE_H
4 #define MAME_INCLUDES_LIBERATE_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class liberate_state : public driver_device
13 {
14 public:
liberate_state(const machine_config & mconfig,device_type type,const char * tag)15 	liberate_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_bg_vram(*this, "bg_vram"),
18 		m_colorram(*this, "colorram"),
19 		m_videoram(*this, "videoram"),
20 		m_spriteram(*this, "spriteram"),
21 		m_scratchram(*this, "scratchram"),
22 		m_decrypted_opcodes(*this, "decrypted_opcodes"),
23 		m_maincpu(*this, "maincpu"),
24 		m_audiocpu(*this, "audiocpu"),
25 		m_gfxdecode(*this, "gfxdecode"),
26 		m_palette(*this, "palette"),
27 		m_soundlatch(*this, "soundlatch")
28 	{ }
29 
30 	void liberate_base(machine_config &config);
31 	void liberate(machine_config &config);
32 	void liberatb(machine_config &config);
33 	void boomrang(machine_config &config);
34 	void prosoccr(machine_config &config);
35 	void prosport(machine_config &config);
36 
37 	void init_yellowcb();
38 	void init_liberate();
39 	void init_prosport();
40 
41 private:
42 	optional_shared_ptr<uint8_t> m_bg_vram; /* prosport */
43 	required_shared_ptr<uint8_t> m_colorram;
44 	required_shared_ptr<uint8_t> m_videoram;
45 	required_shared_ptr<uint8_t> m_spriteram;
46 	optional_shared_ptr<uint8_t> m_scratchram;
47 	optional_shared_ptr<uint8_t> m_decrypted_opcodes;
48 
49 	uint8_t *m_fg_gfx;   /* prosoccr */
50 	std::unique_ptr<uint8_t[]> m_charram;   /* prosoccr */
51 	uint8_t m_io_ram[16];
52 
53 	int m_bank;
54 	int m_latch;
55 	uint8_t m_gfx_rom_readback;
56 	int m_background_color;
57 	int m_background_disable;
58 
59 	tilemap_t *m_back_tilemap;
60 	tilemap_t *m_fix_tilemap;
61 
62 	required_device<cpu_device> m_maincpu;
63 	required_device<cpu_device> m_audiocpu;
64 	required_device<gfxdecode_device> m_gfxdecode;
65 	required_device<palette_device> m_palette;
66 	required_device<generic_latch_8_device> m_soundlatch;
67 
68 	uint8_t deco16_bank_r(offs_t offset);
69 	uint8_t deco16_io_r(offs_t offset);
70 	void deco16_bank_w(uint8_t data);
71 	uint8_t prosoccr_bank_r(offs_t offset);
72 	uint8_t prosoccr_charram_r(offs_t offset);
73 	void prosoccr_charram_w(offs_t offset, uint8_t data);
74 	void prosoccr_char_bank_w(uint8_t data);
75 	void prosoccr_io_bank_w(uint8_t data);
76 	uint8_t prosport_charram_r(offs_t offset);
77 	void prosport_charram_w(offs_t offset, uint8_t data);
78 	void deco16_io_w(offs_t offset, uint8_t data);
79 	void prosoccr_io_w(offs_t offset, uint8_t data);
80 	void prosport_io_w(offs_t offset, uint8_t data);
81 	void liberate_videoram_w(offs_t offset, uint8_t data);
82 	void liberate_colorram_w(offs_t offset, uint8_t data);
83 	void prosport_bg_vram_w(offs_t offset, uint8_t data);
84 	TILEMAP_MAPPER_MEMBER(back_scan);
85 	TILEMAP_MAPPER_MEMBER(fix_scan);
86 	TILE_GET_INFO_MEMBER(get_back_tile_info);
87 	TILE_GET_INFO_MEMBER(get_fix_tile_info);
88 	TILE_GET_INFO_MEMBER(prosport_get_back_tile_info);
89 	DECLARE_MACHINE_START(liberate);
90 	DECLARE_MACHINE_RESET(liberate);
91 	DECLARE_VIDEO_START(liberate);
92 	void liberate_palette(palette_device &palette) const;
93 	DECLARE_VIDEO_START(prosport);
94 	DECLARE_VIDEO_START(boomrang);
95 	DECLARE_VIDEO_START(prosoccr);
96 	uint32_t screen_update_liberate(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
97 	uint32_t screen_update_prosport(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
98 	uint32_t screen_update_boomrang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
99 	uint32_t screen_update_prosoccr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
100 	DECLARE_WRITE_LINE_MEMBER(deco16_interrupt);
101 	void liberate_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
102 	void prosport_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
103 	void boomrang_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int pri );
104 	void prosoccr_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
105 	void deco16_io_map(address_map &map);
106 	void decrypted_opcodes_map(address_map &map);
107 	void liberatb_map(address_map &map);
108 	void liberate_map(address_map &map);
109 	void liberate_sound_map(address_map &map);
110 	void prosoccr_io_map(address_map &map);
111 	void prosoccr_map(address_map &map);
112 	void prosoccr_sound_map(address_map &map);
113 	void prosport_map(address_map &map);
114 };
115 
116 #endif // MAME_INCLUDES_LIBERATE_H
117