Skip to content

Commit

Permalink
- Updated CpuSetPCBase to include MAP_BSX, and refactored some code to
Browse files Browse the repository at this point in the history
prevent performance hits.
  • Loading branch information
bubble2k16 committed Feb 20, 2017
1 parent cc3205e commit 92d6e8c
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 19 deletions.
18 changes: 17 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Try to avoid pressing the Home button or putting the 3DS to sleep. Quit the emul

##What's supported

1. Graphic modes 0 - 5, 7.
1. Graphic modes 0 - 7.
2. Save states of up to 4 slots
3. Cheats - place your .CHT/.CHX (text format) with the same filename in the same folder as your ROM. For example, if your ROM name is MyGame.smc, then your cheat file should be named MyGame.CHT or MyGame.CHX
4. Currently uses CSND for audio. So your entry point to home-brew must be able to use CSND. If you can play BlargSNES with sound, you should be able to play Snes9X_3DS with sound.
Expand All @@ -133,6 +133,22 @@ Try to avoid pressing the Home button or putting the 3DS to sleep. Quit the emul

##Change History

v1.10
- Implemented SA-1 sleep speed-hacks on the following games. These games run faster and some are able to run at 60 fps on the Old 3DS when things on-screen aren't too busy.
Super Mario RPG; Kirby’s Dreamland; Jikkyou Oshaberi Parodius; Kirby Super Star; Marvelous; Super Robot Taisen;
Panic Bomber World; Dragon Ball Hyper Dimension; SD Gundam Next; Power Rangers Zeo;
Daisenryaku Expert 2; Masters New Augusta 3; Bass Fishing; J96 Dream Stadium;
Shining Scorpion; Pebble Beach New; PGA European Tour; SD F1 Grand Prix;
- Fixed mode 7’s CLIP_10_BIT_SIGNED formula to use the original Snes9x’s formula. This fixes Super Chase HQ’s mode 7 intro.
- Imported SPC7110 decompressor chip code from Snes9x 1.52. Now Tengai Makyou Zero (Far East of Eden Zero) can boot after 2 restarts, and in-game graphics appears without problems.
- Fixed important bug in cheat engine so that it doesn't not increment the 65816 processor's clock cycles when enabling/disabling cheats.
- Fixed the problem of the menu not using the correct font when the emulator first boots up.
- Added one more mode when using the 3D slider for a sharper image.
- Major refactoring of code.
- Fixed SA1 MMC's memory map code by copying it from Snes9x 1.54.2. Now Super Mario World hack VLDC 9 boots.
- Fixed Mode 0 rendering bug. The original bug was there since day 1 and with this fix, Lagoon's title screen looks right.


v1.00
- Transplanted the full SPC700 + DSP source codes from Snes9x v1.51 into this emulator. As a result, the sound emulation now supports Gaussian Interpolation, and has better accuracy. This fixes some sound problems in Clay Fighter and Mortal Kombat I and II.
- Fixed Mode 7 priorities in games that use this: Contra III's stage 1 (at the loss of some color fidelity). Implementing this required the use of some crazy math hacks and hardware tricks to pull this off.
Expand Down
Binary file modified snes9x_3ds.3dsx
Binary file not shown.
Binary file modified snes9x_3ds.cia
Binary file not shown.
48 changes: 34 additions & 14 deletions source/cpuexec-ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,21 +198,12 @@ STATIC inline void __attribute__((always_inline)) CpuFixCycles ()
}


INLINE void __attribute__((always_inline)) CpuSetPCBase (uint32 Address)
// We had to move this outside of CpuSetPCBase, because after we added
// MAP_BSX, emulation performance took a dive, presumably due to
// longer jumps in the ARM code for the 65816's branch instructions?
//
void CpuSetPCBaseOthers(uint8 *GetAddress, uint32 Address)
{
int block;
uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK];

CPU.MemSpeed = Memory.MemorySpeed [block];
CPU.MemSpeedx2 = CPU.MemSpeed << 1;

if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
{
CPU.PCBase = GetAddress;
CPU_PC = GetAddress + (Address & 0xffff);
return;
}

switch ((int) GetAddress)
{
case CMemory::MAP_PPU:
Expand Down Expand Up @@ -250,6 +241,11 @@ INLINE void __attribute__((always_inline)) CpuSetPCBase (uint32 Address)
CPU_PC = CPU.PCBase + (Address & 0xffff);
return;

case CMemory::MAP_BSX:
CPU.PCBase = Memory.ROM;
CPU_PC = CPU.PCBase + (Address & 0xffff);
return;

case CMemory::MAP_DEBUG:
#ifdef DEBUGGER
printf ("SBP %06x\n", Address);
Expand All @@ -267,6 +263,30 @@ INLINE void __attribute__((always_inline)) CpuSetPCBase (uint32 Address)
}


// Broke up the CpuSetPCBase into two methods, since the original
// one causes long jumps in ARM which killed performance. This part
// is the one that will be used most of the time anyway.
//
INLINE void __attribute__((always_inline)) CpuSetPCBase (uint32 Address)
{
int block;
uint8 *GetAddress = Memory.Map [block = (Address >> MEMMAP_SHIFT) & MEMMAP_MASK];

CPU.MemSpeed = Memory.MemorySpeed [block];
CPU.MemSpeedx2 = CPU.MemSpeed << 1;

if (GetAddress >= (uint8 *) CMemory::MAP_LAST)
{
CPU.PCBase = GetAddress;
CPU_PC = GetAddress + (Address & 0xffff);
return;
}

CpuSetPCBaseOthers(GetAddress, Address);
}



/***********************************************************************************************
Memory Read/Write
***********************************************************************************************/
Expand Down
8 changes: 4 additions & 4 deletions source/getset.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,15 @@ INLINE void S9xSetPCBase (uint32 Address)
CPU.PC = CPU.PCBase + (Address & 0xffff);
return;

case CMemory::MAP_BSX:
CPU.PCBase = S9xGetBasePointerBSX(Address);
return;

case CMemory::MAP_DEBUG:
#ifdef DEBUGGER
printf ("SBP %06x\n", Address);
#endif

case CMemory::MAP_BSX:
CPU.PCBase = S9xGetBasePointerBSX(Address);
return;

default:
case CMemory::MAP_NONE:
#ifdef DEBUGGER
Expand Down

0 comments on commit 92d6e8c

Please sign in to comment.