1 // license:BSD-3-Clause
2 // copyright-holders:Howie Cohen, Frank Palazzolo, Alex Pasadyn, David Haywood, Phil Stroffolino, Uki
3 #ifndef MAME_INCLUDES_NOVA2001_H
4 #define MAME_INCLUDES_NOVA2001_H
5 
6 #pragma once
7 
8 #include "cpu/z80/z80.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class nova2001_state : public driver_device
13 {
14 public:
nova2001_state(const machine_config & mconfig,device_type type,const char * tag)15 	nova2001_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_maincpu(*this, "maincpu"),
18 		m_gfxdecode(*this, "gfxdecode"),
19 		m_palette(*this, "palette"),
20 		m_fg_videoram(*this, "fg_videoram"),
21 		m_bg_videoram(*this, "bg_videoram"),
22 		m_spriteram(*this, "spriteram")
23 	{ }
24 
25 	void raiders5(machine_config &config);
26 	void ninjakun(machine_config &config);
27 	void nova2001(machine_config &config);
28 	void pkunwar(machine_config &config);
29 
30 	void init_raiders5();
31 	void init_pkunwar();
32 
33 	DECLARE_CUSTOM_INPUT_MEMBER(ninjakun_io_A002_ctrl_r);
34 
35 private:
36 	required_device<z80_device> m_maincpu;
37 	required_device<gfxdecode_device> m_gfxdecode;
38 	required_device<palette_device> m_palette;
39 
40 	optional_shared_ptr<u8> m_fg_videoram;
41 	required_shared_ptr<u8> m_bg_videoram;
42 	optional_shared_ptr<u8> m_spriteram;
43 
44 	u8 m_ninjakun_io_a002_ctrl;
45 	tilemap_t *m_bg_tilemap;
46 	tilemap_t *m_fg_tilemap;
47 
48 	void ninjakun_cpu1_io_A002_w(u8 data);
49 	void ninjakun_cpu2_io_A002_w(u8 data);
50 	void paletteram_w(offs_t offset, u8 data);
51 	void fg_videoram_w(offs_t offset, u8 data);
52 	void nova2001_bg_videoram_w(offs_t offset, u8 data);
53 	void ninjakun_bg_videoram_w(offs_t offset, u8 data);
54 	u8 ninjakun_bg_videoram_r(offs_t offset);
55 	void scroll_x_w(u8 data);
56 	void scroll_y_w(u8 data);
57 	void nova2001_flipscreen_w(u8 data);
58 	void pkunwar_flipscreen_w(u8 data);
59 
60 	DECLARE_VIDEO_START(nova2001);
61 	void nova2001_palette(palette_device &palette) const;
62 	static rgb_t BBGGRRII(u32 raw);
63 	DECLARE_MACHINE_START(ninjakun);
64 	DECLARE_VIDEO_START(ninjakun);
65 	DECLARE_VIDEO_START(pkunwar);
66 	DECLARE_VIDEO_START(raiders5);
67 
68 	TILE_GET_INFO_MEMBER(nova2001_get_bg_tile_info);
69 	TILE_GET_INFO_MEMBER(nova2001_get_fg_tile_info);
70 	TILE_GET_INFO_MEMBER(ninjakun_get_bg_tile_info);
71 	TILE_GET_INFO_MEMBER(ninjakun_get_fg_tile_info);
72 	TILE_GET_INFO_MEMBER(pkunwar_get_bg_tile_info);
73 	TILE_GET_INFO_MEMBER(raiders5_get_bg_tile_info);
74 	TILE_GET_INFO_MEMBER(raiders5_get_fg_tile_info);
75 
76 	u32 screen_update_nova2001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
77 	u32 screen_update_ninjakun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
78 	u32 screen_update_pkunwar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79 	u32 screen_update_raiders5(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
80 	void nova2001_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
81 	void pkunwar_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
82 	void lineswap_gfx_roms(const char *region, const int bit);
83 	void ninjakun_cpu1_map(address_map &map);
84 	void ninjakun_cpu2_map(address_map &map);
85 	void ninjakun_shared_map(address_map &map);
86 	void nova2001_map(address_map &map);
87 	void pkunwar_io(address_map &map);
88 	void pkunwar_map(address_map &map);
89 	void raiders5_cpu1_map(address_map &map);
90 	void raiders5_cpu2_map(address_map &map);
91 	void raiders5_io(address_map &map);
92 };
93 
94 #endif // MAME_INCLUDES_NOVA2001_H
95