summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/tek405x.h
blob: 805ab42c1b23dee6787444290159225d71ee57dc (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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
// license:BSD-3-Clause
// copyright-holders:Curt Coder
#ifndef MAME_INCLUDES_TEK405X_H
#define MAME_INCLUDES_TEK405X_H

#pragma once

#include "bus/generic/carts.h"
#include "bus/generic/slot.h"
#include "bus/ieee488/ieee488.h"

#include "cpu/m6800/m6800.h"

#include "machine/6821pia.h"
#include "machine/6850acia.h"
#include "machine/clock.h"
#include "machine/ram.h"
#include "machine/timer.h"

#include "sound/spkrdev.h"

#include "video/vector.h"


#define MC6800_TAG          "u61"
#define MC6820_Y_TAG        "u561"
#define MC6820_X_TAG        "u565"
#define MC6820_TAPE_TAG     "u361"
#define MC6820_KB_TAG       "u461"
#define MC6820_GPIB_TAG     "u265"
#define MC6820_COM_TAG      "u5"
#define MC6850_TAG          "u25"
#define RS232_TAG           "rs232"
#define SCREEN_TAG          "screen"

#define AM2901A_TAG         "am2901a"

class tek4051_state : public driver_device
{
public:
	tek4051_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_maincpu(*this, MC6800_TAG),
		m_gpib_pia(*this, MC6820_GPIB_TAG),
		m_com_pia(*this, MC6820_COM_TAG),
		m_acia(*this, MC6850_TAG),
		m_acia_clock(*this, "acia_clock"),
		m_gpib(*this, IEEE488_TAG),
		m_speaker(*this, "speaker"),
		m_ram(*this, RAM_TAG),
		m_rom(*this, MC6800_TAG),
		m_bsofl_rom(*this, "020_0147_00"),
		m_bscom_rom(*this, "021_0188_00"),
		m_special(*this, "SPECIAL"),
		m_lamp(*this, "lamp%u", 0U)
	{ }

	void bankswitch(uint8_t data);
	void update_irq();
	void update_nmi();
	void scan_keyboard();

	DECLARE_WRITE8_MEMBER( lbs_w );

	DECLARE_READ8_MEMBER( x_pia_pa_r );
	DECLARE_WRITE8_MEMBER( x_pia_pa_w );
	DECLARE_WRITE8_MEMBER( x_pia_pb_w );
	DECLARE_WRITE_LINE_MEMBER( adot_w );
	DECLARE_WRITE_LINE_MEMBER( bufclk_w );
	DECLARE_WRITE_LINE_MEMBER( x_pia_irqa_w );
	DECLARE_WRITE_LINE_MEMBER( x_pia_irqb_w );

	DECLARE_READ8_MEMBER( sa_r );
	DECLARE_WRITE8_MEMBER( y_pia_pa_w );
	DECLARE_WRITE8_MEMBER( sb_w );
	DECLARE_WRITE_LINE_MEMBER( sot_w );
	DECLARE_WRITE_LINE_MEMBER( y_pia_irqa_w );
	DECLARE_WRITE_LINE_MEMBER( y_pia_irqb_w );

	DECLARE_READ8_MEMBER( kb_pia_pa_r );
	DECLARE_READ8_MEMBER( kb_pia_pb_r );
	DECLARE_WRITE8_MEMBER( kb_pia_pb_w );
	DECLARE_WRITE_LINE_MEMBER( kb_halt_w );
	DECLARE_WRITE_LINE_MEMBER( kb_pia_irqa_w );
	DECLARE_WRITE_LINE_MEMBER( kb_pia_irqb_w );

	DECLARE_READ8_MEMBER( tape_pia_pa_r );
	DECLARE_WRITE8_MEMBER( tape_pia_pa_w );
	DECLARE_WRITE8_MEMBER( tape_pia_pb_w );
	DECLARE_WRITE_LINE_MEMBER( tape_pia_irqa_w );
	DECLARE_WRITE_LINE_MEMBER( tape_pia_irqb_w );

	DECLARE_WRITE8_MEMBER( dio_w );
	DECLARE_READ8_MEMBER( gpib_pia_pb_r );
	DECLARE_WRITE8_MEMBER( gpib_pia_pb_w );
	DECLARE_WRITE_LINE_MEMBER( talk_w );
	DECLARE_WRITE_LINE_MEMBER( gpib_pia_irqa_w );
	DECLARE_WRITE_LINE_MEMBER( gpib_pia_irqb_w );

	DECLARE_WRITE8_MEMBER( com_pia_pa_w );
	DECLARE_READ8_MEMBER( com_pia_pb_r );
	DECLARE_WRITE8_MEMBER( com_pia_pb_w );
	DECLARE_WRITE_LINE_MEMBER( com_pia_irqa_w );
	DECLARE_WRITE_LINE_MEMBER( com_pia_irqb_w );
	DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
	DECLARE_WRITE_LINE_MEMBER( write_acia_clock );

	TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick);
	void tek4051(machine_config &config);
	void tek4051_mem(address_map &map);

protected:
	virtual void machine_start() override;
	virtual void video_start() override;

	required_device<cpu_device> m_maincpu;
	required_device<pia6821_device> m_gpib_pia;
	required_device<pia6821_device> m_com_pia;
	required_device<acia6850_device> m_acia;
	required_device<clock_device> m_acia_clock;
	required_device<ieee488_device> m_gpib;
	required_device<speaker_sound_device> m_speaker;
	required_device<ram_device> m_ram;
	required_memory_region m_rom;
	required_memory_region m_bsofl_rom;
	required_memory_region m_bscom_rom;
	required_ioport m_special;
	output_finder<4> m_lamp;

	// interrupts
	int m_x_pia_irqa;
	int m_x_pia_irqb;
	int m_y_pia_irqa;
	int m_y_pia_irqb;
	int m_tape_pia_irqa;
	int m_tape_pia_irqb;
	int m_kb_pia_irqa;
	int m_kb_pia_irqb;
	int m_gpib_pia_irqa;
	int m_gpib_pia_irqb;
	int m_com_pia_irqa;
	int m_com_pia_irqb;
	int m_acia_irq;

	// keyboard
	int m_kbhalt;
	int m_kc;

	// GPIB
	int m_talk;
};

class tek4052_state : public driver_device
{
public:
	tek4052_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_maincpu(*this, AM2901A_TAG),
		m_ram(*this, RAM_TAG)
	{ }

	void tek4052(machine_config &config);
	void tek4052_mem(address_map &map);

protected:
	virtual void machine_start() override;
	virtual void video_start() override;

	required_device<cpu_device> m_maincpu;
	required_device<ram_device> m_ram;
};

#endif // MAME_INCLUDES_TEK405X_H