src/mess/machine/conkort.c
| r7622 | r7623 | |
| 101 | 101 | |
| 102 | 102 | #define Z80_TAG "5a" |
| 103 | 103 | #define Z80PIO_TAG "3a" |
| 104 | #define FD1791_TAG "7a" |
| 105 | |
| 104 | 106 | #define Z80DMA_TAG "z80dma" |
| 105 | | #define WD1791_TAG "wd1791" |
| 106 | 107 | #define SAB1793_TAG "sab1793" |
| 107 | 108 | |
| 108 | 109 | /*************************************************************************** |
| r7622 | r7623 | |
| 116 | 117 | UINT8 data; /* ABC BUS data */ |
| 117 | 118 | int fdc_irq; /* floppy interrupt */ |
| 118 | 119 | int fdc_drq; /* floppy data request */ |
| 119 | | int fdc_dden; /* floppy density */ |
| 120 | 120 | int wait_enable; /* wait enable */ |
| 121 | 121 | |
| 122 | 122 | /* devices */ |
| 123 | 123 | running_device *cpu; |
| 124 | 124 | running_device *z80pio; |
| 125 | | running_device *wd1791; |
| 125 | running_device *fd1791; |
| 126 | 126 | running_device *image0; |
| 127 | 127 | running_device *image1; |
| 128 | 128 | }; |
| r7622 | r7623 | |
| 184 | 184 | |
| 185 | 185 | UINT8 data = 0xff; |
| 186 | 186 | |
| 187 | | z80pio_astb_w(conkort->z80pio, 0); |
| 188 | | |
| 189 | 187 | if (!BIT(conkort->status, 6)) |
| 190 | 188 | { |
| 191 | 189 | data = conkort->data; |
| 192 | 190 | } |
| 193 | 191 | |
| 192 | logerror("INP\n"); |
| 193 | |
| 194 | z80pio_astb_w(conkort->z80pio, 0); |
| 194 | 195 | z80pio_astb_w(conkort->z80pio, 1); |
| 195 | 196 | |
| 196 | 197 | return data; |
| r7622 | r7623 | |
| 200 | 201 | { |
| 201 | 202 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 202 | 203 | |
| 203 | | z80pio_astb_w(conkort->z80pio, 0); |
| 204 | | |
| 205 | 204 | if (BIT(conkort->status, 6)) |
| 206 | 205 | { |
| 207 | 206 | conkort->data = data; |
| 208 | 207 | } |
| 209 | 208 | |
| 209 | logerror("UTP %02x\n", data); |
| 210 | |
| 211 | z80pio_astb_w(conkort->z80pio, 0); |
| 210 | 212 | z80pio_astb_w(conkort->z80pio, 1); |
| 211 | 213 | } |
| 212 | 214 | |
| r7622 | r7623 | |
| 214 | 216 | { |
| 215 | 217 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 216 | 218 | |
| 219 | logerror("STAT\n"); |
| 220 | |
| 217 | 221 | return (conkort->status & 0xfe) | z80pio_ardy_r(conkort->z80pio); |
| 218 | 222 | } |
| 219 | 223 | |
| r7622 | r7623 | |
| 221 | 225 | { |
| 222 | 226 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 223 | 227 | |
| 224 | | cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, PULSE_LINE); |
| 228 | logerror("C1 %02x\n", data); |
| 229 | |
| 230 | cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, ASSERT_LINE); |
| 231 | cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, CLEAR_LINE); |
| 225 | 232 | } |
| 226 | 233 | |
| 227 | 234 | static WRITE8_HANDLER( slow_bus_c3_w ) |
| 228 | 235 | { |
| 229 | 236 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 230 | 237 | |
| 238 | logerror("C3 %02x\n", data); |
| 239 | |
| 231 | 240 | cpu_set_input_line(conkort->cpu, INPUT_LINE_RESET, PULSE_LINE); |
| 232 | 241 | } |
| 233 | 242 | |
| 234 | 243 | static ABCBUS_CARD_SELECT( luxor_55_10828 ) |
| 235 | 244 | { |
| 236 | | slow_t *conkort = get_safe_token_slow(device); |
| 245 | logerror("CS %02x\n", data); |
| 237 | 246 | |
| 238 | 247 | if (data == 0x2d) // TODO: bit 0 of this is configurable with S1 |
| 239 | 248 | { |
| r7622 | r7623 | |
| 246 | 255 | memory_install_write8_handler(io, ABCBUS_C3, ABCBUS_C3, 0x18, 0, slow_bus_c3_w); |
| 247 | 256 | memory_nop_write(io, ABCBUS_C4, ABCBUS_C4, 0x18, 0); |
| 248 | 257 | } |
| 249 | | |
| 250 | | cpu_set_input_line(conkort->cpu, INPUT_LINE_RESET, PULSE_LINE); |
| 251 | 258 | } |
| 252 | 259 | |
| 253 | 260 | static WRITE8_HANDLER( slow_ctrl_w ) |
| 254 | 261 | { |
| 255 | 262 | /* |
| 256 | 263 | |
| 257 | | bit description |
| 264 | bit signal description |
| 258 | 265 | |
| 259 | | 0 SEL 0 |
| 260 | | 1 SEL 1 |
| 261 | | 2 SEL 2 |
| 262 | | 3 MOT ON |
| 266 | 0 _SEL 0 |
| 267 | 1 _SEL 1 |
| 268 | 2 _SEL 2 |
| 269 | 3 _MOT ON |
| 263 | 270 | 4 SIDE |
| 264 | 271 | 5 _PRECOMP ON |
| 265 | 272 | 6 _WAIT ENABLE |
| r7622 | r7623 | |
| 270 | 277 | slow_t *conkort = get_safe_token_machine_slow(space->machine); |
| 271 | 278 | |
| 272 | 279 | /* drive selection */ |
| 273 | | if (BIT(data, 0)) wd17xx_set_drive(conkort->wd1791, 0); |
| 274 | | if (BIT(data, 1)) wd17xx_set_drive(conkort->wd1791, 1); |
| 275 | | // if (BIT(data, 2)) wd17xx_set_drive(conkort->wd1791, 2); |
| 280 | if (BIT(data, 0)) wd17xx_set_drive(conkort->fd1791, 0); |
| 281 | if (BIT(data, 1)) wd17xx_set_drive(conkort->fd1791, 1); |
| 282 | // if (BIT(data, 2)) wd17xx_set_drive(conkort->fd1791, 2); |
| 276 | 283 | |
| 277 | 284 | /* motor enable */ |
| 278 | 285 | floppy_mon_w(conkort->image0, !BIT(data, 3)); |
| r7622 | r7623 | |
| 281 | 288 | floppy_drive_set_ready_state(conkort->image1, 1, 1); |
| 282 | 289 | |
| 283 | 290 | /* disk side selection */ |
| 284 | | wd17xx_set_side(conkort->wd1791, BIT(data, 4)); |
| 291 | wd17xx_set_side(conkort->fd1791, BIT(data, 4)); |
| 285 | 292 | |
| 286 | 293 | /* wait enable */ |
| 287 | 294 | conkort->wait_enable = BIT(data, 6); |
| 288 | 295 | |
| 289 | | if (!BIT(data, 7)) |
| 290 | | { |
| 291 | | /* FDC master reset */ |
| 292 | | wd17xx_reset(conkort->wd1791); |
| 293 | | } |
| 296 | /* FDC master reset */ |
| 297 | wd17xx_mr_w(conkort->fd1791, BIT(data, 7)); |
| 294 | 298 | } |
| 295 | 299 | |
| 296 | 300 | static WRITE8_HANDLER( slow_status_w ) |
| r7622 | r7623 | |
| 398 | 402 | { |
| 399 | 403 | fast_t *conkort = get_safe_token_machine_fast(space->machine); |
| 400 | 404 | |
| 401 | | cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, PULSE_LINE); |
| 405 | cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, ASSERT_LINE); |
| 406 | cpu_set_input_line(conkort->cpu, INPUT_LINE_NMI, CLEAR_LINE); |
| 402 | 407 | } |
| 403 | 408 | |
| 404 | 409 | static WRITE8_HANDLER( fast_bus_c3_w ) |
| r7622 | r7623 | |
| 473 | 478 | // Slow Controller |
| 474 | 479 | |
| 475 | 480 | static ADDRESS_MAP_START( slow_map, ADDRESS_SPACE_PROGRAM, 8 ) |
| 476 | | AM_RANGE(0x0000, 0x0fff) AM_ROM AM_REGION("abc830", 0) |
| 477 | | AM_RANGE(0x1000, 0x13ff) AM_RAM |
| 481 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 482 | AM_RANGE(0x0000, 0x07ff) AM_MIRROR(0x0800) AM_ROM AM_REGION("abc830", 0) |
| 483 | AM_RANGE(0x1000, 0x13ff) AM_MIRROR(0x0c00) AM_RAM |
| 478 | 484 | ADDRESS_MAP_END |
| 479 | 485 | |
| 480 | 486 | static ADDRESS_MAP_START( slow_io_map, ADDRESS_SPACE_IO, 8 ) |
| 481 | 487 | ADDRESS_MAP_GLOBAL_MASK(0xff) |
| 482 | 488 | AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVREADWRITE(Z80PIO_TAG, z80pio_ba_cd_r, z80pio_ba_cd_w) |
| 483 | | AM_RANGE(0xb0, 0xb3) AM_MIRROR(0x0c) AM_DEVREADWRITE(WD1791_TAG, wd17xx_r, wd17xx_w) |
| 489 | AM_RANGE(0xb0, 0xb3) AM_MIRROR(0x0c) AM_DEVREADWRITE(FD1791_TAG, slow_fdc_r, slow_fdc_w) |
| 484 | 490 | AM_RANGE(0xd0, 0xd0) AM_MIRROR(0x0f) AM_WRITE(slow_status_w) |
| 485 | 491 | AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x0f) AM_WRITE(slow_ctrl_w) |
| 486 | 492 | ADDRESS_MAP_END |
| r7622 | r7623 | |
| 500 | 506 | // AM_RANGE(0x30, 0x30) AM_MIRROR(0x0f) AM_WRITE() |
| 501 | 507 | // AM_RANGE(0x40, 0x40) AM_MIRROR(0x0f) AM_WRITE() |
| 502 | 508 | AM_RANGE(0x50, 0x50) AM_MIRROR(0x0f) AM_READ(fast_ctrl_r) |
| 503 | | AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREAD(SAB1793_TAG, slow_fdc_r) |
| 504 | | AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVWRITE(SAB1793_TAG, slow_fdc_w) |
| 509 | AM_RANGE(0x60, 0x63) AM_MIRROR(0x0c) AM_DEVREAD(SAB1793_TAG, wd17xx_r) |
| 510 | AM_RANGE(0x70, 0x73) AM_MIRROR(0x0c) AM_DEVWRITE(SAB1793_TAG, wd17xx_w) |
| 505 | 511 | AM_RANGE(0x80, 0x80) AM_MIRROR(0x0f) AM_DEVREADWRITE(Z80DMA_TAG, z80dma_r, z80dma_w) |
| 506 | 512 | ADDRESS_MAP_END |
| 507 | 513 | |
| r7622 | r7623 | |
| 578 | 584 | |
| 579 | 585 | bit description |
| 580 | 586 | |
| 581 | | 0 !(_DS0 & _DS1) |
| 582 | | 1 !(_DD0 & _DD1) |
| 587 | 0 !(_DS0 & _DS1) single/double sided (0=SS, 1=DS) |
| 588 | 1 !(_DD0 & _DD1) single/double density (0=DS, 1=DD) |
| 583 | 589 | 2 8B pin 10 |
| 584 | | 3 FDC DDEN |
| 585 | | 4 _R/BS |
| 586 | | 5 FDC HLT |
| 587 | | 6 FDC _HDLD |
| 588 | | 7 FDC IRQ |
| 590 | 3 FDC _DDEN double density enable |
| 591 | 4 _R/BS radial/binary drive select |
| 592 | 5 FDC HLT head load timing |
| 593 | 6 FDC _HDLD head load |
| 594 | 7 FDC IRQ interrupt request |
| 589 | 595 | |
| 590 | 596 | */ |
| 591 | 597 | |
| 592 | 598 | slow_t *conkort = get_safe_token_machine_slow(device->machine); |
| 593 | 599 | |
| 594 | | return conkort->fdc_irq << 7 | 0x10 | !conkort->fdc_dden << 2; |
| 600 | UINT8 data = 0; |
| 601 | |
| 602 | /* single/double sided drive */ |
| 603 | data |= 0x01; |
| 604 | |
| 605 | /* single/double density drive */ |
| 606 | data |= 0x02; |
| 607 | |
| 608 | /* radial/binary drive select */ |
| 609 | data |= 0x10; |
| 610 | |
| 611 | /* head load */ |
| 612 | // data |= wd17xx_hdld_r(conkort->fd1791) << 6; |
| 613 | |
| 614 | /* FDC interrupt request */ |
| 615 | data |= conkort->fdc_irq << 7; |
| 616 | |
| 617 | return data; |
| 595 | 618 | } |
| 596 | 619 | |
| 597 | 620 | static WRITE8_DEVICE_HANDLER( conkort_pio_port_b_w ) |
| 598 | 621 | { |
| 599 | 622 | /* |
| 600 | 623 | |
| 601 | | bit description |
| 624 | bit signal description |
| 602 | 625 | |
| 603 | | 0 !(_DS0 & _DS1) |
| 604 | | 1 !(_DD0 & _DD1) |
| 626 | 0 !(_DS0 & _DS1) single/double sided (0=SS, 1=DS) |
| 627 | 1 !(_DD0 & _DD1) single/double density (0=DS, 1=DD) |
| 605 | 628 | 2 8B pin 10 |
| 606 | | 3 FDC _DDEN |
| 607 | | 4 _R/BS |
| 608 | | 5 FDC HLT |
| 609 | | 6 FDC _HDLD |
| 610 | | 7 FDC IRQ |
| 629 | 3 FDC _DDEN double density enable |
| 630 | 4 _R/BS radial/binary drive select |
| 631 | 5 FDC HLT head load timing |
| 632 | 6 FDC _HDLD head load |
| 633 | 7 FDC IRQ interrupt request |
| 611 | 634 | |
| 612 | 635 | */ |
| 613 | 636 | |
| 614 | 637 | slow_t *conkort = get_safe_token_machine_slow(device->machine); |
| 615 | 638 | |
| 616 | | /* disk density */ |
| 617 | | conkort->fdc_dden = BIT(data, 3); |
| 618 | | wd17xx_dden_w(conkort->wd1791, conkort->fdc_dden); |
| 639 | /* double density enable */ |
| 640 | wd17xx_dden_w(conkort->fd1791, BIT(data, 3)); |
| 641 | |
| 642 | /* head load timing */ |
| 643 | // wd17xx_hlt_w(conkort->fd1791, BIT(data, 5)); |
| 619 | 644 | } |
| 620 | 645 | |
| 621 | 646 | static Z80PIO_INTERFACE( conkort_pio_intf ) |
| r7622 | r7623 | |
| 701 | 726 | |
| 702 | 727 | /* FD1791 */ |
| 703 | 728 | |
| 704 | | static WRITE_LINE_DEVICE_HANDLER( slow_wd1791_intrq_w ) |
| 729 | static WRITE_LINE_DEVICE_HANDLER( slow_fd1791_intrq_w ) |
| 705 | 730 | { |
| 706 | 731 | slow_t *conkort = get_safe_token_machine_slow(device->machine); |
| 707 | 732 | |
| r7622 | r7623 | |
| 714 | 739 | } |
| 715 | 740 | } |
| 716 | 741 | |
| 717 | | static WRITE_LINE_DEVICE_HANDLER( slow_wd1791_drq_w ) |
| 742 | static WRITE_LINE_DEVICE_HANDLER( slow_fd1791_drq_w ) |
| 718 | 743 | { |
| 719 | 744 | slow_t *conkort = get_safe_token_machine_slow(device->machine); |
| 720 | 745 | |
| r7622 | r7623 | |
| 730 | 755 | static const wd17xx_interface slow_wd17xx_interface = |
| 731 | 756 | { |
| 732 | 757 | DEVCB_NULL, |
| 733 | | DEVCB_LINE(slow_wd1791_intrq_w), |
| 734 | | DEVCB_LINE(slow_wd1791_drq_w), |
| 758 | DEVCB_LINE(slow_fd1791_intrq_w), |
| 759 | DEVCB_LINE(slow_fd1791_drq_w), |
| 735 | 760 | { FLOPPY_0, FLOPPY_1, NULL, NULL } |
| 736 | 761 | }; |
| 737 | 762 | |
| r7622 | r7623 | |
| 766 | 791 | MDRV_CPU_CONFIG(slow_daisy_chain) |
| 767 | 792 | |
| 768 | 793 | MDRV_Z80PIO_ADD(Z80PIO_TAG, XTAL_4MHz/2, conkort_pio_intf) |
| 769 | | MDRV_WD179X_ADD(WD1791_TAG, slow_wd17xx_interface) |
| 794 | MDRV_WD179X_ADD(FD1791_TAG, slow_wd17xx_interface) |
| 770 | 795 | |
| 771 | 796 | MDRV_FLOPPY_2_DRIVES_ADD(abc800_floppy_config) |
| 772 | 797 | MACHINE_DRIVER_END |
| r7622 | r7623 | |
| 843 | 868 | |
| 844 | 869 | /* find devices */ |
| 845 | 870 | conkort->z80pio = device->subdevice(Z80PIO_TAG); |
| 846 | | conkort->wd1791 = device->subdevice(WD1791_TAG); |
| 871 | conkort->fd1791 = device->subdevice(FD1791_TAG); |
| 847 | 872 | conkort->image0 = device->subdevice(FLOPPY_0); |
| 848 | 873 | conkort->image1 = device->subdevice(FLOPPY_1); |
| 849 | 874 | |
| r7622 | r7623 | |
| 852 | 877 | state_save_register_device_item(device, 0, conkort->data); |
| 853 | 878 | state_save_register_device_item(device, 0, conkort->fdc_irq); |
| 854 | 879 | state_save_register_device_item(device, 0, conkort->fdc_drq); |
| 855 | | state_save_register_device_item(device, 0, conkort->fdc_dden); |
| 856 | 880 | state_save_register_device_item(device, 0, conkort->wait_enable); |
| 857 | 881 | } |
| 858 | 882 | |