Previous 199869 Revisions Next

r30941 Wednesday 11th June, 2014 at 12:04:35 UTC by Curt Coder
(MESS) ex800: Refactored Epson EX-800 from a driver into a Centronics device. (nw)
[src/emu/bus]bus.mak
[src/emu/bus/centronics]ctronics.c epson_ex800.c* epson_ex800.h* epson_lx800.c epson_lx800.h
[src/emu/layout]ex800.lay*
[src/mess]mess.lst mess.mak
[src/mess/drivers]ex800.c
[src/mess/layout]ex800.lay

trunk/src/emu/layout/ex800.lay
r0r30941
1<?xml version="1.0"?>
2
3<!-- license: MAME, GPL-2.0+ -->
4<!-- copyright-holders: Dirk Best -->
5
6<mamelayout version="2">
7   <element name="background">
8      <rect>
9         <bounds left="0" top="0" right="1" bottom="1" />
10         <color red="0.0" green="0.0" blue="0.0" />
11      </rect>
12   </element>
13   <view name="Default Layout">
14      <bezel element="background">
15         <bounds left="0" top="0" right="1" bottom="1" />
16      </bezel>
17   </view>
18</mamelayout>
Property changes on: trunk/src/emu/layout/ex800.lay
Added: svn:mime-type
   + text/xml
Added: svn:eol-style
   + native
