summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/cpc/mface2.h
blob: 0df2cbab52cb25c97d8297dbab0df283736d09d0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// license:BSD-3-Clause
// copyright-holders:Kevin Thacker, Barry Rodewald
/*
 * mface2.h  --  Romantic Robot Multiface II expansion device for the Amstrad CPC/CPC+
 *
 *  Created on: 31/07/2011
 *
 *  I/O Ports:
 *    -  FEE8: Enables Multiface ROM and RAM
 *    -  FEEA: Disables Multiface ROM and RAM
 *
 *  When enabled, Multiface ROM is mapped to &0000, and RAM to &2000
 *
 *  When the Stop button is pressed, the Multiface II will generate an NMI
 *  (I guess the ROM/RAM is enabled when you do this also?)
 *
 *  It also monitors all I/O port writes, so that it can restore them when resuming the current application.
 */

#ifndef MFACE2_H_
#define MFACE2_H_

#include "cpcexp.h"

/* stop button has been pressed */
#define MULTIFACE_STOP_BUTTON_PRESSED   0x0001
/* ram/rom is paged into memory space */
#define MULTIFACE_RAM_ROM_ENABLED       0x0002
/* when visible OUT commands are performed! */
#define MULTIFACE_VISIBLE               0x0004


class cpc_multiface2_device :   public device_t,
								public device_cpc_expansion_card_interface
{
public:
	// construction/destruction
	cpc_multiface2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	// optional information overrides
	virtual const tiny_rom_entry *device_rom_region() const override;
	virtual ioport_constructor device_input_ports() const override;
	virtual machine_config_constructor device_mconfig_additions() const override;

	int multiface_hardware_enabled();
	void multiface_rethink_memory();
	void multiface_stop();
	int multiface_io_write(uint16_t offset, uint8_t data);
	void check_button_state();
protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override;

private:
	cpc_expansion_slot_device *m_slot;

	std::unique_ptr<uint8_t[]> m_multiface_ram;
	unsigned long m_multiface_flags;

	uint8_t m_romdis;
};

// device type definition
extern const device_type CPC_MFACE2;

#endif /* MFACE2_H_ */