1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Bryan McPhail
3 /*************************************************************************
4 
5     Pocket Gal Deluxe
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_PKTGALDX_H
9 #define MAME_INCLUDES_PKTGALDX_H
10 
11 #pragma once
12 
13 #include "sound/okim6295.h"
14 #include "video/decospr.h"
15 #include "video/deco16ic.h"
16 #include "machine/deco104.h"
17 #include "emupal.h"
18 
19 class pktgaldx_state : public driver_device
20 {
21 public:
pktgaldx_state(const machine_config & mconfig,device_type type,const char * tag)22 	pktgaldx_state(const machine_config &mconfig, device_type type, const char *tag) :
23 		driver_device(mconfig, type, tag),
24 		m_deco104(*this, "ioprot104"),
25 		m_pf1_rowscroll(*this, "pf1_rowscroll"),
26 		m_pf2_rowscroll(*this, "pf2_rowscroll"),
27 		m_spriteram(*this, "spriteram"),
28 		m_pktgaldb_fgram(*this, "pktgaldb_fgram"),
29 		m_pktgaldb_sprites(*this, "pktgaldb_spr"),
30 		m_sprgen(*this, "spritegen"),
31 		m_maincpu(*this, "maincpu"),
32 		m_oki2(*this, "oki2"),
33 		m_deco_tilegen(*this, "tilegen"),
34 		m_gfxdecode(*this, "gfxdecode"),
35 		m_palette(*this, "palette"),
36 		m_decrypted_opcodes(*this, "decrypted_opcodes")
37 	{ }
38 
39 	void pktgaldx(machine_config &config);
40 	void pktgaldb(machine_config &config);
41 
42 	void init_pktgaldx();
43 
44 private:
45 	optional_device<deco104_device> m_deco104;
46 
47 	/* memory pointers */
48 	optional_shared_ptr<uint16_t> m_pf1_rowscroll;
49 	optional_shared_ptr<uint16_t> m_pf2_rowscroll;
50 	optional_shared_ptr<uint16_t> m_spriteram;
51 	optional_shared_ptr<uint16_t> m_pktgaldb_fgram;
52 	optional_shared_ptr<uint16_t> m_pktgaldb_sprites;
53 	optional_device<decospr_device> m_sprgen;
54 
55 	/* devices */
56 	required_device<cpu_device> m_maincpu;
57 	required_device<okim6295_device> m_oki2;
58 	optional_device<deco16ic_device> m_deco_tilegen;
59 	required_device<gfxdecode_device> m_gfxdecode;
60 	required_device<palette_device> m_palette;
61 	optional_shared_ptr<uint16_t> m_decrypted_opcodes;
62 
63 	uint16_t pckgaldx_unknown_r();
64 	uint16_t pckgaldx_protection_r();
65 	void pktgaldx_oki_bank_w(uint16_t data);
66 	virtual void machine_start() override;
67 	uint32_t screen_update_pktgaldx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
68 	uint32_t screen_update_pktgaldb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
69 
70 	uint16_t pktgaldx_protection_region_f_104_r(offs_t offset);
71 	void pktgaldx_protection_region_f_104_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
72 	DECLARE_WRITE_LINE_MEMBER( vblank_w );
73 	void vblank_ack_w(uint16_t data);
74 
75 	DECO16IC_BANK_CB_MEMBER(bank_callback);
76 	void decrypted_opcodes_map(address_map &map);
77 	void pktgaldb_map(address_map &map);
78 	void pktgaldx_map(address_map &map);
79 };
80 
81 #endif // MAME_INCLUDES_PKTGALDX_H
82