trunk/src/emu/bus/bus.mak
r30940r30941
738738BUSOBJS += $(BUSOBJ)/centronics/comxpl80.o
739739BUSOBJS += $(BUSOBJ)/centronics/covox.o
740740BUSOBJS += $(BUSOBJ)/centronics/dsjoy.o
741BUSOBJS += $(BUSOBJ)/centronics/epson_ex800.o
741742BUSOBJS += $(BUSOBJ)/centronics/epson_lx800.o
742743BUSOBJS += $(BUSOBJ)/centronics/printer.o
744$(BUSOBJ)/centronics/epson_ex800.o:    $(EMUOBJ)/layout/ex800.lh
743745$(BUSOBJ)/centronics/epson_lx800.o:    $(EMUOBJ)/layout/lx800.lh
744746endif
745747
trunk/src/emu/bus/centronics/epson_ex800.h
r0r30941
1// license:MAME, GPL-2.0+
2// copyright-holders:Dirk Best
3/**********************************************************************
4
5    Epson EX-800 dot matrix printer emulation
6
7    Copyright MESS Team.
8    Visit http://mamedev.org for licensing and usage restrictions.
9
10**********************************************************************/
11
12#pragma once
13
14#ifndef __EPSON_EX800__
15#define __EPSON_EX800__
16
17#include "emu.h"
18#include "ctronics.h"
19#include "cpu/upd7810/upd7810.h"
20#include "sound/beep.h"
21
22
23
24//**************************************************************************
25//  TYPE DEFINITIONS
26//**************************************************************************
27
28// ======================> epson_ex800_t
29
30class epson_ex800_t :  public device_t,
31                  public device_centronics_peripheral_interface
32{
33public:
34   // construction/destruction
35   epson_ex800_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
36   epson_ex800_t(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
37
38   // optional information overrides
39   virtual const rom_entry *device_rom_region() const;
40   virtual machine_config_constructor device_mconfig_additions() const;
41   virtual ioport_constructor device_input_ports() const;
42
43   DECLARE_READ8_MEMBER(porta_r);
44   DECLARE_READ8_MEMBER(portb_r);
45   DECLARE_READ8_MEMBER(portc_r);
46   DECLARE_WRITE8_MEMBER(porta_w);
47   DECLARE_WRITE8_MEMBER(portb_w);
48   DECLARE_WRITE8_MEMBER(portc_w);
49   DECLARE_READ8_MEMBER(devsel_r);
50   DECLARE_WRITE8_MEMBER(devsel_w);
51   DECLARE_READ8_MEMBER(gate5a_r);
52   DECLARE_WRITE8_MEMBER(gate5a_w);
53   DECLARE_READ8_MEMBER(iosel_r);
54   DECLARE_WRITE8_MEMBER(iosel_w);
55   DECLARE_READ8_MEMBER(gate7a_r);
56   DECLARE_WRITE8_MEMBER(gate7a_w);
57
58   DECLARE_INPUT_CHANGED_MEMBER(online_switch);
59
60protected:
61   // device-level overrides
62   virtual void device_start();
63   virtual void device_reset();
64
65private:
66   required_device<cpu_device> m_maincpu;
67   required_device<beep_device> m_beeper;
68
69   int m_irq_state;
70};
71
72
73
74// device type definition
75extern const device_type EPSON_EX800;
76
77
78
79#endif
Property changes on: trunk/src/emu/bus/centronics/epson_ex800.h
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/emu/bus/centronics/epson_lx800.c
r30940r30941
286286
287287void epson_lx800_t::device_start()
288288{
289}
290
291
292//-------------------------------------------------
293//  device_reset - device-specific reset
294//-------------------------------------------------
295
296void epson_lx800_t::device_reset()
297{
289298   m_beep->set_state(0);
290299   m_beep->set_frequency(4000); /* ? */
291300}
trunk/src/emu/bus/centronics/ctronics.c
r30940r30941
117117
118118
119119#include "comxpl80.h"
120#include "epson_ex800.h"
120121#include "epson_lx800.h"
121122#include "printer.h"
122123
123124SLOT_INTERFACE_START(centronics_printers)
124125   SLOT_INTERFACE("pl80", COMX_PL80)
126   SLOT_INTERFACE("ex800", EPSON_EX800)
125127   SLOT_INTERFACE("lx800", EPSON_LX800)
126128   SLOT_INTERFACE("lx810l", EPSON_LX810L)
127129   SLOT_INTERFACE("ap2000", EPSON_AP2000)
trunk/src/emu/bus/centronics/epson_lx800.h
r30940r30941
5959protected:
6060   // device-level overrides
6161   virtual void device_start();
62   virtual void device_reset();
6263
6364private:
6465   required_device<cpu_device> m_maincpu;
trunk/src/emu/bus/centronics/epson_ex800.c
r0r30941
1// license:MAME, GPL-2.0+
2// copyright-holders:Dirk Best
3/******************************************************************************
4
5    Epson EX-800 Dot Matrix printer
6
7    license: MAME, GPL-2.0+
8    copyright-holders: Dirk Best
9
10
11 --
12
13 Main CPU is a UPD7810H6 running at 12 MHz.
14
15 --
16
17 On startup, the ports are initialized as follows:
18
19 Port A lines PA0-PA7 are configured as output
20 Port B lines PB0-PB7 are configured as output
21 Port C lines PC2, PC4 and PC5 are configured as output
22        the other lines are control lines
23        PC0: TxD output
24        PC1: RxD input
25        PC3: TI input
26        PC6: CO0 output
27        PC7: CO1 output
28
29The I/O lines are connected as follows:
30
31PA0: \
32PA1:  Carriage motor
33PA2:  driving pulses
34PA3: /
35PA4: High when carriage assembly reaches either end
36PA5: High when carriage assembly reaches either end
37PA6: Bank 0
38PA7: Bank 1
39
40PB0: Line feed motor driving pulses
41PB1: Line feed motor driving pulses
42PB2: Line feed motor current control
43PB3: LED09, Online
44PB4: (used for serial port)
45PB5: ERR signal
46PB6: ACKNLG signal, data received at printer
47PB7: LED12, Paper empty
48
49PC0: TxD output
50PC1: RxD input
51PC2:
52PC3: TI input
53PC4:
54PC5:
55PC6: PWD signal of 5a
56PC7: Buzzer
57
58PD0-7: Data bus D0-D7
59
60PF0-7: Address bus A8-A15
61
62AN0: DSW 2
63AN1: DSW 1
64AN2:
65AN3:
66AN4: Print head operating temperature sensor
67AN5: Scanner Unit, Color Home sensor
68AN6:
69AN7: Color Home sensor adjust
70
71INT: Online switch
72
73
74Gate array 5a (parallel port, printer head)
75
76IN0-IN7: DATA1 to DATA8 from parallel port
77HD1-HD9: Head driving pulses
78STROBE: STROBE signal
79PWD: PC6 of CPU
80ALE: ALE of CPU
81
82Gate array 7a (inputs)
83
84- activated when carriage assembly reaches either end?
85
86PA0: Draft switch
87PA1: NLQ Roman switch
88PA2: Pica switch
89PA3: NLQ sans-serif switch
90PA4: Elite switch
91PA5: Proportional switch
92PA6: Normal switch
93PA7: Condensed switch
94
95PB0: Form feed switch
96PB1: Line feed switch
97PB2: Autoload switch
98PB3: Low when paper empty
99PB4: Low when carriage assembly is in home position
100PB5: SLCTIN (connected to parallel port), disable with DSW2-1
101PB6: AUTO FEEDXT (connected to parallel port), disable with DSW2-4
102       "When this signal is LOW, the paper is automatically fed 1 line after
103        printing."
104PB7:
105
106PC0: Dipswitch SW1-1 and SW1-2, Draft LED
107PC1: Dipswitch SW1-3 and SW1-4, Roman LED
108PC2: Dipswitch SW1-5 and SW1-6, Pica LED
109PC3: Dipswitch SW1-7 and SW1-8, Sans-Serif LED
110PC4: Dipswitch SW2-2 and SW2-3, Elite LED
111PC5: Dipswitch SW2-5 and SW2-6, Proportional LED
112PC6: Normal LED
113PC7: Condensed LED
114
115--
116
117LED state on startup:
118
119The power light comes on, then draft, pica and normal. If there is no paper,
120the paper empty LED comes on.
121
122Power LED is green, selectype LED is orange, paper out LED is red.
123
124--
125
126TODO:  - The UPD7810 core is missing analog port emulation
127       - Figure out the gate arrays (using trojan code?)
128       - (much later) write an interface so that other drivers can hook
129         into this one and use to print
130
131******************************************************************************/
132
133#include "epson_ex800.h"
134#include "ex800.lh"
135
136
137
138//**************************************************************************
139//  MACROS / CONSTANTS
140//**************************************************************************
141
142#define PA0 (data & 0x01)
143#define PA1 (data & 0x02)
144#define PA2 (data & 0x04)
145#define PA3 (data & 0x08)
146#define PA4 (data & 0x10)
147#define PA5 (data & 0x20)
148#define PA6 (data & 0x40)
149#define PA7 (data & 0x80)
150
151#define PB0 (data & 0x01)
152#define PB1 (data & 0x02)
153#define PB2 (data & 0x04)
154#define PB3 (data & 0x08)
155#define PB4 (data & 0x10)
156#define PB5 (data & 0x20)
157#define PB6 (data & 0x40)
158#define PB7 (data & 0x80)
159
160#define PC0 (data & 0x01)
161#define PC1 (data & 0x02)
162#define PC2 (data & 0x04)
163#define PC3 (data & 0x08)
164#define PC4 (data & 0x10)
165#define PC5 (data & 0x20)
166#define PC6 (data & 0x40)
167#define PC7 (data & 0x80)
168
169
170
171//**************************************************************************
172//  DEVICE DEFINITIONS
173//**************************************************************************
174
175const device_type EPSON_EX800 = &device_creator<epson_ex800_t>;
176
177
178//-------------------------------------------------
179//  ROM( ex800 )
180//-------------------------------------------------
181
182ROM_START( ex800 )
183   ROM_REGION(0x8000, "maincpu", 0)
184   ROM_LOAD("w8_pe9.9b", 0x0000, 0x8000, CRC(6dd41e9b) SHA1(8e30ead727b9317154742efd881206e9f9bbf95b))
185ROM_END
186
187
188//-------------------------------------------------
189//  rom_region - device-specific ROM region
190//-------------------------------------------------
191
192const rom_entry *epson_ex800_t::device_rom_region() const
193{
194   return ROM_NAME( ex800 );
195}
196
197
198//-------------------------------------------------
199//  ADDRESS_MAP( ex800_mem )
200//-------------------------------------------------
201
202static ADDRESS_MAP_START( ex800_mem, AS_PROGRAM, 8, epson_ex800_t )
203   AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("maincpu", 0)
204   AM_RANGE(0x8000, 0xbfff) AM_RAM /* external RAM */
205   AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x1800) AM_READWRITE(devsel_r, devsel_w)
206   AM_RANGE(0xe000, 0xe7ff) AM_READWRITE(gate5a_r, gate5a_w)
207   AM_RANGE(0xe800, 0xefff) AM_READWRITE(iosel_r, iosel_w)
208   AM_RANGE(0xf000, 0xf001) AM_MIRROR(0x07fc) AM_READ(gate7a_r)
209   AM_RANGE(0xf002, 0xf003) AM_MIRROR(0x07fc) AM_WRITE(gate7a_w)
210   AM_RANGE(0xf800, 0xfeff) AM_NOP /* not connected */
211   AM_RANGE(0xff00, 0xffff) AM_RAM /* internal CPU RAM */
212ADDRESS_MAP_END
213
214
215//-------------------------------------------------
216//  ADDRESS_MAP( ex800_io )
217//-------------------------------------------------
218
219static ADDRESS_MAP_START( ex800_io, AS_IO, 8, epson_ex800_t )
220   AM_RANGE(UPD7810_PORTA, UPD7810_PORTA) AM_READ(porta_r) AM_WRITE(porta_w)
221   AM_RANGE(UPD7810_PORTB, UPD7810_PORTB) AM_READ(portb_r) AM_WRITE(portb_w)
222   AM_RANGE(UPD7810_PORTC, UPD7810_PORTC) AM_READ(portc_r) AM_WRITE(portc_w)
223ADDRESS_MAP_END
224
225
226//-------------------------------------------------
227//  MACHINE_DRIVER( epson_ex800 )
228//-------------------------------------------------
229
230static MACHINE_CONFIG_FRAGMENT( epson_ex800 )
231   /* basic machine hardware */
232   MCFG_CPU_ADD("maincpu", UPD7810, 12000000)  /* 12 MHz? */
233   MCFG_CPU_PROGRAM_MAP(ex800_mem)
234   MCFG_CPU_IO_MAP(ex800_io)
235
236
237   MCFG_DEFAULT_LAYOUT(layout_ex800)
238
239   /* audio hardware */
240   MCFG_SPEAKER_STANDARD_MONO("mono")
241   MCFG_SOUND_ADD("beeper", BEEP, 0)
242   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
243MACHINE_CONFIG_END
244
245
246//-------------------------------------------------
247//  machine_config_additions - device-specific
248//  machine configurations
249//-------------------------------------------------
250
251machine_config_constructor epson_ex800_t::device_mconfig_additions() const
252{
253   return MACHINE_CONFIG_NAME( epson_ex800 );
254}
255
256
257/* The ON LINE switch is directly connected to the INT1 input of the CPU */
258INPUT_CHANGED_MEMBER(epson_ex800_t::online_switch)
259{
260   if (newval)
261   {
262      m_maincpu->set_input_line(UPD7810_INTF1, m_irq_state);
263      m_irq_state = (m_irq_state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
264   }
265}
266
267
268//-------------------------------------------------
269//  INPUT_PORTS( epson_ex800 )
270//-------------------------------------------------
271
272INPUT_PORTS_START( epson_ex800 )
273   PORT_START("ONLISW")
274   PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED)
275   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON LINE")   PORT_CODE(KEYCODE_F9) PORT_CHANGED_MEMBER(DEVICE_SELF, epson_ex800_t, online_switch, NULL)
276
277   PORT_START("FEED")
278   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
279   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FORM FEED") PORT_CODE(KEYCODE_F10)
280   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F11)
281
282   PORT_START("SelecType")
283   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Draft")          PORT_CODE(KEYCODE_F8)
284   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Roman")      PORT_CODE(KEYCODE_F7)
285   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Pica")           PORT_CODE(KEYCODE_F6)
286   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Sans Serif") PORT_CODE(KEYCODE_F5)
287   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Elite")          PORT_CODE(KEYCODE_F4)
288   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Proportional")   PORT_CODE(KEYCODE_F3)
289   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR(Normal))  PORT_CODE(KEYCODE_F2)
290   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Condensed")      PORT_CODE(KEYCODE_F1)
291
292   PORT_START("DSW_1")
293   PORT_DIPNAME(0x01, 0x00, "Condensed characters")
294   PORT_DIPSETTING(   0x00, DEF_STR(Off))
295   PORT_DIPSETTING(   0x01, DEF_STR(On))
296   PORT_DIPNAME(0x02, 0x00, "Slashed zero")
297   PORT_DIPSETTING(   0x00, DEF_STR(Off))
298   PORT_DIPSETTING(   0x02, DEF_STR(On))
299   PORT_DIPNAME(0x04, 0x00, "Character table")
300   PORT_DIPSETTING(   0x00, "Italics")
301   PORT_DIPSETTING(   0x04, "Graphics")
302   PORT_DIPNAME(0x08, 0x00, "Printer commands")
303   PORT_DIPSETTING(   0x00, "ESC/P")
304   PORT_DIPSETTING(   0x08, "IBM printer emulation")
305   PORT_DIPNAME(0x10, 0x00, "Print quality")
306   PORT_DIPSETTING(   0x00, "Draft")
307   PORT_DIPSETTING(   0x10, "NLQ")
308   PORT_DIPNAME(0xe0, 0x00, "Int. character set")
309   PORT_DIPSETTING(   0x00, DEF_STR(USA))
310   PORT_DIPSETTING(   0x20, DEF_STR(French))
311   PORT_DIPSETTING(   0x30, DEF_STR(German))
312   PORT_DIPSETTING(   0x40, "UK")
313   PORT_DIPSETTING(   0x50, "Danish")
314   PORT_DIPSETTING(   0x60, "Swedish")
315   PORT_DIPSETTING(   0x70, DEF_STR(Italian))
316   PORT_DIPSETTING(   0x80, DEF_STR(Spanish))
317
318   PORT_START("DSW_2")
319   PORT_DIPNAME(0x01, 0x00, "Page length")
320   PORT_DIPSETTING(   0x00, "11 inch")
321   PORT_DIPSETTING(   0x01, "12 inch")
322   PORT_DIPNAME(0x02, 0x00, "Auto. sheet feeder")
323   PORT_DIPSETTING(   0x00, "Canceled")
324   PORT_DIPSETTING(   0x02, "Selected")
325   PORT_DIPNAME(0x04, 0x00, "Skip-over-perforation")
326   PORT_DIPSETTING(   0x00, DEF_STR(None))
327   PORT_DIPSETTING(   0x04, "1 inch")
328   PORT_DIPNAME(0x08, 0x00, "Add LF after CR")
329   PORT_DIPSETTING(   0x00, "CR only")
330   PORT_DIPSETTING(   0x08, "CR + LF")
331   PORT_DIPNAME(0x30, 0x00, "Interface type")
332   PORT_DIPSETTING(   0x00, "Parallel")
333   PORT_DIPSETTING(   0x10, "Serial (odd parity)")
334   PORT_DIPSETTING(   0x20, "Serial (even parity)")
335   PORT_DIPSETTING(   0x30, "Serial (no parity)")
336   PORT_DIPNAME(0xc0, 0x00, "Baud rate")
337   PORT_DIPSETTING(   0x00, "9600")
338   PORT_DIPSETTING(   0x40, "4800")
339   PORT_DIPSETTING(   0x80, "1200")
340   PORT_DIPSETTING(   0xc0, "300")
341INPUT_PORTS_END
342
343
344//-------------------------------------------------
345//  input_ports - device-specific input ports
346//-------------------------------------------------
347
348ioport_constructor epson_ex800_t::device_input_ports() const
349{
350   return INPUT_PORTS_NAME( epson_ex800 );
351}
352
353
354
355//**************************************************************************
356//  LIVE DEVICE
357//**************************************************************************
358
359//-------------------------------------------------
360//  epson_ex800_t - constructor
361//-------------------------------------------------
362
363epson_ex800_t::epson_ex800_t(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
364   device_t(mconfig, EPSON_EX800, "Epson EX-800", tag, owner, clock, "ex800", __FILE__),
365   device_centronics_peripheral_interface(mconfig, *this),
366   m_maincpu(*this, "maincpu"),
367   m_beeper(*this, "beeper")
368{
369}
370
371
372//-------------------------------------------------
373//  device_start - device-specific startup
374//-------------------------------------------------
375
376void epson_ex800_t::device_start()
377{
378   m_irq_state = ASSERT_LINE;
379}
380
381
382//-------------------------------------------------
383//  device_reset - device-specific reset
384//-------------------------------------------------
385
386void epson_ex800_t::device_reset()
387{
388   /* Setup beep */
389   m_beeper->set_state(0);
390   m_beeper->set_frequency(4000); /* measured at 4000 Hz */
391}
392
393
394READ8_MEMBER(epson_ex800_t::porta_r)
395{
396   logerror("PA R @%x\n", space.device().safe_pc());
397   return machine().rand();
398}
399
400READ8_MEMBER(epson_ex800_t::portb_r)
401{
402   logerror("PB R @%x\n", space.device().safe_pc());
403   return machine().rand();
404}
405
406READ8_MEMBER(epson_ex800_t::portc_r)
407{
408   logerror("PC R @%x\n", space.device().safe_pc());
409   return machine().rand();
410}
411
412WRITE8_MEMBER(epson_ex800_t::porta_w)
413{
414   if (PA6) logerror("BNK0 selected.\n");
415   if (PA7) logerror("BNK1 selected.\n");
416
417   logerror("PA W %x @%x\n", data, space.device().safe_pc());
418}
419
420WRITE8_MEMBER(epson_ex800_t::portb_w)
421{
422   if (data & 3)
423      logerror("PB0/1 Line feed @%x\n", space.device().safe_pc());
424   if (!(data & 4))
425      logerror("PB2 Line feed @%x\n", space.device().safe_pc());
426   if (data & 8)
427      logerror("PB3 Online LED on @%x\n", space.device().safe_pc());
428   else
429      logerror("PB3 Online LED off @%x\n", space.device().safe_pc());
430   if (data & 16)
431      logerror("PB4 Serial @%x\n", space.device().safe_pc());
432   if (data & 32)
433      logerror("PB4 Serial @%x\n", space.device().safe_pc());
434   if (data & 64)
435      logerror("PB4 Serial @%x\n", space.device().safe_pc());
436   if (data & 128)
437      logerror("PB3 Paper empty LED on @%x\n", space.device().safe_pc());
438   else
439      logerror("PB3 Paper empty LED off @%x\n", space.device().safe_pc());
440
441//  logerror("PB W %x @%x\n", data, space.device().safe_pc());
442}
443
444WRITE8_MEMBER(epson_ex800_t::portc_w)
445{
446   if (data & 0x80)
447      m_beeper->set_state(0);
448   else
449      m_beeper->set_state(1);
450
451   logerror("PC W %x @%x\n", data, space.device().safe_pc());
452}
453
454
455/* Memory mapped I/O access */
456
457READ8_MEMBER(epson_ex800_t::devsel_r)
458{
459   logerror("DEVSEL R @%x with offset %x\n", space.device().safe_pc(), offset);
460   return machine().rand();
461}
462
463WRITE8_MEMBER(epson_ex800_t::devsel_w)
464{
465   logerror("DEVSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
466}
467
468READ8_MEMBER(epson_ex800_t::gate5a_r)
469{
470   logerror("GATE5A R @%x with offset %x\n", space.device().safe_pc(), offset);
471   return machine().rand();
472}
473
474WRITE8_MEMBER(epson_ex800_t::gate5a_w)
475{
476   logerror("GATE5A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
477}
478
479READ8_MEMBER(epson_ex800_t::iosel_r)
480{
481   logerror("IOSEL R @%x with offset %x\n", space.device().safe_pc(), offset);
482   return machine().rand();
483}
484
485WRITE8_MEMBER(epson_ex800_t::iosel_w)
486{
487   logerror("IOSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
488}
489
490READ8_MEMBER(epson_ex800_t::gate7a_r)
491{
492   logerror("GATE7A R @%x with offset %x\n", space.device().safe_pc(), offset);
493   return machine().rand();
494}
495
496WRITE8_MEMBER(epson_ex800_t::gate7a_w)
497{
498   logerror("GATE7A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
499}
Property changes on: trunk/src/emu/bus/centronics/epson_ex800.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/layout/ex800.lay
r30940r30941
1<?xml version="1.0"?>
2
3<!-- license: MAME, GPL-2.0+ -->
4<!-- copyright-holders: Dirk Best -->
5
6<mamelayout version="2">
7   <element name="background">
8      <rect>
9         <bounds left="0" top="0" right="1" bottom="1" />
10         <color red="0.0" green="0.0" blue="0.0" />
11      </rect>
12   </element>
13   <view name="Default Layout">
14      <bezel element="background">
15         <bounds left="0" top="0" right="1" bottom="1" />
16      </bezel>
17   </view>
18</mamelayout>
trunk/src/mess/drivers/ex800.c
r30940r30941
1/******************************************************************************
2
3    Epson EX-800 Dot Matrix printer
4
5    license: MAME, GPL-2.0+
6    copyright-holders: Dirk Best
7
8
9 --
10
11 Main CPU is a UPD7810H6 running at 12 MHz.
12
13 --
14
15 On startup, the ports are initialized as follows:
16
17 Port A lines PA0-PA7 are configured as output
18 Port B lines PB0-PB7 are configured as output
19 Port C lines PC2, PC4 and PC5 are configured as output
20        the other lines are control lines
21        PC0: TxD output
22        PC1: RxD input
23        PC3: TI input
24        PC6: CO0 output
25        PC7: CO1 output
26
27The I/O lines are connected as follows:
28
29PA0: \
30PA1:  Carriage motor
31PA2:  driving pulses
32PA3: /
33PA4: High when carriage assembly reaches either end
34PA5: High when carriage assembly reaches either end
35PA6: Bank 0
36PA7: Bank 1
37
38PB0: Line feed motor driving pulses
39PB1: Line feed motor driving pulses
40PB2: Line feed motor current control
41PB3: LED09, Online
42PB4: (used for serial port)
43PB5: ERR signal
44PB6: ACKNLG signal, data received at printer
45PB7: LED12, Paper empty
46
47PC0: TxD output
48PC1: RxD input
49PC2:
50PC3: TI input
51PC4:
52PC5:
53PC6: PWD signal of 5a
54PC7: Buzzer
55
56PD0-7: Data bus D0-D7
57
58PF0-7: Address bus A8-A15
59
60AN0: DSW 2
61AN1: DSW 1
62AN2:
63AN3:
64AN4: Print head operating temperature sensor
65AN5: Scanner Unit, Color Home sensor
66AN6:
67AN7: Color Home sensor adjust
68
69INT: Online switch
70
71
72Gate array 5a (parallel port, printer head)
73
74IN0-IN7: DATA1 to DATA8 from parallel port
75HD1-HD9: Head driving pulses
76STROBE: STROBE signal
77PWD: PC6 of CPU
78ALE: ALE of CPU
79
80Gate array 7a (inputs)
81
82- activated when carriage assembly reaches either end?
83
84PA0: Draft switch
85PA1: NLQ Roman switch
86PA2: Pica switch
87PA3: NLQ sans-serif switch
88PA4: Elite switch
89PA5: Proportional switch
90PA6: Normal switch
91PA7: Condensed switch
92
93PB0: Form feed switch
94PB1: Line feed switch
95PB2: Autoload switch
96PB3: Low when paper empty
97PB4: Low when carriage assembly is in home position
98PB5: SLCTIN (connected to parallel port), disable with DSW2-1
99PB6: AUTO FEEDXT (connected to parallel port), disable with DSW2-4
100       "When this signal is LOW, the paper is automatically fed 1 line after
101        printing."
102PB7:
103
104PC0: Dipswitch SW1-1 and SW1-2, Draft LED
105PC1: Dipswitch SW1-3 and SW1-4, Roman LED
106PC2: Dipswitch SW1-5 and SW1-6, Pica LED
107PC3: Dipswitch SW1-7 and SW1-8, Sans-Serif LED
108PC4: Dipswitch SW2-2 and SW2-3, Elite LED
109PC5: Dipswitch SW2-5 and SW2-6, Proportional LED
110PC6: Normal LED
111PC7: Condensed LED
112
113--
114
115LED state on startup:
116
117The power light comes on, then draft, pica and normal. If there is no paper,
118the paper empty LED comes on.
119
120Power LED is green, selectype LED is orange, paper out LED is red.
121
122--
123
124TODO:  - The UPD7810 core is missing analog port emulation
125       - Figure out the gate arrays (using trojan code?)
126       - (much later) write an interface so that other drivers can hook
127         into this one and use to print
128
129******************************************************************************/
130
131#include "emu.h"
132#include "cpu/upd7810/upd7810.h"
133#include "sound/beep.h"
134#include "ex800.lh"
135
136
137class ex800_state : public driver_device
138{
139public:
140   ex800_state(const machine_config &mconfig, device_type type, const char *tag)
141      : driver_device(mconfig, type, tag) ,
142      m_maincpu(*this, "maincpu"),
143      m_beeper(*this, "beeper") { }
144
145   int m_irq_state;
146   DECLARE_READ8_MEMBER(ex800_porta_r);
147   DECLARE_READ8_MEMBER(ex800_portb_r);
148   DECLARE_READ8_MEMBER(ex800_portc_r);
149   DECLARE_WRITE8_MEMBER(ex800_porta_w);
150   DECLARE_WRITE8_MEMBER(ex800_portb_w);
151   DECLARE_WRITE8_MEMBER(ex800_portc_w);
152   DECLARE_READ8_MEMBER(ex800_devsel_r);
153   DECLARE_WRITE8_MEMBER(ex800_devsel_w);
154   DECLARE_READ8_MEMBER(ex800_gate5a_r);
155   DECLARE_WRITE8_MEMBER(ex800_gate5a_w);
156   DECLARE_READ8_MEMBER(ex800_iosel_r);
157   DECLARE_WRITE8_MEMBER(ex800_iosel_w);
158   DECLARE_READ8_MEMBER(ex800_gate7a_r);
159   DECLARE_WRITE8_MEMBER(ex800_gate7a_w);
160   virtual void machine_start();
161   DECLARE_INPUT_CHANGED_MEMBER(online_switch);
162   required_device<cpu_device> m_maincpu;
163   required_device<beep_device> m_beeper;
164};
165
166
167
168#define PA0 (data & 0x01)
169#define PA1 (data & 0x02)
170#define PA2 (data & 0x04)
171#define PA3 (data & 0x08)
172#define PA4 (data & 0x10)
173#define PA5 (data & 0x20)
174#define PA6 (data & 0x40)
175#define PA7 (data & 0x80)
176
177#define PB0 (data & 0x01)
178#define PB1 (data & 0x02)
179#define PB2 (data & 0x04)
180#define PB3 (data & 0x08)
181#define PB4 (data & 0x10)
182#define PB5 (data & 0x20)
183#define PB6 (data & 0x40)
184#define PB7 (data & 0x80)
185
186#define PC0 (data & 0x01)
187#define PC1 (data & 0x02)
188#define PC2 (data & 0x04)
189#define PC3 (data & 0x08)
190#define PC4 (data & 0x10)
191#define PC5 (data & 0x20)
192#define PC6 (data & 0x40)
193#define PC7 (data & 0x80)
194
195
196/******************************************************************************
197 Misc (will be moved to other files)
198******************************************************************************/
199
200
201/* The ON LINE switch is directly connected to the INT1 input of the CPU */
202INPUT_CHANGED_MEMBER(ex800_state::online_switch)
203{
204   if (newval)
205   {
206      m_maincpu->set_input_line(UPD7810_INTF1, m_irq_state);
207      m_irq_state = (m_irq_state == ASSERT_LINE) ? CLEAR_LINE : ASSERT_LINE;
208   }
209}
210
211
212void ex800_state::machine_start()
213{
214   m_irq_state = ASSERT_LINE;
215   /* Setup beep */
216   m_beeper->set_state(0);
217   m_beeper->set_frequency(4000); /* measured at 4000 Hz */
218}
219
220
221READ8_MEMBER(ex800_state::ex800_porta_r)
222{
223   logerror("PA R @%x\n", space.device().safe_pc());
224   return machine().rand();
225}
226
227READ8_MEMBER(ex800_state::ex800_portb_r)
228{
229   logerror("PB R @%x\n", space.device().safe_pc());
230   return machine().rand();
231}
232
233READ8_MEMBER(ex800_state::ex800_portc_r)
234{
235   logerror("PC R @%x\n", space.device().safe_pc());
236   return machine().rand();
237}
238
239WRITE8_MEMBER(ex800_state::ex800_porta_w)
240{
241   if (PA6) logerror("BNK0 selected.\n");
242   if (PA7) logerror("BNK1 selected.\n");
243
244   logerror("PA W %x @%x\n", data, space.device().safe_pc());
245}
246
247WRITE8_MEMBER(ex800_state::ex800_portb_w)
248{
249   if (data & 3)
250      logerror("PB0/1 Line feed @%x\n", space.device().safe_pc());
251   if (!(data & 4))
252      logerror("PB2 Line feed @%x\n", space.device().safe_pc());
253   if (data & 8)
254      logerror("PB3 Online LED on @%x\n", space.device().safe_pc());
255   else
256      logerror("PB3 Online LED off @%x\n", space.device().safe_pc());
257   if (data & 16)
258      logerror("PB4 Serial @%x\n", space.device().safe_pc());
259   if (data & 32)
260      logerror("PB4 Serial @%x\n", space.device().safe_pc());
261   if (data & 64)
262      logerror("PB4 Serial @%x\n", space.device().safe_pc());
263   if (data & 128)
264      logerror("PB3 Paper empty LED on @%x\n", space.device().safe_pc());
265   else
266      logerror("PB3 Paper empty LED off @%x\n", space.device().safe_pc());
267
268//  logerror("PB W %x @%x\n", data, space.device().safe_pc());
269}
270
271WRITE8_MEMBER(ex800_state::ex800_portc_w)
272{
273   if (data & 0x80)
274      m_beeper->set_state(0);
275   else
276      m_beeper->set_state(1);
277
278   logerror("PC W %x @%x\n", data, space.device().safe_pc());
279}
280
281
282/* Memory mapped I/O access */
283
284READ8_MEMBER(ex800_state::ex800_devsel_r)
285{
286   logerror("DEVSEL R @%x with offset %x\n", space.device().safe_pc(), offset);
287   return machine().rand();
288}
289
290WRITE8_MEMBER(ex800_state::ex800_devsel_w)
291{
292   logerror("DEVSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
293}
294
295READ8_MEMBER(ex800_state::ex800_gate5a_r)
296{
297   logerror("GATE5A R @%x with offset %x\n", space.device().safe_pc(), offset);
298   return machine().rand();
299}
300
301WRITE8_MEMBER(ex800_state::ex800_gate5a_w)
302{
303   logerror("GATE5A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
304}
305
306READ8_MEMBER(ex800_state::ex800_iosel_r)
307{
308   logerror("IOSEL R @%x with offset %x\n", space.device().safe_pc(), offset);
309   return machine().rand();
310}
311
312WRITE8_MEMBER(ex800_state::ex800_iosel_w)
313{
314   logerror("IOSEL W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
315}
316
317READ8_MEMBER(ex800_state::ex800_gate7a_r)
318{
319   logerror("GATE7A R @%x with offset %x\n", space.device().safe_pc(), offset);
320   return machine().rand();
321}
322
323WRITE8_MEMBER(ex800_state::ex800_gate7a_w)
324{
325   logerror("GATE7A W %x @%x with offset %x\n", data, space.device().safe_pc(), offset);
326}
327
328
329/******************************************************************************
330 Address Maps
331******************************************************************************/
332
333
334static ADDRESS_MAP_START( ex800_mem, AS_PROGRAM, 8, ex800_state )
335   AM_RANGE(0x0000, 0x7fff) AM_ROM AM_REGION("maincpu", 0)
336   AM_RANGE(0x8000, 0xbfff) AM_RAM /* external RAM */
337   AM_RANGE(0xc000, 0xc7ff) AM_MIRROR(0x1800) AM_READWRITE(ex800_devsel_r, ex800_devsel_w)
338   AM_RANGE(0xe000, 0xe7ff) AM_READWRITE(ex800_gate5a_r, ex800_gate5a_w)
339   AM_RANGE(0xe800, 0xefff) AM_READWRITE(ex800_iosel_r, ex800_iosel_w)
340   AM_RANGE(0xf000, 0xf001) AM_MIRROR(0x07fc) AM_READ(ex800_gate7a_r)
341   AM_RANGE(0xf002, 0xf003) AM_MIRROR(0x07fc) AM_WRITE(ex800_gate7a_w)
342   AM_RANGE(0xf800, 0xfeff) AM_NOP /* not connected */
343   AM_RANGE(0xff00, 0xffff) AM_RAM /* internal CPU RAM */
344ADDRESS_MAP_END
345
346
347static ADDRESS_MAP_START( ex800_io, AS_IO, 8, ex800_state )
348   AM_RANGE(UPD7810_PORTA, UPD7810_PORTA) AM_READ(ex800_porta_r) AM_WRITE(ex800_porta_w)
349   AM_RANGE(UPD7810_PORTB, UPD7810_PORTB) AM_READ(ex800_portb_r) AM_WRITE(ex800_portb_w)
350   AM_RANGE(UPD7810_PORTC, UPD7810_PORTC) AM_READ(ex800_portc_r) AM_WRITE(ex800_portc_w)
351ADDRESS_MAP_END
352
353
354
355/******************************************************************************
356 Inputs and DIP switches
357******************************************************************************/
358
359
360static INPUT_PORTS_START( ex800 )
361   PORT_START("ONLISW")
362   PORT_BIT(0xfe, IP_ACTIVE_HIGH, IPT_UNUSED)
363   PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("ON LINE")   PORT_CODE(KEYCODE_F9) PORT_CHANGED_MEMBER(DEVICE_SELF, ex800_state, online_switch, NULL)
364
365   PORT_START("FEED")
366   PORT_BIT(0xfc, IP_ACTIVE_LOW, IPT_UNUSED)
367   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("FORM FEED") PORT_CODE(KEYCODE_F10)
368   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("LINE FEED") PORT_CODE(KEYCODE_F11)
369
370   PORT_START("SelecType")
371   PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Draft")          PORT_CODE(KEYCODE_F8)
372   PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Roman")      PORT_CODE(KEYCODE_F7)
373   PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Pica")           PORT_CODE(KEYCODE_F6)
374   PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("NLQ Sans Serif") PORT_CODE(KEYCODE_F5)
375   PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Elite")          PORT_CODE(KEYCODE_F4)
376   PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Proportional")   PORT_CODE(KEYCODE_F3)
377   PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME(DEF_STR(Normal))  PORT_CODE(KEYCODE_F2)
378   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Condensed")      PORT_CODE(KEYCODE_F1)
379
380   PORT_START("DSW_1")
381   PORT_DIPNAME(0x01, 0x00, "Condensed characters")
382   PORT_DIPSETTING(   0x00, DEF_STR(Off))
383   PORT_DIPSETTING(   0x01, DEF_STR(On))
384   PORT_DIPNAME(0x02, 0x00, "Slashed zero")
385   PORT_DIPSETTING(   0x00, DEF_STR(Off))
386   PORT_DIPSETTING(   0x02, DEF_STR(On))
387   PORT_DIPNAME(0x04, 0x00, "Character table")
388   PORT_DIPSETTING(   0x00, "Italics")
389   PORT_DIPSETTING(   0x04, "Graphics")
390   PORT_DIPNAME(0x08, 0x00, "Printer commands")
391   PORT_DIPSETTING(   0x00, "ESC/P")
392   PORT_DIPSETTING(   0x08, "IBM printer emulation")
393   PORT_DIPNAME(0x10, 0x00, "Print quality")
394   PORT_DIPSETTING(   0x00, "Draft")
395   PORT_DIPSETTING(   0x10, "NLQ")
396   PORT_DIPNAME(0xe0, 0x00, "Int. character set")
397   PORT_DIPSETTING(   0x00, DEF_STR(USA))
398   PORT_DIPSETTING(   0x20, DEF_STR(French))
399   PORT_DIPSETTING(   0x30, DEF_STR(German))
400   PORT_DIPSETTING(   0x40, "UK")
401   PORT_DIPSETTING(   0x50, "Danish")
402   PORT_DIPSETTING(   0x60, "Swedish")
403   PORT_DIPSETTING(   0x70, DEF_STR(Italian))
404   PORT_DIPSETTING(   0x80, DEF_STR(Spanish))
405
406   PORT_START("DSW_2")
407   PORT_DIPNAME(0x01, 0x00, "Page length")
408   PORT_DIPSETTING(   0x00, "11 inch")
409   PORT_DIPSETTING(   0x01, "12 inch")
410   PORT_DIPNAME(0x02, 0x00, "Auto. sheet feeder")
411   PORT_DIPSETTING(   0x00, "Canceled")
412   PORT_DIPSETTING(   0x02, "Selected")
413   PORT_DIPNAME(0x04, 0x00, "Skip-over-perforation")
414   PORT_DIPSETTING(   0x00, DEF_STR(None))
415   PORT_DIPSETTING(   0x04, "1 inch")
416   PORT_DIPNAME(0x08, 0x00, "Add LF after CR")
417   PORT_DIPSETTING(   0x00, "CR only")
418   PORT_DIPSETTING(   0x08, "CR + LF")
419   PORT_DIPNAME(0x30, 0x00, "Interface type")
420   PORT_DIPSETTING(   0x00, "Parallel")
421   PORT_DIPSETTING(   0x10, "Serial (odd parity)")
422   PORT_DIPSETTING(   0x20, "Serial (even parity)")
423   PORT_DIPSETTING(   0x30, "Serial (no parity)")
424   PORT_DIPNAME(0xc0, 0x00, "Baud rate")
425   PORT_DIPSETTING(   0x00, "9600")
426   PORT_DIPSETTING(   0x40, "4800")
427   PORT_DIPSETTING(   0x80, "1200")
428   PORT_DIPSETTING(   0xc0, "300")
429INPUT_PORTS_END
430
431
432
433/******************************************************************************
434 Machine Drivers
435******************************************************************************/
436
437
438static MACHINE_CONFIG_START( ex800, ex800_state )
439   /* basic machine hardware */
440   MCFG_CPU_ADD("maincpu", UPD7810, 12000000)  /* 12 MHz? */
441   MCFG_CPU_PROGRAM_MAP(ex800_mem)
442   MCFG_CPU_IO_MAP(ex800_io)
443
444
445   MCFG_DEFAULT_LAYOUT(layout_ex800)
446
447   /* audio hardware */
448   MCFG_SPEAKER_STANDARD_MONO("mono")
449   MCFG_SOUND_ADD("beeper", BEEP, 0)
450   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
451MACHINE_CONFIG_END
452
453
454
455/******************************************************************************
456 ROM Definitions
457******************************************************************************/
458
459
460ROM_START( ex800 )
461   ROM_REGION(0x8000, "maincpu", 0)
462   ROM_LOAD("w8_pe9.9b", 0x0000, 0x8000, CRC(6dd41e9b) SHA1(8e30ead727b9317154742efd881206e9f9bbf95b))
463ROM_END
464
465
466
467/******************************************************************************
468 Drivers
469******************************************************************************/
470
471
472/*    YEAR  NAME   PARENT  COMPAT  MACHINE INPUT  INIT   COMPANY  FULLNAME  FLAGS */
473COMP( 1986, ex800,      0,      0, ex800,  ex800, driver_device, 0,     "Epson", "EX-800", GAME_NO_SOUND | GAME_NOT_WORKING)
trunk/src/mess/mess.mak
r30940r30941
12661266   $(MESS_AUDIO)/upd1771.o     \
12671267
12681268$(MESSOBJ)/epson.a:             \
1269   $(MESS_DRIVERS)/ex800.o     \
12701269   $(MESS_DRIVERS)/hx20.o      \
12711270   $(MESS_MACHINE)/e05a03.o    \
12721271   $(MESS_DRIVERS)/px4.o       \
r30940r30941
22712270$(MESS_MACHINE)/esqvfd.o:   $(MESS_LAYOUT)/esq2by40.lh \
22722271                     $(MESS_LAYOUT)/esq1by22.lh
22732272$(MESS_DRIVERS)/et3400.o:   $(MESS_LAYOUT)/et3400.lh
2274$(MESS_DRIVERS)/ex800.o:    $(MESS_LAYOUT)/ex800.lh
22752273$(MESS_DRIVERS)/fidelz80.o: $(MESS_LAYOUT)/fidelz80.lh \
22762274                     $(MESS_LAYOUT)/bridgec3.lh \
22772275                     $(MESS_LAYOUT)/vsc.lh
trunk/src/mess/mess.lst
r30940r30941
19851985
19861986//********** Misc **********************************************************
19871987
1988ex800 // Epson EX-800 printer
19891988ssem // Manchester Small-Scale Experimental Machine, "Baby"
19901989craft // Craft, by [lft]
19911990

Previous 199869 Revisions Next


© 1997-2024 The MAME Team