src/emu/machine/z80dma.c
| r5821 | r5822 | |
| 69 | 69 | |
| 70 | 70 | #define PORTA_STEP(_c) (((WR1(_c) >> 4) & 0x03)*2-1) |
| 71 | 71 | #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) |
| 72 | 74 | #define PORTA_FIXED(_c) (((WR1(_c) >> 4) & 0x02) == 0x02) |
| 73 | 75 | #define PORTB_FIXED(_c) (((WR2(_c) >> 4) & 0x02) == 0x02) |
| 74 | 76 | #define PORTA_MEMORY(_c) (((WR1(_c) >> 3) & 0x01) == 0x00) |
| r5821 | r5822 | |
| 142 | 144 | cntx->latch = cntx->intf->memory_read(device, cntx->addressA); |
| 143 | 145 | else |
| 144 | 146 | 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); |
| 146 | 149 | } |
| 147 | 150 | else |
| 148 | 151 | { |
| r5821 | r5822 | |
| 151 | 154 | else |
| 152 | 155 | cntx->latch = cntx->intf->portB_read(device, cntx->addressB); |
| 153 | 156 | |
| 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); |
| 155 | 158 | } |
| 156 | 159 | break; |
| 157 | 160 | case TM_SEARCH: |
| r5821 | r5822 | |
| 186 | 189 | else |
| 187 | 190 | cntx->intf->portB_write(device, cntx->addressB, cntx->latch); |
| 188 | 191 | |
| 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); |
| 190 | 193 | } |
| 191 | 194 | else |
| 192 | 195 | { |
| 193 | 196 | if (PORTA_MEMORY(cntx)) |
| 194 | 197 | cntx->intf->memory_write(device, cntx->addressA, cntx->latch); |
| 195 | 198 | else |
| 196 | | cntx->intf->portB_write(device, cntx->addressA, cntx->latch); |
| 199 | cntx->intf->portA_write(device, cntx->addressA, cntx->latch); |
| 197 | 200 | |
| 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); |
| 199 | 202 | } |
| 200 | 203 | cntx->count--; |
| 201 | 204 | done = (cntx->count == 0xFFFF); |