1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Pierpaolo Prazzoli
3 #ifndef MAME_INCLUDES_SCOTRSHT_H
4 #define MAME_INCLUDES_SCOTRSHT_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class scotrsht_state : public driver_device
13 {
14 public:
scotrsht_state(const machine_config & mconfig,device_type type,const char * tag)15 	scotrsht_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_maincpu(*this, "maincpu"),
18 		m_audiocpu(*this, "audiocpu"),
19 		m_gfxdecode(*this, "gfxdecode"),
20 		m_palette(*this, "palette"),
21 		m_soundlatch(*this, "soundlatch"),
22 		m_colorram(*this, "colorram"),
23 		m_videoram(*this, "videoram"),
24 		m_spriteram(*this, "spriteram"),
25 		m_scroll(*this, "scroll")
26 	{ }
27 
28 	void scotrsht(machine_config &config);
29 
30 private:
31 	required_device<cpu_device> m_maincpu;
32 	required_device<cpu_device> m_audiocpu;
33 	required_device<gfxdecode_device> m_gfxdecode;
34 	required_device<palette_device> m_palette;
35 	required_device<generic_latch_8_device> m_soundlatch;
36 
37 	required_shared_ptr<uint8_t> m_colorram;
38 	required_shared_ptr<uint8_t> m_videoram;
39 	required_shared_ptr<uint8_t> m_spriteram;
40 	required_shared_ptr<uint8_t> m_scroll;
41 
42 	tilemap_t *m_bg_tilemap;
43 
44 	int m_irq_enable;
45 	int m_charbank;
46 	int m_palette_bank;
47 
48 	void ctrl_w(uint8_t data);
49 	void soundlatch_w(uint8_t data);
50 	void videoram_w(offs_t offset, uint8_t data);
51 	void colorram_w(offs_t offset, uint8_t data);
52 	void charbank_w(uint8_t data);
53 	void palettebank_w(uint8_t data);
54 
55 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
56 
57 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
58 
59 	virtual void video_start() override;
60 	void scotrsht_palette(palette_device &palette) const;
61 
62 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
63 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
64 	void scotrsht_map(address_map &map);
65 	void scotrsht_sound_map(address_map &map);
66 	void scotrsht_sound_port(address_map &map);
67 };
68 
69 #endif // MAME_INCLUDES_SCOTRSHT_H
70