Search found 429 matches

by James
Thu Jul 02, 2015 9:17 pm
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

I spent some time analyzing test signals tonight (square, triangle, and noise). Decimating before filtering does cause aliasing that is a) measurable in a spectrum analyzer and b) audible, particularly at higher frequencies. Decimating by 3 is especially bad.
by James
Thu Jul 02, 2015 10:59 am
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

I wonder if you can save any more CPU time by decimating the input somewhat between the elliptic and Butterworth stages, such as by providing only one out of every six outputs from elliptic to Butterworth. My implementation is vectorized, so the Butterworth stage adds no additional CPU time. In gen...
by James
Thu Jul 02, 2015 9:00 am
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

I use a 12th order Elliptic followed by a 4th order Butterworth. 32-bit single precision, no stability problems. It accounts for about 5% of the process' CPU utilization (which is ~8% on my 2.7GHz 2015 MacBook Pro). Why 2 filters? How did you test for stability problems? The elliptic has a sharp cu...
by James
Thu Jul 02, 2015 8:22 am
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

Is there a practical IIR for resampling? (I've seen the analog equivalent in ADCs, but not in a digital resampler.) I use an IIR-based resampler in nemulator. I generate an audio sample every 3rd CPU cycle (~596600Hz), then filter it with a 16th order IIR lowpass (equivalent to ~512th order FIR). I...
by James
Wed Jul 01, 2015 3:22 pm
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

Where does the >447kHz content come from? Harmonics?
by James
Wed Jul 01, 2015 1:17 pm
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

Noise rate 0 (highest frequency) produces a moderate amount of aliasing from that range: -11 to -13 dBFS; so does noise rate 1 (-17dbFS to -21dBFS). Noise rate 2 (-23dBFS to -29dBFS) and beyond don't alias too much... Noise rate 0 is ~447kHz. Wouldn't that be aliased to ~149kHz at Fs=596kHz? And no...
by James
Tue Jun 30, 2015 8:46 pm
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

Why every 3rd CPU cycle? Probably someone's idea of the best compromise between speed and accuracy. I would have done every 2 CPU cycles, as the majority of the APU changes its output every other cycle, and the one channel that does allow odd periods (triangle) only changes it by a comparatively sm...
by James
Tue Jun 30, 2015 9:01 am
Forum: NESemdev
Topic: Some advice of DSP here...
Replies: 97
Views: 16632

Re: Some advice of DSP here...

Is there a practical IIR for resampling? (I've seen the analog equivalent in ADCs, but not in a digital resampler.) I use an IIR-based resampler in nemulator. I generate an audio sample every 3rd CPU cycle (~596600Hz), then filter it with a 16th order IIR lowpass (equivalent to ~512th order FIR). I...
by James
Wed Apr 08, 2015 7:56 pm
Forum: NESemdev
Topic: Stuck on PPU Implementation
Replies: 17
Views: 8231

Re: Stuck on PPU Implementation

Sik wrote:Erm, that's identical...
Oops. Fixed.
by James
Wed Apr 08, 2015 6:15 pm
Forum: NESemdev
Topic: Stuck on PPU Implementation
Replies: 17
Views: 8231

Re: Stuck on PPU Implementation

zeroone wrote:

Code: Select all

void renderFrame() {
  for(int i = -1; i < 262; i++) {
    for(int j = 0; j < 341; j++) {
      renderDot(i, j);
    }
  }
}
That's one scanline too many. Should be:

Code: Select all

for(int i = 0; i < 262; i++)
Edit: oops
by James
Mon Mar 23, 2015 3:39 pm
Forum: NESemdev
Topic: Cycle-by-cycle CPU
Replies: 5
Views: 2423

Re: Cycle-by-cycle CPU

In practice, opcode-level granularity works fine for NES emulation. There are a few games that require cycle-level accuracy for NMI timing. I don't recall what they are, off the top of my head, but I don't think that Marble Madness is one of them. In any event, you can account for this without resor...
by James
Fri Feb 27, 2015 4:23 pm
Forum: NESemdev
Topic: Micro Machines glitches
Replies: 88
Views: 27068

Re: Micro Machines glitches

I can reproduce the black line issue by breaking writes to the palette. Specifically, by mirroring $3F00 writes to $3F04, $3F08, and $3F0C. Writes shouldn't be mirrored here, but reads from these locations while rendering should return the value at $3F00.
by James
Fri Feb 27, 2015 12:13 pm
Forum: NESemdev
Topic: Micro Machines glitches
Replies: 88
Views: 27068

Re: Micro Machines glitches

Are you accounting for palette mirroring and this, re: $3F04/$3F08/$3F0C? If the current VRAM address points in the range $3F00-$3FFF during forced blanking, the color indicated by this palette location will be shown on screen instead of the backdrop color. (Looking at the relevant circuitry in Visu...
by James
Thu Feb 26, 2015 6:16 pm
Forum: NESemdev
Topic: Micro Machines glitches
Replies: 88
Views: 27068

Re: Micro Machines glitches

Secondary
by James
Thu Feb 26, 2015 4:56 pm
Forum: NESemdev
Topic: Micro Machines glitches
Replies: 88
Views: 27068

Re: Micro Machines glitches

Code: Select all

if (rendering)
{
   if (current_cycle < 64)
      return_value = 0xFF;
   else if (current_cycle < 256)
      return_value = 0x00;
//Micro Machines relies on this:
   else if (current_cycle < 320)
      return_value = 0xFF;
//and this:
   else
      return_value = sprite_buffer[0];
}