1 // license:BSD-3-Clause
2 // copyright-holders:Ernesto Corvi
3 /***************************************************************************
4 
5     Jailbreak
6 
7 ***************************************************************************/
8 #ifndef MAME_INCLUDES_JAILBREK_H
9 #define MAME_INCLUDES_JAILBREK_H
10 
11 #pragma once
12 
13 #include "sound/vlm5030.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 #define MASTER_CLOCK        XTAL(18'432'000)
18 #define VOICE_CLOCK         XTAL(3'579'545)
19 
20 class jailbrek_state : public driver_device
21 {
22 public:
jailbrek_state(const machine_config & mconfig,device_type type,const char * tag)23 	jailbrek_state(const machine_config &mconfig, device_type type, const char *tag) :
24 		driver_device(mconfig, type, tag),
25 		m_colorram(*this, "colorram"),
26 		m_videoram(*this, "videoram"),
27 		m_spriteram(*this, "spriteram"),
28 		m_scroll_x(*this, "scroll_x"),
29 		m_scroll_dir(*this, "scroll_dir"),
30 		m_maincpu(*this, "maincpu"),
31 		m_vlm(*this, "vlm"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_palette(*this, "palette")
34 	{ }
35 
36 	void jailbrek(machine_config &config);
37 
38 private:
39 	/* memory pointers */
40 	required_shared_ptr<uint8_t> m_colorram;
41 	required_shared_ptr<uint8_t> m_videoram;
42 	required_shared_ptr<uint8_t> m_spriteram;
43 	required_shared_ptr<uint8_t> m_scroll_x;
44 	required_shared_ptr<uint8_t> m_scroll_dir;
45 
46 	/* devices */
47 	required_device<cpu_device> m_maincpu;
48 	required_device<vlm5030_device> m_vlm;
49 	required_device<gfxdecode_device> m_gfxdecode;
50 	required_device<palette_device> m_palette;
51 
52 	/* video-related */
53 	tilemap_t      *m_bg_tilemap;
54 
55 	/* misc */
56 	uint8_t        m_irq_enable;
57 	uint8_t        m_nmi_enable;
58 	void ctrl_w(uint8_t data);
59 	void coin_w(uint8_t data);
60 	void videoram_w(offs_t offset, uint8_t data);
61 	void colorram_w(offs_t offset, uint8_t data);
62 	uint8_t speech_r();
63 	void speech_w(uint8_t data);
64 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
65 	virtual void machine_start() override;
66 	virtual void machine_reset() override;
67 	virtual void video_start() override;
68 	void jailbrek_palette(palette_device &palette) const;
69 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
70 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
71 	INTERRUPT_GEN_MEMBER(interrupt_nmi);
72 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
73 	void jailbrek_map(address_map &map);
74 	void vlm_map(address_map &map);
75 };
76 
77 #endif // MAME_INCLUDES_JAILBREK_H
78