summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/machine/m24_z8000.h
blob: aca700397368bc05e83705b39b3d79519c330526 (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
// license:BSD-3-Clause
// copyright-holders:Carl
#ifndef M24_Z8000_H_
#define M24_Z8000_H_

#include "emu.h"
#include "cpu/z8000/z8000.h"
#include "machine/i8251.h"
#include "machine/pit8253.h"
#include "machine/pic8259.h"

#define MCFG_M24_Z8000_HALT(_devcb) \
	devcb = &m24_z8000_device::set_halt_callback(*device, DEVCB_##_devcb);

class m24_z8000_device :  public device_t
{
public:
	m24_z8000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	virtual const tiny_rom_entry *device_rom_region() const override;
	virtual machine_config_constructor device_mconfig_additions() const override;
	template<class _Object> static devcb_base &set_halt_callback(device_t &device, _Object object) { return downcast<m24_z8000_device &>(device).m_halt_out.set_callback(object); }

	DECLARE_READ16_MEMBER(pmem_r);
	DECLARE_WRITE16_MEMBER(pmem_w);
	DECLARE_READ16_MEMBER(dmem_r);
	DECLARE_WRITE16_MEMBER(dmem_w);
	DECLARE_READ16_MEMBER(i86_io_r);
	DECLARE_WRITE16_MEMBER(i86_io_w);
	DECLARE_WRITE8_MEMBER(irqctl_w);
	DECLARE_WRITE8_MEMBER(serctl_w);
	DECLARE_READ8_MEMBER(handshake_r);
	DECLARE_WRITE8_MEMBER(handshake_w);
	DECLARE_WRITE_LINE_MEMBER(mo_w);
	DECLARE_WRITE_LINE_MEMBER(timer_irq_w);
	IRQ_CALLBACK_MEMBER(int_cb);
	bool halted() { return m_z8000_halt; }

	required_device<z8001_device> m_z8000;
protected:
	void device_start() override;
	void device_reset() override;

private:
	required_device<cpu_device> m_maincpu;
	required_device<pic8259_device> m_pic;
	devcb_write_line m_halt_out;
	static const uint8_t pmem_table[16][4];
	static const uint8_t dmem_table[16][4];
	uint8_t m_handshake, m_irq;
	bool m_z8000_halt, m_z8000_mem, m_timer_irq;
};

extern const device_type M24_Z8000;

#endif /* M24_Z8000_H_ */