1 // license:BSD-3-Clause
2 // copyright-holders:Barry Rodewald
3 /*
4  * transtape.c  --  Hard Micro SA Transtape
5  *
6  * Spanish hacking device
7  *
8  */
9 
10 #ifndef MAME_BUS_CPC_TRANSTAPE_H
11 #define MAME_BUS_CPC_TRANSTAPE_H
12 
13 #pragma once
14 
15 #include "cpcexp.h"
16 
17 class cpc_transtape_device  : public device_t,
18 						public device_cpc_expansion_card_interface
19 {
20 public:
21 	// construction/destruction
22 	cpc_transtape_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
23 
24 	// optional information overrides
25 	virtual const tiny_rom_entry *device_rom_region() const override;
26 	virtual ioport_constructor device_input_ports() const override;
27 
28 	virtual void set_mapping(uint8_t type) override;
WRITE_LINE_MEMBER(romen_w)29 	virtual WRITE_LINE_MEMBER( romen_w ) override { m_romen = state; }
30 
31 	uint8_t input_r();
32 	void output_w(uint8_t data);
33 	DECLARE_INPUT_CHANGED_MEMBER(button_red_w);
34 	DECLARE_INPUT_CHANGED_MEMBER(button_black_w);
35 
36 protected:
37 	// device-level overrides
38 	virtual void device_start() override;
39 	virtual void device_reset() override;
40 
41 private:
42 	cpc_expansion_slot_device *m_slot;
43 	address_space* m_space;
44 	std::unique_ptr<uint8_t[]> m_ram;  // 8kB internal RAM
45 	bool m_rom_active;
46 	bool m_romen;
47 	uint8_t m_output;
48 
49 	void map_enable();
50 };
51 
52 // device type definition
53 DECLARE_DEVICE_TYPE(CPC_TRANSTAPE, cpc_transtape_device)
54 
55 #endif // MAME_BUS_CPC_TRANSTAPE_H
56