src/emu/machine/z80dma.c
| r5752 | r5753 | |
| 108 | 108 | UINT16 count; |
| 109 | 109 | |
| 110 | 110 | UINT8 rdy; |
| 111 | UINT8 irq_en; |
| 111 | 112 | |
| 112 | 113 | UINT8 is_read; |
| 113 | 114 | UINT8 cur_cycle; |
| r5752 | r5753 | |
| 151 | 152 | cntx->addressB += PORTB_STEP(cntx); |
| 152 | 153 | } |
| 153 | 154 | break; |
| 154 | | |
| 155 | case TM_SEARCH: |
| 156 | fatalerror("z80dma_do_operation: unhandled search mode!\n"); |
| 157 | break; |
| 158 | case TM_SEARCH_TRANSFER: |
| 159 | fatalerror("z80dma_do_operation: unhandled search & transfer mode !\n"); |
| 160 | break; |
| 155 | 161 | default: |
| 156 | 162 | fatalerror("z80dma_do_operation: invalid mode %d!\n", mode); |
| 157 | 163 | break; |
| r5752 | r5753 | |
| 191 | 197 | done = (cntx->count == 0xFFFF); |
| 192 | 198 | break; |
| 193 | 199 | |
| 200 | case TM_SEARCH: |
| 201 | fatalerror("z80dma_do_operation: unhandled search mode!\n"); |
| 202 | break; |
| 203 | |
| 204 | case TM_SEARCH_TRANSFER: |
| 205 | fatalerror("z80dma_do_operation: unhandled search & transfer mode !\n"); |
| 206 | break; |
| 207 | |
| 194 | 208 | default: |
| 195 | 209 | fatalerror("z80dma_do_operation: invalid mode %d!\n", mode); |
| 196 | 210 | break; |
| r5752 | r5753 | |
| 340 | 354 | WR6(cntx) = data; |
| 341 | 355 | switch (data) |
| 342 | 356 | { |
| 343 | | case 0x88: /* Reinitialize status byte */ |
| 344 | 357 | case 0xA3: /* Reset and disable interrupts */ |
| 345 | | case 0xAB: /* Enable interrupts */ |
| 346 | | case 0xAF: /* Disable interrupts */ |
| 347 | | case 0xB3: /* Force ready */ |
| 348 | 358 | case 0xB7: /* Enable after rti */ |
| 349 | 359 | case 0xBF: /* Read status byte */ |
| 350 | 360 | fatalerror("Unimplemented WR6 command %02x", data); |
| r5752 | r5753 | |
| 366 | 376 | cntx->addressA = PORTA_ADDRESS(cntx); |
| 367 | 377 | cntx->addressB = PORTB_ADDRESS(cntx); |
| 368 | 378 | cntx->count = BLOCKLEN(cntx); |
| 379 | cntx->status &= ~0x30; |
| 369 | 380 | LOG(("Load A: %x B: %x N: %x\n", cntx->addressA, cntx->addressB, cntx->count)); |
| 370 | 381 | break; |
| 371 | 382 | case 0x83: /* Disable dma */ |
| r5752 | r5753 | |
| 382 | 393 | case 0xD3: /* Continue */ |
| 383 | 394 | cntx->count = 0; |
| 384 | 395 | cntx->dma_enabled = 1; |
| 385 | | //FIXME: "mach" & "endb" flags should be zeroed here |
| 396 | //"match not found" & "end of block" status flags zeroed here |
| 397 | cntx->status &= ~0x30; |
| 386 | 398 | break; |
| 387 | 399 | case 0xc7: /* Reset Port A Timing */ |
| 388 | 400 | PORTA_TIMING(cntx) = 0; |
| r5752 | r5753 | |
| 390 | 402 | case 0xcb: /* Reset Port B Timing */ |
| 391 | 403 | PORTB_TIMING(cntx) = 0; |
| 392 | 404 | break; |
| 405 | case 0xB3: /* Force ready */ |
| 406 | cntx->rdy = (WR5(cntx) & 0x8)>>3; |
| 407 | break; |
| 408 | case 0xAB: /* Enable interrupts */ |
| 409 | cntx->irq_en = 1; |
| 410 | break; |
| 411 | case 0xAF: /* Disable interrupts */ |
| 412 | cntx->irq_en = 0; |
| 413 | break; |
| 414 | case 0x8B: /* Reinitialize status byte */ |
| 415 | /* FIXME: docs says these two is 1, but behaviour makes me think it's a 0, investigate */ |
| 416 | cntx->status &= ~0x30; |
| 417 | break; |
| 393 | 418 | default: |
| 394 | 419 | fatalerror("Unknown WR6 command %02x", data); |
| 395 | 420 | } |
| r5752 | r5753 | |
| 508 | 533 | z80dma->num_follow = 0; |
| 509 | 534 | z80dma->dma_enabled = 0; |
| 510 | 535 | z80dma->read_num_follow = z80dma->read_cur_follow = 0; |
| 536 | z80dma->irq_en = 0; |
| 511 | 537 | z80dma_update_status(device); |
| 512 | 538 | } |
| 513 | 539 | |