summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/elf.h
blob: 18a23c9135e8d7d8589772467678cb9614ff1987 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// license:BSD-3-Clause
// copyright-holders:Curt Coder
#ifndef MAME_INCLUDES_ELF_H
#define MAME_INCLUDES_ELF_H

#pragma once


#include "cpu/cosmac/cosmac.h"
#include "imagedev/cassette.h"
#include "imagedev/snapquik.h"
#include "machine/mm74c922.h"
#include "video/cdp1861.h"
#include "video/dm9368.h"
#include "machine/rescap.h"
#include "machine/ram.h"

#define SCREEN_TAG      "screen"
#define CDP1802_TAG     "a6"
#define CDP1861_TAG     "a14"
#define MM74C923_TAG    "a10"
#define DM9368_L_TAG    "a12"
#define DM9368_H_TAG    "a8"

class elf2_state : public driver_device
{
public:
	elf2_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_maincpu(*this, CDP1802_TAG)
		, m_vdc(*this, CDP1861_TAG)
		, m_kb(*this, MM74C923_TAG)
		, m_led_l(*this, DM9368_L_TAG)
		, m_led_h(*this, DM9368_H_TAG)
		, m_cassette(*this, "cassette")
		, m_ram(*this, RAM_TAG)
		, m_special(*this, "SPECIAL")
		, m_7segs(*this, "digit%u", 0U)
		, m_led(*this, "led0")
	{ }

	void elf2(machine_config &config);

	DECLARE_INPUT_CHANGED_MEMBER( input_w );

private:
	DECLARE_READ8_MEMBER( dispon_r );
	DECLARE_READ8_MEMBER( data_r );
	DECLARE_WRITE8_MEMBER( data_w );
	DECLARE_WRITE8_MEMBER( memory_w );
	DECLARE_READ_LINE_MEMBER( wait_r );
	DECLARE_READ_LINE_MEMBER( clear_r );
	DECLARE_READ_LINE_MEMBER( ef4_r );
	DECLARE_WRITE_LINE_MEMBER( q_w );
	uint8_t dma_r();
	void sc_w(uint8_t data);
	DECLARE_WRITE_LINE_MEMBER( da_w );
	template <unsigned N> void digit_w(uint8_t data) { m_7segs[N] = data; }

	DECLARE_QUICKLOAD_LOAD_MEMBER( quickload_cb );
	void elf2_io(address_map &map);
	void elf2_mem(address_map &map);

	virtual void machine_start() override;

	required_device<cosmac_device> m_maincpu;
	required_device<cdp1861_device> m_vdc;
	required_device<mm74c922_device> m_kb;
	required_device<dm9368_device> m_led_l;
	required_device<dm9368_device> m_led_h;
	required_device<cassette_image_device> m_cassette;
	required_device<ram_device> m_ram;
	required_ioport m_special;
	output_finder<2> m_7segs;
	output_finder<> m_led;

	// display state
	uint8_t m_data;
};

#endif