summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/einstein/pipe/speculator.h
blob: 54159838878cad6881d6a07f3a707dcc88826c63 (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
// license: GPL-2.0+
// copyright-holders: Dirk Best
/***************************************************************************

    Speculator

    A Spectrum emulator

***************************************************************************/

#ifndef MAME_BUS_EINSTEIN_PIPE_SPECULATOR_H
#define MAME_BUS_EINSTEIN_PIPE_SPECULATOR_H

#pragma once

#include "pipe.h"
#include "machine/74123.h"
#include "imagedev/cassette.h"
#include "sound/spkrdev.h"
#include "speaker.h"


//**************************************************************************
//  TYPE DEFINITIONS
//**************************************************************************

// ======================> einstein_speculator_device

class einstein_speculator_device : public device_t, public device_tatung_pipe_interface
{
public:
	// construction/destruction
	einstein_speculator_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);

	virtual void int_w(int state) override;

	uint8_t ram_r(offs_t offset);
	void ram_w(offs_t offset, uint8_t data);
	uint8_t tape_r();
	void nmi_w(uint8_t data);

	DECLARE_WRITE_LINE_MEMBER(ic5a_q_w);
	DECLARE_WRITE_LINE_MEMBER(ic5b_q_w);

protected:
	virtual void device_add_mconfig(machine_config &config) override;
	virtual void device_start() override;
	virtual void device_reset() override;

private:
	offs_t address_translate(offs_t offset);

	required_device<ttl74123_device> m_ic5a;
	required_device<ttl74123_device> m_ic5b;
	required_device<cassette_image_device> m_cassette;
	required_device<speaker_sound_device> m_speaker;

	std::unique_ptr<uint8_t[]> m_ram;

	int m_nmisel;
};

// device type definition
DECLARE_DEVICE_TYPE(EINSTEIN_SPECULATOR, einstein_speculator_device)

#endif // MAME_BUS_EINSTEIN_PIPE_SPECULATOR_H