Broke my GGSound program
Moderator: Moderators
-
- Posts: 314
- Joined: Sun Mar 08, 2015 12:23 pm
- Location: Croatia
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
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
Re: Broke my GGSound program
You can pause execution of an NES program in FCEUX for Windows in either of two ways: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?
- Press the Frame Advance key (defaults to backslash)
- Debug > Debugger > Step Into
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: Broke my GGSound program
I always used the "Pause Break" key on my keyboard, which also pauses FCEUX.
- GradualGames
- Posts: 1106
- Joined: Sun Nov 09, 2008 9:18 pm
- Location: Pennsylvania, USA
- Contact:
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.
-
- Posts: 314
- Joined: Sun Mar 08, 2015 12:23 pm
- Location: Croatia
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?
- GradualGames
- Posts: 1106
- Joined: Sun Nov 09, 2008 9:18 pm
- Location: Pennsylvania, USA
- Contact:
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:
Replace these with:
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.
Code: Select all
.bank 3
.org $C000
include "battle3_dpcm.asm"
.bank 4
.org $E000
Code: Select all
.bank 2
.org $C000
include "battle3_dpcm.asm"
.bank 3
.org $E000
- GradualGames
- Posts: 1106
- Joined: Sun Nov 09, 2008 9:18 pm
- Location: Pennsylvania, USA
- Contact:
Re: Broke my GGSound program
There's also something wrong with your controller testing code, its alternating pausing and unpausing the song every frame.
- GradualGames
- Posts: 1106
- Joined: Sun Nov 09, 2008 9:18 pm
- Location: Pennsylvania, USA
- Contact:
Re: Broke my GGSound program
You need to use your button flags using immediate addressing:
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.
Code: Select all
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
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.
-
- Posts: 314
- Joined: Sun Mar 08, 2015 12:23 pm
- Location: Croatia
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.
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.
-
- Posts: 314
- Joined: Sun Mar 08, 2015 12:23 pm
- Location: Croatia
Re: Broke my GGSound program
Update: Commented out the controller code which means that the controller code is bad.
-
- Posts: 314
- Joined: Sun Mar 08, 2015 12:23 pm
- Location: Croatia
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.
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.
- GradualGames
- Posts: 1106
- Joined: Sun Nov 09, 2008 9:18 pm
- Location: Pennsylvania, USA
- Contact:
Re: Broke my GGSound program
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.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?
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!)EDIT:
Also, the duty cycle changing loop doesn't loop in GGSound. Listen to the FamiTracker module and to the NES file.