1 // license:BSD-3-Clause
2 // copyright-holders:Mirko Buffoni
3 /*************************************************************************
4 
5     Bomb Jack
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_BOMBJACK_H
9 #define MAME_INCLUDES_BOMBJACK_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 class bombjack_state : public driver_device
18 {
19 public:
bombjack_state(const machine_config & mconfig,device_type type,const char * tag)20 	bombjack_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_videoram(*this, "videoram"),
23 		m_colorram(*this, "colorram"),
24 		m_spriteram(*this, "spriteram"),
25 		m_maincpu(*this, "maincpu"),
26 		m_gfxdecode(*this, "gfxdecode"),
27 		m_palette(*this, "palette"),
28 		m_soundlatch(*this, "soundlatch")
29 	{ }
30 
31 	void bombjack(machine_config &config);
32 
33 protected:
34 	virtual void machine_start() override;
35 	virtual void machine_reset() override;
36 	virtual void video_start() override;
37 
38 private:
39 	uint8_t soundlatch_read_and_clear();
40 	void irq_mask_w(uint8_t data);
41 	void bombjack_videoram_w(offs_t offset, uint8_t data);
42 	void bombjack_colorram_w(offs_t offset, uint8_t data);
43 	void bombjack_background_w(uint8_t data);
44 	void bombjack_flipscreen_w(uint8_t data);
45 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
46 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
47 	uint32_t screen_update_bombjack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
48 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
49 	TIMER_CALLBACK_MEMBER(soundlatch_callback);
50 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
51 
52 	void audio_io_map(address_map &map);
53 	void audio_map(address_map &map);
54 	void main_map(address_map &map);
55 
56 	/* memory pointers */
57 	required_shared_ptr<uint8_t> m_videoram;
58 	required_shared_ptr<uint8_t> m_colorram;
59 	required_shared_ptr<uint8_t> m_spriteram;
60 
61 	/* video-related */
62 	tilemap_t   *m_fg_tilemap;
63 	tilemap_t   *m_bg_tilemap;
64 	uint8_t       m_background_image;
65 
66 	bool          m_nmi_mask;
67 
68 	required_device<cpu_device> m_maincpu;
69 	required_device<gfxdecode_device> m_gfxdecode;
70 	required_device<palette_device> m_palette;
71 	required_device<generic_latch_8_device> m_soundlatch;
72 };
73 
74 #endif // MAME_INCLUDES_BOMBJACK_H
75