1 // license:BSD-3-Clause
2 // copyright-holders:Paul Leaman
3 /***************************************************************************
4 
5     Black Tiger
6 
7 ***************************************************************************/
8 #ifndef MAME_INCLUDES_BLKTIGER_H
9 #define MAME_INCLUDES_BLKTIGER_H
10 
11 #pragma once
12 
13 #include "cpu/mcs51/mcs51.h"
14 #include "video/bufsprite.h"
15 #include "emupal.h"
16 #include "tilemap.h"
17 
18 class blktiger_state : public driver_device
19 {
20 public:
blktiger_state(const machine_config & mconfig,device_type type,const char * tag)21 	blktiger_state(const machine_config &mconfig, device_type type, const char *tag) :
22 		driver_device(mconfig, type, tag),
23 		m_spriteram(*this, "spriteram"),
24 		m_txvideoram(*this, "txvideoram"),
25 		m_mcu(*this, "mcu"),
26 		m_audiocpu(*this, "audiocpu"),
27 		m_maincpu(*this, "maincpu"),
28 		m_gfxdecode(*this, "gfxdecode"),
29 		m_palette(*this, "palette")
30 	{ }
31 
32 	/* memory pointers */
33 	required_device<buffered_spriteram8_device> m_spriteram;
34 	required_shared_ptr<uint8_t> m_txvideoram;
35 
36 	/* video-related */
37 	tilemap_t *m_tx_tilemap;
38 	tilemap_t *m_bg_tilemap8x4;
39 	tilemap_t *m_bg_tilemap4x8;
40 	uint32_t  m_scroll_bank;
41 	uint8_t   m_scroll_x[2];
42 	uint8_t   m_scroll_y[2];
43 	std::unique_ptr<uint8_t[]>   m_scroll_ram;
44 	uint8_t   m_screen_layout;
45 	uint8_t   m_chon;
46 	uint8_t   m_objon;
47 	uint8_t   m_bgon;
48 
49 	/* mcu-related */
50 	uint8_t   m_z80_latch;
51 	uint8_t   m_i8751_latch;
52 
53 	/* devices */
54 	optional_device<i8751_device> m_mcu;
55 	required_device<cpu_device> m_audiocpu;
56 	uint8_t blktiger_from_mcu_r();
57 	void blktiger_to_mcu_w(uint8_t data);
58 	uint8_t blktiger_from_main_r();
59 	void blktiger_to_main_w(uint8_t data);
60 	void blktiger_bankswitch_w(uint8_t data);
61 	void blktiger_coinlockout_w(uint8_t data);
62 	void blktiger_txvideoram_w(offs_t offset, uint8_t data);
63 	uint8_t blktiger_bgvideoram_r(offs_t offset);
64 	void blktiger_bgvideoram_w(offs_t offset, uint8_t data);
65 	void blktiger_bgvideoram_bank_w(uint8_t data);
66 	void blktiger_scrolly_w(offs_t offset, uint8_t data);
67 	void blktiger_scrollx_w(offs_t offset, uint8_t data);
68 	void blktiger_video_control_w(uint8_t data);
69 	void blktiger_video_enable_w(uint8_t data);
70 	void blktiger_screen_layout_w(uint8_t data);
71 	TILEMAP_MAPPER_MEMBER(bg8x4_scan);
72 	TILEMAP_MAPPER_MEMBER(bg4x8_scan);
73 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
74 	TILE_GET_INFO_MEMBER(get_tx_tile_info);
75 	virtual void machine_start() override;
76 	virtual void machine_reset() override;
77 	virtual void video_start() override;
78 	uint32_t screen_update_blktiger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
79 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
80 	required_device<cpu_device> m_maincpu;
81 	required_device<gfxdecode_device> m_gfxdecode;
82 	required_device<palette_device> m_palette;
83 
84 	void init_blktigerb3();
85 	void blktiger(machine_config &config);
86 	void blktigerbl(machine_config &config);
87 	void blktiger_io_map(address_map &map);
88 	void blktiger_map(address_map &map);
89 	void blktiger_sound_map(address_map &map);
90 	void blktigerbl_io_map(address_map &map);
91 };
92 
93 #endif // MAME_INCLUDES_BLKTIGER_H
94