1 // license: BSD-3-Clause
2 // copyright-holders: Dirk Best
3 /***************************************************************************
4
5 Informer 207/376
6
7 IBM 3270 compatible terminal
8
9 Hardware:
10 - M6809
11 - 8253 PIT
12 - Z80SCC 8530
13 - 2x 6850 ACIA (up to 4)
14 - 2x X2212P NOVRAM
15
16 TODO:
17 - Dump keyboard controller and emulate it (currently HLE'd)
18 - Problably needs improvements to at least the Z80SCC to
19 properly support synchrous modes
20 - Figure out the unknown bits at 0x8400
21 - Verify clock speeds
22
23 Notes:
24 - Thanks to charcole and his zmachine3270 project at
25 https://github.com/charcole/zmachine3270
26
27 ***************************************************************************/
28
29 #include "emu.h"
30 #include "cpu/m6809/m6809.h"
31 #include "machine/6850acia.h"
32 #include "machine/pit8253.h"
33 #include "machine/input_merger.h"
34 #include "machine/ripple_counter.h"
35 #include "machine/x2212.h"
36 #include "machine/z80scc.h"
37 #include "video/mc6845.h"
38 #include "sound/beep.h"
39 #include "bus/rs232/rs232.h"
40 #include "bus/rs232/printer.h"
41 #include "machine/informer_207_376_kbd.h"
42 #include "emupal.h"
43 #include "screen.h"
44 #include "speaker.h"
45
46
47 //**************************************************************************
48 // TYPE DEFINITIONS
49 //**************************************************************************
50
51 class informer_207_376_state : public driver_device
52 {
53 public:
informer_207_376_state(const machine_config & mconfig,device_type type,const char * tag)54 informer_207_376_state(const machine_config &mconfig, device_type type, const char *tag) :
55 driver_device(mconfig, type, tag),
56 m_maincpu(*this, "maincpu"),
57 m_novram(*this, "novram%u", 0U),
58 m_crtc(*this, "crtc"),
59 m_screen(*this, "screen"),
60 m_palette(*this, "palette"),
61 m_pit(*this, "pit"),
62 m_scc(*this, "scc"),
63 m_acia(*this, "acia%u", 0U),
64 m_beep(*this, "beep"),
65 m_ram(*this, "ram"),
66 m_chargen(*this, "chargen")
67 { }
68
69 void informer_207_376(machine_config &config);
70
71 protected:
72 void machine_start() override;
73 void machine_reset() override;
74
75 private:
76 required_device<cpu_device> m_maincpu;
77 required_device_array<x2212_device, 2> m_novram;
78 required_device<mc6845_device> m_crtc;
79 required_device<screen_device> m_screen;
80 required_device<palette_device> m_palette;
81 required_device<pit8253_device> m_pit;
82 required_device<scc85c30_device> m_scc;
83 required_device_array<acia6850_device, 2> m_acia;
84 required_device<beep_device> m_beep;
85 required_shared_ptr<uint8_t> m_ram;
86 required_region_ptr<uint8_t> m_chargen;
87
88 void mem_map(address_map &map);
89
90 void unk_8400_w(uint8_t data);
91 void crt_brightness_w(uint8_t data);
92 uint8_t novram_r(address_space &space, offs_t offset);
93 void novram_w(offs_t offset, uint8_t data);
94 uint8_t novram_recall_r();
95
96 MC6845_UPDATE_ROW(crtc_update_row);
97 };
98
99
100 //**************************************************************************
101 // ADDRESS MAPS
102 //**************************************************************************
103
mem_map(address_map & map)104 void informer_207_376_state::mem_map(address_map &map)
105 {
106 map(0x0000, 0x7fff).ram().share("ram");
107 map(0x8000, 0x8000).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w));
108 map(0x8001, 0x8001).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
109 map(0x8400, 0x8400).lr8(NAME([] () { return 0xff; })).w(FUNC(informer_207_376_state::unk_8400_w)); // ?
110 map(0x8802, 0x8803).rw(m_acia[0], FUNC(acia6850_device::read), FUNC(acia6850_device::write));
111 map(0x8804, 0x8805).rw(m_acia[1], FUNC(acia6850_device::read), FUNC(acia6850_device::write));
112 map(0x8c00, 0x8c00).w(FUNC(informer_207_376_state::crt_brightness_w));
113 map(0x9000, 0x9003).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
114 map(0x9400, 0x9403).rw(m_scc, FUNC(scc85c30_device::ab_dc_r), FUNC(scc85c30_device::ab_dc_w));
115 map(0x9800, 0x9800).r(FUNC(informer_207_376_state::novram_recall_r));
116 map(0x9c00, 0x9cff).rw(FUNC(informer_207_376_state::novram_r), FUNC(informer_207_376_state::novram_w));
117 map(0xa000, 0xffff).rom().region("maincpu", 0);
118 }
119
120
121 //**************************************************************************
122 // INPUT PORT DEFINITIONS
123 //**************************************************************************
124
INPUT_PORTS_START(informer_207_376)125 static INPUT_PORTS_START( informer_207_376 )
126 INPUT_PORTS_END
127
128
129 //**************************************************************************
130 // VIDEO EMULATION
131 //**************************************************************************
132
133 void informer_207_376_state::crt_brightness_w(uint8_t data)
134 {
135 // unknown algorithm for the brightness
136 // default value is 6, range is 0 (off) to 15 (brightest)
137 m_screen->set_brightness(256 - (256 / ((data & 0x0f) + 1)));
138 }
139
MC6845_UPDATE_ROW(informer_207_376_state::crtc_update_row)140 MC6845_UPDATE_ROW( informer_207_376_state::crtc_update_row )
141 {
142 pen_t const *const pen = m_palette->pens();
143
144 for (int x = 0; x < x_count; x++)
145 {
146 uint8_t const code = m_ram[ma + x];
147 uint8_t data = m_chargen[(code << 4) + ra];
148
149 if (x == cursor_x)
150 data = 0xff;
151
152 // the line above the status bar seems to be hardcoded
153 if (y == 274)
154 data = 0xff;
155
156 // draw 8 pixels of the character
157 bitmap.pix(y, x * 8 + 7) = pen[BIT(data, 0)];
158 bitmap.pix(y, x * 8 + 6) = pen[BIT(data, 1)];
159 bitmap.pix(y, x * 8 + 5) = pen[BIT(data, 2)];
160 bitmap.pix(y, x * 8 + 4) = pen[BIT(data, 3)];
161 bitmap.pix(y, x * 8 + 3) = pen[BIT(data, 4)];
162 bitmap.pix(y, x * 8 + 2) = pen[BIT(data, 5)];
163 bitmap.pix(y, x * 8 + 1) = pen[BIT(data, 6)];
164 bitmap.pix(y, x * 8 + 0) = pen[BIT(data, 7)];
165 }
166 }
167
168 static const gfx_layout char_layout =
169 {
170 8,11,
171 RGN_FRAC(1,1),
172 1,
173 { 0 },
174 { 0, 1, 2, 3, 4, 5, 6, 7 },
175 { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8, 10*8 },
176 8*16
177 };
178
179 static GFXDECODE_START(chars)
180 GFXDECODE_ENTRY("chargen", 0, char_layout, 0, 1)
181 GFXDECODE_END
182
183
184 //**************************************************************************
185 // MACHINE EMULATION
186 //**************************************************************************
187
unk_8400_w(uint8_t data)188 void informer_207_376_state::unk_8400_w(uint8_t data)
189 {
190 // 7------- beeper
191 // -6------ unknown
192 // --5----- 1=internal modem, 0=host rs232
193 // ---43--- unknown
194 // -----2-- unknown
195 // ------10 unknown
196
197 m_beep->set_state(BIT(data, 7));
198 }
199
novram_r(address_space & space,offs_t offset)200 uint8_t informer_207_376_state::novram_r(address_space &space, offs_t offset)
201 {
202 return (m_novram[0]->read(space, offset) << 4) | (m_novram[1]->read(space, offset) & 0x0f);
203 }
204
novram_w(offs_t offset,uint8_t data)205 void informer_207_376_state::novram_w(offs_t offset, uint8_t data)
206 {
207 m_novram[0]->write(offset, data >> 4);
208 m_novram[1]->write(offset, data & 0x0f);
209 }
210
novram_recall_r()211 uint8_t informer_207_376_state::novram_recall_r()
212 {
213 m_novram[0]->recall(1);
214 m_novram[1]->recall(1);
215 m_novram[0]->recall(0);
216 m_novram[1]->recall(0);
217
218 return 0xff;
219 }
220
machine_start()221 void informer_207_376_state::machine_start()
222 {
223 }
224
machine_reset()225 void informer_207_376_state::machine_reset()
226 {
227 }
228
229
230 //**************************************************************************
231 // MACHINE DEFINTIONS
232 //**************************************************************************
233
printer_devices(device_slot_interface & device)234 void printer_devices(device_slot_interface &device)
235 {
236 device.option_add("printer", SERIAL_PRINTER);
237 }
238
informer_207_376(machine_config & config)239 void informer_207_376_state::informer_207_376(machine_config &config)
240 {
241 MC6809(config, m_maincpu, 36_MHz_XTAL / 4); // unknown clock divisor
242 m_maincpu->set_addrmap(AS_PROGRAM, &informer_207_376_state::mem_map);
243
244 input_merger_device &cpu_irq(INPUT_MERGER_ANY_HIGH(config, "cpu_irq"));
245 cpu_irq.output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE);
246
247 X2212(config, m_novram[0]);
248 X2212(config, m_novram[1]);
249
250 PIT8253(config, m_pit);
251 m_pit->set_clk<0>(2.457600_MHz_XTAL);
252 m_pit->out_handler<0>().set(m_acia[1], FUNC(acia6850_device::write_txc));
253 m_pit->out_handler<0>().append(m_acia[1], FUNC(acia6850_device::write_rxc));
254 m_pit->set_clk<1>(2.457600_MHz_XTAL);
255 m_pit->out_handler<1>().set(m_acia[0], FUNC(acia6850_device::write_txc));
256 m_pit->out_handler<1>().append(m_acia[0], FUNC(acia6850_device::write_rxc));
257 m_pit->out_handler<1>().append("nmi_clk", FUNC(ripple_counter_device::clock_w));
258
259 ripple_counter_device &nmi_clk(RIPPLE_COUNTER(config, "nmi_clk")); // CD4020BE
260 nmi_clk.set_stages(14);
261 nmi_clk.count_out_cb().set_inputline(m_maincpu, INPUT_LINE_NMI).bit(13); // Q14
262
263 SCC85C30(config, m_scc, 0); // externally clocked?
264 m_scc->out_txda_callback().set("com1", FUNC(rs232_port_device::write_txd));
265 m_scc->out_dtra_callback().set("com1", FUNC(rs232_port_device::write_dtr));
266 m_scc->out_rtsa_callback().set("com1", FUNC(rs232_port_device::write_rts));
267 m_scc->out_txdb_callback().set("com2", FUNC(rs232_port_device::write_txd));
268 m_scc->out_dtrb_callback().set("com2", FUNC(rs232_port_device::write_dtr));
269 m_scc->out_rtsb_callback().set("com2", FUNC(rs232_port_device::write_rts));
270 m_scc->out_int_callback().set("cpu_irq", FUNC(input_merger_device::in_w<0>));
271
272 ACIA6850(config, m_acia[0]);
273 m_acia[0]->txd_handler().set("kbd", FUNC(informer_207_376_kbd_hle_device::rx_w));
274 m_acia[0]->irq_handler().set("cpu_irq", FUNC(input_merger_device::in_w<1>));
275 m_acia[0]->rts_handler().set(m_novram[0], FUNC(x2212_device::store)).invert();
276 m_acia[0]->rts_handler().append(m_novram[1], FUNC(x2212_device::store)).invert();
277
278 ACIA6850(config, m_acia[1]);
279 m_acia[1]->txd_handler().set("printer", FUNC(rs232_port_device::write_txd));
280
281 rs232_port_device &com1(RS232_PORT(config, "com1", default_rs232_devices, nullptr));
282 com1.rxd_handler().set(m_scc, FUNC(scc85c30_device::rxa_w));
283 com1.dcd_handler().set(m_scc, FUNC(scc85c30_device::dcda_w));
284 com1.cts_handler().set(m_scc, FUNC(scc85c30_device::ctsa_w));
285
286 rs232_port_device &com2(RS232_PORT(config, "com2", default_rs232_devices, nullptr));
287 com2.rxd_handler().set(m_scc, FUNC(scc85c30_device::rxb_w));
288 com2.dcd_handler().set(m_scc, FUNC(scc85c30_device::dcdb_w));
289 com2.cts_handler().set(m_scc, FUNC(scc85c30_device::ctsb_w));
290
291 RS232_PORT(config, "printer", printer_devices, nullptr);
292
293 informer_207_376_kbd_hle_device &kbd(INFORMER_207_376_KBD_HLE(config, "kbd"));
294 kbd.tx_handler().set(m_acia[0], FUNC(acia6850_device::write_rxd));
295
296 // video
297 SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
298 m_screen->set_color(rgb_t::green());
299 m_screen->set_raw(36_MHz_XTAL / 2.5, 800, 0, 640, 300, 0, 286);
300 m_screen->set_screen_update(m_crtc, FUNC(mc6845_device::screen_update));
301
302 PALETTE(config, m_palette, palette_device::MONOCHROME);
303
304 GFXDECODE(config, "gfxdecode", m_palette, chars);
305
306 MC6845(config, m_crtc, 36_MHz_XTAL / 20);
307 m_crtc->set_screen("screen");
308 m_crtc->set_show_border_area(false);
309 m_crtc->set_char_width(8);
310 m_crtc->set_update_row_callback(FUNC(informer_207_376_state::crtc_update_row));
311
312 // sound
313 SPEAKER(config, "mono").front_center();
314 BEEP(config, "beep", 500).add_route(ALL_OUTPUTS, "mono", 0.50); // frequency unknown
315 }
316
317
318 //**************************************************************************
319 // ROM DEFINITIONS
320 //**************************************************************************
321
322 ROM_START( in207376 )
323 ROM_REGION(0x6000, "maincpu", 0)
324 // M2764A F1
325 // 79590-023 376SNA V1.00 201C 7224 (checksum matches)
326 ROM_LOAD("79590-023.z37", 0x0000, 0x2000, CRC(61d49637) SHA1(aabcd55af88ff0b6a198eef04a88f58cc8f65dcc))
327 // M27128AF1
328 // 79589-023 376 SNAV1.00 201C E86F (checksum matches)
329 ROM_LOAD("79589-023.z36", 0x2000, 0x4000, CRC(cdfaf629) SHA1(1f21ef6848020726ef3d7ab05166ac8590d58476))
330
331 ROM_REGION(0x1000, "chargen", 0)
332 // TMS2732AGL-25
333 // 79573-001 V1.00 376/8 CHAR. GEN.
334 ROM_LOAD("79573-001.z6", 0x0000, 0x1000, CRC(f704b827) SHA1(bcc56eeb8681c2bebe3a9f4b6b78c0373c06d875))
335 ROM_END
336
337
338 //**************************************************************************
339 // SYSTEM DRIVERS
340 //**************************************************************************
341
342 // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
343 COMP( 1986, in207376, 0, 0, informer_207_376, informer_207_376, informer_207_376_state, empty_init, "Informer", "Informer 207/376", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
344