1 // license:BSD-3-Clause
2 // copyright-holders:Olivier Galibert
3 #ifndef MAME_BUS_ORICEXT_MICRODISC_H
4 #define MAME_BUS_ORICEXT_MICRODISC_H
5 
6 #include "oricext.h"
7 #include "imagedev/floppy.h"
8 #include "machine/wd_fdc.h"
9 
DECLARE_DEVICE_TYPE(ORIC_MICRODISC,oric_microdisc_device)10 DECLARE_DEVICE_TYPE(ORIC_MICRODISC, oric_microdisc_device)
11 
12 class oric_microdisc_device : public device_t, public device_oricext_interface
13 {
14 public:
15 	oric_microdisc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
16 	virtual ~oric_microdisc_device();
17 
18 protected:
19 	enum {
20 		P_IRQEN  = 0x01,
21 		P_ROMDIS = 0x02,
22 		P_DDS    = 0x04,
23 		P_DDEN   = 0x08,
24 		P_SS     = 0x10,
25 		P_DRIVE  = 0x60,
26 		P_EPROM  = 0x80
27 	};
28 
29 	required_device<fd1793_device> fdc;
30 
31 	uint8_t *microdisc_rom;
32 	floppy_image_device *floppies[4];
33 	uint8_t port_314;
34 	bool intrq_state, drq_state, hld_state;
35 
36 	virtual void device_start() override;
37 	virtual void device_reset() override;
38 	const tiny_rom_entry *device_rom_region() const override;
39 	virtual void device_add_mconfig(machine_config &config) override;
40 
41 	void remap();
42 
43 private:
44 	DECLARE_WRITE_LINE_MEMBER(fdc_irq_w);
45 	DECLARE_WRITE_LINE_MEMBER(fdc_drq_w);
46 	DECLARE_WRITE_LINE_MEMBER(fdc_hld_w);
47 
48 	void port_314_w(uint8_t data);
49 	uint8_t port_314_r();
50 	uint8_t port_318_r();
51 
52 	void map(address_map &map);
53 
54 	DECLARE_FLOPPY_FORMATS(floppy_formats);
55 };
56 
57 #endif // MAME_BUS_ORICEXT_MICRODISC_H
58