src/mess/drivers/eti660.c
| r7027 | r7028 | |
| 2 | 2 | |
| 3 | 3 | TODO: |
| 4 | 4 | |
| 5 | - does not boot! |
| 5 | 6 | - allocate color ram |
| 6 | 7 | - quickload |
| 7 | | - keyboard |
| 8 | 8 | - color on |
| 9 | 9 | |
| 10 | 10 | */ |
| r7027 | r7028 | |
| 18 | 18 | #include "machine/rescap.h" |
| 19 | 19 | #include "sound/cdp1864.h" |
| 20 | 20 | |
| 21 | #define RX(_machine) \ |
| 22 | cpu_get_reg(_machine->firstcpu, CDP1802_R0 + cpu_get_reg(_machine->firstcpu, CDP1802_X)) |
| 23 | |
| 21 | 24 | /* Read/Write Handlers */ |
| 22 | 25 | |
| 26 | static READ8_DEVICE_HANDLER( pia_r ) |
| 27 | { |
| 28 | int pia_offset = RX(device->machine) & 0x03; |
| 29 | |
| 30 | return pia6821_r(device, pia_offset); |
| 31 | } |
| 32 | |
| 23 | 33 | static WRITE8_DEVICE_HANDLER( pia_w ) |
| 24 | 34 | { |
| 25 | | int pia_offset = cpu_get_reg(device->machine->firstcpu, CDP1802_R0 + cpu_get_reg(device->machine->firstcpu, CDP1802_X)) & 0x03; |
| 35 | int pia_offset = RX(device->machine) & 0x03; |
| 26 | 36 | |
| 27 | 37 | pia6821_w(device, pia_offset, data); |
| 28 | 38 | } |
| r7027 | r7028 | |
| 30 | 40 | static WRITE8_HANDLER( eti660_colorram_w ) |
| 31 | 41 | { |
| 32 | 42 | 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; |
| 43 | int colorram_offset = RX(space->machine) & 0xff; |
| 34 | 44 | |
| 35 | 45 | colorram_offset = ((colorram_offset & 0xf8) >> 1) || (colorram_offset & 0x03); |
| 36 | 46 | |
| r7027 | r7028 | |
| 46 | 56 | |
| 47 | 57 | static ADDRESS_MAP_START( eti660_io_map, ADDRESS_SPACE_IO, 8 ) |
| 48 | 58 | 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) |
| 59 | AM_RANGE(0x02, 0x02) AM_DEVREADWRITE(MC6821_TAG, pia_r, pia_w) |
| 50 | 60 | AM_RANGE(0x03, 0x03) AM_WRITE(eti660_colorram_w) |
| 51 | 61 | AM_RANGE(0x04, 0x04) AM_DEVREADWRITE(CDP1864_TAG, cdp1864_dispoff_r, cdp1864_tone_latch_w) |
| 52 | 62 | ADDRESS_MAP_END |
| 53 | 63 | |
| 54 | 64 | /* Input Ports */ |
| 55 | 65 | |
| 66 | static INPUT_CHANGED( trigger_reset ) |
| 67 | { |
| 68 | eti660_state *state = field->port->machine->driver_data; |
| 69 | |
| 70 | state->cdp1802_mode = newval ? CDP1802_MODE_RUN : CDP1802_MODE_RESET; |
| 71 | } |
| 72 | |
| 56 | 73 | static INPUT_PORTS_START( eti660 ) |
| 57 | 74 | PORT_START("PA0") |
| 58 | 75 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CHAR('3') |
| r7027 | r7028 | |
| 77 | 94 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') |
| 78 | 95 | PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_C) PORT_CHAR('C') |
| 79 | 96 | PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') |
| 97 | |
| 98 | PORT_START("SPECIAL") |
| 99 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESET") PORT_CODE(KEYCODE_R) PORT_CHANGED(trigger_reset, 0) |
| 100 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("STEP") PORT_CODE(KEYCODE_S) |
| 80 | 101 | INPUT_PORTS_END |
| 81 | 102 | |
| 82 | 103 | /* Video */ |
| r7027 | r7028 | |
| 156 | 177 | /* tape input */ |
| 157 | 178 | if (cassette_input(state->cassette) < 0) ef -= EF2; |
| 158 | 179 | |
| 180 | /* STEP key */ |
| 181 | if (!BIT(input_port_read(device->machine, "SPECIAL"), 1)) ef -= EF4; |
| 182 | |
| 159 | 183 | return ef; |
| 160 | 184 | } |
| 161 | 185 | |
| r7027 | r7028 | |
| 290 | 314 | |
| 291 | 315 | /* reset CPU */ |
| 292 | 316 | state->cdp1802_mode = CDP1802_MODE_RESET; |
| 293 | | timer_set(machine, ATTOTIME_IN_MSEC(200), NULL, 0, set_cpu_mode); |
| 317 | timer_set(machine, ATTOTIME_IN_MSEC(0), NULL, 0, set_cpu_mode); |
| 294 | 318 | |
| 295 | 319 | /* reset CDP1864 */ |
| 296 | 320 | device_reset(state->cdp1864); |
| r7027 | r7028 | |
| 330 | 354 | |
| 331 | 355 | /* devices */ |
| 332 | 356 | MDRV_PIA6821_ADD(MC6821_TAG, eti660_mc6821_intf) |
| 333 | | MDRV_CASSETTE_ADD("cassette", eti660_cassette_config) |
| 357 | MDRV_CASSETTE_ADD(CASSETTE_TAG, eti660_cassette_config) |
| 334 | 358 | |
| 335 | 359 | /* internal ram */ |
| 336 | 360 | MDRV_RAM_ADD("messram") |
| 337 | | MDRV_RAM_DEFAULT_SIZE("1K") |
| 338 | | MDRV_RAM_EXTRA_OPTIONS("3K") |
| 361 | MDRV_RAM_DEFAULT_SIZE("3K") |
| 339 | 362 | MACHINE_DRIVER_END |
| 340 | 363 | |
| 341 | 364 | /* ROMs */ |