summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/mbee.h
blob: fcecfb8787149541d1ad21f6cf751d581ac03423 (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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
// license:BSD-3-Clause
// copyright-holders:Robbbert
/*****************************************************************************
 *
 * includes/mbee.h
 *
 ****************************************************************************/

#ifndef MAME_INCLUDES_MBEE_H
#define MAME_INCLUDES_MBEE_H

#include "bus/centronics/ctronics.h"

#include "cpu/z80/z80.h"
#include "machine/z80daisy.h"

#include "imagedev/cassette.h"
#include "imagedev/snapquik.h"

#include "machine/8530scc.h"
#include "machine/buffer.h"
#include "machine/mc146818.h"
#include "machine/wd_fdc.h"
#include "machine/z80pio.h"

#include "sound/spkrdev.h"
#include "sound/wave.h"

#include "video/mc6845.h"

#include "screen.h"


class mbee_state : public driver_device
{
public:
	enum
	{
		TIMER_MBEE_NEWKB
	};

	mbee_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_palette(*this, "palette")
		, m_maincpu(*this, "maincpu")
		, m_pio(*this, "z80pio")
		, m_cassette(*this, "cassette")
		, m_wave(*this, "wave")
		, m_speaker(*this, "speaker")
		, m_centronics(*this, "centronics")
		, m_cent_data_out(*this, "cent_data_out")
		, m_crtc(*this, "crtc")
		, m_fdc(*this, "fdc")
		, m_floppy0(*this, "fdc:0")
		, m_floppy1(*this, "fdc:1")
		, m_rtc(*this, "rtc")
		, m_pak(*this, "pak")
		, m_telcom(*this, "telcom")
		, m_basic(*this, "basic")
		, m_io_x7(*this, "X.7")
		, m_io_oldkb(*this, "X.%u", 0)
		, m_io_newkb(*this, "Y.%u", 0)
		, m_io_config(*this, "CONFIG")
		, m_screen(*this, "screen")
	{ }

	DECLARE_WRITE8_MEMBER(port04_w);
	DECLARE_WRITE8_MEMBER(port06_w);
	DECLARE_READ8_MEMBER(port07_r);
	DECLARE_READ8_MEMBER(port08_r);
	DECLARE_WRITE8_MEMBER(port08_w);
	DECLARE_WRITE8_MEMBER(port0a_w);
	DECLARE_WRITE8_MEMBER(port0b_w);
	DECLARE_READ8_MEMBER(port18_r);
	DECLARE_READ8_MEMBER(port1c_r);
	DECLARE_WRITE8_MEMBER(port1c_w);
	DECLARE_WRITE8_MEMBER(mbee128_50_w);
	DECLARE_WRITE8_MEMBER(mbee256_50_w);
	DECLARE_READ8_MEMBER(telcom_low_r);
	DECLARE_READ8_MEMBER(telcom_high_r);
	DECLARE_READ8_MEMBER(speed_low_r);
	DECLARE_READ8_MEMBER(speed_high_r);
	DECLARE_WRITE8_MEMBER(m6545_index_w);
	DECLARE_WRITE8_MEMBER(m6545_data_w);
	DECLARE_READ8_MEMBER(video_low_r);
	DECLARE_READ8_MEMBER(video_high_r);
	DECLARE_WRITE8_MEMBER(video_low_w);
	DECLARE_WRITE8_MEMBER(video_high_w);
	DECLARE_WRITE8_MEMBER(pio_port_b_w);
	DECLARE_READ8_MEMBER(pio_port_b_r);
	DECLARE_WRITE_LINE_MEMBER(pio_ardy);
	DECLARE_WRITE_LINE_MEMBER(crtc_vs);
	DECLARE_READ8_MEMBER(fdc_status_r);
	DECLARE_WRITE8_MEMBER(fdc_motor_w);
	void init_mbeepc85();
	void init_mbee256();
	void init_mbee56();
	void init_mbeett();
	void init_mbeeppc();
	void init_mbee();
	void init_mbeepc();
	void init_mbeeic();
	void init_mbee128();
	DECLARE_MACHINE_RESET(mbee);
	DECLARE_VIDEO_START(mono);
	DECLARE_VIDEO_START(standard);
	DECLARE_VIDEO_START(premium);
	DECLARE_PALETTE_INIT(standard);
	DECLARE_PALETTE_INIT(premium);
	DECLARE_MACHINE_RESET(mbee56);
	DECLARE_MACHINE_RESET(mbee128);
	DECLARE_MACHINE_RESET(mbee256);
	DECLARE_MACHINE_RESET(mbeett);
	uint32_t screen_update_mbee(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	TIMER_CALLBACK_MEMBER(timer_newkb);
	DECLARE_QUICKLOAD_LOAD_MEMBER(mbee);
	DECLARE_QUICKLOAD_LOAD_MEMBER(mbee_z80bin);
	WRITE_LINE_MEMBER(rtc_irq_w);
	WRITE_LINE_MEMBER(fdc_intrq_w);
	WRITE_LINE_MEMBER(fdc_drq_w);
	MC6845_UPDATE_ROW(crtc_update_row);
	MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr);

	required_device<palette_device> m_palette;
	void mbee56(machine_config &config);
	void mbeeppc(machine_config &config);
	void mbee128(machine_config &config);
	void mbee256(machine_config &config);
	void mbee(machine_config &config);
	void mbeett(machine_config &config);
	void mbeeic(machine_config &config);
	void mbeepc(machine_config &config);
	void mbee128p(machine_config &config);
	void mbee128_io(address_map &map);
	void mbee256_io(address_map &map);
	void mbee256_mem(address_map &map);
	void mbee56_io(address_map &map);
	void mbee56_mem(address_map &map);
	void mbee_io(address_map &map);
	void mbee_mem(address_map &map);
	void mbeeic_io(address_map &map);
	void mbeeic_mem(address_map &map);
	void mbeepc_io(address_map &map);
	void mbeepc_mem(address_map &map);
	void mbeeppc_io(address_map &map);
	void mbeeppc_mem(address_map &map);
	void mbeett_io(address_map &map);
	void mbeett_mem(address_map &map);
private:
	uint8_t *m_p_videoram;
	uint8_t *m_p_gfxram;
	uint8_t *m_p_colorram;
	uint8_t *m_p_attribram;
	bool m_is_premium;
	bool m_has_oldkb;
	size_t m_size;
	bool m_b7_rtc;
	bool m_b7_vs;
	bool m_b2;
	uint8_t m_framecnt;
	uint8_t m_08;
	uint8_t m_0a;
	uint8_t m_0b;
	uint8_t m_1c;
	uint8_t m_sy6545_cursor[16];
	uint8_t m_mbee256_was_pressed[15];
	uint8_t m_mbee256_q[20];
	uint8_t m_mbee256_q_pos;
	uint8_t m_sy6545_reg[32];
	uint8_t m_sy6545_ind;
	uint8_t m_fdc_rq;
	uint8_t m_bank_array[33];
	void setup_banks(uint8_t data, bool first_time, uint8_t b_mask);
	void sy6545_cursor_configure();
	void oldkb_scan(uint16_t param);
	void oldkb_matrix_r(uint16_t offs);
	void machine_reset_common();
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
	required_device<cpu_device> m_maincpu;
	required_device<z80pio_device> m_pio;
	required_device<cassette_image_device> m_cassette;
	required_device<wave_device> m_wave;
	required_device<speaker_sound_device> m_speaker;
	required_device<centronics_device> m_centronics;
	required_device<output_latch_device> m_cent_data_out;
	required_device<mc6845_device> m_crtc;
	optional_device<wd2793_device> m_fdc;
	optional_device<floppy_connector> m_floppy0;
	optional_device<floppy_connector> m_floppy1;
	optional_device<mc146818_device> m_rtc;
	optional_memory_bank m_pak;
	optional_memory_bank m_telcom;
	optional_memory_bank m_basic;
	optional_ioport m_io_x7;
	optional_ioport_array<8> m_io_oldkb;
	optional_ioport_array<15> m_io_newkb;
	required_ioport m_io_config;
	required_device<screen_device> m_screen;
};

#endif // MAME_INCLUDES_MBEE_H