Previous 15994 Revisions Next

r5292 Wednesday 22nd July, 2009 at 06:27:25 UTC by Justin Kerk
Missed one eol-style
[src/mess/drivers]lx800.c

src/mess/drivers/lx800.c
r5291r5292
1/***************************************************************************
2 
3    Epson LX-800 dot matrix printer
4 
5    Skeleton driver
6 
7***************************************************************************/
8 
9#include "driver.h"
10#include "cpu/upd7810/upd7810.h"
11#include "machine/e05a03.h"
12#include "sound/beep.h"
13#include "lx800.lh"
14 
15 
16/***************************************************************************
17    TYPE DEFINITIONS
18***************************************************************************/
19 
20typedef struct _lx800_state lx800_state;
21struct _lx800_state
22{
23   const device_config *speaker;
24};
25 
26 
27/***************************************************************************
28    I/O PORTS
29***************************************************************************/
30 
31/* PA0   W  CRCOM  carriage motor, 0 = holding voltage, 1 = drive voltage
32 * PA1             not used
33 * PA2   W  PFCOM  paper feed motor, 0 = holding voltage, 1 = drive voltage
34 * PA3  R   LF SW  line feed switch
35 * PA4  R   FF SW  form feed switch
36 * PA5  R   PE SW  paper end sensor, 0 = no paper, 1 = paper
37 * PA6             not used
38 * PA7  R   P/S    P/S signal from the optional interface
39 */
40static READ8_HANDLER( lx800_porta_r )
41{
42   UINT8 result = 0;
43 
44   logerror("%s: lx800_porta_r(%02x)\n", cpuexec_describe_context(space->machine), offset);
45 
46   result |= input_port_read(space->machine, "LINEFEED") << 3;
47   result |= input_port_read(space->machine, "FORMFEED") << 4;
48   result |= 1 << 5;
49 
50   result |= 1 << 7;
51 
52   return result;
53}
54 
55static WRITE8_HANDLER( lx800_porta_w )
56{
57   logerror("%s: lx800_porta_w(%02x): %02x\n", cpuexec_describe_context(space->machine), offset, data);
58   logerror("--> carriage: %d, paper feed: %d\n", BIT(data, 0), BIT(data, 2));
59}
60 
61/* PC0   W  TXD        serial i/o txd
62 * PC1  R   RXD        serial i/o rxd
63 * PC2   W  ONLINE LP  online led
64 * PC3  R   ONLINE SW  online switch
65 * PC4   W  ERR        centronics error
66 * PC5   W  ACK        centronics acknowledge
67 * PC6   W  FIRE       drive pulse width signal
1/***************************************************************************
2
3    Epson LX-800 dot matrix printer
4
5    Skeleton driver
6
7***************************************************************************/
8
9#include "driver.h"
10#include "cpu/upd7810/upd7810.h"
11#include "machine/e05a03.h"
12#include "sound/beep.h"
13#include "lx800.lh"
14
15
16/***************************************************************************
17    TYPE DEFINITIONS
18***************************************************************************/
19
20typedef struct _lx800_state lx800_state;
21struct _lx800_state
22{
23   const device_config *speaker;
24};
25
26
27/***************************************************************************
28    I/O PORTS
29***************************************************************************/
30
31/* PA0   W  CRCOM  carriage motor, 0 = holding voltage, 1 = drive voltage
32 * PA1             not used
33 * PA2   W  PFCOM  paper feed motor, 0 = holding voltage, 1 = drive voltage
34 * PA3  R   LF SW  line feed switch
35 * PA4  R   FF SW  form feed switch
36 * PA5  R   PE SW  paper end sensor, 0 = no paper, 1 = paper
37 * PA6             not used
38 * PA7  R   P/S    P/S signal from the optional interface
39 */
40static READ8_HANDLER( lx800_porta_r )
41{
42   UINT8 result = 0;
43
44   logerror("%s: lx800_porta_r(%02x)\n", cpuexec_describe_context(space->machine), offset);
45
46   result |= input_port_read(space->machine, "LINEFEED") << 3;
47   result |= input_port_read(space->machine, "FORMFEED") << 4;
48   result |= 1 << 5;
49
50   result |= 1 << 7;
51
52   return result;
53}
54
55static WRITE8_HANDLER( lx800_porta_w )
56{
57   logerror("%s: lx800_porta_w(%02x): %02x\n", cpuexec_describe_context(space->machine), offset, data);
58   logerror("--> carriage: %d, paper feed: %d\n", BIT(data, 0), BIT(data, 2));
59}
60
61/* PC0   W  TXD        serial i/o txd
62 * PC1  R   RXD        serial i/o rxd
63 * PC2   W  ONLINE LP  online led
64 * PC3  R   ONLINE SW  online switch
65 * PC4   W  ERR        centronics error
66 * PC5   W  ACK        centronics acknowledge
67 * PC6   W  FIRE       drive pulse width signal
6868 * PC7   W  BUZZER     buzzer signal
69 */
70static READ8_HANDLER( lx800_portc_r )
71{
72   UINT8 result = 0;
73 
74   logerror("%s: lx800_portc_r(%02x)\n", cpuexec_describe_context(space->machine), offset);
75 
76   result |= input_port_read(space->machine, "ONLINE") << 3;
77 
78   return result;
79}
80 
81static WRITE8_HANDLER( lx800_portc_w )
82{
83   lx800_state *lx800 = space->machine->driver_data;
84 
85   logerror("%s: lx800_portc_w(%02x): %02x\n", cpuexec_describe_context(space->machine), offset, data);
86   logerror("--> err: %d, ack: %d, fire: %d, buzzer: %d\n", BIT(data, 4), BIT(data, 5), BIT(data, 6), BIT(data, 7));
87 
88   output_set_value("online_led", !BIT(data, 2));
89   beep_set_state(lx800->speaker, !BIT(data, 7));
90}
91 
92 
93/***************************************************************************
94    GATE ARRAY
95***************************************************************************/
96 
97static READ8_DEVICE_HANDLER( lx800_centronics_data_r )
98{
99   logerror("centronics: data read\n");
100   return 0x55;
101}
102 
103static WRITE_LINE_DEVICE_HANDLER( lx800_centronics_pe_w )
104{
105   logerror("centronics: pe = %d\n", state);
106}
107 
108static WRITE_LINE_DEVICE_HANDLER( lx800_paperempty_led_w )
109{
110   output_set_value("paperout_led", state);
111}
112 
113static WRITE_LINE_DEVICE_HANDLER( lx800_reset_w )
114{
115   cputag_reset(device->machine, "maincpu");
116}
117 
118 
119/***************************************************************************
120    MACHINE EMULATION
121***************************************************************************/
122 
123static MACHINE_START( lx800 )
124{
125   lx800_state *lx800 = machine->driver_data;
126 
127   lx800->speaker = devtag_get_device(machine, "beep");
128 
129   beep_set_state(lx800->speaker, 0);
130   beep_set_frequency(lx800->speaker, 4000); /* ? */
131}
132 
133 
134/***************************************************************************
135    ADDRESS MAPS
136***************************************************************************/
137 
138static ADDRESS_MAP_START( lx800_mem, ADDRESS_SPACE_PROGRAM, 8 )
139   AM_RANGE(0x0000, 0x7fff) AM_ROM /* 32k firmware */
140   AM_RANGE(0x8000, 0x9fff) AM_RAM /* 8k external RAM */
141   AM_RANGE(0xa000, 0xbfff) AM_NOP /* not used */
142   AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x1ff8) AM_DEVREADWRITE("ic3b", e05a03_r, e05a03_w)
143   AM_RANGE(0xe000, 0xfeff) AM_NOP /* not used */
144   AM_RANGE(0xff00, 0xffff) AM_RAM /* internal CPU RAM */
145ADDRESS_MAP_END
146 
147static ADDRESS_MAP_START( lx800_io, ADDRESS_SPACE_IO, 8 )
148   AM_RANGE(UPD7810_PORTA, UPD7810_PORTA) AM_READWRITE(lx800_porta_r, lx800_porta_w)
149   AM_RANGE(UPD7810_PORTB, UPD7810_PORTB) AM_READ_PORT("DIPSW1")
150   AM_RANGE(UPD7810_PORTC, UPD7810_PORTC) AM_READWRITE(lx800_portc_r, lx800_portc_w)
151ADDRESS_MAP_END
152 
153 
154/***************************************************************************
155    INPUT PORTS
156***************************************************************************/
157 
158static INPUT_PORTS_START( lx800 )
159   PORT_START("ONLINE")
160   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("On Line") PORT_CODE(KEYCODE_O)
161 
162   PORT_START("FORMFEED")
163   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Form Feed") PORT_CODE(KEYCODE_F)
164 
165   PORT_START("LINEFEED")
166   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_L)
167 
168   PORT_START("DIPSW1")
169   PORT_DIPNAME(0x01, 0x00, "Typeface")
170   PORT_DIPLOCATION("DIP:8")
171   PORT_DIPSETTING(0x01, "Condensed")
172   PORT_DIPSETTING(0x00, DEF_STR(Normal))
173   PORT_DIPNAME(0x02, 0x00, "ZERO font")
174   PORT_DIPLOCATION("DIP:7")
175   PORT_DIPSETTING(0x02, "0")
176   PORT_DIPSETTING(0x00, "0")
177   PORT_DIPNAME(0x04, 0x00, "Character Table")
178   PORT_DIPLOCATION("DIP:6")
179   PORT_DIPSETTING(0x04, "Graphic")
180   PORT_DIPSETTING(0x00, "Italic")
181   PORT_DIPNAME(0x08, 0x00, "Paper-out detection")
182   PORT_DIPLOCATION("DIP:5")
183   PORT_DIPSETTING(0x08, "Valid")
184   PORT_DIPSETTING(0x00, "Invalid")
185   PORT_DIPNAME(0x10, 0x00, "Printing quality")
186   PORT_DIPLOCATION("DIP:4")
187   PORT_DIPSETTING(0x10, "NLQ")
188   PORT_DIPSETTING(0x00, "Draft")
189   PORT_DIPNAME(0xe0, 0xe0, "International character set")
190   PORT_DIPLOCATION("DIP:3,2,1")
191   PORT_DIPSETTING(0xe0, "U.S.A.")
192   PORT_DIPSETTING(0x60, "France")
193   PORT_DIPSETTING(0xa0, "Germany")
194   PORT_DIPSETTING(0x20, "U.K.")
195   PORT_DIPSETTING(0xc0, "Denmark")
196   PORT_DIPSETTING(0x40, "Sweden")
197   PORT_DIPSETTING(0x80, "Italy")
198   PORT_DIPSETTING(0x00, "Spain")
199 
200   PORT_START("DIPSW2")
201   PORT_DIPNAME(0x01, 0x00, "Page length")
202   PORT_DIPLOCATION("DIP:4")
203   PORT_DIPSETTING(0x01, "12\"")
204   PORT_DIPSETTING(0x00, "11\"")
205   PORT_DIPNAME(0x02, 0x00, "Cut sheet feeder mode")
206   PORT_DIPLOCATION("DIP:3")
207   PORT_DIPSETTING(0x02, "Valid")
208   PORT_DIPSETTING(0x00, "Invalid")
209   PORT_DIPNAME(0x04, 0x00, "1\" skip over perforation")
210   PORT_DIPLOCATION("DIP:2")
211   PORT_DIPSETTING(0x04, "Valid")
212   PORT_DIPSETTING(0x00, "Invalid")
213   PORT_DIPNAME(0x08, 0x00, "AUTO FEED XT control")
214   PORT_DIPLOCATION("DIP:1")
215   PORT_DIPSETTING(0x08, "Fix to LOW")
216   PORT_DIPSETTING(0x00, "Depends on external signal")
217INPUT_PORTS_END
218 
219 
220/***************************************************************************
221    MACHINE DRIVERS
222***************************************************************************/
223 
224static const UPD7810_CONFIG lx800_cpu_config =
225{
226    TYPE_7810,
227    0
228};
229 
230static const e05a03_interface lx800_e05a03_intf =
231{
232   DEVCB_HANDLER(lx800_centronics_data_r),
233   DEVCB_NULL,
234   DEVCB_LINE(lx800_paperempty_led_w),
235   DEVCB_LINE(lx800_centronics_pe_w),
236   DEVCB_LINE(lx800_reset_w)
237};
238 
239static MACHINE_DRIVER_START( lx800 )
240   /* basic machine hardware */
241   MDRV_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz)
242   MDRV_CPU_CONFIG(lx800_cpu_config)
243   MDRV_CPU_PROGRAM_MAP(lx800_mem)
244   MDRV_CPU_IO_MAP(lx800_io)
245 
246   MDRV_MACHINE_START(lx800)
247 
248   MDRV_DRIVER_DATA(lx800_state)
249 
250   MDRV_DEFAULT_LAYOUT(layout_lx800)
251 
252   /* audio hardware */
253   MDRV_SPEAKER_STANDARD_MONO("mono")
254   MDRV_SOUND_ADD("beep", BEEP, 0)
255   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
256 
257   /* gate array */
258   MDRV_E05A03_ADD("ic3b", lx800_e05a03_intf)
259MACHINE_DRIVER_END
260 
261 
262/***************************************************************************
263    ROM DEFINITIONS
264***************************************************************************/
265 
266ROM_START( lx800 )
267    ROM_REGION(0x8000, "maincpu", 0)
268    ROM_LOAD("lx800.ic3c", 0x0000, 0x8000, CRC(da06c45b) SHA1(9618c940dd10d5b43cd1edd5763b90e6447de667))
269ROM_END
270 
271 
272/***************************************************************************
273    GAME DRIVERS
274***************************************************************************/
275 
276/*    YEAR  NAME   PARENT  COMPAT  MACHINE  INPUT  INIT  CONFIG  COMPANY  FULLNAME  FLAGS */
277COMP( 1987, lx800, 0,      0,      lx800,   lx800, 0,    0,      "Epson", "LX-800", GAME_NOT_WORKING )
69 */
70static READ8_HANDLER( lx800_portc_r )
71{
72   UINT8 result = 0;
73
74   logerror("%s: lx800_portc_r(%02x)\n", cpuexec_describe_context(space->machine), offset);
75
76   result |= input_port_read(space->machine, "ONLINE") << 3;
77
78   return result;
79}
80
81static WRITE8_HANDLER( lx800_portc_w )
82{
83   lx800_state *lx800 = space->machine->driver_data;
84
85   logerror("%s: lx800_portc_w(%02x): %02x\n", cpuexec_describe_context(space->machine), offset, data);
86   logerror("--> err: %d, ack: %d, fire: %d, buzzer: %d\n", BIT(data, 4), BIT(data, 5), BIT(data, 6), BIT(data, 7));
87
88   output_set_value("online_led", !BIT(data, 2));
89   beep_set_state(lx800->speaker, !BIT(data, 7));
90}
91
92
93/***************************************************************************
94    GATE ARRAY
95***************************************************************************/
96
97static READ8_DEVICE_HANDLER( lx800_centronics_data_r )
98{
99   logerror("centronics: data read\n");
100   return 0x55;
101}
102
103static WRITE_LINE_DEVICE_HANDLER( lx800_centronics_pe_w )
104{
105   logerror("centronics: pe = %d\n", state);
106}
107
108static WRITE_LINE_DEVICE_HANDLER( lx800_paperempty_led_w )
109{
110   output_set_value("paperout_led", state);
111}
112
113static WRITE_LINE_DEVICE_HANDLER( lx800_reset_w )
114{
115   cputag_reset(device->machine, "maincpu");
116}
117
118
119/***************************************************************************
120    MACHINE EMULATION
121***************************************************************************/
122
123static MACHINE_START( lx800 )
124{
125   lx800_state *lx800 = machine->driver_data;
126
127   lx800->speaker = devtag_get_device(machine, "beep");
128
129   beep_set_state(lx800->speaker, 0);
130   beep_set_frequency(lx800->speaker, 4000); /* ? */
131}
132
133
134/***************************************************************************
135    ADDRESS MAPS
136***************************************************************************/
137
138static ADDRESS_MAP_START( lx800_mem, ADDRESS_SPACE_PROGRAM, 8 )
139   AM_RANGE(0x0000, 0x7fff) AM_ROM /* 32k firmware */
140   AM_RANGE(0x8000, 0x9fff) AM_RAM /* 8k external RAM */
141   AM_RANGE(0xa000, 0xbfff) AM_NOP /* not used */
142   AM_RANGE(0xc000, 0xdfff) AM_MIRROR(0x1ff8) AM_DEVREADWRITE("ic3b", e05a03_r, e05a03_w)
143   AM_RANGE(0xe000, 0xfeff) AM_NOP /* not used */
144   AM_RANGE(0xff00, 0xffff) AM_RAM /* internal CPU RAM */
145ADDRESS_MAP_END
146
147static ADDRESS_MAP_START( lx800_io, ADDRESS_SPACE_IO, 8 )
148   AM_RANGE(UPD7810_PORTA, UPD7810_PORTA) AM_READWRITE(lx800_porta_r, lx800_porta_w)
149   AM_RANGE(UPD7810_PORTB, UPD7810_PORTB) AM_READ_PORT("DIPSW1")
150   AM_RANGE(UPD7810_PORTC, UPD7810_PORTC) AM_READWRITE(lx800_portc_r, lx800_portc_w)
151ADDRESS_MAP_END
152
153
154/***************************************************************************
155    INPUT PORTS
156***************************************************************************/
157
158static INPUT_PORTS_START( lx800 )
159   PORT_START("ONLINE")
160   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("On Line") PORT_CODE(KEYCODE_O)
161
162   PORT_START("FORMFEED")
163   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Form Feed") PORT_CODE(KEYCODE_F)
164
165   PORT_START("LINEFEED")
166   PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("Line Feed") PORT_CODE(KEYCODE_L)
167
168   PORT_START("DIPSW1")
169   PORT_DIPNAME(0x01, 0x00, "Typeface")
170   PORT_DIPLOCATION("DIP:8")
171   PORT_DIPSETTING(0x01, "Condensed")
172   PORT_DIPSETTING(0x00, DEF_STR(Normal))
173   PORT_DIPNAME(0x02, 0x00, "ZERO font")
174   PORT_DIPLOCATION("DIP:7")
175   PORT_DIPSETTING(0x02, "0")
176   PORT_DIPSETTING(0x00, "0")
177   PORT_DIPNAME(0x04, 0x00, "Character Table")
178   PORT_DIPLOCATION("DIP:6")
179   PORT_DIPSETTING(0x04, "Graphic")
180   PORT_DIPSETTING(0x00, "Italic")
181   PORT_DIPNAME(0x08, 0x00, "Paper-out detection")
182   PORT_DIPLOCATION("DIP:5")
183   PORT_DIPSETTING(0x08, "Valid")
184   PORT_DIPSETTING(0x00, "Invalid")
185   PORT_DIPNAME(0x10, 0x00, "Printing quality")
186   PORT_DIPLOCATION("DIP:4")
187   PORT_DIPSETTING(0x10, "NLQ")
188   PORT_DIPSETTING(0x00, "Draft")
189   PORT_DIPNAME(0xe0, 0xe0, "International character set")
190   PORT_DIPLOCATION("DIP:3,2,1")
191   PORT_DIPSETTING(0xe0, "U.S.A.")
192   PORT_DIPSETTING(0x60, "France")
193   PORT_DIPSETTING(0xa0, "Germany")
194   PORT_DIPSETTING(0x20, "U.K.")
195   PORT_DIPSETTING(0xc0, "Denmark")
196   PORT_DIPSETTING(0x40, "Sweden")
197   PORT_DIPSETTING(0x80, "Italy")
198   PORT_DIPSETTING(0x00, "Spain")
199
200   PORT_START("DIPSW2")
201   PORT_DIPNAME(0x01, 0x00, "Page length")
202   PORT_DIPLOCATION("DIP:4")
203   PORT_DIPSETTING(0x01, "12\"")
204   PORT_DIPSETTING(0x00, "11\"")
205   PORT_DIPNAME(0x02, 0x00, "Cut sheet feeder mode")
206   PORT_DIPLOCATION("DIP:3")
207   PORT_DIPSETTING(0x02, "Valid")
208   PORT_DIPSETTING(0x00, "Invalid")
209   PORT_DIPNAME(0x04, 0x00, "1\" skip over perforation")
210   PORT_DIPLOCATION("DIP:2")
211   PORT_DIPSETTING(0x04, "Valid")
212   PORT_DIPSETTING(0x00, "Invalid")
213   PORT_DIPNAME(0x08, 0x00, "AUTO FEED XT control")
214   PORT_DIPLOCATION("DIP:1")
215   PORT_DIPSETTING(0x08, "Fix to LOW")
216   PORT_DIPSETTING(0x00, "Depends on external signal")
217INPUT_PORTS_END
218
219
220/***************************************************************************
221    MACHINE DRIVERS
222***************************************************************************/
223
224static const UPD7810_CONFIG lx800_cpu_config =
225{
226    TYPE_7810,
227    0
228};
229
230static const e05a03_interface lx800_e05a03_intf =
231{
232   DEVCB_HANDLER(lx800_centronics_data_r),
233   DEVCB_NULL,
234   DEVCB_LINE(lx800_paperempty_led_w),
235   DEVCB_LINE(lx800_centronics_pe_w),
236   DEVCB_LINE(lx800_reset_w)
237};
238
239static MACHINE_DRIVER_START( lx800 )
240   /* basic machine hardware */
241   MDRV_CPU_ADD("maincpu", UPD7810, XTAL_14_7456MHz)
242   MDRV_CPU_CONFIG(lx800_cpu_config)
243   MDRV_CPU_PROGRAM_MAP(lx800_mem)
244   MDRV_CPU_IO_MAP(lx800_io)
245
246   MDRV_MACHINE_START(lx800)
247
248   MDRV_DRIVER_DATA(lx800_state)
249
250   MDRV_DEFAULT_LAYOUT(layout_lx800)
251
252   /* audio hardware */
253   MDRV_SPEAKER_STANDARD_MONO("mono")
254   MDRV_SOUND_ADD("beep", BEEP, 0)
255   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
256
257   /* gate array */
258   MDRV_E05A03_ADD("ic3b", lx800_e05a03_intf)
259MACHINE_DRIVER_END
260
261
262/***************************************************************************
263    ROM DEFINITIONS
264***************************************************************************/
265
266ROM_START( lx800 )
267    ROM_REGION(0x8000, "maincpu", 0)
268    ROM_LOAD("lx800.ic3c", 0x0000, 0x8000, CRC(da06c45b) SHA1(9618c940dd10d5b43cd1edd5763b90e6447de667))
269ROM_END
270
271
272/***************************************************************************
273    GAME DRIVERS
274***************************************************************************/
275
276/*    YEAR  NAME   PARENT  COMPAT  MACHINE  INPUT  INIT  CONFIG  COMPANY  FULLNAME  FLAGS */
277COMP( 1987, lx800, 0,      0,      lx800,   lx800, 0,    0,      "Epson", "LX-800", GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team