1 // license:BSD-3-Clause
2 // copyright-holders:Curt Coder
3 // thanks-to:Kenneth Lin (original driver author)
4 #ifndef MAME_INCLUDES_JACKAL_H
5 #define MAME_INCLUDES_JACKAL_H
6 
7 #pragma once
8 
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 #define MASTER_CLOCK         XTAL(18'432'000)
13 #define SOUND_CLOCK          XTAL(3'579'545)
14 
15 
16 
17 class jackal_state : public driver_device
18 {
19 public:
jackal_state(const machine_config & mconfig,device_type type,const char * tag)20 	jackal_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_videoctrl(*this, "videoctrl"),
23 		m_dials(*this, "DIAL%u", 0U),
24 		m_mastercpu(*this, "master"),
25 		m_slavecpu(*this, "slave"),
26 		m_gfxdecode(*this, "gfxdecode"),
27 		m_palette(*this, "palette")
28 	{ }
29 
30 	void jackal(machine_config &config);
31 
32 private:
33 	/* memory pointers */
34 	required_shared_ptr<uint8_t> m_videoctrl;
35 	uint8_t *  m_scrollram;
36 
37 	/* video-related */
38 	tilemap_t  *m_bg_tilemap;
39 
40 	/* misc */
41 	int      m_irq_enable;
42 	uint8_t    *m_rambank;
43 	uint8_t    *m_spritebank;
44 	optional_ioport_array<2> m_dials;
45 
46 	/* devices */
47 	required_device<cpu_device> m_mastercpu;
48 	required_device<cpu_device> m_slavecpu;
49 	required_device<gfxdecode_device> m_gfxdecode;
50 	required_device<palette_device> m_palette;
51 
52 	uint8_t jackalr_rotary_r(offs_t offset);
53 	void jackal_flipscreen_w(uint8_t data);
54 	uint8_t jackal_zram_r(offs_t offset);
55 	uint8_t jackal_voram_r(offs_t offset);
56 	uint8_t jackal_spriteram_r(offs_t offset);
57 	void jackal_rambank_w(uint8_t data);
58 	void jackal_zram_w(offs_t offset, uint8_t data);
59 	void jackal_voram_w(offs_t offset, uint8_t data);
60 	void jackal_spriteram_w(offs_t offset, uint8_t data);
61 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
62 	virtual void machine_start() override;
63 	virtual void machine_reset() override;
64 	virtual void video_start() override;
65 	void jackal_palette(palette_device &palette) const;
66 	uint32_t screen_update_jackal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
67 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
68 	void jackal_mark_tile_dirty( int offset );
69 	void draw_background( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect );
70 	void draw_sprites_region( bitmap_ind16 &bitmap, const rectangle &cliprect, const uint8_t *sram, int length, int bank );
71 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
72 	void master_map(address_map &map);
73 	void slave_map(address_map &map);
74 };
75 
76 #endif // MAME_INCLUDES_JACKAL_H
77