1 // license:BSD-3-Clause
2 // copyright-holders:Philip Bennett
3 #ifndef MAME_INCLUDES_METALMX_H
4 #define MAME_INCLUDES_METALMX_H
5 
6 #pragma once
7 
8 #include "audio/cage.h"
9 
10 #include "cpu/adsp2100/adsp2100.h"
11 #include "cpu/m68000/m68000.h"
12 #include "cpu/tms34010/tms34010.h"
13 #include "cpu/dsp32/dsp32.h"
14 
15 class metalmx_state : public driver_device
16 {
17 public:
metalmx_state(const machine_config & mconfig,device_type type,const char * tag)18 	metalmx_state(const machine_config &mconfig, device_type type, const char *tag) :
19 		driver_device(mconfig, type, tag),
20 		m_maincpu(*this, "maincpu"),
21 		m_gsp(*this, "gsp"),
22 		m_adsp(*this, "adsp"),
23 		m_dsp32c(*this, "dsp32c_%u", 1U),
24 		m_cage(*this, "cage"),
25 		m_adsp_internal_program_ram(*this, "adsp_intprog"),
26 		m_gsp_dram(*this, "gsp_dram"),
27 		m_gsp_vram(*this, "gsp_vram")
28 	{ }
29 
30 	void init_metalmx();
31 	void metalmx(machine_config &config);
32 
33 private:
34 	uint32_t unk_r();
35 	uint32_t watchdog_r();
36 	void shifter_w(uint32_t data);
37 	void motor_w(uint32_t data);
38 	void reset_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
39 	uint32_t sound_data_r(offs_t offset, uint32_t mem_mask = ~0);
40 	void sound_data_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
41 	template<int Chip> void dsp32c_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
42 	template<int Chip> uint32_t dsp32c_r(offs_t offset, uint32_t mem_mask = ~0);
43 	void host_gsp_w(offs_t offset, uint32_t data);
44 	uint32_t host_gsp_r(offs_t offset);
45 	uint32_t host_dram_r(offs_t offset);
46 	void host_dram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
47 	uint32_t host_vram_r(offs_t offset);
48 	void host_vram_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
49 	void timer_w(offs_t offset, uint32_t data);
50 	void cage_irq_callback(uint8_t data);
51 	virtual void machine_reset() override;
52 	virtual void video_start() override;
53 	uint32_t screen_update_metalmx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54 	void adsp_data_map(address_map &map);
55 	void adsp_program_map(address_map &map);
56 	void dsp32c_1_map(address_map &map);
57 	void dsp32c_2_map(address_map &map);
58 	void gsp_map(address_map &map);
59 	void main_map(address_map &map);
60 
61 	required_device<m68ec020_device> m_maincpu;
62 	required_device<tms34020_device> m_gsp;
63 	required_device<adsp2105_device> m_adsp;
64 	required_device_array<dsp32c_device, 2> m_dsp32c;
65 	required_device<atari_cage_device> m_cage;
66 
67 	required_shared_ptr<uint32_t> m_adsp_internal_program_ram;
68 	required_shared_ptr<uint32_t> m_gsp_dram;
69 	required_shared_ptr<uint32_t> m_gsp_vram;
70 };
71 
72 #endif // MAME_INCLUDES_METALMX_H
73