1 // license:BSD-3-Clause
2 // copyright-holders:Brad Oliver,Sal and John Bugliarisi,Paul Priest
3 #ifndef MAME_INCLUDES_NAUGHTYB_H
4 #define MAME_INCLUDES_NAUGHTYB_H
5 
6 #pragma once
7 
8 #include "audio/pleiads.h"
9 #include "emupal.h"
10 #include "screen.h"
11 
12 class naughtyb_state : public driver_device
13 {
14 public:
naughtyb_state(const machine_config & mconfig,device_type type,const char * tag)15 	naughtyb_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_maincpu(*this, "maincpu"),
18 		m_naughtyb_custom(*this, "naughtyb_custom"),
19 		m_popflame_custom(*this, "popflame_custom"),
20 		m_gfxdecode(*this, "gfxdecode"),
21 		m_screen(*this, "screen"),
22 		m_palette(*this, "palette"),
23 		m_videoram(*this, "videoram"),
24 		m_videoram2(*this, "videoram2"),
25 		m_scrollreg(*this, "scrollreg")
26 	{ }
27 
28 	void naughtyb_base(machine_config &config);
29 	void popflame(machine_config &config);
30 	void naughtyb(machine_config &config);
31 
32 	void init_trvmstr();
33 	void init_popflame();
34 
35 	DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
36 
37 protected:
38 	virtual void video_start() override;
39 
40 private:
41 	required_device<cpu_device> m_maincpu;
42 	optional_device<naughtyb_sound_device> m_naughtyb_custom;
43 	optional_device<popflame_sound_device> m_popflame_custom;
44 	required_device<gfxdecode_device> m_gfxdecode;
45 	required_device<screen_device> m_screen;
46 	required_device<palette_device> m_palette;
47 
48 	required_shared_ptr<uint8_t> m_videoram;
49 	required_shared_ptr<uint8_t> m_videoram2;
50 	required_shared_ptr<uint8_t> m_scrollreg;
51 
52 	uint8_t m_popflame_prot_seed;
53 	int m_r_index;
54 	int m_prot_count;
55 	int m_question_offset;
56 	int m_cocktail;
57 	uint8_t m_palreg;
58 	int m_bankreg;
59 	bitmap_ind16 m_tmpbitmap;
60 
61 	uint8_t in0_port_r();
62 	uint8_t dsw0_port_r();
63 	uint8_t popflame_protection_r();
64 	void popflame_protection_w(uint8_t data);
65 	uint8_t trvmstr_questions_r();
66 	void trvmstr_questions_w(offs_t offset, uint8_t data);
67 	void naughtyb_videoreg_w(uint8_t data);
68 	void popflame_videoreg_w(uint8_t data);
69 
70 	void naughtyb_palette(palette_device &palette) const;
71 
72 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
73 
74 	void naughtyb_map(address_map &map);
75 	void popflame_map(address_map &map);
76 };
77 
78 #endif // MAME_INCLUDES_NAUGHTYB_H
79