Previous 15994 Revisions Next

r5753 Wednesday 16th September, 2009 at 22:02:35 UTC by Angelo Salese
[z80dma]: Added enable/disable irq, force ready and reinitialize status byte commands
[src/emu/machine]z80dma.c

src/emu/machine/z80dma.c
r5752r5753
108108   UINT16 count;
109109
110110   UINT8 rdy;
111   UINT8 irq_en;
111112
112113   UINT8 is_read;
113114   UINT8 cur_cycle;
r5752r5753
151152            cntx->addressB += PORTB_STEP(cntx);
152153         }
153154         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;
155161      default:
156162         fatalerror("z80dma_do_operation: invalid mode %d!\n", mode);
157163         break;
r5752r5753
191197         done = (cntx->count == 0xFFFF);
192198         break;
193199
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
194208      default:
195209         fatalerror("z80dma_do_operation: invalid mode %d!\n", mode);
196210         break;
r5752r5753
340354         WR6(cntx) = data;
341355         switch (data)
342356         {
343            case 0x88:   /* Reinitialize status byte */
344357            case 0xA3:   /* Reset and disable interrupts */
345            case 0xAB:   /* Enable interrupts */
346            case 0xAF:   /* Disable interrupts */
347            case 0xB3:   /* Force ready */
348358            case 0xB7:   /* Enable after rti */
349359            case 0xBF:   /* Read status byte */
350360               fatalerror("Unimplemented WR6 command %02x", data);
r5752r5753
366376               cntx->addressA = PORTA_ADDRESS(cntx);
367377               cntx->addressB = PORTB_ADDRESS(cntx);
368378               cntx->count = BLOCKLEN(cntx);
379               cntx->status &= ~0x30;
369380               LOG(("Load A: %x B: %x N: %x\n", cntx->addressA, cntx->addressB, cntx->count));
370381               break;
371382            case 0x83:   /* Disable dma */
r5752r5753
382393            case 0xD3:   /* Continue */
383394               cntx->count = 0;
384395               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;
386398               break;
387399            case 0xc7:   /* Reset Port A Timing */
388400               PORTA_TIMING(cntx) = 0;
r5752r5753
390402            case 0xcb:   /* Reset Port B Timing */
391403               PORTB_TIMING(cntx) = 0;
392404               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;
393418            default:
394419               fatalerror("Unknown WR6 command %02x", data);
395420         }
r5752r5753
508533   z80dma->num_follow = 0;
509534   z80dma->dma_enabled = 0;
510535   z80dma->read_num_follow = z80dma->read_cur_follow = 0;
536   z80dma->irq_en = 0;
511537   z80dma_update_status(device);
512538}
513539

Previous 15994 Revisions Next


© 1998-2018 The MESS Team