nesdev.com
http://forums.nesdev.com/

Broke my GGSound program
http://forums.nesdev.com/viewtopic.php?f=6&t=14141
Page 1 of 1

Author:  8bitMicroGuy [ Mon Apr 25, 2016 1:48 pm ]
Post subject:  Broke my GGSound program

I just don't know what's going on with the program that I've made. It just won't work. And would someone please kindly explain to me how to break the program in FCEUX like in Visual Studio one clicks the pause button?

I tried to write a basic program after a while and I somehow broke it. I don't know where and how. It's supposed to use GGSound and play a song. I'm just lost. https://www.dropbox.com/s/rk7z20w12p9e1 ... 3.zip?dl=0

Author:  tepples [ Mon Apr 25, 2016 2:49 pm ]
Post subject:  Re: Broke my GGSound program

8bitMicroGuy wrote:
would someone please kindly explain to me how to break the program in FCEUX like in Visual Studio one clicks the pause button?

You can pause execution of an NES program in FCEUX for Windows in either of two ways:
  1. Press the Frame Advance key (defaults to backslash)
  2. Debug > Debugger > Step Into

Unless you've set a breakpoint in the debugger, FCEUX usually pauses on the post-render line (240). To skip forward to the beginning of the NMI handler (241), click Run Line in the debugger window.

Author:  rainwarrior [ Mon Apr 25, 2016 3:46 pm ]
Post subject:  Re: Broke my GGSound program

I always used the "Pause Break" key on my keyboard, which also pauses FCEUX.

Author:  GradualGames [ Thu Apr 28, 2016 10:39 am ]
Post subject:  Re: Broke my GGSound program

Maybe start backing up your code so you can go back to when it was working, helps you learn what broke. Simplest way to do that would be to copy your code to a new folder and date/timestamp it, each time you're happy with progress you've made. Eventually you might even want to pick up git or svn to automate this. I use git all the time even for small experiments like this one.

Author:  8bitMicroGuy [ Sat Apr 30, 2016 7:44 am ]
Post subject:  Re: Broke my GGSound program

I seriously don't understand why the program counter jumps to $5000 something. That's not supposed to happen. Can someone please help me by debugging my program for me and finding the problem?

Author:  GradualGames [ Sun May 01, 2016 12:33 pm ]
Post subject:  Re: Broke my GGSound program

Hey 8bitmicroguy, I was able to figure out what was going wrong with your program. First, you were using the wrong banks for your code:

Code:

  .bank 3
  .org $C000
  include "battle3_dpcm.asm"
 
  .bank 4
  .org $E000


Replace these with:

Code:


  .bank 2
  .org $C000
  include "battle3_dpcm.asm"
 
  .bank 3
  .org $E000



Then your rom will execute---you've still got some problems though as the music sounds messed up. You're doing a couple of things wrong. You shouldn't be setting nmi within nmi, for one. I would recommend against reading the controller within nmi, as well, you should do this in your main thread, and have some mechanism for synchronizing your main thread/loop with nmi. Hopefully that'll get you started.

Author:  GradualGames [ Sun May 01, 2016 12:44 pm ]
Post subject:  Re: Broke my GGSound program

There's also something wrong with your controller testing code, its alternating pausing and unpausing the song every frame.

Author:  GradualGames [ Sun May 01, 2016 1:12 pm ]
Post subject:  Re: Broke my GGSound program

You need to use your button flags using immediate addressing:

Code:

if_pressed .macro   ; Return non-zero if joypad=1 and joypadhold=0
            lda \1+1 ; Load joypad hold byte
         eor #$FF  ; Invert
         and \1   ; And joypad byte
         and #\2   ; And button flags     <<<ADD IMMEDIATE ADDRESSING FOR THIS BUTTON FLAG, (or you could pass it in to the macro with a #)
         .endm    ; Use BNE for JUST PRESSED or BEQ for NOT JUST PRESSED
         



You also used the wrong condition to test, you used bne, but your own documentation says use BEQ for not just pressed.

I made those described changes and commented out your ppu code in nmi and was able to play and pause/unpause the song without issue.

Author:  8bitMicroGuy [ Sun May 01, 2016 1:59 pm ]
Post subject:  Re: Broke my GGSound program

I know, I should have used #s for immediate operand.

I fixed the GGSound bug that's in the other topic. But I still get the stuttering. I just don't know how to debug this. I have another demo where these button latches work perfectly fine. I looked up the hex-editor and see that the controller latches perfectly fine.

Two bytes are reserved for each controller. The first byte has the current presses and the second one has the presses of the previous frame. They are bitwise compared for "edge detection" as in "pressed this frame" and "released this frame".

I'll be tweaking until I find out what's going on.

Author:  8bitMicroGuy [ Sun May 01, 2016 2:19 pm ]
Post subject:  Re: Broke my GGSound program

Update: Commented out the controller code which means that the controller code is bad.

Author:  8bitMicroGuy [ Sun May 01, 2016 4:03 pm ]
Post subject:  Re: Broke my GGSound program

Sorry. I didn't see your post, GradualGames.

https://www.dropbox.com/s/rk7z20w12p9e1 ... 3.zip?dl=0

Here's the updated version. I fixed it and it works, but the problem is that the sound effect doesn't stop playing. Could you fix that please?

EDIT:
Also, the duty cycle changing loop doesn't loop in GGSound. Listen to the FamiTracker module and to the NES file.

Author:  GradualGames [ Mon May 02, 2016 5:24 am ]
Post subject:  Re: Broke my GGSound program

8bitMicroGuy wrote:
Sorry. I didn't see your post, GradualGames.

https://www.dropbox.com/s/rk7z20w12p9e1 ... 3.zip?dl=0

Here's the updated version. I fixed it and it works, but the problem is that the sound effect doesn't stop playing. Could you fix that please?


If I recall correctly you were also using bne instead of beq in your controller/sfx play test. I was able to hear your sound effect just fine with your own code, yesterday.

Quote:
EDIT:
Also, the duty cycle changing loop doesn't loop in GGSound. Listen to the FamiTracker module and to the NES file.


You know what? I never implemented loop points for duty cycles (they either loop in full, or don't loop at all). I will add this next GGSound update! (prob Wednesday, sit tight!)

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/