src/emu/machine/z80dma.c
| r6337 | r6338 | |
| 97 | 97 | typedef struct _z80dma_t z80dma_t; |
| 98 | 98 | struct _z80dma_t |
| 99 | 99 | { |
| 100 | | const z80dma_interface *intf; |
| 100 | devcb_resolved_write_line out_busreq_func; |
| 101 | devcb_resolved_write_line out_int_func; |
| 102 | devcb_resolved_write_line out_bao_func; |
| 103 | devcb_resolved_read8 in_mreq_func; |
| 104 | devcb_resolved_write8 out_mreq_func; |
| 105 | devcb_resolved_read8 in_iorq_func; |
| 106 | devcb_resolved_write8 out_iorq_func; |
| 107 | |
| 101 | 108 | emu_timer *timer; |
| 102 | 109 | |
| 103 | 110 | UINT16 regs[REGNUM(6,1)+1]; |
| r6337 | r6338 | |
| 147 | 154 | if (PORTA_IS_SOURCE(cntx)) |
| 148 | 155 | { |
| 149 | 156 | if (PORTA_MEMORY(cntx)) |
| 150 | | cntx->latch = cntx->intf->memory_read(device, cntx->addressA); |
| 157 | cntx->latch = devcb_call_read8(&cntx->in_mreq_func, cntx->addressA); |
| 151 | 158 | else |
| 152 | | cntx->latch = cntx->intf->portA_read(device, cntx->addressA); |
| 159 | cntx->latch = devcb_call_read8(&cntx->in_iorq_func, cntx->addressA); |
| 153 | 160 | |
| 154 | 161 | LOG(("A src: %04x \n",cntx->addressA)); |
| 155 | 162 | cntx->addressA += PORTA_FIXED(cntx) ? 0 : PORTA_INC(cntx) ? PORTA_STEP(cntx) : -PORTA_STEP(cntx); |
| r6337 | r6338 | |
| 157 | 164 | else |
| 158 | 165 | { |
| 159 | 166 | if (PORTB_MEMORY(cntx)) |
| 160 | | cntx->latch = cntx->intf->memory_read(device, cntx->addressB); |
| 167 | cntx->latch = devcb_call_read8(&cntx->in_mreq_func, cntx->addressB); |
| 161 | 168 | else |
| 162 | | cntx->latch = cntx->intf->portB_read(device, cntx->addressB); |
| 169 | cntx->latch = devcb_call_read8(&cntx->in_iorq_func, cntx->addressB); |
| 163 | 170 | |
| 164 | 171 | LOG(("B src: %04x \n",cntx->addressB)); |
| 165 | 172 | cntx->addressB += PORTB_FIXED(cntx) ? 0 : PORTB_INC(cntx) ? PORTB_STEP(cntx) : -PORTB_STEP(cntx); |
| r6337 | r6338 | |
| 190 | 197 | if (PORTA_IS_SOURCE(cntx)) |
| 191 | 198 | { |
| 192 | 199 | if (PORTB_MEMORY(cntx)) |
| 193 | | cntx->intf->memory_write(device, cntx->addressB, cntx->latch); |
| 200 | devcb_call_write8(&cntx->out_mreq_func, cntx->addressB, cntx->latch); |
| 194 | 201 | else |
| 195 | | cntx->intf->portB_write(device, cntx->addressB, cntx->latch); |
| 202 | devcb_call_write8(&cntx->out_iorq_func, cntx->addressB, cntx->latch); |
| 196 | 203 | |
| 197 | 204 | LOG(("B dst: %04x \n",cntx->addressB)); |
| 198 | 205 | cntx->addressB += PORTB_FIXED(cntx) ? 0 : PORTB_INC(cntx) ? PORTB_STEP(cntx) : -PORTB_STEP(cntx); |
| r6337 | r6338 | |
| 200 | 207 | else |
| 201 | 208 | { |
| 202 | 209 | if (PORTA_MEMORY(cntx)) |
| 203 | | cntx->intf->memory_write(device, cntx->addressA, cntx->latch); |
| 210 | devcb_call_write8(&cntx->out_mreq_func, cntx->addressA, cntx->latch); |
| 204 | 211 | else |
| 205 | | cntx->intf->portA_write(device, cntx->addressA, cntx->latch); |
| 212 | devcb_call_write8(&cntx->out_iorq_func, cntx->addressA, cntx->latch); |
| 206 | 213 | |
| 207 | 214 | LOG(("A dst: %04x \n",cntx->addressA)); |
| 208 | 215 | cntx->addressA += PORTA_FIXED(cntx) ? 0 : PORTA_INC(cntx) ? PORTA_STEP(cntx) : -PORTA_STEP(cntx); |
| r6337 | r6338 | |
| 296 | 303 | timer_reset(z80dma->timer, attotime_never); |
| 297 | 304 | } |
| 298 | 305 | |
| 299 | | /* set the halt line */ |
| 300 | | if (z80dma->intf && z80dma->intf->cputag != NULL) |
| 301 | | { |
| 302 | | //FIXME: Synchronization is done by BUSREQ! |
| 303 | | cputag_set_input_line(device->machine, z80dma->intf->cputag, INPUT_LINE_HALT, |
| 304 | | pending_transfer ? ASSERT_LINE : CLEAR_LINE); |
| 305 | | } |
| 306 | /* set the busreq line */ |
| 307 | devcb_call_write_line(&z80dma->out_busreq_func, pending_transfer ? ASSERT_LINE : CLEAR_LINE); |
| 306 | 308 | } |
| 307 | 309 | |
| 308 | 310 | /* ----------------------------------------------------------------------- */ |
| r6337 | r6338 | |
| 423 | 425 | LOG(("Disable DMA\n")); |
| 424 | 426 | cntx->dma_enabled = 0; |
| 425 | 427 | cntx->rdy = 1 ^ ((WR5(cntx) & 0x8)>>3); |
| 426 | | z80dma_rdy_w(device, 0, cntx->rdy); |
| 428 | z80dma_rdy_w(device, cntx->rdy); |
| 427 | 429 | break; |
| 428 | 430 | case 0x87: /* Enable dma */ |
| 429 | 431 | LOG(("Enable DMA\n")); |
| 430 | 432 | cntx->dma_enabled = 1; |
| 431 | 433 | cntx->rdy = (WR5(cntx) & 0x8)>>3; |
| 432 | | z80dma_rdy_w(device, 0, cntx->rdy); |
| 434 | z80dma_rdy_w(device, cntx->rdy); |
| 433 | 435 | break; |
| 434 | 436 | case 0xBB: |
| 435 | 437 | LOG(("Set Read Mask\n")); |
| r6337 | r6338 | |
| 453 | 455 | case 0xB3: /* Force ready */ |
| 454 | 456 | LOG(("Force ready\n")); |
| 455 | 457 | cntx->rdy = (WR5(cntx) & 0x8)>>3; |
| 456 | | z80dma_rdy_w(device, 0, cntx->rdy); |
| 458 | z80dma_rdy_w(device, cntx->rdy); |
| 457 | 459 | break; |
| 458 | 460 | case 0xAB: /* Enable interrupts */ |
| 459 | 461 | LOG(("Enable IRQ\n")); |
| r6337 | r6338 | |
| 512 | 514 | } |
| 513 | 515 | |
| 514 | 516 | |
| 515 | | WRITE8_DEVICE_HANDLER( z80dma_rdy_w ) |
| 517 | WRITE_LINE_DEVICE_HANDLER( z80dma_rdy_w ) |
| 516 | 518 | { |
| 517 | 519 | z80dma_t *z80dma = get_safe_token(device); |
| 518 | 520 | int param; |
| 519 | 521 | |
| 520 | 522 | assert( offset == 0); |
| 521 | 523 | |
| 522 | | param = (data ? 1 : 0); |
| 523 | | LOG(("RDY: %d Active High: %d\n", data, READY_ACTIVE_HIGH(z80dma))); |
| 524 | param = (state ? 1 : 0); |
| 525 | LOG(("RDY: %d Active High: %d\n", state, READY_ACTIVE_HIGH(z80dma))); |
| 524 | 526 | timer_call_after_resynch(device->machine, (void *) device, param, z80dma_rdy_write_callback); |
| 525 | 527 | } |
| 526 | 528 | |
| 529 | WRITE_LINE_DEVICE_HANDLER( z80dma_wait_w ) |
| 530 | { |
| 531 | } |
| 527 | 532 | |
| 533 | WRITE_LINE_DEVICE_HANDLER( z80dma_bai_w ) |
| 534 | { |
| 535 | } |
| 536 | |
| 537 | |
| 528 | 538 | /*************************************************************************** |
| 529 | 539 | DAISY CHAIN INTERFACE |
| 530 | 540 | ***************************************************************************/ |
| r6337 | r6338 | |
| 552 | 562 | static DEVICE_START( z80dma ) |
| 553 | 563 | { |
| 554 | 564 | z80dma_t *z80dma = get_safe_token(device); |
| 565 | z80dma_interface *intf = (z80dma_interface *)device->static_config; |
| 555 | 566 | |
| 556 | | /* validate arguments */ |
| 557 | | assert(device != NULL); |
| 558 | | assert(device->tag != NULL); |
| 567 | /* resolve callbacks */ |
| 568 | devcb_resolve_write_line(&z80dma->out_busreq_func, &intf->out_busreq_func, device); |
| 569 | devcb_resolve_write_line(&z80dma->out_int_func, &intf->out_int_func, device); |
| 570 | devcb_resolve_write_line(&z80dma->out_bao_func, &intf->out_bao_func, device); |
| 571 | devcb_resolve_read8(&z80dma->in_mreq_func, &intf->in_mreq_func, device); |
| 572 | devcb_resolve_write8(&z80dma->out_mreq_func, &intf->out_mreq_func, device); |
| 573 | devcb_resolve_read8(&z80dma->in_iorq_func, &intf->in_iorq_func, device); |
| 574 | devcb_resolve_write8(&z80dma->out_iorq_func, &intf->out_iorq_func, device); |
| 559 | 575 | |
| 560 | | z80dma->intf = (const z80dma_interface *)device->static_config; |
| 561 | | |
| 576 | /* allocate timer */ |
| 562 | 577 | z80dma->timer = timer_alloc(device->machine, z80dma_timerproc, (void *) device); |
| 563 | 578 | |
| 579 | /* register for state saving */ |
| 564 | 580 | state_save_register_device_item_array(device, 0, z80dma->regs); |
| 565 | 581 | state_save_register_device_item_array(device, 0, z80dma->regs_follow); |
| 566 | | |
| 567 | 582 | state_save_register_device_item(device, 0, z80dma->num_follow); |
| 568 | 583 | state_save_register_device_item(device, 0, z80dma->cur_follow); |
| 569 | 584 | state_save_register_device_item(device, 0, z80dma->status); |
| 570 | 585 | state_save_register_device_item(device, 0, z80dma->dma_enabled); |
| 571 | | |
| 572 | 586 | state_save_register_device_item(device, 0, z80dma->addressA); |
| 573 | 587 | state_save_register_device_item(device, 0, z80dma->addressB); |
| 574 | 588 | state_save_register_device_item(device, 0, z80dma->count); |
| r6337 | r6338 | |
| 612 | 626 | case DEVINFO_FCT_IRQ_RETI: info->f = (genf *)z80dma_irq_reti; break; |
| 613 | 627 | |
| 614 | 628 | /* --- the following bits of info are returned as NULL-terminated strings --- */ |
| 615 | | case DEVINFO_STR_NAME: strcpy(info->s, "Z80DMA"); break; |
| 616 | | case DEVINFO_STR_FAMILY: strcpy(info->s, "DMA controllers"); break; |
| 629 | case DEVINFO_STR_NAME: strcpy(info->s, "Z8410"); break; |
| 630 | case DEVINFO_STR_FAMILY: strcpy(info->s, "Z80DMA"); break; |
| 617 | 631 | case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; |
| 618 | 632 | case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; |
| 619 | 633 | case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright Nicola Salmoria and the MAME Team"); break; |
| 620 | 634 | } |
| 621 | 635 | } |
| 622 | | |
src/emu/machine/z80dma.h
| r6337 | r6338 | |
| 1 | | /********************************************************************** |
| 1 | /*************************************************************************** |
| 2 | 2 | |
| 3 | | Z80 DMA interface and emulation |
| 3 | Zilog Z80 DMA Direct Memory Access Controller emulation |
| 4 | 4 | |
| 5 | | **********************************************************************/ |
| 5 | Copyright Nicola Salmoria and the MAME Team. |
| 6 | Visit http://mamedev.org for licensing and usage restrictions. |
| 6 | 7 | |
| 7 | | #ifndef Z80DMA_H |
| 8 | | #define Z80DMA_H |
| 8 | **************************************************************************** |
| 9 | _____ _____ |
| 10 | A5 1 |* \_/ | 40 A6 |
| 11 | A4 2 | | 39 A7 |
| 12 | A3 3 | | 38 IEI |
| 13 | A2 4 | | 37 _INT/_PULSE |
| 14 | A1 5 | | 36 IEO |
| 15 | A0 6 | | 35 D0 |
| 16 | CLK 7 | | 34 D1 |
| 17 | _WR 8 | | 33 D2 |
| 18 | _RD 9 | | 32 D3 |
| 19 | _IORQ 10 | Z8410 | 31 D4 |
| 20 | +5V 11 | | 30 GND |
| 21 | _MREQ 12 | | 29 D5 |
| 22 | _BAO 13 | | 28 D6 |
| 23 | _BAI 14 | | 27 D7 |
| 24 | _BUSREQ 15 | | 26 _M1 |
| 25 | _CE/_WAIT 16 | | 25 RDY |
| 26 | A15 17 | | 24 A8 |
| 27 | A14 18 | | 23 A9 |
| 28 | A13 19 | | 22 A10 |
| 29 | A12 20 |_____________| 21 A11 |
| 9 | 30 | |
| 31 | ***************************************************************************/ |
| 32 | |
| 33 | #ifndef __Z80DMA__ |
| 34 | #define __Z80DMA__ |
| 35 | |
| 36 | #include "devcb.h" |
| 37 | |
| 38 | /*************************************************************************** |
| 39 | MACROS / CONSTANTS |
| 40 | ***************************************************************************/ |
| 41 | |
| 10 | 42 | #define Z80DMA DEVICE_GET_INFO_NAME(z80dma) |
| 11 | 43 | |
| 12 | 44 | #define MDRV_Z80DMA_ADD(_tag, _clock, _config) \ |
| 13 | 45 | MDRV_DEVICE_ADD(_tag, Z80DMA, _clock) \ |
| 14 | 46 | MDRV_DEVICE_CONFIG(_config) |
| 15 | 47 | |
| 48 | #define Z80DMA_INTERFACE(_name) \ |
| 49 | const z80dma_interface (_name) = |
| 50 | |
| 51 | /*************************************************************************** |
| 52 | TYPE DEFINITIONS |
| 53 | ***************************************************************************/ |
| 54 | |
| 16 | 55 | typedef struct _z80dma_interface z80dma_interface; |
| 17 | 56 | struct _z80dma_interface |
| 18 | 57 | { |
| 19 | | /* CPU to halt when DMA is active */ |
| 20 | | const char *cputag; |
| 58 | devcb_write_line out_busreq_func; |
| 59 | devcb_write_line out_int_func; |
| 60 | devcb_write_line out_bao_func; |
| 21 | 61 | |
| 22 | | /* accessors to main memory */ |
| 23 | | read8_device_func memory_read; |
| 24 | | write8_device_func memory_write; |
| 62 | /* memory accessors */ |
| 63 | devcb_read8 in_mreq_func; |
| 64 | devcb_write8 out_mreq_func; |
| 25 | 65 | |
| 26 | | /* port accesors */ |
| 27 | | read8_device_func portA_read; |
| 28 | | write8_device_func portA_write; |
| 29 | | read8_device_func portB_read; |
| 30 | | write8_device_func portB_write; |
| 31 | | |
| 32 | | /* interrupt callback - not implemented */ |
| 33 | | void (*irq_cb)(const device_config *device, int state); |
| 66 | /* I/O accessors */ |
| 67 | devcb_read8 in_iorq_func; |
| 68 | devcb_write8 out_iorq_func; |
| 34 | 69 | }; |
| 35 | 70 | |
| 36 | | /* device interface */ |
| 37 | | DEVICE_GET_INFO( z80dma ); |
| 71 | /*************************************************************************** |
| 72 | PROTOTYPES |
| 73 | ***************************************************************************/ |
| 38 | 74 | |
| 75 | /* register access */ |
| 39 | 76 | READ8_DEVICE_HANDLER( z80dma_r ); |
| 40 | | WRITE8_DEVICE_HANDLER( z80dma_w); |
| 77 | WRITE8_DEVICE_HANDLER( z80dma_w ); |
| 41 | 78 | |
| 42 | | WRITE8_DEVICE_HANDLER( z80dma_rdy_w ); |
| 79 | /* ready */ |
| 80 | WRITE_LINE_DEVICE_HANDLER( z80dma_rdy_w ); |
| 43 | 81 | |
| 44 | | #endif /* Z80_H */ |
| 82 | /* wait */ |
| 83 | WRITE_LINE_DEVICE_HANDLER( z80dma_wait_w ); |
| 84 | |
| 85 | /* bus acknowledge in */ |
| 86 | WRITE_LINE_DEVICE_HANDLER( z80dma_bai_w ); |
| 87 | |
| 88 | DEVICE_GET_INFO( z80dma ); |
| 89 | |
| 90 | #endif |
src/mess/machine/conkort.c
| r6337 | r6338 | |
| 630 | 630 | |
| 631 | 631 | */ |
| 632 | 632 | |
| 633 | | static void dma_irq_callback(const device_config *device, int state) |
| 633 | static Z80DMA_INTERFACE( dma_intf ) |
| 634 | 634 | { |
| 635 | | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 636 | | |
| 637 | | cpu_set_input_line(conkort->cpu, INPUT_LINE_IRQ0, state); |
| 638 | | } |
| 639 | | |
| 640 | | static READ8_DEVICE_HANDLER( dma_port_a_r ) |
| 641 | | { |
| 642 | | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 643 | | const address_space *program = cpu_get_address_space(conkort->cpu, ADDRESS_SPACE_PROGRAM); |
| 644 | | |
| 645 | | UINT8 data = 0xff; |
| 646 | | |
| 647 | | data = memory_read_byte_8le(program, offset); |
| 648 | | |
| 649 | | return data; |
| 650 | | } |
| 651 | | |
| 652 | | static WRITE8_DEVICE_HANDLER( dma_port_a_w ) |
| 653 | | { |
| 654 | | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 655 | | const address_space *program = cpu_get_address_space(conkort->cpu, ADDRESS_SPACE_PROGRAM); |
| 656 | | |
| 657 | | memory_write_byte_8le(program, offset, data); |
| 658 | | } |
| 659 | | |
| 660 | | static READ8_DEVICE_HANDLER( dma_port_b_r ) |
| 661 | | { |
| 662 | | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 663 | | const address_space *io = cpu_get_address_space(conkort->cpu, ADDRESS_SPACE_IO); |
| 664 | | |
| 665 | | UINT8 data = 0xff; |
| 666 | | |
| 667 | | data = memory_read_byte_8le(io, offset); |
| 668 | | |
| 669 | | return data; |
| 670 | | } |
| 671 | | |
| 672 | | static WRITE8_DEVICE_HANDLER( dma_port_b_w ) |
| 673 | | { |
| 674 | | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 675 | | const address_space *io = cpu_get_address_space(conkort->cpu, ADDRESS_SPACE_IO); |
| 676 | | |
| 677 | | memory_write_byte_8le(io, offset, data); |
| 678 | | } |
| 679 | | |
| 680 | | static const z80dma_interface dma_intf = |
| 681 | | { |
| 682 | | "conkort:5a", /* cpu to HALT */ |
| 683 | | dma_port_a_r, /* memory read */ |
| 684 | | dma_port_a_w, /* memory write */ |
| 685 | | dma_port_a_r, /* port A read */ |
| 686 | | dma_port_a_w, /* port A write */ |
| 687 | | dma_port_b_r, /* port B read */ |
| 688 | | dma_port_b_w, /* port B write */ |
| 689 | | dma_irq_callback /* interrupt callback */ |
| 635 | DEVCB_CPU_INPUT_LINE("conkort:5a", INPUT_LINE_HALT), |
| 636 | DEVCB_CPU_INPUT_LINE("conkort:5a", INPUT_LINE_IRQ0), |
| 637 | DEVCB_NULL, |
| 638 | DEVCB_MEMORY_HANDLER("conkort:5a", PROGRAM, memory_read_byte), |
| 639 | DEVCB_MEMORY_HANDLER("conkort:5a", PROGRAM, memory_write_byte), |
| 640 | DEVCB_MEMORY_HANDLER("conkort:5a", IO, memory_read_byte), |
| 641 | DEVCB_MEMORY_HANDLER("conkort:5a", IO, memory_write_byte) |
| 690 | 642 | }; |
| 691 | 643 | |
| 692 | 644 | static const z80_daisy_chain fast_daisy_chain[] = |
| r6337 | r6338 | |
| 715 | 667 | static WRITE_LINE_DEVICE_HANDLER( fast_wd1793_drq_w ) |
| 716 | 668 | { |
| 717 | 669 | fast_t *conkort = get_safe_token_machine_fast(device->machine); |
| 718 | | z80dma_rdy_w(conkort->z80dma, 0, state); |
| 670 | z80dma_rdy_w(conkort->z80dma, state); |
| 719 | 671 | } |
| 720 | 672 | |
| 721 | 673 | static const wd17xx_interface fast_wd17xx_interface = |
src/mess/drivers/x1.c
| r6337 | r6338 | |
| 1578 | 1578 | NULL /* update address callback */ |
| 1579 | 1579 | }; |
| 1580 | 1580 | |
| 1581 | | static READ8_DEVICE_HANDLER(x1_dma_read_byte) |
| 1581 | static Z80DMA_INTERFACE( x1_dma ) |
| 1582 | 1582 | { |
| 1583 | | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1584 | | return memory_read_byte(space, offset); |
| 1585 | | } |
| 1586 | | |
| 1587 | | static WRITE8_DEVICE_HANDLER(x1_dma_write_byte) |
| 1588 | | { |
| 1589 | | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1590 | | memory_write_byte(space, offset, data); |
| 1591 | | } |
| 1592 | | |
| 1593 | | static READ8_DEVICE_HANDLER(x1_dma_read_io) |
| 1594 | | { |
| 1595 | | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_IO); |
| 1596 | | return memory_read_byte(space, offset); |
| 1597 | | } |
| 1598 | | |
| 1599 | | static WRITE8_DEVICE_HANDLER(x1_dma_write_io) |
| 1600 | | { |
| 1601 | | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_IO); |
| 1602 | | memory_write_byte(space, offset, data); |
| 1603 | | } |
| 1604 | | |
| 1605 | | |
| 1606 | | static const z80dma_interface x1_dma = |
| 1607 | | { |
| 1608 | | "maincpu", |
| 1609 | | |
| 1610 | | x1_dma_read_byte, |
| 1611 | | x1_dma_write_byte, |
| 1612 | | x1_dma_read_io, x1_dma_write_io, x1_dma_read_io, x1_dma_write_io, |
| 1613 | | NULL |
| 1583 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT), |
| 1584 | DEVCB_NULL, |
| 1585 | DEVCB_NULL, |
| 1586 | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte), |
| 1587 | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_write_byte), |
| 1588 | DEVCB_MEMORY_HANDLER("maincpu", IO, memory_read_byte), |
| 1589 | DEVCB_MEMORY_HANDLER("maincpu", IO, memory_write_byte) |
| 1614 | 1590 | }; |
| 1615 | 1591 | |
| 1616 | 1592 | /************************************* |
src/mess/drivers/p8k.c
| r6337 | r6338 | |
| 206 | 206 | |
| 207 | 207 | /* Z80 DMA */ |
| 208 | 208 | |
| 209 | | static READ8_DEVICE_HANDLER(p8k_dma_read_byte) |
| 210 | | { |
| 211 | | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 212 | | return memory_read_byte(space, offset); |
| 213 | | } |
| 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 |
| 214 | 210 | |
| 215 | | static WRITE8_DEVICE_HANDLER(p8k_dma_write_byte) |
| 211 | static Z80DMA_INTERFACE( p8k_dma_intf ) |
| 216 | 212 | { |
| 217 | | const address_space *space = cputag_get_address_space(device->machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 218 | | memory_write_byte(space, offset, data); |
| 219 | | } |
| 220 | | |
| 221 | | // 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 |
| 222 | | static const z80dma_interface p8k_dma_intf = |
| 223 | | { |
| 224 | | "maincpu", |
| 225 | | p8k_dma_read_byte, |
| 226 | | p8k_dma_write_byte, |
| 227 | | NULL, NULL, NULL, NULL, |
| 228 | | p8k_daisy_interrupt |
| 213 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_HALT), |
| 214 | DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0), |
| 215 | DEVCB_NULL, |
| 216 | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_read_byte), |
| 217 | DEVCB_MEMORY_HANDLER("maincpu", PROGRAM, memory_write_byte), |
| 218 | DEVCB_MEMORY_HANDLER("maincpu", IO, memory_read_byte), |
| 219 | DEVCB_MEMORY_HANDLER("maincpu", IO, memory_write_byte) |
| 229 | 220 | }; |
| 230 | 221 | |
| 231 | 222 | /* Z80 CTC 0 */ |