NSF player for PowerPak

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
NSF player for PowerPak
by on (#38319)
Enjoy.
It's not thoroughly tested. If you run across something that doesn't play well, let me know and I'll try to fix it.

by on (#38324)
Legendary, testing it as soon as I get home.

by on (#38329)
Loopy, you are the greatest! :!: :!:

by on (#38330)
Works friggen awesome so far! :D

The only glitch I've seen in my short test period was some random graphical glitches while playing this song: http://home.comcast.net/~jerryatrick/494.nsf. It was just some random garbage that appeared and changed to the music (sort of a garbled spectrum analyzer :P).

by on (#38331)
I just did a quick test, I'll try out even more later. Everything asides FDS and MMC5 nsfs work so far, flawlessly! And it's not like you'd even try running those normally anyways. I tried to test things of a distinct nature.

Tested:

Handful of Anamanaguchi nsfs: created in nerdtracker
Arumana no Kiseki (FDS): loads and runs, most tracks won't work
Asterix: PAL soundtrack, plays at 60fps of course.
Akumajou Densetsu (VRC6): plays fine, w/out sound expansion of course.
Gimmick (FME-07): same as above
Just Breed (MMC5): freezes
Lagrange Point (VRC7): plays fine, w/out sound expansion
Skate or Die 2: Includes raw PCM vocal samples in the first track.
Ducktales: Ok, nothing really special with this choice.
Batman Return of the Joker: same as above

:)

This is totally awesome dude, thanks a lot!

by on (#38335)
Posting in a legendary thread~

Any chance you could add wildcard support to the converter (or maybe a "convert all NSFs in the current folder" switch)? I have a crapload of NSFs I want to try out... :)

by on (#38337)
for %i in (*.nsf) do nsf2nes "%i"

by on (#38338)
I had my roommate batch-convert them already, but thanks anyway. :)

by on (#38340)
Very nice, will have to test when I get home. :)

by on (#38348)
Thanks for this. I'm glad its a long weekend. I have one of x|k's prosound mod NES consoles and I'm going spend a lot of time listening to my favorite tunes!

by on (#38363)
Guido Anchovy wrote:
The only glitch I've seen in my short test period was some random graphical glitches while playing this song: http://home.comcast.net/~jerryatrick/494.nsf. It was just some random garbage that appeared and changed to the music (sort of a garbled spectrum analyzer :P).

Jittery horizontal white lines that slowly scroll up or down? If so, I get that same effect with every song. Kinda like what you get when someone's running a vacuum cleaner on the same circuit as the TV. Doesn't affect playback at all, though.

The soft reset behavior is pretty erratic, too. Depending on the file, pressing reset will either go straight back to the menu, lock up the NSF (holding reset usually works), or lock up the entire PowerPak (requiring a power cycle).

So far, the only NSF that outright refuses to work is 1942 (Capcom)--I get one note, then a gray screen. It's probably for the best. :P

by on (#38364)
Hmm... it comes and goes. Wiggling the cart and resetting sometimes fixes it.
I thought it was just my cart; apparently not.

Yeah, reset is screwy too.

by on (#38366)
Ah yes, I've also noticed that the soft rest can be screwy.

I haven't gotten any jittery lines yet.

by on (#38368)
Are there any bad NSF rips that also include PPU-altering code?

by on (#38373)
First I must say thank you.
I get the jittery lines too playing the recca nsf.
I was wondering is this supposed to change tracks on its own or not.

Again thank you

by on (#38837)
Can you add VRC7/VRC6/NAMCO106 sound channels support?

by on (#38838)
Quote:
Can you add VRC7/VRC6/NAMCO106 sound channels support?


Unless I've misunderstood what this program does I don't see how the player would do that. An nsf contains the code/data to play the music, so what you'd need is a cart with either of those sound expansion chips you mentioned.

by on (#38851)
Well, the PowerPak emulates mappers, can't it emulate those chips? I don't see it being any easy to implement, I'm just saying that maybe the hardware can do it. It would still be only emulation though, so accuracy issues would show up.

by on (#38854)
Guido Anchovy wrote:
Works friggen awesome so far! :D

The only glitch I've seen in my short test period was some random graphical glitches while playing this song: http://home.comcast.net/~jerryatrick/494.nsf. It was just some random garbage that appeared and changed to the music (sort of a garbled spectrum analyzer :P).


I've noticed that this NSF writes to a lot of N106 and FDS registers. These writes can be removed, then I would check to see if the rip plays without glitches.

Code:
$8088:A9 0F     LDA #$0F
$808A:8D 15 40  STA $4015 = #$FF
$808D:A9 00     LDA #$00
$808F:8D A9 07  STA $07A9 = #$00
$8092:8D 80 40  STA $4080 = #$FF
$8095:8D 82 40  STA $4082 = #$FF
$8098:8D 83 40  STA $4083 = #$FF
$809B:8D 84 40  STA $4084 = #$FF
$809E:8D 85 40  STA $4085 = #$FF
$80A1:8D 86 40  STA $4086 = #$FF
$80A4:8D 87 40  STA $4087 = #$FF
$80A7:8D 88 40  STA $4088 = #$FF
$80AA:8D 89 40  STA $4089 = #$FF
$80AD:A9 E8     LDA #$E8
$80AF:8D 8A 40  STA $408A = #$FF
$80B2:A2 00     LDX #$00
$80B4:A9 80     LDA #$80
$80B6:8D 00 F8  STA $F800 = #$FF
$80B9:A9 00     LDA #$00
$80BB:8D 00 48  STA $4800 = #$FF
$80BE:E8        INX
$80BF:E0 00     CPX #$00
$80C1:F0 03     BEQ $80C6
$80C3:4C BB 80  JMP $80BB


An older version of Nintendulator emulated this behaviour to some extent. That was the only way that I could duplicate this issue. The NSF should be debugged, then carefully remove any illegal reads and writes.

by on (#38920)
Updated.
Push Select to return to the PowerPak menu.
Reset problem is fixed.
Graphical glitches are fixed (I think?).
PAL tunes should play correctly (on a PAL NES).

by on (#38950)
I love you more than words can say.

by on (#39511)
Loopy, thanks for the NSF player. I tried this on my Famicom, and there are various graphical glitches running up/down the screen while the NSF plays. That's no problem, though. What is a problem is that all NSF songs play too fast, something like 120%-150% too fast compared to regular 60hz timing. Any idea why this is?

Also, both on this and the FDS mapper, do you think it would be possible for you to add button detection not only for bit 0 of 4016, but bit 1 as well (the extra controller port on the Famicom)? I play most games using a rapid-fire controller hooked up to this port, and it's a little annoying having to drop that controller (PowerPak menu ROM recognizes the expansion controller) to change NSF songs, or to "insert" an FDS disk.

by on (#39517)
Hmm... curious. My player gets its timing from 2 things. First it detects if it's a PAL or NTSC system, and from that chooses either the PAL or NTSC speed in the NSF header (using default values if those are nulled out). It also uses a 1MHz timer, derived from a 20MHz clock in the PowerPak, to count time during playback.

If the PAL detect code is bad, it should make playing slower, not faster. Maybe the clock in your powerpak is not the same speed as mine? That seems unlikely. I may need to have you help me with debugging.

Hm... on second thought, the PAL/NTSC handling should be changed now. That was written back when I was using M2 for the timer. I'll change the controller reading code to look at both bits.

by on (#39527)
tokumaru wrote:
Well, the PowerPak emulates mappers, can't it emulate those chips? I don't see it being any easy to implement, I'm just saying that maybe the hardware can do it. It would still be only emulation though, so accuracy issues would show up.


It seems like an easy idea to dismiss, but I think I see a way to do it. Obviously it needs the sound logic, but then it also needs to be able to feed the sound output to the NES. If the NES can read from the mapper (can't it?), it could pick it up digital samples on data bus and write it to $4011, all timed by an IRQ. Personally I think it's a brilliant idea, that's what I do on Squeedo and it sounds incredible (except for the aliasing at high-freqs, no big loss in my case).

However, forget about VRC7. It's complicated. Namco106, I'm not sure about either, the wavetable memory might eat up a good amount of resources. That leaves VRC6 and FME-7 as being the "easy" ones.

I'm just speculating here, I don't have a PowerPak yet, nor have I made anything signficant with programmable logic.

by on (#39528)
All right, you've piqued my interest :D
Looking into it.

by on (#40323)
NSF player updated, now with FDS and VRC6 sound.
Linky

by on (#40375)
loopy wrote:
Updated.
Push Select to return to the PowerPak menu.
Reset problem is fixed.
Graphical glitches are fixed (I think?).
PAL tunes should play correctly (on a PAL NES).


Okay, i had the wrong mapper set.. I got 1.20

then added the mappers given in the new nsf player release.

however, i no longer get the extra audio channels from VRC6, and do not get the FDS either.. i had done the audio mod and had VRC6 working perfectly before, now its silent..

anyone else have this problem?

*** EDIT ***

issue resolved on its own, inexplicably, while loopy was helping my troubleshoot it.

Thanks to the spirits that left my nes.

by on (#40394)
Next up: NAMCO 106 has been added. :D

The FPGA is almost maxed out. I _might_ be able to slip in one more simple sound channel.

by on (#40400)
Hmm... maybe you could manage to fit in more by sharing some logic between VRC6, MMC5 and AY-3-8912. Because three VRC6 rectangle waves could be a superset of both the MMC5's two rectangle waves and the three square waves in AY-3-8912.

But on a longer term, it might be better to make a separate NSF mapper for each hardware. The only ones that would cry about this are the 2A03 sillies who love making songs using every damn expansion chip ever made. ;)

by on (#40401)
Bananmos wrote:
it might be better to make a separate NSF mapper for each hardware. The only ones that would cry about this are the 2A03 sillies who love making songs using every damn expansion chip ever made. ;)

Even sillier is making an NSF and a GBS to run at the same time. But some of my S3M chiptunes actually sound like that.