1 // license:BSD-3-Clause
2 // copyright-holders:Tomasz Slanina
3 #ifndef MAME_INCLUDES_FCOMBAT_H
4 #define MAME_INCLUDES_FCOMBAT_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 
12 // this is copied from Exerion, but it should be correct
13 #define FCOMBAT_MASTER_CLOCK        (20000000)
14 #define FCOMBAT_CPU_CLOCK           (FCOMBAT_MASTER_CLOCK / 6)
15 #define FCOMBAT_AY8910_CLOCK        (FCOMBAT_CPU_CLOCK / 2)
16 #define FCOMBAT_PIXEL_CLOCK         (FCOMBAT_MASTER_CLOCK / 3)
17 #define FCOMBAT_HCOUNT_START        (0x58)
18 #define FCOMBAT_HTOTAL              (512-FCOMBAT_HCOUNT_START)
19 #define FCOMBAT_HBEND               (12*8)  // ??
20 #define FCOMBAT_HBSTART             (52*8)  //
21 #define FCOMBAT_VTOTAL              (256)
22 #define FCOMBAT_VBEND               (16)
23 #define FCOMBAT_VBSTART             (240)
24 
25 #define BACKGROUND_X_START      32
26 #define BACKGROUND_X_START_FLIP 72
27 
28 #define VISIBLE_X_MIN           (12*8)
29 #define VISIBLE_X_MAX           (52*8)
30 #define VISIBLE_Y_MIN           (2*8)
31 #define VISIBLE_Y_MAX           (30*8)
32 
33 
34 class fcombat_state : public driver_device
35 {
36 public:
fcombat_state(const machine_config & mconfig,device_type type,const char * tag)37 	fcombat_state(const machine_config &mconfig, device_type type, const char *tag) :
38 		driver_device(mconfig, type, tag),
39 		m_videoram(*this, "videoram"),
40 		m_spriteram(*this, "spriteram"),
41 		m_bgdata_rom(*this, "bgdata"),
42 		m_user2_region(*this, "user2"),
43 		m_io_in(*this, "IN%u", 0U),
44 		m_maincpu(*this, "maincpu"),
45 		m_gfxdecode(*this, "gfxdecode"),
46 		m_palette(*this, "palette")
47 	{ }
48 
49 	void fcombat(machine_config &config);
50 
51 	void init_fcombat();
52 
53 	DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
54 
55 private:
56 	/* memory pointers */
57 	required_shared_ptr<u8> m_videoram;
58 	required_shared_ptr<u8> m_spriteram;
59 	required_region_ptr<u8> m_bgdata_rom;
60 	required_region_ptr<u8> m_user2_region;
61 
62 	required_ioport_array<2> m_io_in;
63 
64 	/* video-related */
65 	tilemap_t    *m_bgmap;
66 	u8      m_cocktail_flip;
67 	u8      m_char_palette;
68 	u8      m_sprite_palette;
69 	u8      m_char_bank;
70 
71 	/* misc */
72 	int        m_fcombat_sh;
73 	int        m_fcombat_sv;
74 	int        m_tx;
75 	int        m_ty;
76 
77 	/* devices */
78 	required_device<cpu_device> m_maincpu;
79 	required_device<gfxdecode_device> m_gfxdecode;
80 	required_device<palette_device> m_palette;
81 
82 	u8 protection_r();
83 	u8 port01_r();
84 	void e900_w(u8 data);
85 	void ea00_w(u8 data);
86 	void eb00_w(u8 data);
87 	void ec00_w(u8 data);
88 	void ed00_w(u8 data);
89 	u8 e300_r();
90 	void ee00_w(u8 data);
91 	void videoreg_w(u8 data);
92 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
93 	virtual void machine_start() override;
94 	virtual void machine_reset() override;
95 	virtual void video_start() override;
96 	void fcombat_palette(palette_device &palette) const;
97 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
98 	void audio_map(address_map &map);
99 	void main_map(address_map &map);
100 };
101 
102 #endif // MAME_INCLUDES_FCOMBAT_H
103