Previous 15994 Revisions Next

r5822 Sunday 20th September, 2009 at 22:30:03 UTC by Angelo Salese
[z80dma]: added decrement step mode and fixed a conceptual bug with portA writes
[src/emu/machine]z80dma.c

src/emu/machine/z80dma.c
r5821r5822
6969
7070#define PORTA_STEP(_c)      (((WR1(_c) >> 4) & 0x03)*2-1)
7171#define PORTB_STEP(_c)      (((WR2(_c) >> 4) & 0x03)*2-1)
72#define PORTA_INC(_c)      (WR1(_c) & 0x10)
73#define PORTB_INC(_c)      (WR2(_c) & 0x10)
7274#define PORTA_FIXED(_c)      (((WR1(_c) >> 4) & 0x02) == 0x02)
7375#define PORTB_FIXED(_c)      (((WR2(_c) >> 4) & 0x02) == 0x02)
7476#define PORTA_MEMORY(_c)   (((WR1(_c) >> 3) & 0x01) == 0x00)
r5821r5822
142144               cntx->latch = cntx->intf->memory_read(device, cntx->addressA);
143145            else
144146               cntx->latch = cntx->intf->portA_read(device, cntx->addressA);
145            cntx->addressA += PORTA_FIXED(cntx) ? 0 : PORTA_STEP(cntx);
147
148            cntx->addressA += PORTA_FIXED(cntx) ? 0 : PORTA_INC(cntx) ? PORTA_STEP(cntx) : -PORTA_STEP(cntx);
146149         }
147150         else
148151         {
r5821r5822
151154            else
152155               cntx->latch = cntx->intf->portB_read(device, cntx->addressB);
153156
154            cntx->addressB += PORTB_FIXED(cntx) ? 0 : PORTB_STEP(cntx);
157            cntx->addressB += PORTB_FIXED(cntx) ? 0 : PORTB_INC(cntx) ? PORTB_STEP(cntx) : -PORTB_STEP(cntx);
155158         }
156159         break;
157160      case TM_SEARCH:
r5821r5822
186189            else
187190               cntx->intf->portB_write(device, cntx->addressB, cntx->latch);
188191
189            cntx->addressB += PORTB_FIXED(cntx) ? 0 : PORTB_STEP(cntx);
192            cntx->addressB += PORTB_FIXED(cntx) ? 0 : PORTB_INC(cntx) ? PORTB_STEP(cntx) : -PORTB_STEP(cntx);
190193         }
191194         else
192195         {
193196            if (PORTA_MEMORY(cntx))
194197               cntx->intf->memory_write(device, cntx->addressA, cntx->latch);
195198            else
196               cntx->intf->portB_write(device, cntx->addressA, cntx->latch);
199               cntx->intf->portA_write(device, cntx->addressA, cntx->latch);
197200
198            cntx->addressA += PORTA_FIXED(cntx) ? 0 : PORTA_STEP(cntx);
201            cntx->addressA += PORTA_FIXED(cntx) ? 0 : PORTA_INC(cntx) ? PORTA_STEP(cntx) : -PORTA_STEP(cntx);
199202         }
200203         cntx->count--;
201204         done = (cntx->count == 0xFFFF);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team