1 // license:BSD-3-Clause
2 // copyright-holders:Richard Davies
3 #ifndef MAME_INCLUDES_PHOENIX_H
4 #define MAME_INCLUDES_PHOENIX_H
5 
6 #pragma once
7 
8 #include "audio/pleiads.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class phoenix_state : public driver_device
13 {
14 public:
phoenix_state(const machine_config & mconfig,device_type type,const char * tag)15 	phoenix_state(const machine_config &mconfig, device_type type, const char *tag)
16 		: driver_device(mconfig, type, tag)
17 		, m_maincpu(*this, "maincpu")
18 		, m_pleiads_custom(*this, "pleiads_custom")
19 		, m_gfxdecode(*this, "gfxdecode")
20 		, m_palette(*this, "palette")
21 		, m_fg_tilemap(nullptr)
22 		, m_bg_tilemap(nullptr)
23 	{
24 	}
25 
26 	void phoenix_videoram_w(offs_t offset, uint8_t data);
27 	void phoenix_videoreg_w(uint8_t data);
28 	void pleiads_videoreg_w(uint8_t data);
29 	void phoenix_scroll_w(uint8_t data);
30 	uint8_t survival_input_port_0_r();
31 	DECLARE_CUSTOM_INPUT_MEMBER(player_input_r);
32 	DECLARE_READ_LINE_MEMBER(pleiads_protection_r);
33 	void init_oneprom();
34 	void init_coindsw();
35 	void init_oneprom_coindsw();
36 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
37 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
38 	DECLARE_MACHINE_RESET(phoenix);
39 	DECLARE_VIDEO_START(phoenix);
40 	void phoenix_palette(palette_device &palette) const;
41 	void survival_palette(palette_device &palette) const;
42 	void pleiads_palette(palette_device &palette) const;
43 	uint32_t screen_update_phoenix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
44 	uint8_t survival_protection_r();
45 	DECLARE_READ_LINE_MEMBER(survival_sid_callback);
46 
47 	void condor(machine_config &config);
48 	void phoenix(machine_config &config);
49 	void survival(machine_config &config);
50 	void pleiads(machine_config &config);
51 	void phoenix_memory_map(address_map &map);
52 	void pleiads_memory_map(address_map &map);
53 	void survival_memory_map(address_map &map);
54 protected:
55 	required_device<cpu_device>             m_maincpu;
56 	optional_device<pleiads_sound_device>   m_pleiads_custom;
57 	required_device<gfxdecode_device>       m_gfxdecode;
58 	required_device<palette_device>         m_palette;
59 
60 	tilemap_t *m_fg_tilemap;
61 	tilemap_t *m_bg_tilemap;
62 
63 	std::unique_ptr<uint8_t[]> m_videoram_pg[2];
64 	uint8_t m_videoram_pg_index;
65 	uint8_t m_palette_bank;
66 	uint8_t m_cocktail_mode;
67 	uint8_t m_pleiads_protection_question;
68 	uint8_t m_survival_protection_value;
69 	int m_survival_sid_value;
70 	uint8_t m_survival_input_latches[2];
71 	uint8_t m_survival_input_readc;
72 };
73 
74 
75 /*----------- video timing  -----------*/
76 
77 #define MASTER_CLOCK            XTAL(11'000'000)
78 
79 #define PIXEL_CLOCK             (MASTER_CLOCK/2)
80 #define CPU_CLOCK               (PIXEL_CLOCK)
81 #define HTOTAL                  (512-160)
82 #define HBSTART                 (256)
83 #define HBEND                   (0)
84 #define VTOTAL                  (256)
85 #define VBSTART                 (208)
86 #define VBEND                   (0)
87 
88 #endif // MAME_INCLUDES_PHOENIX_H
89