src/mess/drivers/p8k.c
| r6503 | r6504 | |
| 11 | 11 | TODO: |
| 12 | 12 | * add Z8001 core so that we can handle the 16bit IO Map (Z8000 uses a |
| 13 | 13 | 8bit IO Map, and hence I commented out the whole map) |
| 14 | | * add floppy emulation to 8 bit board |
| 15 | 14 | * properly implement Z80 daisy chain in 16 bit board |
| 16 | 15 | |
| 17 | 16 | ****************************************************************************/ |
| r6503 | r6504 | |
| 20 | 19 | #include "cpu/z80/z80.h" |
| 21 | 20 | #include "cpu/z8000/z8000.h" |
| 22 | 21 | #include "cpu/z80/z80daisy.h" |
| 22 | #include "formats/basicdsk.h" |
| 23 | #include "devices/flopdrv.h" |
| 24 | #include "machine/upd765.h" |
| 23 | 25 | #include "machine/z80ctc.h" |
| 24 | 26 | #include "machine/z80pio.h" |
| 25 | 27 | #include "machine/z80sio.h" |
| r6503 | r6504 | |
| 73 | 75 | AM_RANGE(0x08, 0x0b) AM_DEVREADWRITE("z80ctc_0", z80ctc_r, z80ctc_w) |
| 74 | 76 | AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE("z80pio_0", z80pio_alt_r, z80pio_alt_w) |
| 75 | 77 | AM_RANGE(0x18, 0x1b) AM_DEVREADWRITE("z80pio_1", z80pio_alt_r, z80pio_alt_w) |
| 76 | | AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_alt_r, z80pio_alt_w) // we still need to add the FDC related part of this one |
| 77 | | // AM_RANGE(0x20, 0x23) // FDC |
| 78 | AM_RANGE(0x1c, 0x1f) AM_DEVREADWRITE("z80pio_2", z80pio_alt_r, z80pio_alt_w) |
| 79 | AM_RANGE(0x20, 0x20) AM_DEVREADWRITE("i8272", upd765_data_r, upd765_data_w) |
| 80 | AM_RANGE(0x21, 0x21) AM_DEVREAD("i8272", upd765_status_r) |
| 78 | 81 | AM_RANGE(0x24, 0x27) AM_DEVREADWRITE("z80sio_0", sio2_r, sio2_w) |
| 79 | 82 | AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("z80sio_1", sio2_r, sio2_w) |
| 80 | 83 | AM_RANGE(0x2c, 0x2f) AM_DEVREADWRITE("z80ctc_1", z80ctc_r, z80ctc_w) |
| 81 | | AM_RANGE(0x3c, 0x3c) AM_DEVREADWRITE("z80dma", z80dma_r, z80dma_w) // FDC related |
| 84 | AM_RANGE(0x3c, 0x3c) AM_DEVREADWRITE("z80dma", z80dma_r, z80dma_w) |
| 82 | 85 | ADDRESS_MAP_END |
| 83 | 86 | |
| 84 | 87 | static ADDRESS_MAP_START(p8k_16_memmap, ADDRESS_SPACE_PROGRAM, 16) |
| r6503 | r6504 | |
| 206 | 209 | |
| 207 | 210 | /* Z80 DMA */ |
| 208 | 211 | |
| 209 | | // still to implement: dma io read/write which handle FDC. also, the interrupt should deal with FDC as well, with p8k_daisy_interrupt as a fallback |
| 212 | static WRITE_LINE_DEVICE_HANDLER( p8k_dma_irq_w ) |
| 213 | { |
| 214 | if (state) |
| 215 | { |
| 216 | const device_config *i8272 = devtag_get_device(device->machine, "i8272"); |
| 217 | upd765_tc_w(i8272, state); |
| 218 | } |
| 210 | 219 | |
| 220 | p8k_daisy_interrupt(device, state); |
| 221 | } |
| 222 | |
| 211 | 223 | static Z80DMA_INTERFACE( p8k_dma_intf ) |
| 212 | 224 | { |
| 213 | | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT), |
| 225 | DEVCB_LINE(p8k_dma_irq_w), |
| 214 | 226 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), |
| 215 | 227 | DEVCB_NULL, |
| 216 | 228 | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte), |
| r6503 | r6504 | |
| 320 | 332 | NULL /* receive handler */ |
| 321 | 333 | }; |
| 322 | 334 | |
| 323 | | |
| 324 | 335 | /* Z80 Daisy Chain */ |
| 325 | 336 | |
| 326 | 337 | static const z80_daisy_chain p8k_daisy_chain[] = |
| r6503 | r6504 | |
| 336 | 347 | { NULL } |
| 337 | 348 | }; |
| 338 | 349 | |
| 350 | /* Intel 8272 Interface */ |
| 339 | 351 | |
| 352 | static WRITE_LINE_DEVICE_HANDLER( p8k_i8272_irq_w ) |
| 353 | { |
| 354 | const device_config *z80pio = devtag_get_device(device->machine, "z80pio_2"); |
| 355 | |
| 356 | z80pio_p_w(z80pio, 1, (state) ? 0x10 : 0x00); |
| 357 | } |
| 358 | |
| 359 | static UPD765_DMA_REQUEST( p8k_i8272_drq_w ) |
| 360 | { |
| 361 | const device_config *z80dma = devtag_get_device(device->machine, "z80dma"); |
| 362 | |
| 363 | z80dma_rdy_w(z80dma, state); |
| 364 | } |
| 365 | |
| 366 | static const struct upd765_interface p8k_i8272_intf = |
| 367 | { |
| 368 | DEVCB_LINE(p8k_i8272_irq_w), |
| 369 | p8k_i8272_drq_w, |
| 370 | NULL, |
| 371 | UPD765_RDY_PIN_CONNECTED, |
| 372 | { FLOPPY_0, FLOPPY_1, NULL, NULL } |
| 373 | }; |
| 374 | |
| 375 | static const floppy_config p8k_floppy_config = |
| 376 | { |
| 377 | DEVCB_NULL, |
| 378 | DEVCB_NULL, |
| 379 | DEVCB_NULL, |
| 380 | DEVCB_NULL, |
| 381 | DEVCB_NULL, |
| 382 | FLOPPY_DRIVE_DS_80, |
| 383 | FLOPPY_OPTIONS_NAME(default), |
| 384 | DO_NOT_KEEP_GEOMETRY |
| 385 | }; |
| 386 | |
| 340 | 387 | /*************************************************************************** |
| 341 | 388 | |
| 342 | 389 | P8000 16bit Peripherals |
| r6503 | r6504 | |
| 443 | 490 | NULL /* receive handler */ |
| 444 | 491 | }; |
| 445 | 492 | |
| 446 | | |
| 447 | 493 | /* Z80 Daisy Chain */ |
| 448 | 494 | |
| 449 | 495 | static const z80_daisy_chain p8k_16_daisy_chain[] = |
| r6503 | r6504 | |
| 483 | 529 | MDRV_Z80PIO_ADD("z80pio_0", p8k_pio_0_intf) |
| 484 | 530 | MDRV_Z80PIO_ADD("z80pio_1", p8k_pio_1_intf) |
| 485 | 531 | MDRV_Z80PIO_ADD("z80pio_2", p8k_pio_2_intf) |
| 532 | MDRV_UPD765A_ADD("i8272", p8k_i8272_intf) |
| 533 | MDRV_FLOPPY_2_DRIVES_ADD(p8k_floppy_config) |
| 486 | 534 | |
| 487 | 535 | /* sound hardware */ |
| 488 | 536 | MDRV_SPEAKER_STANDARD_MONO("mono") |