Hi,
I'm using blargg's NES sound APU library in visual studio 2005. I'm still learning reading his and brad's docs as well as getting assistance on #nesdev(thanks blargg, kev and thefox).
I'm having a bit of trouble with understanding some write register functions and the logic behind them.
To start, this binary operation.
now looking at this code, i see that 0xb0 is 176 and i added a comment as a reminder. then in order to break that down into binary i open up pcalc and cheat a bit: 10110000. then, i deal with the volume which with a little debugging, i've found is 14 at its highest level 000001110.
so after ORing them i get:
which is 190(correct?). so i'm writting 10111110 to register 0x4000
so i'm writting
10 to the duty register?
11 to loop envelope/disable length?(not sure how this works yet)
1110 to the volume envelope?
I must admit, that writting this has cleared up a bit of this, but i'm still not sure of the result. is my answer correct? or backwards(little-endian needed)? is this affecting ONLY the volume?
thanks.
I'm using blargg's NES sound APU library in visual studio 2005. I'm still learning reading his and brad's docs as well as getting assistance on #nesdev(thanks blargg, kev and thefox).
I'm having a bit of trouble with understanding some write register functions and the logic behind them.
To start, this binary operation.
Code:
apu.write_register( 0x4000, 0xb0/*176*/ | volume );
now looking at this code, i see that 0xb0 is 176 and i added a comment as a reminder. then in order to break that down into binary i open up pcalc and cheat a bit: 10110000. then, i deal with the volume which with a little debugging, i've found is 14 at its highest level 000001110.
so after ORing them i get:
Code:
10110000
00001110
------------
10111110
00001110
------------
10111110
which is 190(correct?). so i'm writting 10111110 to register 0x4000
Blargg's APU Doc wrote:
$4000/4 ddle nnnn duty, loop env/disable length, env disable, vol/env
period
period
so i'm writting
10 to the duty register?
11 to loop envelope/disable length?(not sure how this works yet)
1110 to the volume envelope?
I must admit, that writting this has cleared up a bit of this, but i'm still not sure of the result. is my answer correct? or backwards(little-endian needed)? is this affecting ONLY the volume?
thanks.