summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/dragon.h
blob: 19843f57d5904026012a6cc8028b4735568d5f8a (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// license:BSD-3-Clause
// copyright-holders:Nathan Woods
/***************************************************************************

    dragon.h

    Dragon Family

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

#pragma once

#ifndef MAME_INCLUDES_DRAGON_H
#define MAME_INCLUDES_DRAGON_H


#include "includes/coco12.h"
#include "imagedev/printer.h"
#include "machine/mos6551.h"
#include "video/mc6845.h"


//**************************************************************************
//  MACROS / CONSTANTS
//**************************************************************************

#define PRINTER_TAG     "printer"
#define ACIA_TAG        "acia"



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

class dragon_state : public coco12_state
{
public:
	dragon_state(const machine_config &mconfig, device_type type, const char *tag)
		: coco12_state(mconfig, type, tag)
		, m_printer(*this, PRINTER_TAG)
	{
	}

	void dragon_base(machine_config &config);
	void dragon32(machine_config &config);
	void dragon_mem(address_map &map);
protected:
	virtual void pia1_pa_changed(uint8_t data) override;

private:
	required_device<printer_image_device> m_printer;
};


// dragon64 has an ACIA chip
class dragon64_state : public dragon_state
{
public:
	dragon64_state(const machine_config &mconfig, device_type type, const char *tag)
		: dragon_state(mconfig, type, tag)
		, m_acia(*this, ACIA_TAG)
	{
	}

	void tanodr64(machine_config &config);
	void dragon64(machine_config &config);
	void tanodr64h(machine_config &config);
	void dragon64h(machine_config &config);
protected:
	virtual DECLARE_READ8_MEMBER( ff00_read ) override;
	virtual DECLARE_WRITE8_MEMBER( ff00_write ) override;

	virtual void pia1_pb_changed(uint8_t data) override;
	void page_rom(bool romswitch);

private:
	required_device<mos6551_device> m_acia;
};


// dragon200e has a character generator
class dragon200e_state : public dragon64_state
{
public:
	dragon200e_state(const machine_config &mconfig, device_type type, const char *tag)
		: dragon64_state(mconfig, type, tag)
		, m_char_rom(*this, "chargen")
	{
	}

	MC6847_GET_CHARROM_MEMBER(char_rom_r);

	void dragon200e(machine_config &config);
private:
	required_memory_region m_char_rom;
};


// d64plus has a HD6845 and character generator
class d64plus_state : public dragon64_state
{
public:
	d64plus_state(const machine_config &mconfig, device_type type, const char *tag)
		: dragon64_state(mconfig, type, tag)
		, m_crtc(*this, "crtc")
		, m_palette(*this, "palette")
		, m_plus_ram(*this, "plus_ram")
		, m_video_ram(*this, "video_ram")
		, m_char_rom(*this, "chargen")
	{
	}

	DECLARE_READ8_MEMBER(d64plus_6845_disp_r);
	DECLARE_WRITE8_MEMBER(d64plus_bank_w);
	MC6845_UPDATE_ROW(crtc_update_row);

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

private:
	required_device<hd6845_device> m_crtc;
	required_device<palette_device> m_palette;
	optional_shared_ptr<uint8_t> m_plus_ram;
	optional_shared_ptr<uint8_t> m_video_ram;
	required_memory_region m_char_rom;
};

#endif // MAME_INCLUDES_DRAGON_H