Previous 15994 Revisions Next

r7774 Saturday 10th April, 2010 at 13:23:06 UTC by Angelo Salese
reapplied latest snes source code
[src/mame/machine]snes.c
[src/mame/video]snes.c

src/mame/machine/snes.c
r7773r7774
66
77  R. Belmont
88  Anthony Kruize
9  Angelo Salese
10  Fabio Priuli
911  Harmony
1012  Based on the original code by Lee Hammerton (aka Savoury Snax)
1113  Thanks to Anomie for invaluable technical information.
r7773r7774
955957   else
956958      value = snes_ram[offset];
957959
958   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
960   if(!space->debugger_access)
961      cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
962
959963   return value;
960964}
961965
r7773r7774
10121016   else
10131017      value = snes_ram[0x300000 + offset];
10141018
1015   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
1019   if(!space->debugger_access)
1020      cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
10161021
10171022   return value;
10181023}
r7773r7774
10521057   else                                 /* Mode 21 & 25 + SuperFX games */
10531058      value = snes_ram[0x400000 + offset];
10541059
1055   cpu_adjust_icount(space->cpu, -8);
1060   if(!space->debugger_access)
1061      cpu_adjust_icount(space->cpu, -8);
1062
10561063   return value;
10571064}
10581065
r7773r7774
10881095   else if (snes_cart.mode & 0x0a)               /* Mode 21 & 25 */
10891096      value = snes_ram[0x600000 + offset];
10901097
1091   cpu_adjust_icount(space->cpu, -8);
1098   if(!space->debugger_access)
1099      cpu_adjust_icount(space->cpu, -8);
1100
10921101   return value;
10931102}
10941103
r7773r7774
11221131   else
11231132      value = snes_ram[0x700000 + offset];
11241133
1125   cpu_adjust_icount(space->cpu, -8);
1134   if(!space->debugger_access)
1135      cpu_adjust_icount(space->cpu, -8);
1136
11261137   return value;
11271138}
11281139
r7773r7774
11681179   else
11691180      value = snes_ram[0x800000 + offset];
11701181
1171   cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
1182   if(!space->debugger_access)
1183      cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
1184
11721185   return value;
11731186}
11741187
r7773r7774
12191232   else                        /* Mode 21 & 25 + SuperFX Games */
12201233      value = snes_ram[0xc00000 + offset];
12211234
1222   cpu_adjust_icount(space->cpu, -((snes_ram[MEMSEL] & 1) ? 6 : 8));
1235   if(!space->debugger_access)
1236      cpu_adjust_icount(space->cpu, -((snes_ram[MEMSEL] & 1) ? 6 : 8));
12231237
12241238   return value;
12251239}
r7773r7774
12661280   else
12671281      logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset );
12681282
1269   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
1283   if(!space->debugger_access)
1284      cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
12701285}
12711286
12721287/* 0x300000 - 0x3fffff */
r7773r7774
13171332   else
13181333      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x300000);
13191334
1320   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
1335   if(!space->debugger_access)
1336      cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
13211337}
13221338
13231339/* 0x600000 - 0x6fffff */
r7773r7774
13411357   else if (snes_cart.mode & 0x0a)
13421358      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x600000);
13431359
1344   cpu_adjust_icount(space->cpu, -8);
1360   if(!space->debugger_access)
1361      cpu_adjust_icount(space->cpu, -8);
13451362}
13461363
13471364/* 0x700000 - 0x7dffff */
r7773r7774
13641381   else if (snes_cart.mode & 0x0a)
13651382      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x700000);
13661383
1367   cpu_adjust_icount(space->cpu, -8);
1384   if(!space->debugger_access)
1385      cpu_adjust_icount(space->cpu, -8);
13681386}
13691387
13701388
r7773r7774
14111429   else
14121430      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x800000);
14131431
1414   cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
1432   if(!space->debugger_access)
1433      cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
14151434}
14161435
14171436
r7773r7774
14491468   else if (snes_cart.mode & 0x0a)
14501469      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0xc00000);
14511470
1452   cpu_adjust_icount(space->cpu, -((snes_ram[MEMSEL] & 1) ? 6 : 8));
1471   if(!space->debugger_access)
1472      cpu_adjust_icount(space->cpu, -((snes_ram[MEMSEL] & 1) ? 6 : 8));
14531473}
14541474
14551475
r7773r7774
17031723   snes_ram[WRDIVL] = 0xff;
17041724   snes_ram[WRDIVH] = 0xff;
17051725
1726   /* init DMA regs to be 0xff */
1727   {
1728      int i;
1729
1730      for(i=0;i<8;i++)
1731      {
1732         state->dma_channel[i].dmap = 0xff;
1733         state->dma_channel[i].dest_addr = 0xff;
1734         state->dma_channel[i].src_addr = 0xffff;
1735         state->dma_channel[i].bank = 0xff;
1736         state->dma_channel[i].trans_size = 0xffff;
1737         state->dma_channel[i].ibank = 0xff;
1738         state->dma_channel[i].hdma_addr = 0xffff;
1739         state->dma_channel[i].hdma_line_counter = 0xff;
1740         state->dma_channel[i].unk = 0xff;
1741      }
1742   }
1743
17061744   switch (snes_has_addon_chip)
17071745   {
17081746      case HAS_SDD1:
r7773r7774
20352073
20362074            bbus = state->dma_channel[i].dest_addr + 0x2100;
20372075
2076
2077
20382078            switch (state->dma_channel[i].dmap & 0x07)
20392079            {
20402080            case 0:      /* 1 register write once             (1 byte:  p               ) */
r7773r7774
21402180         /* Number of bytes to transfer */
21412181         length = state->dma_channel[i].trans_size;
21422182
2143         //        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);
2183//         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);
21442184
21452185#ifdef SNES_DBG_DMA
21462186         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);
src/mame/video/snes.c
r7773r7774
239239         if (scanlines[screen].priority[ii >> 1] <= priority)
240240         {
241241            UINT8 clr = colour;
242            UINT8 clipmask = snes_ppu.clipmasks[layer][ii];
242            UINT8 clipmask = snes_ppu.clipmasks[layer][ii >> 1];
243243
244244#ifdef SNES_LAYER_DEBUG
245245            if (debug_options.windows_disabled)
r7773r7774
13201320            switch (snes_ppu.layer[jj].wlog_mask)
13211321            {
13221322               case 0x00:   /* OR */
1323                  snes_ppu.clipmasks[jj][ii] = w1 | w2 ? 0x00 : 0xff;
1323                  snes_ppu.clipmasks[jj][ii] = (w1 | w2) ? 0x00 : 0xff;
13241324                  break;
13251325               case 0x01:   /* AND */
1326                  snes_ppu.clipmasks[jj][ii] = w1 & w2 ? 0x00 : 0xff;
1326                  snes_ppu.clipmasks[jj][ii] = (w1 & w2) ? 0x00 : 0xff;
13271327                  break;
13281328               case 0x02:   /* XOR */
1329                  snes_ppu.clipmasks[jj][ii] = w1 ^ w2 ? 0x00 : 0xff;
1329                  snes_ppu.clipmasks[jj][ii] = (w1 ^ w2) ? 0x00 : 0xff;
13301330                  break;
13311331               case 0x03:   /* XNOR */
13321332                  snes_ppu.clipmasks[jj][ii] = !(w1 ^ w2) ? 0x00 : 0xff;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team