Previous 15994 Revisions Next

r5586 Saturday 5th September, 2009 at 00:48:43 UTC by MooglyGuy
Copying over Harmony's latest SNES changes from MAME
[src/mame/machine]snes.c snessdd1.c

src/mame/machine/snessdd1.c
r5585r5586
411411static void SDD1_OL_launch(SDD1_OL* this)
412412{
413413   UINT8 i;
414   UINT8 register1, register2;
414   UINT8 register1 = 0, register2 = 0;
415415
416416   switch(this->bitplanesInfo)
417417   {
r5585r5586
540540   snes_sdd1.sdd1emu = SDD1emu_ctor(machine);
541541}
542542
543static UINT8 sdd1_mmio_read(running_machine* machine, UINT16 addr)
543static UINT8 sdd1_mmio_read(const address_space *space, UINT32 addr)
544544{
545545   addr &= 0xffff;
546546
547   //printf("SDD1::mmio_read(%04x)\n", addr);
548
549   if((addr & 0x4380) == 0x4300)
550   {
551      return snes_r_io(space, addr & 0x7f);
552   }
553
547554   switch(addr)
548555   {
549556      case 0x4804:
550557         return (snes_sdd1.mmc[0] >> 20) & 7;
558         break;
551559      case 0x4805:
552560         return (snes_sdd1.mmc[1] >> 20) & 7;
561         break;
553562      case 0x4806:
554563         return (snes_sdd1.mmc[2] >> 20) & 7;
564         break;
555565      case 0x4807:
556566         return (snes_sdd1.mmc[3] >> 20) & 7;
567         break;
557568   }
558569
559570   return 0xff;
560571}
561572
562static void sdd1_mmio_write(running_machine* machine, UINT16 addr, UINT8 data)
573static void sdd1_mmio_write(const address_space *space, UINT32 addr, UINT8 data)
563574{
564575   addr &= 0xffff;
565576
r5585r5586
570581      {
571582         case 2:
572583            snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0xffff00) + (data <<  0);
584            //printf( "dma[%d].addr = %06x\n", channel, snes_sdd1.dma[channel].addr );
573585            break;
574586         case 3:
575587            snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0xff00ff) + (data <<  8);
588            //printf( "dma[%d].addr = %06x\n", channel, snes_sdd1.dma[channel].addr );
576589            break;
577590         case 4:
578591            snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr & 0x00ffff) + (data << 16);
592            //printf( "dma[%d].addr = %06x\n", channel, snes_sdd1.dma[channel].addr );
579593            break;
580594
581595         case 5:
582            snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr &   0xff00) + (data <<  0);
596            snes_sdd1.dma[channel].size = (snes_sdd1.dma[channel].size &   0xff00) + (data <<  0);
597            //printf( "dma[%d].size = %04x\n", channel, snes_sdd1.dma[channel].size );
583598            break;
584599         case 6:
585            snes_sdd1.dma[channel].addr = (snes_sdd1.dma[channel].addr &   0x00ff) + (data <<  8);
600            snes_sdd1.dma[channel].size = (snes_sdd1.dma[channel].size &   0x00ff) + (data <<  8);
601            //printf( "dma[%d].size = %04x\n", channel, snes_sdd1.dma[channel].size );
586602            break;
587603      }
588604      snes_ram[addr] = data;
r5585r5586
615631
616632static UINT8 sdd1_read(running_machine* machine, UINT16 addr)
617633{
634   //printf( "sdd1.read(%06x)\n", addr );
618635   if(snes_sdd1.sdd1_enable & snes_sdd1.xfer_enable)
619636   {
620637      // at least one channel has S-DD1 decompression enabled...
r5585r5586
659676      } // channel loop
660677   } // S-DD1 decompressor enabled
661678
662   return memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff));
679   //printf( "returning a generic memory read from %06x\n", 0xc00000 + snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff) );
680   return snes_ram[0xc00000 + snes_sdd1.mmc[(addr >> 20) & 3] + (addr & 0x0fffff)];
663681}
664682
665683static void sdd1_reset(running_machine *machine)
src/mame/machine/snes.c
r5585r5586
369369   {
370370      if(offset >= 0x4800 && offset < 0x4808)
371371      {
372         return sdd1_mmio_read(space->machine, offset);
372         return sdd1_mmio_read(space, (UINT32)offset);
373373      }
374      if(offset < 0x80)
375      {
376         offset += 0x4300;
377      }
374378   }
375379
376380   /* offset is from 0x000000 */
r5585r5586
735739      if((offset >= 0x4300 && offset < 0x4380) ||
736740         (offset >= 0x4800 && offset < 0x4808))
737741      {
738         sdd1_mmio_write(space->machine, offset, data);
742         sdd1_mmio_write(space, (UINT32)offset, data);
739743         return;
740744      }
745      if(offset < 0x80)
746      {
747         offset += 0x4300;
748      }
741749   }
742750
743751   /* offset is from 0x000000 */
r5585r5586
16381646/* 0xc00000 - 0xffffff */
16391647READ8_HANDLER( snes_r_bank7 )
16401648{
1641   UINT8 value;
1649   UINT8 value = 0;
16421650   UINT16 address = offset & 0xffff;
16431651
1644   if(snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
1652   if(snes_has_addon_chip == HAS_SDD1)
16451653   {
1654      return sdd1_read(space->machine, offset);
1655   }
1656   else if(snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
1657   {
16461658      logerror( "snes_r_bank7 hit in Super FX mode, please fix me\n" );
16471659   }
1648   if (snes_cart.mode & 5)            /* Mode 20 & 22 */
1660   else if (snes_cart.mode & 5)            /* Mode 20 & 22 */
16491661   {
16501662      if (address < 0x8000)
16511663      {
r5585r5586
17321744
17331745   if (snes_has_addon_chip == HAS_SUPERFX && cputag_get_cpu(space->machine, "superfx") != NULL)
17341746   {
1747      //printf( "Writing %02x to %08x\n", data, 0x600000 + offset );
17351748      snes_ram[0x600000 + offset] = data;
17361749   }
17371750   else if (snes_cart.mode & 5)               /* Mode 20 & 22 */
r5585r5586
23112324   {
23122325      if( channels & mask )
23132326      {
2327         //printf( "Making a transfer on channel %d\n", i );
23142328         /* Find transfer addresses */
23152329         abus = (snes_ram[SNES_DMA_BASE + dma + 3] << 8) + snes_ram[SNES_DMA_BASE + dma + 2];
23162330         abus_bank = (snes_ram[SNES_DMA_BASE + dma + 4] << 16);
23172331         bbus = 0x2100 + snes_ram[SNES_DMA_BASE + dma + 1];
23182332
2333         //printf( "Address: %06x\n", abus | abus_bank );
23192334         /* Auto increment */
23202335         if( snes_ram[SNES_DMA_BASE + dma] & 0x8 )
23212336         {
r5585r5586
24452460#endif
24462461               break;
24472462         }
2463
24482464         /* We're done so write the new abus back to the registers */
2449         snes_ram[SNES_DMA_BASE + dma + 2] = abus & 0xff;
2450         snes_ram[SNES_DMA_BASE + dma + 3] = (abus >> 8) & 0xff;
2451         snes_ram[SNES_DMA_BASE + dma + 5] = 0;
2452         snes_ram[SNES_DMA_BASE + dma + 6] = 0;
2465         snes_w_io(space, SNES_DMA_BASE + dma + 2, abus & 0xff);
2466         snes_w_io(space, SNES_DMA_BASE + dma + 3, (abus >> 8) & 0xff);
2467         snes_w_io(space, SNES_DMA_BASE + dma + 5, 0);
2468         snes_w_io(space, SNES_DMA_BASE + dma + 6, 0);
2469         //snes_ram[SNES_DMA_BASE + dma + 2] = abus & 0xff;
2470         //snes_ram[SNES_DMA_BASE + dma + 3] = (abus >> 8) & 0xff;
2471         //snes_ram[SNES_DMA_BASE + dma + 5] = 0;
2472         //snes_ram[SNES_DMA_BASE + dma + 6] = 0;
24532473      }
24542474      dma += 0x10;
24552475      mask <<= 1;
r5585r5586
24682488
24692489READ8_HANDLER( superfx_r_bank3 )
24702490{
2491   //printf( "superfx_r_bank3: %08x = %02x\n", 0x600000 + offset, snes_ram[0x600000 + offset] );
24712492   return snes_ram[0x600000 + offset];
24722493}
24732494
24742495WRITE8_HANDLER( superfx_w_bank1 )
24752496{
2497   printf( "Attempting to write to cart ROM: %08x = %02x\n", offset, data );
24762498   // Do nothing; can't write to cart ROM.
24772499}
24782500
24792501WRITE8_HANDLER( superfx_w_bank2 )
24802502{
2503   printf( "Attempting to write to cart ROM: %08x = %02x\n", 0x400000 + offset, data );
24812504   // Do nothing; can't write to cart ROM.
24822505}
24832506

Previous 15994 Revisions Next


© 1998-2018 The MESS Team