Previous 15994 Revisions Next

r7746 Wednesday 7th April, 2010 at 01:18:05 UTC by Angelo Salese
[SNES]: Basic implementation of the memory map master cycle steals
[src/mame/machine]snes.c

src/mame/machine/snes.c
r7745r7746
809809
810810*/
811811
812/*FIXME: missing work RAM access steal */
813static int snes_bank_0x00_0x3f_cycles(running_machine *machine,UINT32 offset)
814{
815/*
816 $00-$3F | $0000-$1FFF | Slow  | Address Bus A + /WRAM (mirror $7E:0000-$1FFF)
817         | $2000-$20FF | Fast  | Address Bus A
818         | $2100-$21FF | Fast  | Address Bus B
819         | $2200-$3FFF | Fast  | Address Bus A
820         | $4000-$41FF | XSlow | Internal CPU registers (see Note 1 below)
821         | $4200-$43FF | Fast  | Internal CPU registers (see Note 1 below)
822         | $4400-$5FFF | Fast  | Address Bus A
823         | $6000-$7FFF | Slow  | Address Bus A
824         | $8000-$FFFF | Slow  | Address Bus A + /CART
825         */
826
827   if(((offset & 0xff00) == 0x4000) || ((offset & 0xff00) == 0x4100))
828      return 12;
829
830   if(((offset & 0xff00) >= 0x0000) && ((offset & 0xff00) <= 0x1f00))
831      return 8;
832
833   if((offset & 0xff00) >= 0x6000)
834      return 8;
835
836   return 6;
837}
838
839static int snes_bank_0x80_0xbf_cycles(running_machine *machine,UINT32 offset)
840{
841/*
842 $80-$BF | $0000-$1FFF | Slow  | Address Bus A + /WRAM (mirror $7E:0000-$1FFF)
843         | $2000-$20FF | Fast  | Address Bus A
844         | $2100-$21FF | Fast  | Address Bus B
845         | $2200-$3FFF | Fast  | Address Bus A
846         | $4000-$41FF | XSlow | Internal CPU registers (see Note 1 below)
847         | $4200-$43FF | Fast  | Internal CPU registers (see Note 1 below)
848         | $4400-$5FFF | Fast  | Address Bus A
849         | $6000-$7FFF | Slow  | Address Bus A
850         | $8000-$FFFF | Note2 | Address Bus A + /CART
851*/
852
853   if(((offset & 0xff00) == 0x4000) || ((offset & 0xff00) == 0x4100))
854      return 12;
855
856   if(((offset & 0xff00) >= 0x0000) && ((offset & 0xff00) <= 0x1f00))
857      return 8;
858
859   if(((offset & 0xff00) >= 0x6000) && ((offset & 0xff00) <= 0x7f00))
860      return 8;
861
862   if(((offset & 0xff00) >= 0x8000) && ((offset & 0xff00) <= 0xff00))
863      return (snes_ram[MEMSEL] & 1) ? 6 : 8;
864
865   return 6;
866}
867
812868/* 0x000000 - 0x2fffff */
813869READ8_HANDLER( snes_r_bank1 )
814870{
r7745r7746
855911   else
856912      value = snes_ram[offset];
857913
914   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
858915   return value;
859916}
860917
r7745r7746
911968   else
912969      value = snes_ram[0x300000 + offset];
913970
971   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
972
914973   return value;
915974}
916975
r7745r7746
9491008   else                                 /* Mode 21 & 25 + SuperFX games */
9501009      value = snes_ram[0x400000 + offset];
9511010
1011   cpu_adjust_icount(space->cpu, -8);
9521012   return value;
9531013}
9541014
r7745r7746
9841044   else if (snes_cart.mode & 0x0a)               /* Mode 21 & 25 */
9851045      value = snes_ram[0x600000 + offset];
9861046
1047   cpu_adjust_icount(space->cpu, -8);
9871048   return value;
9881049}
9891050
r7745r7746
10171078   else
10181079      value = snes_ram[0x700000 + offset];
10191080
1081   cpu_adjust_icount(space->cpu, -8);
10201082   return value;
10211083}
10221084
r7745r7746
10621124   else
10631125      value = snes_ram[0x800000 + offset];
10641126
1127   cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
10651128   return value;
10661129}
10671130
r7745r7746
11121175   else                        /* Mode 21 & 25 + SuperFX Games */
11131176      value = snes_ram[0xc00000 + offset];
11141177
1178   cpu_adjust_icount(space->cpu, -(snes_ram[MEMSEL] & 1) ? 6 : 8);
1179
11151180   return value;
11161181}
11171182
r7745r7746
11561221      dsp3_write(address, data);
11571222   else
11581223      logerror( "(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset );
1224
1225   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
11591226}
11601227
11611228/* 0x300000 - 0x3fffff */
r7745r7746
12051272      dsp4_write(data);
12061273   else
12071274      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x300000);
1275
1276   cpu_adjust_icount(space->cpu, -snes_bank_0x00_0x3f_cycles(space->machine, offset));
12081277}
12091278
12101279/* 0x600000 - 0x6fffff */
r7745r7746
12271296   }
12281297   else if (snes_cart.mode & 0x0a)
12291298      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x600000);
1299
1300   cpu_adjust_icount(space->cpu, -8);
12301301}
12311302
12321303/* 0x700000 - 0x7dffff */
r7745r7746
12481319   }
12491320   else if (snes_cart.mode & 0x0a)
12501321      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x700000);
1322
1323   cpu_adjust_icount(space->cpu, -8);
12511324}
12521325
12531326
r7745r7746
12931366      dsp4_write(data);
12941367   else
12951368      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0x800000);
1369
1370   cpu_adjust_icount(space->cpu, -snes_bank_0x80_0xbf_cycles(space->machine, offset));
12961371}
12971372
12981373
r7745r7746
13291404   }
13301405   else if (snes_cart.mode & 0x0a)
13311406      logerror("(PC=%06x) Attempt to write to ROM address: %X\n",cpu_get_pc(space->cpu),offset + 0xc00000);
1407
1408   cpu_adjust_icount(space->cpu, -(snes_ram[MEMSEL] & 1) ? 6 : 8);
13321409}
13331410
13341411

Previous 15994 Revisions Next


© 1998-2018 The MESS Team