Eliminating the Noise Channel in NerdTracker2 - How To

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Eliminating the Noise Channel in NerdTracker2 - How To
by on (#38651)
Well, in the game I'm working on right now, the noise channel isn't really needed for the music. The music in said game can be airy, so I decided, why not just use the noise channel for sound effects? After a couple days of tinkering with the NerdTracker2 replay code, and a bit of debugging advice from Tepples (thanks again, big props!), I have now gotten rid of anything the replay code has to do with writing to $400c-$400f, and also have $4015 working in favor of playing the sound effects outside of the tracker. (NOTE: I haven't tested this while using the DMC channel, so I really don't know if that is broken now or not : P )

I'm posting this in case anyone else has any project they are working on where the music doesn't have to have the noise channel, and in this way you can free it up to do some sound effects at the same time. I'll just post a quick how-to here:

First off, make a copy of nt2-22.asm, and name it something like nt2-nonoise.asm. Next, edit the makensf.bat file, and change both places where it says 'nt2-22' to 'nt2-nonoise'. The batch file itself is now ready to be used. First though, let's edit our renamed 'nt2-noise.asm'.

Find this:
Code:
NED_SetPeriod:

... and comment out this:
Code:
;                CPX     #NOSWAV_CHN
;                BEQ     @SetPeriodNoise

Though I don't think it's really necessary, you can go ahead and comment this bit out if it makes you feel better:
Code:
;@SetPeriodNoise:
;                AND     #$0F
;                ORA     NED_ChnLoopedNoise,X
;                STA     $400E
;                LDA     #8
;                STA     $400F
;                RTS

Find:
Code:
@ClearChnLoop:

... and just above it change...
Code:
                LDX     #3

... to..
Code:
                LDX     #2

Find:
Code:
@UpdateTx:
                                lda     #6
;                                sta     $2001

... and just after that, change this...
Code:
                LDX     #3

... to this...
Code:
                LDX     #2

Find:
Code:
@UpdateChannels:

... and just above that change this...
Code:
                LDX     #3

... to this...
Code:
                LDX     #2

I believe this might be unnecessary, but I did it anyway. Change this:
Code:
NED_Chn2RegIndex:       .byte     $00,$04,$08,$0C

... to this...
Code:
NED_Chn2RegIndex:       .byte     $00,$04,$08  ;,$0c

Like I said, might be unnecessary because of changing the #3's above to #2's, but I haven't tested to see.

Find the first iteration of this:
Code:
      sta     NED_Reg4015

And just above it put in this line:
Code:
      lda      #$0f


Start writing your tunes, then during your game, just make sure that you're using the noise channel, and you're all set.

That should be all, I don't _think_ I forgot anything that I changed. Let me know if there are any bugs that anyone might find. This is still an exploratory area for me, so who knows what might pop up in future songs that I need to write in this fashion hehe