1 // license:BSD-3-Clause
2 // copyright-holders:Manuel Abadia
3 /*************************************************************************
4 
5     Fast Lane
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_FASTLANE_H
9 #define MAME_INCLUDES_FASTLANE_H
10 
11 #pragma once
12 
13 #include "machine/timer.h"
14 #include "sound/k007232.h"
15 #include "video/k007121.h"
16 #include "video/k051733.h"
17 #include "emupal.h"
18 #include "screen.h"
19 #include "tilemap.h"
20 
21 class fastlane_state : public driver_device
22 {
23 public:
fastlane_state(const machine_config & mconfig,device_type type,const char * tag)24 	fastlane_state(const machine_config &mconfig, device_type type, const char *tag) :
25 		driver_device(mconfig, type, tag),
26 		m_maincpu(*this,"maincpu"),
27 		m_k007121_regs(*this, "k007121_regs"),
28 		m_videoram1(*this, "videoram1"),
29 		m_videoram2(*this, "videoram2"),
30 		m_spriteram(*this, "spriteram"),
31 		m_k007232_1(*this, "k007232_1"),
32 		m_k007232_2(*this, "k007232_2"),
33 		m_k007121(*this, "k007121"),
34 		m_gfxdecode(*this, "gfxdecode"),
35 		m_screen(*this, "screen"),
36 		m_palette(*this, "palette")
37 	{ }
38 
39 	void fastlane(machine_config &config);
40 
41 private:
42 	required_device<cpu_device> m_maincpu;
43 
44 	/* memory pointers */
45 	required_shared_ptr<uint8_t> m_k007121_regs;
46 	required_shared_ptr<uint8_t> m_videoram1;
47 	required_shared_ptr<uint8_t> m_videoram2;
48 	required_shared_ptr<uint8_t> m_spriteram;
49 
50 	/* video-related */
51 	tilemap_t    *m_layer0;
52 	tilemap_t    *m_layer1;
53 	rectangle  m_clip0;
54 	rectangle  m_clip1;
55 
56 	/* devices */
57 	required_device<k007232_device> m_k007232_1;
58 	required_device<k007232_device> m_k007232_2;
59 	required_device<k007121_device> m_k007121;
60 	required_device<gfxdecode_device> m_gfxdecode;
61 	required_device<screen_device> m_screen;
62 	required_device<palette_device> m_palette;
63 
64 	void k007121_registers_w(offs_t offset, uint8_t data);
65 	void fastlane_bankswitch_w(uint8_t data);
66 	void fastlane_vram1_w(offs_t offset, uint8_t data);
67 	void fastlane_vram2_w(offs_t offset, uint8_t data);
68 	uint8_t fastlane_k1_k007232_r(offs_t offset);
69 	void fastlane_k1_k007232_w(offs_t offset, uint8_t data);
70 	uint8_t fastlane_k2_k007232_r(offs_t offset);
71 	void fastlane_k2_k007232_w(offs_t offset, uint8_t data);
72 	TILE_GET_INFO_MEMBER(get_tile_info0);
73 	TILE_GET_INFO_MEMBER(get_tile_info1);
74 	virtual void machine_start() override;
75 	virtual void video_start() override;
76 	void fastlane_palette(palette_device &palette) const;
77 	uint32_t screen_update_fastlane(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
78 	TIMER_DEVICE_CALLBACK_MEMBER(fastlane_scanline);
79 	void volume_callback0(uint8_t data);
80 	void volume_callback1(uint8_t data);
81 	void fastlane_map(address_map &map);
82 };
83 
84 #endif // MAME_INCLUDES_FASTLANE_H
85