1 // license:BSD-3-Clause
2 // copyright-holders:Ernesto Corvi
3 /*************************************************************************
4 
5     Knuckle Joe
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_BLOODBRO_H
9 #define MAME_INCLUDES_BLOODBRO_H
10 
11 #pragma once
12 
13 #include "machine/gen_latch.h"
14 #include "sound/ay8910.h"
15 #include "emupal.h"
16 #include "screen.h"
17 #include "tilemap.h"
18 
19 class kncljoe_state : public driver_device
20 {
21 public:
kncljoe_state(const machine_config & mconfig,device_type type,const char * tag)22 	kncljoe_state(const machine_config &mconfig, device_type type, const char *tag) :
23 		driver_device(mconfig, type, tag),
24 		m_videoram(*this, "videoram"),
25 		m_scrollregs(*this, "scrollregs"),
26 		m_spriteram(*this, "spriteram"),
27 		m_maincpu(*this, "maincpu"),
28 		m_soundcpu(*this, "soundcpu"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_screen(*this, "screen"),
31 		m_palette(*this, "palette"),
32 		m_ay8910(*this, "aysnd"),
33 		m_soundlatch(*this, "soundlatch")
34 	{ }
35 
36 	void kncljoe(machine_config &config);
37 
38 private:
39 	/* memory pointers */
40 	required_shared_ptr<uint8_t> m_videoram;
41 	required_shared_ptr<uint8_t> m_scrollregs;
42 	required_shared_ptr<uint8_t> m_spriteram;
43 
44 	/* video-related */
45 	tilemap_t    *m_bg_tilemap;
46 	int        m_tile_bank;
47 	int         m_sprite_bank;
48 	int        m_flipscreen;
49 
50 	/* misc */
51 	uint8_t      m_port1;
52 	uint8_t      m_port2;
53 
54 	/* devices */
55 	required_device<cpu_device> m_maincpu;
56 	required_device<cpu_device> m_soundcpu;
57 	required_device<gfxdecode_device> m_gfxdecode;
58 	required_device<screen_device> m_screen;
59 	required_device<palette_device> m_palette;
60 	required_device<ay8910_device> m_ay8910;
61 	required_device<generic_latch_8_device> m_soundlatch;
62 
63 	void sound_cmd_w(uint8_t data);
64 	void sound_irq_ack_w(uint8_t data);
65 	void kncljoe_videoram_w(offs_t offset, uint8_t data);
66 	void kncljoe_control_w(uint8_t data);
67 	void kncljoe_scroll_w(offs_t offset, uint8_t data);
68 	void m6803_port1_w(uint8_t data);
69 	void m6803_port2_w(uint8_t data);
70 	uint8_t m6803_port1_r();
71 	uint8_t m6803_port2_r();
72 	void unused_w(uint8_t data);
73 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
74 	virtual void machine_start() override;
75 	virtual void machine_reset() override;
76 	virtual void video_start() override;
77 	void kncljoe_palette(palette_device &palette) const;
78 	uint32_t screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79 	INTERRUPT_GEN_MEMBER(sound_nmi);
80 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
81 	void main_map(address_map &map);
82 	void sound_map(address_map &map);
83 };
84 
85 #endif // MAME_INCLUDES_BLOODBRO_H
86