1 // license:BSD-3-Clause
2 // copyright-holders:Mike Coates
3 /*************************************************************************
4 
5     Rainbow Islands
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_RBISLAND_H
9 #define MAME_INCLUDES_RBISLAND_H
10 
11 #pragma once
12 
13 
14 #include "machine/taitocchip.h"
15 
16 #include "video/pc080sn.h"
17 #include "video/pc090oj.h"
18 #include "machine/timer.h"
19 #include "emupal.h"
20 
21 class rbisland_state : public driver_device
22 {
23 public:
rbisland_state(const machine_config & mconfig,device_type type,const char * tag)24 	rbisland_state(const machine_config &mconfig, device_type type, const char *tag) :
25 		driver_device(mconfig, type, tag),
26 		m_spriteram(*this, "spriteram"),
27 		m_maincpu(*this, "maincpu"),
28 		m_audiocpu(*this, "audiocpu"),
29 		m_cchip(*this, "cchip"),
30 		m_pc080sn(*this, "pc080sn"),
31 		m_pc090oj(*this, "pc090oj"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_palette(*this, "palette"),
34 		m_cchip_irq_clear(*this, "cchip_irq_clear")
35 	{ }
36 
37 	void jumping(machine_config &config);
38 	void rbisland(machine_config &config);
39 	void jumpingi(machine_config &config);
40 
41 	void init_jumping();
42 	void init_rbisland();
43 
44 protected:
45 	virtual void machine_start() override;
46 
47 private:
48 	void jumping_sound_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
49 	uint8_t jumping_latch_r();
50 	void jumping_spritectrl_w(offs_t offset, uint16_t data);
51 	void bankswitch_w(uint8_t data);
52 	void counters_w(uint8_t data);
53 	DECLARE_VIDEO_START(jumping);
54 	void rbisland_colpri_cb(u32 &sprite_colbank, u32 &pri_mask, u16 sprite_ctrl);
55 	uint32_t screen_update_rainbow(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
56 	uint32_t screen_update_jumping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
57 	TIMER_CALLBACK_MEMBER(cchip_timer);
58 	INTERRUPT_GEN_MEMBER(interrupt);
59 	TIMER_DEVICE_CALLBACK_MEMBER(cchip_irq_clear_cb);
60 
61 	void jumping_map(address_map &map);
62 	void jumping_sound_map(address_map &map);
63 	void rbisland_map(address_map &map);
64 	void rbisland_sound_map(address_map &map);
65 
66 	/* memory pointers */
67 	optional_shared_ptr<uint16_t> m_spriteram;
68 
69 	/* video-related */
70 	uint16_t      m_sprite_ctrl;
71 	uint16_t      m_sprites_flipscreen;
72 
73 	/* misc */
74 	uint8_t       m_jumping_latch;
75 
76 	/* devices */
77 	required_device<cpu_device> m_maincpu;
78 	required_device<cpu_device> m_audiocpu;
79 	optional_device<taito_cchip_device> m_cchip;
80 	required_device<pc080sn_device> m_pc080sn;
81 	optional_device<pc090oj_device> m_pc090oj;
82 	required_device<gfxdecode_device> m_gfxdecode;
83 	required_device<palette_device> m_palette;
84 	optional_device<timer_device> m_cchip_irq_clear;
85 };
86 
87 #endif // MAME_INCLUDES_RBISLAND_H
88