Previous 15994 Revisions Next

r7019 Tuesday 12th January, 2010 at 14:11:09 UTC by Curt Coder
[ETI660] Added keyboard, color RAM, and PIA write.
[src/mess/drivers]eti660.c
[src/mess/includes]eti660.h

src/mess/includes/eti660.h
r7018r7019
2626
2727   /* video state */
2828   int cdp1864_efx;
29   UINT8 *color_ram;
29   UINT8 color_ram[0x100];
3030   UINT8 color;
3131
3232   /* devices */
src/mess/drivers/eti660.c
r7018r7019
1/*
2
3   TODO:
4
5   - allocate color ram
6   - quickload
7   - keyboard
8   - color on
9
10*/
11
112#include "driver.h"
213#include "includes/eti660.h"
314#include "cpu/cdp1802/cdp1802.h"
r7018r7019
920
1021/* Read/Write Handlers */
1122
23static WRITE8_DEVICE_HANDLER( pia_w )
24{
25   int pia_offset = cpu_get_reg(device->machine->firstcpu, CDP1802_R0 + cpu_get_reg(device->machine->firstcpu, CDP1802_X)) & 0x03;
26
27   pia6821_w(device, pia_offset, data);
28}
29
1230static WRITE8_HANDLER( eti660_colorram_w )
1331{
32   eti660_state *state = space->machine->driver_data;
33   int colorram_offset = cpu_get_reg(space->machine->firstcpu, CDP1802_R0 + cpu_get_reg(space->machine->firstcpu, CDP1802_X)) & 0xff;
34
35   colorram_offset = ((colorram_offset & 0xf8) >> 1) || (colorram_offset & 0x03);
36
37   state->color_ram[colorram_offset] = data;
1438}
1539
1640/* Memory Maps */
r7018r7019
2246
2347static ADDRESS_MAP_START( eti660_io_map, ADDRESS_SPACE_IO, 8 )
2448   AM_RANGE(0x01, 0x01) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_dispon_r, cdp1864_step_bgcolor_w)
49   AM_RANGE(0x02, 0x02) AM_DEVWRITE(MC6821_TAG, pia_w)
2550   AM_RANGE(0x03, 0x03) AM_WRITE(eti660_colorram_w)
2651   AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_dispoff_r, cdp1864_tone_latch_w)
2752ADDRESS_MAP_END
r7018r7019
2954/* Input Ports */
3055
3156static INPUT_PORTS_START( eti660 )
57   PORT_START("PA0")
58   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3')
59   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_B) PORT_CHAR('B')
60   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_F) PORT_CHAR('F')
61   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7')
62
63   PORT_START("PA1")
64   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CHAR('2')
65   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_A) PORT_CHAR('A')
66   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CHAR('E')
67   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6')
68
69   PORT_START("PA2")
70   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CHAR('1')
71   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CHAR('9')
72   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_D) PORT_CHAR('D')
73   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5')
74
75   PORT_START("PA3")
76   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CHAR('0')
77   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8')
78   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C')
79   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4')
3280INPUT_PORTS_END
3381
3482/* Video */
r7018r7019
4088   driver_state->cdp1864_efx = state;
4189}
4290
43static VIDEO_UPDATE( eti660 )
91static READ_LINE_DEVICE_HANDLER( rdata_r )
4492{
45   eti660_state *state = screen->machine->driver_data;
93   eti660_state *state = device->machine->driver_data;
4694
47   cdp1864_update(state->cdp1864, bitmap, cliprect);
95   return BIT(state->color, 0);
96}
4897
49   return 0;
98static READ_LINE_DEVICE_HANDLER( bdata_r )
99{
100   eti660_state *state = device->machine->driver_data;
101
102   return BIT(state->color, 1);
50103}
51104
105static READ_LINE_DEVICE_HANDLER( gdata_r )
106{
107   eti660_state *state = device->machine->driver_data;
108
109   return BIT(state->color, 2);
110}
111
52112static CDP1864_INTERFACE( eti660_cdp1864_intf )
53113{
54114   CDP1802_TAG,
55115   SCREEN_TAG,
56116   CDP1864_INTERLACED,
57   DEVCB_LINE_VCC,
58   DEVCB_LINE_VCC,
59   DEVCB_LINE_VCC,
117   DEVCB_LINE(rdata_r),
118   DEVCB_LINE(bdata_r),
119   DEVCB_LINE(gdata_r),
60120   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_INT),
61121   DEVCB_CPU_INPUT_LINE(CDP1802_TAG, CDP1802_INPUT_LINE_DMAOUT),
62122   DEVCB_LINE(eti660_efx_w),
r7018r7019
66126   RES_K(4.7)   /* R4 */
67127};
68128
129static VIDEO_UPDATE( eti660 )
130{
131   eti660_state *state = screen->machine->driver_data;
132
133   cdp1864_update(state->cdp1864, bitmap, cliprect);
134
135   return 0;
136}
137
69138/* CDP1802 Interface */
70139
71140static CDP1802_MODE_READ( eti660_mode_r )
r7018r7019
107176static WRITE8_DEVICE_HANDLER( eti660_dma_w )
108177{
109178   eti660_state *state = device->machine->driver_data;
179   UINT8 colorram_offset = ((offset & 0xf8) >> 1) || (offset & 0x03);
110180
111   state->color = state->color_ram[offset / 4];
181   state->color = state->color_ram[colorram_offset];
112182
113183   cdp1864_con_w(state->cdp1864, 0); // HACK
114184   cdp1864_dma_w(state->cdp1864, offset, data);
r7018r7019
143213
144214    */
145215
146//   eti660_state *state = device->machine->driver_data;
216   eti660_state *state = device->machine->driver_data;
217   UINT8 data = 0xf0;
147218
148   return 0xf0;
219   if (!BIT(state->keylatch, 0)) data &= input_port_read(device->machine, "PA0");
220   if (!BIT(state->keylatch, 1)) data &= input_port_read(device->machine, "PA1");
221   if (!BIT(state->keylatch, 2)) data &= input_port_read(device->machine, "PA2");
222   if (!BIT(state->keylatch, 3)) data &= input_port_read(device->machine, "PA3");
223
224   return data;
149225}
150226
151227static WRITE8_DEVICE_HANDLER( eti660_pia_a_w )
r7018r7019
170246   state->keylatch = data & 0x0f;
171247}
172248
173static const pia6821_interface bw12_pia_config =
249static const pia6821_interface eti660_mc6821_intf =
174250{
175251   DEVCB_HANDLER(eti660_pia_a_r),                        /* port A input */
176252   DEVCB_NULL,                                       /* port B input */
r7018r7019
182258   DEVCB_NULL,                                       /* port B output */
183259   DEVCB_NULL,                                       /* CA2 output */
184260   DEVCB_NULL,                                       /* CB2 output */
185   DEVCB_NULL,DEVCB_NULL
186//   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0),            /* IRQA output */
187//   DEVCB_CPU_INPUT_LINE(Z80_TAG, INPUT_LINE_IRQ0)            /* IRQB output */
261   DEVCB_NULL,                                       /* IRQA output */
262   DEVCB_NULL                                       /* IRQB output */
188263};
189264
190265/* Machine Initialization */
191266
267static TIMER_CALLBACK( set_cpu_mode )
268{
269   eti660_state *state = machine->driver_data;
270
271   state->cdp1802_mode = CDP1802_MODE_RUN;
272}
273
192274static MACHINE_START( eti660 )
193275{
194276   eti660_state *state = machine->driver_data;
r7018r7019
202284   state_save_register_global(machine, state->cdp1864_efx);
203285}
204286
287static MACHINE_RESET( eti660 )
288{
289   eti660_state *state = machine->driver_data;
290
291   /* reset CPU */
292   state->cdp1802_mode = CDP1802_MODE_RESET;
293   timer_set(machine, ATTOTIME_IN_MSEC(200), NULL, 0, set_cpu_mode);
294
295   /* reset CDP1864 */
296   device_reset(state->cdp1864);
297}
298
205299/* Machine Drivers */
206300
207301static const cassette_config eti660_cassette_config =
r7018r7019
221315   MDRV_CPU_CONFIG(eti660_config)
222316
223317   MDRV_MACHINE_START(eti660)
318   MDRV_MACHINE_RESET(eti660)
224319
225320    /* video hardware */
226321   MDRV_CDP1864_SCREEN_ADD(SCREEN_TAG, XTAL_8_867238MHz/5)
r7018r7019
234329   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
235330
236331   /* devices */
237//   MDRV_PIA6821_ADD(MC6821_TAG, eti660_mc6821_intf)
332   MDRV_PIA6821_ADD(MC6821_TAG, eti660_mc6821_intf)
238333   MDRV_CASSETTE_ADD("cassette", eti660_cassette_config)
239334   
240335   /* internal ram */
r7018r7019
251346ROM_END
252347
253348/*    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT       INIT        COMPANY                        FULLNAME            FLAGS */
254COMP( 1978, eti660,      0,      0,      eti660,      eti660,      0,         "Electronics Today International",   "ETI-660 (Australia)",   GAME_NOT_WORKING )
349COMP( 1981, eti660,      0,      0,      eti660,      eti660,      0,         "Electronics Today International",   "ETI-660 (Australia)",   GAME_NOT_WORKING )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team