src/emu/machine/z80dma.c
| r5750 | r5751 | |
| 97 | 97 | UINT8 num_follow; |
| 98 | 98 | UINT8 cur_follow; |
| 99 | 99 | UINT8 regs_follow[4]; |
| 100 | UINT8 read_num_follow; |
| 101 | UINT8 read_cur_follow; |
| 102 | UINT8 read_regs_follow[7]; |
| 100 | 103 | UINT8 status; |
| 101 | 104 | UINT8 dma_enabled; |
| 102 | 105 | |
| r5750 | r5751 | |
| 268 | 271 | |
| 269 | 272 | READ8_DEVICE_HANDLER( z80dma_r ) |
| 270 | 273 | { |
| 271 | | fatalerror("z80dma_read: not implemented"); |
| 272 | | return 0; |
| 274 | z80dma_t *cntx = get_safe_token(device); |
| 275 | UINT8 res; |
| 276 | |
| 277 | res = cntx->read_regs_follow[cntx->read_cur_follow]; |
| 278 | cntx->read_cur_follow++; |
| 279 | |
| 280 | if(cntx->read_cur_follow >= cntx->read_num_follow) |
| 281 | cntx->read_cur_follow = 0; |
| 282 | |
| 283 | return res; |
| 273 | 284 | } |
| 274 | 285 | |
| 275 | 286 | |
| r5750 | r5751 | |
| 331 | 342 | { |
| 332 | 343 | case 0x88: /* Reinitialize status byte */ |
| 333 | 344 | case 0xA3: /* Reset and disable interrupts */ |
| 334 | | case 0xA7: /* Initiate read sequence */ |
| 335 | 345 | case 0xAB: /* Enable interrupts */ |
| 336 | 346 | case 0xAF: /* Disable interrupts */ |
| 337 | 347 | case 0xB3: /* Force ready */ |
| r5750 | r5751 | |
| 340 | 350 | case 0xD3: /* Continue */ |
| 341 | 351 | fatalerror("Unimplemented WR6 command %02x", data); |
| 342 | 352 | break; |
| 353 | case 0xA7: /* Initiate read sequence */ |
| 354 | cntx->read_cur_follow = cntx->read_num_follow = 0; |
| 355 | if(READ_MASK(cntx) & 0x01) { cntx->read_regs_follow[cntx->read_num_follow++] = cntx->status; } |
| 356 | if(READ_MASK(cntx) & 0x02) { cntx->read_regs_follow[cntx->read_num_follow++] = cntx->count & 0xff; } //byte counter (low) |
| 357 | if(READ_MASK(cntx) & 0x04) { cntx->read_regs_follow[cntx->read_num_follow++] = (cntx->count >> 8) & 0xff; } //byte counter (high) |
| 358 | if(READ_MASK(cntx) & 0x08) { cntx->read_regs_follow[cntx->read_num_follow++] = cntx->addressA & 0xff; } //port A address (low) |
| 359 | if(READ_MASK(cntx) & 0x10) { cntx->read_regs_follow[cntx->read_num_follow++] = (cntx->addressA >> 8) & 0xff; } //port A address (high) |
| 360 | if(READ_MASK(cntx) & 0x20) { cntx->read_regs_follow[cntx->read_num_follow++] = cntx->addressB & 0xff; } //port B address (low) |
| 361 | if(READ_MASK(cntx) & 0x40) { cntx->read_regs_follow[cntx->read_num_follow++] = (cntx->addressB >> 8) & 0xff; } //port B address (high) |
| 362 | break; |
| 343 | 363 | case 0xC3: /* Reset */ |
| 344 | 364 | LOG(("Reset\n")); |
| 345 | 365 | break; |
| r5750 | r5751 | |
| 402 | 422 | } |
| 403 | 423 | |
| 404 | 424 | |
| 405 | | WRITE8_DEVICE_HANDLER( z80dma_rdy_w) |
| 425 | WRITE8_DEVICE_HANDLER( z80dma_rdy_w ) |
| 406 | 426 | { |
| 407 | 427 | z80dma_t *z80dma = get_safe_token(device); |
| 408 | 428 | int param; |
| r5750 | r5751 | |
| 477 | 497 | z80dma->rdy = 0; |
| 478 | 498 | z80dma->num_follow = 0; |
| 479 | 499 | z80dma->dma_enabled = 0; |
| 500 | z80dma->read_num_follow = z80dma->read_cur_follow = 0; |
| 480 | 501 | z80dma_update_status(device); |
| 481 | 502 | } |
| 482 | 503 | |