1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina,David Haywood
3 
4 #include "machine/74259.h"
5 #include "emupal.h"
6 #include "tilemap.h"
7 
8 class freekick_state : public driver_device
9 {
10 public:
freekick_state(const machine_config & mconfig,device_type type,const char * tag)11 	freekick_state(const machine_config &mconfig, device_type type, const char *tag)
12 		: driver_device(mconfig, type, tag),
13 		m_videoram(*this, "videoram"),
14 		m_spriteram(*this, "spriteram"),
15 		m_maincpu(*this, "maincpu"),
16 		m_gfxdecode(*this, "gfxdecode"),
17 		m_palette(*this, "palette"),
18 		m_outlatch(*this, "outlatch"),
19 		m_bank1(*this, "bank1"),
20 		m_bank1d(*this, "bank1d") { }
21 
22 	void base(machine_config &config);
23 	void oigas(machine_config &config);
24 	void pbillrd(machine_config &config);
25 	void pbillrdbl(machine_config &config);
26 	void gigas(machine_config &config);
27 	void gigasm(machine_config &config);
28 	void pbillrdm(machine_config &config);
29 	void omega(machine_config &config);
30 	void freekick(machine_config &config);
31 
32 	void init_gigas();
33 	void init_gigasb();
34 	void init_pbillrdbl();
35 	void init_pbillrds();
36 
37 private:
38 	/* memory pointers */
39 	required_shared_ptr<uint8_t> m_videoram;
40 	required_shared_ptr<uint8_t> m_spriteram;
41 
42 	/* video-related */
43 	tilemap_t    *m_freek_tilemap;
44 
45 	/* misc */
46 	int        m_inval;
47 	int        m_outval;
48 	int        m_cnt;   // used by oigas
49 	int        m_romaddr;
50 	int        m_spinner;
51 	int        m_nmi_en;
52 	int        m_ff_data;
53 	DECLARE_WRITE_LINE_MEMBER(flipscreen_x_w);
54 	DECLARE_WRITE_LINE_MEMBER(flipscreen_y_w);
55 	DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
56 	DECLARE_WRITE_LINE_MEMBER(coin1_w);
57 	DECLARE_WRITE_LINE_MEMBER(coin2_w);
58 	DECLARE_WRITE_LINE_MEMBER(spinner_select_w);
59 	void gigas_spinner_select_w(uint8_t data);
60 	uint8_t spinner_r();
61 	void pbillrd_bankswitch_w(uint8_t data);
62 	DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
63 	void oigas_5_w(uint8_t data);
64 	uint8_t oigas_3_r();
65 	uint8_t oigas_2_r();
66 	uint8_t freekick_ff_r();
67 	void freekick_ff_w(uint8_t data);
68 	void freek_videoram_w(offs_t offset, uint8_t data);
69 	void snd_rom_addr_l_w(uint8_t data);
70 	void snd_rom_addr_h_w(uint8_t data);
71 	uint8_t snd_rom_r();
72 	TILE_GET_INFO_MEMBER(get_freek_tile_info);
73 	virtual void video_start() override;
74 	DECLARE_MACHINE_START(pbillrd);
75 	DECLARE_MACHINE_RESET(freekick);
76 	DECLARE_MACHINE_START(freekick);
77 	DECLARE_MACHINE_START(oigas);
78 	DECLARE_MACHINE_RESET(oigas);
79 	uint32_t screen_update_pbillrd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
80 	uint32_t screen_update_freekick(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
81 	uint32_t screen_update_gigas(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
82 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
83 	void gigas_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
84 	void pbillrd_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
85 	void freekick_draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
86 	required_device<cpu_device> m_maincpu;
87 	required_device<gfxdecode_device> m_gfxdecode;
88 	required_device<palette_device> m_palette;
89 	required_device<ls259_device> m_outlatch;
90 	optional_memory_bank m_bank1, m_bank1d;
91 	void decrypted_opcodes_map(address_map &map);
92 	void freekick_io_map(address_map &map);
93 	void freekick_map(address_map &map);
94 	void gigas_io_map(address_map &map);
95 	void gigas_map(address_map &map);
96 	void oigas_io_map(address_map &map);
97 	void omega_io_map(address_map &map);
98 	void omega_map(address_map &map);
99 	void pbillrd_map(address_map &map);
100 	void pbillrdbl_map(address_map &map);
101 };
102