src/mess/video/zx8301.c
| r3630 | r3631 | |
| 105 | 105 | |
| 106 | 106 | if (zx8301->vda) |
| 107 | 107 | { |
| 108 | | cpu_spinuntil_time(video_screen_get_time_until_pos(zx8301->screen, 256, 0)); |
| 108 | cpu_spinuntil_time(device->machine->cpu[0],video_screen_get_time_until_pos(zx8301->screen, 256, 0)); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | return zx8301->intf->ram_r(device, offset); |
| r3630 | r3631 | |
| 119 | 119 | |
| 120 | 120 | if (zx8301->vda) |
| 121 | 121 | { |
| 122 | | cpu_spinuntil_time(video_screen_get_time_until_pos(zx8301->screen, 256, 0)); |
| 122 | cpu_spinuntil_time(device->machine->cpu[0],video_screen_get_time_until_pos(zx8301->screen, 256, 0)); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | zx8301->intf->ram_w(device, offset, data); |
| r3630 | r3631 | |
| 231 | 231 | static DEVICE_START( zx8301 ) |
| 232 | 232 | { |
| 233 | 233 | zx8301_t *zx8301 = get_safe_token(device); |
| 234 | | char unique_tag[30]; |
| 235 | | |
| 236 | 234 | /* validate arguments */ |
| 237 | 235 | assert(device != NULL); |
| 238 | 236 | assert(device->tag != NULL); |
| r3630 | r3631 | |
| 261 | 259 | timer_adjust_periodic(zx8301->flash_timer, ATTOTIME_IN_HZ(2), 0, ATTOTIME_IN_HZ(2)); |
| 262 | 260 | |
| 263 | 261 | /* register for state saving */ |
| 264 | | state_save_combine_module_and_tag(unique_tag, "zx8301", device->tag); |
| 265 | | |
| 266 | | state_save_register_item(unique_tag, 0, zx8301->dispoff); |
| 267 | | state_save_register_item(unique_tag, 0, zx8301->mode8); |
| 268 | | state_save_register_item(unique_tag, 0, zx8301->base); |
| 269 | | state_save_register_item(unique_tag, 0, zx8301->flash); |
| 270 | | state_save_register_item(unique_tag, 0, zx8301->vsync); |
| 271 | | state_save_register_item(unique_tag, 0, zx8301->vda); |
| 262 | state_save_register_item("zx8301",NULL , 0, zx8301->dispoff); |
| 263 | state_save_register_item("zx8301",NULL , 0, zx8301->mode8); |
| 264 | state_save_register_item("zx8301",NULL , 0, zx8301->base); |
| 265 | state_save_register_item("zx8301",NULL , 0, zx8301->flash); |
| 266 | state_save_register_item("zx8301",NULL , 0, zx8301->vsync); |
| 267 | state_save_register_item("zx8301",NULL , 0, zx8301->vda); |
| 272 | 268 | return DEVICE_START_OK; |
| 273 | 269 | } |
| 274 | 270 | |
src/mess/machine/zx8302.c
| r3630 | r3631 | |
| 568 | 568 | static DEVICE_START( zx8302 ) |
| 569 | 569 | { |
| 570 | 570 | zx8302_t *zx8302 = get_safe_token(device); |
| 571 | | char unique_tag[30]; |
| 572 | 571 | int i; |
| 573 | 572 | |
| 574 | 573 | /* validate arguments */ |
| r3630 | r3631 | |
| 606 | 605 | timer_adjust_periodic(zx8302->gap_timer, attotime_zero, 0, ATTOTIME_IN_MSEC(31)); |
| 607 | 606 | |
| 608 | 607 | /* register for state saving */ |
| 609 | | state_save_combine_module_and_tag(unique_tag, "zx8302", device->tag); |
| 610 | 608 | |
| 611 | | state_save_register_item(unique_tag, 0, zx8302->idr); |
| 612 | | state_save_register_item(unique_tag, 0, zx8302->tcr); |
| 613 | | state_save_register_item(unique_tag, 0, zx8302->tdr); |
| 614 | | state_save_register_item(unique_tag, 0, zx8302->irq); |
| 615 | | state_save_register_item(unique_tag, 0, zx8302->ctr); |
| 616 | | state_save_register_item(unique_tag, 0, zx8302->status); |
| 609 | state_save_register_item("zx8302",NULL , 0, zx8302->idr); |
| 610 | state_save_register_item("zx8302",NULL , 0, zx8302->tcr); |
| 611 | state_save_register_item("zx8302",NULL , 0, zx8302->tdr); |
| 612 | state_save_register_item("zx8302",NULL , 0, zx8302->irq); |
| 613 | state_save_register_item("zx8302",NULL , 0, zx8302->ctr); |
| 614 | state_save_register_item("zx8302",NULL , 0, zx8302->status); |
| 617 | 615 | |
| 618 | | state_save_register_item(unique_tag, 0, zx8302->comdata); |
| 619 | | state_save_register_item(unique_tag, 0, zx8302->comctl); |
| 620 | | state_save_register_item(unique_tag, 0, zx8302->ipc_state); |
| 621 | | state_save_register_item(unique_tag, 0, zx8302->ipc_rx); |
| 622 | | state_save_register_item(unique_tag, 0, zx8302->ipc_busy); |
| 623 | | state_save_register_item(unique_tag, 0, zx8302->baudx4); |
| 616 | state_save_register_item("zx8302",NULL , 0, zx8302->comdata); |
| 617 | state_save_register_item("zx8302",NULL , 0, zx8302->comctl); |
| 618 | state_save_register_item("zx8302",NULL , 0, zx8302->ipc_state); |
| 619 | state_save_register_item("zx8302",NULL , 0, zx8302->ipc_rx); |
| 620 | state_save_register_item("zx8302",NULL , 0, zx8302->ipc_busy); |
| 621 | state_save_register_item("zx8302",NULL , 0, zx8302->baudx4); |
| 624 | 622 | |
| 625 | | state_save_register_item(unique_tag, 0, zx8302->tx_bits); |
| 626 | | state_save_register_item(unique_tag, 0, zx8302->ser1_rxd); |
| 627 | | state_save_register_item(unique_tag, 0, zx8302->ser1_cts); |
| 628 | | state_save_register_item(unique_tag, 0, zx8302->ser2_txd); |
| 629 | | state_save_register_item(unique_tag, 0, zx8302->ser2_dtr); |
| 630 | | state_save_register_item(unique_tag, 0, zx8302->netout); |
| 631 | | state_save_register_item(unique_tag, 0, zx8302->netin); |
| 623 | state_save_register_item("zx8302",NULL , 0, zx8302->tx_bits); |
| 624 | state_save_register_item("zx8302",NULL , 0, zx8302->ser1_rxd); |
| 625 | state_save_register_item("zx8302",NULL , 0, zx8302->ser1_cts); |
| 626 | state_save_register_item("zx8302",NULL , 0, zx8302->ser2_txd); |
| 627 | state_save_register_item("zx8302",NULL , 0, zx8302->ser2_dtr); |
| 628 | state_save_register_item("zx8302",NULL , 0, zx8302->netout); |
| 629 | state_save_register_item("zx8302",NULL , 0, zx8302->netin); |
| 632 | 630 | |
| 633 | | state_save_register_item(unique_tag, 0, zx8302->mdrdw); |
| 634 | | state_save_register_item(unique_tag, 0, zx8302->mdselck); |
| 635 | | state_save_register_item(unique_tag, 0, zx8302->mdseld); |
| 636 | | state_save_register_item(unique_tag, 0, zx8302->erase); |
| 631 | state_save_register_item("zx8302",NULL , 0, zx8302->mdrdw); |
| 632 | state_save_register_item("zx8302",NULL , 0, zx8302->mdselck); |
| 633 | state_save_register_item("zx8302",NULL , 0, zx8302->mdseld); |
| 634 | state_save_register_item("zx8302",NULL , 0, zx8302->erase); |
| 637 | 635 | |
| 638 | | state_save_register_item(unique_tag, 0, zx8302->mdv_motor); |
| 639 | | state_save_register_item_array(unique_tag, 0, zx8302->mdv_offset); |
| 636 | state_save_register_item("zx8302",NULL , 0, zx8302->mdv_motor); |
| 637 | state_save_register_item_array("zx8302",NULL , 0, zx8302->mdv_offset); |
| 640 | 638 | return DEVICE_START_OK; |
| 641 | 639 | } |
| 642 | 640 | |
src/mess/drivers/ql.c
| r3630 | r3631 | |
| 78 | 78 | { |
| 79 | 79 | // pulse COMCTL line |
| 80 | 80 | |
| 81 | | const device_config *zx8302 = device_list_find_by_tag(machine->config->devicelist, ZX8302, ZX8302_TAG); |
| 81 | const device_config *zx8302 = device_list_find_by_tag(space->machine->config->devicelist, ZX8302, ZX8302_TAG); |
| 82 | 82 | |
| 83 | 83 | zx8302_comctl_w(zx8302, 0); |
| 84 | 84 | zx8302_comctl_w(zx8302, 1); |
| r3630 | r3631 | |
| 121 | 121 | |
| 122 | 122 | */ |
| 123 | 123 | |
| 124 | | const device_config *zx8302 = device_list_find_by_tag(machine->config->devicelist, ZX8302, ZX8302_TAG); |
| 124 | const device_config *zx8302 = device_list_find_by_tag(space->machine->config->devicelist, ZX8302, ZX8302_TAG); |
| 125 | 125 | |
| 126 | 126 | int ipl = (BIT(data, 2) << 1) | BIT(data, 3); |
| 127 | 127 | |
| r3630 | r3631 | |
| 130 | 130 | switch (ipl) |
| 131 | 131 | { |
| 132 | 132 | case 0: |
| 133 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, CLEAR_LINE); |
| 134 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_5, CLEAR_LINE); |
| 135 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_7, HOLD_LINE); |
| 133 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_2, CLEAR_LINE); |
| 134 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_5, CLEAR_LINE); |
| 135 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_7, HOLD_LINE); |
| 136 | 136 | break; |
| 137 | 137 | |
| 138 | 138 | case 1: |
| 139 | 139 | // CTRL-ALT-7 pressed |
| 140 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, CLEAR_LINE); |
| 141 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_5, HOLD_LINE); |
| 142 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_7, CLEAR_LINE); |
| 140 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_2, CLEAR_LINE); |
| 141 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_5, HOLD_LINE); |
| 142 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_7, CLEAR_LINE); |
| 143 | 143 | break; |
| 144 | 144 | |
| 145 | 145 | case 2: |
| 146 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, HOLD_LINE); |
| 147 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_5, CLEAR_LINE); |
| 148 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_7, CLEAR_LINE); |
| 146 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_2, HOLD_LINE); |
| 147 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_5, CLEAR_LINE); |
| 148 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_7, CLEAR_LINE); |
| 149 | 149 | break; |
| 150 | 150 | |
| 151 | 151 | case 3: |
| 152 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_2, CLEAR_LINE); |
| 153 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_5, CLEAR_LINE); |
| 154 | | cpu_set_input_line(machine->cpu[0], MC68000_IRQ_7, CLEAR_LINE); |
| 152 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_2, CLEAR_LINE); |
| 153 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_5, CLEAR_LINE); |
| 154 | cpu_set_input_line(space->machine->cpu[0], M68K_IRQ_7, CLEAR_LINE); |
| 155 | 155 | break; |
| 156 | 156 | } |
| 157 | 157 | |
| r3630 | r3631 | |
| 187 | 187 | |
| 188 | 188 | int irq = (ipc.ser2_rxd | ipc.ser1_txd); |
| 189 | 189 | |
| 190 | | cpu_set_input_line(machine->cpu[1], INPUT_LINE_IRQ0, irq); |
| 190 | cpu_set_input_line(space->machine->cpu[1], INPUT_LINE_IRQ0, irq); |
| 191 | 191 | |
| 192 | 192 | return (ipc.comdata << 7) | irq; |
| 193 | 193 | } |
| r3630 | r3631 | |
| 216 | 216 | |
| 217 | 217 | UINT8 data = 0; |
| 218 | 218 | |
| 219 | | if (BIT(ipc.keylatch, 0)) data |= input_port_read(machine, "ROW0") | input_port_read(machine, "JOY0"); |
| 220 | | if (BIT(ipc.keylatch, 1)) data |= input_port_read(machine, "ROW1") | input_port_read(machine, "JOY1"); |
| 221 | | if (BIT(ipc.keylatch, 2)) data |= input_port_read(machine, "ROW2"); |
| 222 | | if (BIT(ipc.keylatch, 3)) data |= input_port_read(machine, "ROW3"); |
| 223 | | if (BIT(ipc.keylatch, 4)) data |= input_port_read(machine, "ROW4"); |
| 224 | | if (BIT(ipc.keylatch, 5)) data |= input_port_read(machine, "ROW5"); |
| 225 | | if (BIT(ipc.keylatch, 6)) data |= input_port_read(machine, "ROW6"); |
| 226 | | if (BIT(ipc.keylatch, 7)) data |= input_port_read(machine, "ROW7"); |
| 219 | if (BIT(ipc.keylatch, 0)) data |= input_port_read(space->machine, "ROW0") | input_port_read(space->machine, "JOY0"); |
| 220 | if (BIT(ipc.keylatch, 1)) data |= input_port_read(space->machine, "ROW1") | input_port_read(space->machine, "JOY1"); |
| 221 | if (BIT(ipc.keylatch, 2)) data |= input_port_read(space->machine, "ROW2"); |
| 222 | if (BIT(ipc.keylatch, 3)) data |= input_port_read(space->machine, "ROW3"); |
| 223 | if (BIT(ipc.keylatch, 4)) data |= input_port_read(space->machine, "ROW4"); |
| 224 | if (BIT(ipc.keylatch, 5)) data |= input_port_read(space->machine, "ROW5"); |
| 225 | if (BIT(ipc.keylatch, 6)) data |= input_port_read(space->machine, "ROW6"); |
| 226 | if (BIT(ipc.keylatch, 7)) data |= input_port_read(space->machine, "ROW7"); |
| 227 | 227 | |
| 228 | 228 | return data; |
| 229 | 229 | } |
| r3630 | r3631 | |
| 517 | 517 | |
| 518 | 518 | static ZX8302_IRQ_CALLBACK( ql_irq_w ) |
| 519 | 519 | { |
| 520 | | cpunum_set_input_line(device->machine, 0, MC68000_IRQ_2, state); |
| 520 | cpu_set_input_line(device->machine->cpu[0], M68K_IRQ_2, state); |
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | static ZX8302_ON_BAUDX4_CHANGED( ql_baudx4_w ) |
| r3630 | r3631 | |
| 867 | 867 | { |
| 868 | 868 | if (image_fread(image, ptr, filesize) == filesize) |
| 869 | 869 | { |
| 870 | | memory_install_readwrite8_handler(image->machine, 0, ADDRESS_SPACE_PROGRAM, 0x00c000, 0x00ffff, 0, 0, SMH_BANK1, SMH_UNMAP); |
| 870 | memory_install_readwrite8_handler(cpu_get_address_space(image->machine->cpu[0],ADDRESS_SPACE_PROGRAM), 0x00c000, 0x00ffff, 0, 0, SMH_BANK1, SMH_UNMAP); |
| 871 | 871 | |
| 872 | 872 | return INIT_PASS; |
| 873 | 873 | } |