src/mame/machine/snes.c
| r7753 | r7754 | |
| 203 | 203 | timer_adjust_oneshot(state->scanline_timer, attotime_never, 0); |
| 204 | 204 | timer_adjust_oneshot(state->hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert, state->hblank_offset * state->htmult), 0); |
| 205 | 205 | |
| 206 | | // printf("%02x %d\n",snes_ram[HVBJOY],snes_ppu.beam.current_vert); |
| 206 | // printf("%02x %d\n",snes_ram[HVBJOY],snes_ppu.beam.current_vert); |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | /* This is called at the start of hblank *before* the scanline indicated in current_vert! */ |
| r7753 | r7754 | |
| 418 | 418 | return state->joy4h; |
| 419 | 419 | case DMAP0: case DMAP1: case DMAP2: case DMAP3: /*0x43n0*/ |
| 420 | 420 | case DMAP4: case DMAP5: case DMAP6: case DMAP7: |
| 421 | | return state->dma_channel[(offset & 0x70) >> 4].dmap; |
| 421 | return state->dma_channel[(offset >> 4) & 0x07].dmap; |
| 422 | 422 | case BBAD0: case BBAD1: case BBAD2: case BBAD3: /*0x43n1*/ |
| 423 | 423 | case BBAD4: case BBAD5: case BBAD6: case BBAD7: |
| 424 | | return state->dma_channel[(offset & 0x70) >> 4].dest_addr; |
| 424 | return state->dma_channel[(offset >> 4) & 0x07].dest_addr; |
| 425 | 425 | case A1T0L: case A1T1L: case A1T2L: case A1T3L: /*0x43n2*/ |
| 426 | 426 | case A1T4L: case A1T5L: case A1T6L: case A1T7L: |
| 427 | | return state->dma_channel[(offset & 0x70) >> 4].src_addr & 0xff; |
| 427 | return state->dma_channel[(offset >> 4) & 0x07].src_addr & 0xff; |
| 428 | 428 | case A1T0H: case A1T1H: case A1T2H: case A1T3H: /*0x43n3*/ |
| 429 | 429 | case A1T4H: case A1T5H: case A1T6H: case A1T7H: |
| 430 | | return (state->dma_channel[(offset & 0x70) >> 4].src_addr >> 8) & 0xff; |
| 430 | return (state->dma_channel[(offset >> 4) & 0x07].src_addr >> 8) & 0xff; |
| 431 | 431 | case A1B0: case A1B1: case A1B2: case A1B3: /*0x43n4*/ |
| 432 | 432 | case A1B4: case A1B5: case A1B6: case A1B7: |
| 433 | | return state->dma_channel[(offset & 0x70) >> 4].bank; |
| 433 | return state->dma_channel[(offset >> 4) & 0x07].bank; |
| 434 | 434 | case DAS0L: case DAS1L: case DAS2L: case DAS3L: /*0x43n5*/ |
| 435 | 435 | case DAS4L: case DAS5L: case DAS6L: case DAS7L: |
| 436 | | return state->dma_channel[(offset & 0x70) >> 4].trans_size & 0xff; |
| 436 | return state->dma_channel[(offset >> 4) & 0x07].trans_size & 0xff; |
| 437 | 437 | case DAS0H: case DAS1H: case DAS2H: case DAS3H: /*0x43n6*/ |
| 438 | 438 | case DAS4H: case DAS5H: case DAS6H: case DAS7H: |
| 439 | | return (state->dma_channel[(offset & 0x70) >> 4].trans_size >> 8) & 0xff; |
| 439 | return (state->dma_channel[(offset >> 4) & 0x07].trans_size >> 8) & 0xff; |
| 440 | 440 | case DSAB0: case DSAB1: case DSAB2: case DSAB3: /*0x43n7*/ |
| 441 | 441 | case DSAB4: case DSAB5: case DSAB6: case DSAB7: |
| 442 | | return state->dma_channel[(offset & 0x70) >> 4].ibank; |
| 442 | return state->dma_channel[(offset >> 4) & 0x07].ibank; |
| 443 | 443 | case A2A0L: case A2A1L: case A2A2L: case A2A3L: /*0x43n8*/ |
| 444 | 444 | case A2A4L: case A2A5L: case A2A6L: case A2A7L: |
| 445 | | return state->dma_channel[(offset & 0x70) >> 4].hdma_addr & 0xff; |
| 445 | return state->dma_channel[(offset >> 4) & 0x07].hdma_addr & 0xff; |
| 446 | 446 | case A2A0H: case A2A1H: case A2A2H: case A2A3H: /*0x43n9*/ |
| 447 | 447 | case A2A4H: case A2A5H: case A2A6H: case A2A7H: |
| 448 | | return (state->dma_channel[(offset & 0x70) >> 4].hdma_addr >> 8) & 0xff; |
| 448 | return (state->dma_channel[(offset >> 4) & 0x07].hdma_addr >> 8) & 0xff; |
| 449 | 449 | case NTRL0: case NTRL1: case NTRL2: case NTRL3: /*0x43na*/ |
| 450 | 450 | case NTRL4: case NTRL5: case NTRL6: case NTRL7: |
| 451 | | return state->dma_channel[(offset & 0x70) >> 4].hdma_line_counter; |
| 451 | return state->dma_channel[(offset >> 4) & 0x07].hdma_line_counter; |
| 452 | 452 | case 0x430b: case 0x431b: case 0x432b: case 0x433b: /* according to bsnes, this does not return open_bus (even if its precise effect is unknown) */ |
| 453 | 453 | case 0x434b: case 0x435b: case 0x436b: case 0x437b: |
| 454 | | return state->dma_channel[(offset & 0x70) >> 4].unk; |
| 454 | return state->dma_channel[(offset >> 4) & 0x07].unk; |
| 455 | 455 | |
| 456 | 456 | #ifndef MESS |
| 457 | 457 | case 0x4100: /* NSS Dip-Switches */ |
| r7753 | r7754 | |
| 677 | 677 | /* Below is all DMA related */ |
| 678 | 678 | case DMAP0: case DMAP1: case DMAP2: case DMAP3: /*0x43n0*/ |
| 679 | 679 | case DMAP4: case DMAP5: case DMAP6: case DMAP7: |
| 680 | | state->dma_channel[(offset & 0x70) >> 4].dmap = data; |
| 680 | state->dma_channel[(offset >> 4) & 0x07].dmap = data; |
| 681 | 681 | break; |
| 682 | 682 | case BBAD0: case BBAD1: case BBAD2: case BBAD3: /*0x43n1*/ |
| 683 | 683 | case BBAD4: case BBAD5: case BBAD6: case BBAD7: |
| 684 | | state->dma_channel[(offset & 0x70) >> 4].dest_addr = data; |
| 684 | state->dma_channel[(offset >> 4) & 0x07].dest_addr = data; |
| 685 | 685 | break; |
| 686 | 686 | case A1T0L: case A1T1L: case A1T2L: case A1T3L: /*0x43n2*/ |
| 687 | 687 | case A1T4L: case A1T5L: case A1T6L: case A1T7L: |
| 688 | | state->dma_channel[(offset & 0x70) >> 4].src_addr = (state->dma_channel[(offset & 0x70) >> 4].src_addr & 0xff00) | (data << 0); |
| 688 | state->dma_channel[(offset >> 4) & 0x07].src_addr = (state->dma_channel[(offset >> 4) & 0x07].src_addr & 0xff00) | (data << 0); |
| 689 | 689 | break; |
| 690 | 690 | case A1T0H: case A1T1H: case A1T2H: case A1T3H: /*0x43n3*/ |
| 691 | 691 | case A1T4H: case A1T5H: case A1T6H: case A1T7H: |
| 692 | | state->dma_channel[(offset & 0x70) >> 4].src_addr = (state->dma_channel[(offset & 0x70) >> 4].src_addr & 0x00ff) | (data << 8); |
| 692 | state->dma_channel[(offset >> 4) & 0x07].src_addr = (state->dma_channel[(offset >> 4) & 0x07].src_addr & 0x00ff) | (data << 8); |
| 693 | 693 | break; |
| 694 | 694 | case A1B0: case A1B1: case A1B2: case A1B3: /*0x43n4*/ |
| 695 | 695 | case A1B4: case A1B5: case A1B6: case A1B7: |
| 696 | | state->dma_channel[(offset & 0x70) >> 4].bank = data; |
| 696 | state->dma_channel[(offset >> 4) & 0x07].bank = data; |
| 697 | 697 | break; |
| 698 | 698 | case DAS0L: case DAS1L: case DAS2L: case DAS3L: /*0x43n5*/ |
| 699 | 699 | case DAS4L: case DAS5L: case DAS6L: case DAS7L: |
| 700 | | state->dma_channel[(offset & 0x70) >> 4].trans_size = (state->dma_channel[(offset & 0x70) >> 4].trans_size & 0xff00) | (data << 0); |
| 700 | state->dma_channel[(offset >> 4) & 0x07].trans_size = (state->dma_channel[(offset >> 4) & 0x07].trans_size & 0xff00) | (data << 0); |
| 701 | 701 | break; |
| 702 | 702 | case DAS0H: case DAS1H: case DAS2H: case DAS3H: /*0x43n6*/ |
| 703 | 703 | case DAS4H: case DAS5H: case DAS6H: case DAS7H: |
| 704 | | state->dma_channel[(offset & 0x70) >> 4].trans_size = (state->dma_channel[(offset & 0x70) >> 4].trans_size & 0x00ff) | (data << 8); |
| 704 | state->dma_channel[(offset >> 4) & 0x07].trans_size = (state->dma_channel[(offset >> 4) & 0x07].trans_size & 0x00ff) | (data << 8); |
| 705 | 705 | break; |
| 706 | 706 | case DSAB0: case DSAB1: case DSAB2: case DSAB3: /*0x43n7*/ |
| 707 | 707 | case DSAB4: case DSAB5: case DSAB6: case DSAB7: |
| 708 | | state->dma_channel[(offset & 0x70) >> 4].ibank = data; |
| 708 | state->dma_channel[(offset >> 4) & 0x07].ibank = data; |
| 709 | 709 | break; |
| 710 | 710 | case A2A0L: case A2A1L: case A2A2L: case A2A3L: /*0x43n8*/ |
| 711 | 711 | case A2A4L: case A2A5L: case A2A6L: case A2A7L: |
| 712 | | state->dma_channel[(offset & 0x70) >> 4].hdma_addr = (state->dma_channel[(offset & 0x70) >> 4].hdma_addr & 0xff00) | (data << 0); |
| 712 | state->dma_channel[(offset >> 4) & 0x07].hdma_addr = (state->dma_channel[(offset >> 4) & 0x07].hdma_addr & 0xff00) | (data << 0); |
| 713 | 713 | break; |
| 714 | 714 | case A2A0H: case A2A1H: case A2A2H: case A2A3H: /*0x43n9*/ |
| 715 | 715 | case A2A4H: case A2A5H: case A2A6H: case A2A7H: |
| 716 | | state->dma_channel[(offset & 0x70) >> 4].hdma_addr = (state->dma_channel[(offset & 0x70) >> 4].hdma_addr & 0x00ff) | (data << 8); |
| 716 | state->dma_channel[(offset >> 4) & 0x07].hdma_addr = (state->dma_channel[(offset >> 4) & 0x07].hdma_addr & 0x00ff) | (data << 8); |
| 717 | 717 | break; |
| 718 | 718 | case NTRL0: case NTRL1: case NTRL2: case NTRL3: /*0x43na*/ |
| 719 | 719 | case NTRL4: case NTRL5: case NTRL6: case NTRL7: |
| 720 | | state->dma_channel[(offset & 0x70) >> 4].hdma_line_counter = data; |
| 720 | state->dma_channel[(offset >> 4) & 0x07].hdma_line_counter = data; |
| 721 | 721 | break; |
| 722 | 722 | case 0x430b: case 0x431b: case 0x432b: case 0x433b: |
| 723 | 723 | case 0x434b: case 0x435b: case 0x436b: case 0x437b: |
| 724 | | state->dma_channel[(offset & 0x70) >> 4].unk = data; |
| 724 | state->dma_channel[(offset >> 4) & 0x07].unk = data; |
| 725 | 725 | break; |
| 726 | 726 | } |
| 727 | 727 | |
| r7753 | r7754 | |
| 1933 | 1933 | if (state->dma_channel[dma].dmap & 0x40) |
| 1934 | 1934 | { |
| 1935 | 1935 | /* One oddity: if $43xA is 0 and this is the last active HDMA channel for this scanline, only load |
| 1936 | | one byte for Address, and use the $00 for the low byte. So Address ends up incremented one less than |
| 1937 | | otherwise expected */ |
| 1936 | one byte for Address, and use the $00 for the low byte. So Address ends up incremented one less than |
| 1937 | otherwise expected */ |
| 1938 | 1938 | |
| 1939 | 1939 | abus = snes_get_hdma_addr(space->machine, dma); |
| 1940 | 1940 | state->dma_channel[dma].trans_size = snes_abus_read(space, abus) << 8; |
| r7753 | r7754 | |
| 2058 | 2058 | int i; |
| 2059 | 2059 | INT8 increment; |
| 2060 | 2060 | UINT16 bbus; |
| 2061 | | UINT32 abus, abus_bank, length; |
| 2061 | UINT32 abus, abus_bank; |
| 2062 | UINT16 length; |
| 2062 | 2063 | |
| 2063 | | /* FIXME: we also need to round to the nearest 8 master cycles */ |
| 2064 | /* FIXME: we also need to round to the nearest 8 master cycles */ |
| 2064 | 2065 | |
| 2065 | 2066 | /* overhead steals 8 master cycles, correct? */ |
| 2066 | 2067 | cpu_adjust_icount(space->cpu,-8); |
| r7753 | r7754 | |
| 2071 | 2072 | if (BIT(channels, i)) |
| 2072 | 2073 | { |
| 2073 | 2074 | /* FIXME: the following should be used to stop DMA if the same channel is used by HDMA (being set to 1 in snes_hdma) |
| 2074 | | However, this cannot be implemented as is atm, because currently DMA transfers always happen as soon as they are enabled... */ |
| 2075 | However, this cannot be implemented as is atm, because currently DMA transfers always happen as soon as they are enabled... */ |
| 2075 | 2076 | state->dma_channel[i].dma_disabled = 0; |
| 2076 | 2077 | |
| 2077 | 2078 | //printf( "Making a transfer on channel %d\n", i ); |
| 2078 | 2079 | /* Find transfer addresses */ |
| 2079 | | abus = state->dma_channel[i].src_addr; |
| 2080 | | abus_bank = state->dma_channel[i].bank << 16; |
| 2081 | | bbus = state->dma_channel[i].dest_addr + 0x2100; |
| 2080 | abus = (snes_ram[SNES_DMA_BASE + (i * 0x10) + 3] << 8) + snes_ram[SNES_DMA_BASE + (i * 0x10) + 2]; |
| 2081 | abus_bank = (snes_ram[SNES_DMA_BASE + (i * 0x10) + 4] << 16); |
| 2082 | bbus = 0x2100 + snes_ram[SNES_DMA_BASE + (i * 0x10) + 1]; |
| 2082 | 2083 | |
| 2083 | | //printf("Address: %06x\n", abus | abus_bank); |
| 2084 | //printf( "Address: %06x\n", abus | abus_bank ); |
| 2084 | 2085 | /* Auto increment */ |
| 2085 | | if (state->dma_channel[i].dmap & 0x8) |
| 2086 | if (snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x8) |
| 2087 | { |
| 2086 | 2088 | increment = 0; |
| 2089 | } |
| 2087 | 2090 | else |
| 2088 | 2091 | { |
| 2089 | | if (state->dma_channel[i].dmap & 0x10) |
| 2092 | if (snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x10) |
| 2090 | 2093 | increment = -1; |
| 2091 | 2094 | else |
| 2092 | 2095 | increment = 1; |
| 2093 | 2096 | } |
| 2094 | 2097 | |
| 2095 | 2098 | /* Number of bytes to transfer */ |
| 2096 | | length = state->dma_channel[i].trans_size; |
| 2097 | | if (!length) |
| 2098 | | length = 0x10000; /* 0x0000 really means 0x10000 */ |
| 2099 | length = (snes_ram[SNES_DMA_BASE + (i * 0x10) + 6] << 8) + snes_ram[SNES_DMA_BASE + (i * 0x10) + 5]; |
| 2099 | 2100 | |
| 2100 | | // printf( "DMA-Ch %d: len: %X, abus: %X, bbus: %X, incr: %d, dir: %s, type: %d\n", i, length, abus | abus_bank, bbus, increment, state->dma_channel[i].dmap & 0x80 ? "PPU->CPU" : "CPU->PPU", state->dma_channel[i].dmap & 0x07); |
| 2101 | // printf( "DMA-Ch %d: len: %X, abus: %X, bbus: %X, incr: %d, dir: %s, type: %d\n", i, length, abus, bbus, increment, snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x80 ? "PPU->CPU" : "CPU->PPU", snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x07); |
| 2101 | 2102 | |
| 2102 | 2103 | #ifdef SNES_DBG_DMA |
| 2103 | | mame_printf_debug( "DMA-Ch %d: len: %X, abus: %X, bbus: %X, incr: %d, dir: %s, type: %d\n", i, length, abus | abus_bank, bbus, increment, state->dma_channel[i].dmap & 0x80 ? "PPU->CPU" : "CPU->PPU", state->dma_channel[i].dmap & 0x07); |
| 2104 | mame_printf_debug( "DMA-Ch %d: len: %X, abus: %X, bbus: %X, incr: %d, dir: %s, type: %d\n", i, length, abus, bbus, increment, snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x80 ? "PPU->CPU" : "CPU->PPU", snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x07); |
| 2104 | 2105 | #endif |
| 2105 | 2106 | |
| 2106 | | switch (state->dma_channel[i].dmap & 0x07) |
| 2107 | switch (snes_ram[SNES_DMA_BASE + (i * 0x10)] & 0x07) |
| 2107 | 2108 | { |
| 2108 | | case 0: /* 1 register write once */ |
| 2109 | | case 2: /* 1 register write twice */ |
| 2110 | | case 6: /* 1 register write twice */ |
| 2111 | | while (length-- && !state->dma_channel[i].dma_disabled) |
| 2112 | | { |
| 2113 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2114 | | abus += increment; |
| 2115 | | } |
| 2116 | | break; |
| 2117 | | case 1: /* 2 registers write once */ |
| 2118 | | case 5: /* 2 registers write twice alternate */ |
| 2119 | | while (length-- && !state->dma_channel[i].dma_disabled) |
| 2120 | | { |
| 2121 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2122 | | abus += increment; |
| 2123 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2124 | | break; |
| 2125 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2126 | | abus += increment; |
| 2127 | | } |
| 2128 | | break; |
| 2129 | | case 3: /* 2 registers write twice each */ |
| 2130 | | case 7: /* 2 registers write twice each */ |
| 2131 | | while (length-- && !state->dma_channel[i].dma_disabled) |
| 2132 | | { |
| 2133 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2134 | | abus += increment; |
| 2135 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2136 | | break; |
| 2137 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2138 | | abus += increment; |
| 2139 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2140 | | break; |
| 2141 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2142 | | abus += increment; |
| 2143 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2144 | | break; |
| 2145 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2146 | | abus += increment; |
| 2147 | | } |
| 2148 | | break; |
| 2149 | | case 4: /* 4 registers write once */ |
| 2150 | | while (length-- && !state->dma_channel[i].dma_disabled) |
| 2151 | | { |
| 2152 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2153 | | abus += increment; |
| 2154 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2155 | | break; |
| 2156 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2157 | | abus += increment; |
| 2158 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2159 | | break; |
| 2160 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 2); |
| 2161 | | abus += increment; |
| 2162 | | if (!(length--) || state->dma_channel[i].dma_disabled) |
| 2163 | | break; |
| 2164 | | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 3); |
| 2165 | | abus += increment; |
| 2166 | | } |
| 2167 | | break; |
| 2168 | | default: |
| 2109 | case 0: /* 1 register write once */ |
| 2110 | case 2: /* 1 register write twice */ |
| 2111 | case 6: /* 1 register write twice */ |
| 2112 | do |
| 2113 | { |
| 2114 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2115 | abus += increment; |
| 2116 | } while (--length && !state->dma_channel[i].dma_disabled); |
| 2117 | break; |
| 2118 | case 1: /* 2 registers write once */ |
| 2119 | case 5: /* 2 registers write twice alternate */ |
| 2120 | do |
| 2121 | { |
| 2122 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2123 | abus += increment; |
| 2124 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2125 | break; |
| 2126 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2127 | abus += increment; |
| 2128 | } while (--length && !state->dma_channel[i].dma_disabled); |
| 2129 | break; |
| 2130 | case 3: /* 2 registers write twice each */ |
| 2131 | case 7: /* 2 registers write twice each */ |
| 2132 | do |
| 2133 | { |
| 2134 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2135 | abus += increment; |
| 2136 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2137 | break; |
| 2138 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2139 | abus += increment; |
| 2140 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2141 | break; |
| 2142 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2143 | abus += increment; |
| 2144 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2145 | break; |
| 2146 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2147 | abus += increment; |
| 2148 | } while (--length && !state->dma_channel[i].dma_disabled); |
| 2149 | break; |
| 2150 | case 4: /* 4 registers write once */ |
| 2151 | do |
| 2152 | { |
| 2153 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus); |
| 2154 | abus += increment; |
| 2155 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2156 | break; |
| 2157 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 1); |
| 2158 | abus += increment; |
| 2159 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2160 | break; |
| 2161 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 2); |
| 2162 | abus += increment; |
| 2163 | if (!(--length) || state->dma_channel[i].dma_disabled) |
| 2164 | break; |
| 2165 | snes_dma_transfer(space, i, (abus & 0xffff) | abus_bank, bbus + 3); |
| 2166 | abus += increment; |
| 2167 | } while (--length && !state->dma_channel[i].dma_disabled); |
| 2168 | break; |
| 2169 | default: |
| 2169 | 2170 | #ifdef MAME_DEBUG |
| 2170 | | mame_printf_debug(" DMA of unsupported type: %d\n", state->dma_channel[i].dmap & 0x07); |
| 2171 | mame_printf_debug(" DMA of unsupported type: %d\n", state->dma_channel[i].dmap & 0x07); |
| 2171 | 2172 | #endif |
| 2172 | | break; |
| 2173 | break; |
| 2173 | 2174 | } |
| 2174 | 2175 | |
| 2175 | | /* We're done, so write the new abus back to the registers */ |
| 2176 | | state->dma_channel[i].src_addr = abus; |
| 2177 | | state->dma_channel[i].trans_size = 0; |
| 2178 | | /* active channel takes 8 master cycles */ |
| 2176 | /* We're done so write the new abus back to the registers */ |
| 2177 | snes_w_io(space, SNES_DMA_BASE + (i * 0x10) + 2, abus & 0xff); |
| 2178 | snes_w_io(space, SNES_DMA_BASE + (i * 0x10) + 3, (abus >> 8) & 0xff); |
| 2179 | snes_w_io(space, SNES_DMA_BASE + (i * 0x10) + 5, 0); |
| 2180 | snes_w_io(space, SNES_DMA_BASE + (i * 0x10) + 6, 0); |
| 2181 | |
| 2182 | /* active channel takes 8 master cycles */ |
| 2179 | 2183 | cpu_adjust_icount(space->cpu,-8); |
| 2180 | 2184 | } |
| 2181 | 2185 | } |
| r7753 | r7754 | |
| 2197 | 2201 | READ8_HANDLER( superfx_r_bank3 ) |
| 2198 | 2202 | { |
| 2199 | 2203 | /* IMPORTANT: SFX RAM sits in 0x600000-0x7fffff, and it's mirrored in 0xe00000-0xffffff. However, SNES |
| 2200 | | has only access to 0x600000-0x7dffff (because there is WRAM after that), hence we directly use the mirror |
| 2201 | | as the place where to write & read SFX RAM. SNES handlers have been setup accordingly. */ |
| 2204 | has only access to 0x600000-0x7dffff (because there is WRAM after that), hence we directly use the mirror |
| 2205 | as the place where to write & read SFX RAM. SNES handlers have been setup accordingly. */ |
| 2202 | 2206 | //printf("superfx_r_bank3: %08x = %02x\n", offset, snes_ram[0xe00000 + offset]); |
| 2203 | 2207 | return snes_ram[0xe00000 + offset]; |
| 2204 | 2208 | } |
| r7753 | r7754 | |
| 2218 | 2222 | WRITE8_HANDLER( superfx_w_bank3 ) |
| 2219 | 2223 | { |
| 2220 | 2224 | /* IMPORTANT: SFX RAM sits in 0x600000-0x7fffff, and it's mirrored in 0xe00000-0xffffff. However, SNES |
| 2221 | | has only access to 0x600000-0x7dffff (because there is WRAM after that), hence we directly use the mirror |
| 2222 | | as the place where to write & read SFX RAM. SNES handlers have been setup accordingly. */ |
| 2225 | has only access to 0x600000-0x7dffff (because there is WRAM after that), hence we directly use the mirror |
| 2226 | as the place where to write & read SFX RAM. SNES handlers have been setup accordingly. */ |
| 2223 | 2227 | //printf("superfx_w_bank3: %08x = %02x\n", offset, data); |
| 2224 | 2228 | snes_ram[0xe00000 + offset] = data; |
| 2225 | 2229 | } |