Previous 15994 Revisions Next

r5751 Wednesday 16th September, 2009 at 21:11:40 UTC by Angelo Salese
[z80dma]: Added Initiate read sequence command and hooked up basic status reading
[src/emu/machine]z80dma.c

src/emu/machine/z80dma.c
r5750r5751
9797   UINT8    num_follow;
9898   UINT8   cur_follow;
9999   UINT8    regs_follow[4];
100   UINT8   read_num_follow;
101   UINT8   read_cur_follow;
102   UINT8    read_regs_follow[7];
100103   UINT8   status;
101104   UINT8   dma_enabled;
102105
r5750r5751
268271
269272READ8_DEVICE_HANDLER( z80dma_r )
270273{
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;
273284}
274285
275286
r5750r5751
331342         {
332343            case 0x88:   /* Reinitialize status byte */
333344            case 0xA3:   /* Reset and disable interrupts */
334            case 0xA7:   /* Initiate read sequence */
335345            case 0xAB:   /* Enable interrupts */
336346            case 0xAF:   /* Disable interrupts */
337347            case 0xB3:   /* Force ready */
r5750r5751
340350            case 0xD3:   /* Continue */
341351               fatalerror("Unimplemented WR6 command %02x", data);
342352               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;
343363            case 0xC3:   /* Reset */
344364               LOG(("Reset\n"));
345365               break;
r5750r5751
402422}
403423
404424
405WRITE8_DEVICE_HANDLER( z80dma_rdy_w)
425WRITE8_DEVICE_HANDLER( z80dma_rdy_w )
406426{
407427   z80dma_t *z80dma = get_safe_token(device);
408428   int param;
r5750r5751
477497   z80dma->rdy = 0;
478498   z80dma->num_follow = 0;
479499   z80dma->dma_enabled = 0;
500   z80dma->read_num_follow = z80dma->read_cur_follow = 0;
480501   z80dma_update_status(device);
481502}
482503

Previous 15994 Revisions Next


© 1998-2018 The MESS Team