2012-03-23 10:43:39 +00:00
|
|
|
struct DSP : Thread {
|
Updated to v067r21 release.
byuu says:
This moves toward a profile-selection mode. Right now, it is incomplete.
There are three binaries, one for each profile. The GUI selection
doesn't actually do anything yet. There will be a launcher in a future
release that loads each profile's respective binary.
I reverted away from blargg's SMP library for the time being, in favor
of my own. This will fix most of the csnes/bsnes-performance bugs. This
causes a 10% speed hit on 64-bit platforms, and a 15% speed hit on
32-bit platforms. I hope to be able to regain that speed in the future,
I may also experiment with creating my own fast-SMP core which drops bus
hold delays and TEST register support (never used by anything, ever.)
Save states now work in all three cores, but they are not
cross-compatible. The profile name is stored in the description field of
the save states, and it won't load a state if the profile name doesn't
match.
The debugger only works on the research target for now. Give it time and
it will return for the other targets.
Other than that, let's please resume testing on all three once again.
See how far we get this time :)
I can confirm the following games have issues on the performance
profile:
- Armored Police Metal Jacket (minor logo flickering, not a big deal)
- Chou Aniki (won't start, so obviously unplayable)
- Robocop vs The Terminator (major in-game flickering, unplayable)
Anyone still have that gigantic bsnes thread archive from the ZSNES
forum? Maybe I posted about how to fix those two broken games in there,
heh.
I really want to release this as v1.0, but my better judgment says we
need to give it another week. Damn.
2010-10-20 11:22:44 +00:00
|
|
|
enum : bool { Threaded = true };
|
2010-08-09 13:28:56 +00:00
|
|
|
alwaysinline void step(unsigned clocks);
|
|
|
|
alwaysinline void synchronize_smp();
|
|
|
|
|
2012-05-29 12:20:46 +00:00
|
|
|
bool mute();
|
2010-08-09 13:28:56 +00:00
|
|
|
uint8 read(uint8 addr);
|
|
|
|
void write(uint8 addr, uint8 data);
|
|
|
|
|
Updated to v067r21 release.
byuu says:
This moves toward a profile-selection mode. Right now, it is incomplete.
There are three binaries, one for each profile. The GUI selection
doesn't actually do anything yet. There will be a launcher in a future
release that loads each profile's respective binary.
I reverted away from blargg's SMP library for the time being, in favor
of my own. This will fix most of the csnes/bsnes-performance bugs. This
causes a 10% speed hit on 64-bit platforms, and a 15% speed hit on
32-bit platforms. I hope to be able to regain that speed in the future,
I may also experiment with creating my own fast-SMP core which drops bus
hold delays and TEST register support (never used by anything, ever.)
Save states now work in all three cores, but they are not
cross-compatible. The profile name is stored in the description field of
the save states, and it won't load a state if the profile name doesn't
match.
The debugger only works on the research target for now. Give it time and
it will return for the other targets.
Other than that, let's please resume testing on all three once again.
See how far we get this time :)
I can confirm the following games have issues on the performance
profile:
- Armored Police Metal Jacket (minor logo flickering, not a big deal)
- Chou Aniki (won't start, so obviously unplayable)
- Robocop vs The Terminator (major in-game flickering, unplayable)
Anyone still have that gigantic bsnes thread archive from the ZSNES
forum? Maybe I posted about how to fix those two broken games in there,
heh.
I really want to release this as v1.0, but my better judgment says we
need to give it another week. Damn.
2010-10-20 11:22:44 +00:00
|
|
|
void enter();
|
2010-08-09 13:28:56 +00:00
|
|
|
void power();
|
|
|
|
void reset();
|
|
|
|
|
|
|
|
void serialize(serializer&);
|
|
|
|
DSP();
|
|
|
|
~DSP();
|
|
|
|
|
2012-02-09 12:53:55 +00:00
|
|
|
privileged:
|
Update to v088r02 release.
byuu says:
Basically, the current implementation of nall/array is deprecated now.
The old method was for non-reference types, it acted like a vector for
POD types (raw memory allocation instead of placement new construction.)
And for reference types, it acted like an unordered set. Yeah, not good.
As of right now, nall/array is no longer used. The vector type usage was
replaced with actual vectors.
I've created nall/set, which now contains the specialization for
reference types.
nall/set basically acts much like std::unordered_set. No auto-sort, only
one of each type is allowed, automatic growth.
This will be the same both for reference and non-reference types ...
however, the non-reference type wasn't implemented just yet.
Future plans for nall/array are for it to be a statically allocated
block of memory, ala array<type, size>, which is meant for RAII memory
usage.
Have to work on the specifics, eg the size as a template parameter may
be problematic. I'd like to return allocated chunks of memory (eg
file::read) in this container so that I don't have to manually free the
data anymore.
I also removed nall/moduloarray, and moved that into the SNES DSP class,
since that's the only thing that uses it.
2012-04-26 10:56:15 +00:00
|
|
|
#include "moduloarray.hpp"
|
|
|
|
|
2010-08-09 13:28:56 +00:00
|
|
|
//global registers
|
|
|
|
enum global_reg_t {
|
|
|
|
r_mvoll = 0x0c, r_mvolr = 0x1c,
|
|
|
|
r_evoll = 0x2c, r_evolr = 0x3c,
|
|
|
|
r_kon = 0x4c, r_koff = 0x5c,
|
|
|
|
r_flg = 0x6c, r_endx = 0x7c,
|
|
|
|
r_efb = 0x0d, r_pmon = 0x2d,
|
|
|
|
r_non = 0x3d, r_eon = 0x4d,
|
|
|
|
r_dir = 0x5d, r_esa = 0x6d,
|
|
|
|
r_edl = 0x7d, r_fir = 0x0f, //8 coefficients at 0x0f, 0x1f, ... 0x7f
|
|
|
|
};
|
|
|
|
|
|
|
|
//voice registers
|
|
|
|
enum voice_reg_t {
|
|
|
|
v_voll = 0x00, v_volr = 0x01,
|
|
|
|
v_pitchl = 0x02, v_pitchh = 0x03,
|
|
|
|
v_srcn = 0x04, v_adsr0 = 0x05,
|
|
|
|
v_adsr1 = 0x06, v_gain = 0x07,
|
|
|
|
v_envx = 0x08, v_outx = 0x09,
|
|
|
|
};
|
|
|
|
|
|
|
|
//internal envelope modes
|
|
|
|
enum env_mode_t { env_release, env_attack, env_decay, env_sustain };
|
|
|
|
|
|
|
|
//internal constants
|
|
|
|
enum { echo_hist_size = 8 };
|
|
|
|
enum { brr_buf_size = 12 };
|
|
|
|
enum { brr_block_size = 9 };
|
|
|
|
|
|
|
|
//global state
|
|
|
|
struct state_t {
|
|
|
|
uint8 regs[128];
|
|
|
|
|
Update to v088r02 release.
byuu says:
Basically, the current implementation of nall/array is deprecated now.
The old method was for non-reference types, it acted like a vector for
POD types (raw memory allocation instead of placement new construction.)
And for reference types, it acted like an unordered set. Yeah, not good.
As of right now, nall/array is no longer used. The vector type usage was
replaced with actual vectors.
I've created nall/set, which now contains the specialization for
reference types.
nall/set basically acts much like std::unordered_set. No auto-sort, only
one of each type is allowed, automatic growth.
This will be the same both for reference and non-reference types ...
however, the non-reference type wasn't implemented just yet.
Future plans for nall/array are for it to be a statically allocated
block of memory, ala array<type, size>, which is meant for RAII memory
usage.
Have to work on the specifics, eg the size as a template parameter may
be problematic. I'd like to return allocated chunks of memory (eg
file::read) in this container so that I don't have to manually free the
data anymore.
I also removed nall/moduloarray, and moved that into the SNES DSP class,
since that's the only thing that uses it.
2012-04-26 10:56:15 +00:00
|
|
|
moduloarray<int, echo_hist_size> echo_hist[2]; //echo history keeps most recent 8 samples
|
2010-08-09 13:28:56 +00:00
|
|
|
int echo_hist_pos;
|
|
|
|
|
|
|
|
bool every_other_sample; //toggles every sample
|
|
|
|
int kon; //KON value when last checked
|
|
|
|
int noise;
|
|
|
|
int counter;
|
|
|
|
int echo_offset; //offset from ESA in echo buffer
|
|
|
|
int echo_length; //number of bytes that echo_offset will stop at
|
|
|
|
|
|
|
|
//hidden registers also written to when main register is written to
|
|
|
|
int new_kon;
|
|
|
|
int endx_buf;
|
|
|
|
int envx_buf;
|
|
|
|
int outx_buf;
|
|
|
|
|
|
|
|
//temporary state between clocks
|
|
|
|
|
|
|
|
//read once per sample
|
|
|
|
int t_pmon;
|
|
|
|
int t_non;
|
|
|
|
int t_eon;
|
|
|
|
int t_dir;
|
|
|
|
int t_koff;
|
|
|
|
|
|
|
|
//read a few clocks ahead before used
|
|
|
|
int t_brr_next_addr;
|
|
|
|
int t_adsr0;
|
|
|
|
int t_brr_header;
|
|
|
|
int t_brr_byte;
|
|
|
|
int t_srcn;
|
|
|
|
int t_esa;
|
|
|
|
int t_echo_disabled;
|
|
|
|
|
|
|
|
//internal state that is recalculated every sample
|
|
|
|
int t_dir_addr;
|
|
|
|
int t_pitch;
|
|
|
|
int t_output;
|
|
|
|
int t_looped;
|
|
|
|
int t_echo_ptr;
|
|
|
|
|
|
|
|
//left/right sums
|
|
|
|
int t_main_out[2];
|
|
|
|
int t_echo_out[2];
|
|
|
|
int t_echo_in [2];
|
|
|
|
} state;
|
|
|
|
|
|
|
|
//voice state
|
|
|
|
struct voice_t {
|
Update to v088r02 release.
byuu says:
Basically, the current implementation of nall/array is deprecated now.
The old method was for non-reference types, it acted like a vector for
POD types (raw memory allocation instead of placement new construction.)
And for reference types, it acted like an unordered set. Yeah, not good.
As of right now, nall/array is no longer used. The vector type usage was
replaced with actual vectors.
I've created nall/set, which now contains the specialization for
reference types.
nall/set basically acts much like std::unordered_set. No auto-sort, only
one of each type is allowed, automatic growth.
This will be the same both for reference and non-reference types ...
however, the non-reference type wasn't implemented just yet.
Future plans for nall/array are for it to be a statically allocated
block of memory, ala array<type, size>, which is meant for RAII memory
usage.
Have to work on the specifics, eg the size as a template parameter may
be problematic. I'd like to return allocated chunks of memory (eg
file::read) in this container so that I don't have to manually free the
data anymore.
I also removed nall/moduloarray, and moved that into the SNES DSP class,
since that's the only thing that uses it.
2012-04-26 10:56:15 +00:00
|
|
|
moduloarray<int, brr_buf_size> buffer; //decoded samples
|
2010-08-09 13:28:56 +00:00
|
|
|
int buf_pos; //place in buffer where next samples will be decoded
|
|
|
|
int interp_pos; //relative fractional position in sample (0x1000 = 1.0)
|
|
|
|
int brr_addr; //address of current BRR block
|
|
|
|
int brr_offset; //current decoding offset in BRR block
|
|
|
|
int vbit; //bitmask for voice: 0x01 for voice 0, 0x02 for voice 1, etc
|
|
|
|
int vidx; //voice channel register index: 0x00 for voice 0, 0x10 for voice 1, etc
|
|
|
|
int kon_delay; //KON delay/current setup phase
|
|
|
|
int env_mode;
|
|
|
|
int env; //current envelope level
|
|
|
|
int t_envx_out;
|
|
|
|
int hidden_env; //used by GAIN mode 7, very obscure quirk
|
|
|
|
} voice[8];
|
|
|
|
|
|
|
|
//gaussian
|
|
|
|
static const int16 gaussian_table[512];
|
2013-05-05 09:21:30 +00:00
|
|
|
int gaussian_interpolate(const voice_t& v);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//counter
|
|
|
|
enum { counter_range = 2048 * 5 * 3 }; //30720 (0x7800)
|
|
|
|
static const uint16 counter_rate[32];
|
|
|
|
static const uint16 counter_offset[32];
|
|
|
|
void counter_tick();
|
|
|
|
bool counter_poll(unsigned rate);
|
|
|
|
|
|
|
|
//envelope
|
2013-05-05 09:21:30 +00:00
|
|
|
void envelope_run(voice_t& v);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//brr
|
2013-05-05 09:21:30 +00:00
|
|
|
void brr_decode(voice_t& v);
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//misc
|
|
|
|
void misc_27();
|
|
|
|
void misc_28();
|
|
|
|
void misc_29();
|
|
|
|
void misc_30();
|
|
|
|
|
|
|
|
//voice
|
2013-05-05 09:21:30 +00:00
|
|
|
void voice_output(voice_t& v, bool channel);
|
2010-08-09 13:28:56 +00:00
|
|
|
void voice_1 (voice_t &v);
|
|
|
|
void voice_2 (voice_t &v);
|
|
|
|
void voice_3 (voice_t &v);
|
|
|
|
void voice_3a(voice_t &v);
|
|
|
|
void voice_3b(voice_t &v);
|
|
|
|
void voice_3c(voice_t &v);
|
|
|
|
void voice_4 (voice_t &v);
|
|
|
|
void voice_5 (voice_t &v);
|
|
|
|
void voice_6 (voice_t &v);
|
|
|
|
void voice_7 (voice_t &v);
|
|
|
|
void voice_8 (voice_t &v);
|
|
|
|
void voice_9 (voice_t &v);
|
|
|
|
|
|
|
|
//echo
|
|
|
|
int calc_fir(int i, bool channel);
|
|
|
|
int echo_output(bool channel);
|
|
|
|
void echo_read(bool channel);
|
|
|
|
void echo_write(bool channel);
|
|
|
|
void echo_22();
|
|
|
|
void echo_23();
|
|
|
|
void echo_24();
|
|
|
|
void echo_25();
|
|
|
|
void echo_26();
|
|
|
|
void echo_27();
|
|
|
|
void echo_28();
|
|
|
|
void echo_29();
|
|
|
|
void echo_30();
|
|
|
|
|
2010-08-09 13:33:44 +00:00
|
|
|
//dsp
|
|
|
|
static void Enter();
|
|
|
|
void tick();
|
2010-08-09 13:28:56 +00:00
|
|
|
};
|
|
|
|
|
Update to v085r03 release.
byuu says:
Changelog:
- fixed cursor being visible under Metacity window manager (hopefully
doesn't cause regression with other WMs)
- show normal cursor when using SDL video driver
- added menu accelerators (meh, why not?)
- removed debugvirtual, ChipDebugger and chip/debugger functionality
entirely
- alt/smp disassembler moved up
- fixed alt/smp incw/decw instructions (unsigned->uint16 for internal
variables)
My plan going forward for a debugger is not to hardcode functionality
that causes the 10-15% slowdown right into the emulator itself.
Instead, I'm going to make a callback class, which will be a specialized
version of nall::function:
- can call function even if not assigned (results in no-op, return type
must have a trivial default constructor)
- if compiled without #define DEBUGGER, the entire thing turns into
a huge no-op; and will be eliminated entirely when compiled
- strategically place the functions: cb_step, cb_read, cb_write, etc.
From here, the ui-debugger GUI will bind the callbacks, implement
breakpoint checking, usage table generation, etc itself.
I'll probably have to add some breakout commands to exit the emulation
core prior to a frame event in some cases as well.
I didn't initially want any debugger-related stuff in the base cores,
but the #if debugger sCPUDebugger #else sCPU #endif stuff was already
more of a burden than this will be.
2012-02-04 09:23:53 +00:00
|
|
|
extern DSP dsp;
|