Offline
Michigan

I have a few questions about some of the registers within the gameboy.
The names are used from the "Everything You wanted to KNow about Gameboy" document.

question 1.

$FF19 - NR 24 - AUD2HIGH

Bit 6 - Counter/Consecutive selection

If this bit is reset, will the sound sustain and when this bit is set, will the sound play for as long as is set in AUD2LEN, bits 5-0?

question 2.

$FF1C - NR 32 - AUD3LEVEL

This register states that the Wave Pattern RAM is located from $FF30 - $FF3F and I understand that the volume is set here. How is wave patter RAM processed though? Are all 32 bits played sequentially, 4-bits at a time?

question 3.

$FF17 - NR 22 - AUD2ENV

Bit 3 - Attenuate/Amplify

Does this mean that I may not Amplify and then Attenuate? Only one at a time? Is there an easy way to use the sound length data of a channel to toggle an attack and then decay once the sound completes?

question 4.

$FF22 - NR 43 - AUD4POLY

I don't get this register in the least. What is going on? Here is the full description:

Contents - Sound Mode 4 register, polynomial counter (R/W)

              Bit 7-4 - Selection of the shift clock frequency of the
                        polynomial counter
              Bit 3   - Selection of the polynomial counter's step
              Bit 2-0 - Selection of the dividing ratio of frequencies

              Selection of the dividing ratio of frequencies:
              000: f * 1/2^3 * 2
              001: f * 1/2^3 * 1
              010: f * 1/2^3 * 1/2
              011: f * 1/2^3 * 1/3
              100: f * 1/2^3 * 1/4
              101: f * 1/2^3 * 1/5
              110: f * 1/2^3 * 1/6
              111: f * 1/2^3 * 1/7           f = 4.194304 Mhz

              Selection of the polynomial counter step:
              0: 15 steps
              1: 7 steps

              Selection of the shift clock frequency of the polynomial
              counter:

              0000: dividing ratio of frequencies * 1/2
              0001: dividing ratio of frequencies * 1/2^2
              0010: dividing ratio of frequencies * 1/2^3
              0011: dividing ratio of frequencies * 1/2^4
                    :                          :
                    :                          :
                    :                          :
              0101: dividing ratio of frequencies * 1/2^14
              1110: prohibited code
              1111: prohibited code

Offline
Michigan

bump
NA forums won't help me either!

Offline
Sweeeeeeden

First off, you should probably use the newer version of Pandocs:
http://problemkaputt.de/pandocs.htm

Secondly, you can experiment with these things in LSDj.
1) This setting corresponds to the length setting in an LSDj instrument. When then bit is 0, the channel continues to play forever (or until the envelope runs out or you kill it.) When that bit is 1, the channel stops playing after a period set by NRx0.

2) Yes, all 32 of the 4-bit samples are played sequentially in a loop. The volume, btw, is set by shifting each sample 1 or 2 bits to the right, which means the sample isn't just attenuated, but also "bitcrushed" to use modern terminology.

3) This setting corresponds to the envelope setting in a pulse/noise instrument in an LSDj instrument, or an E command. You can rewrite a new value to restart the envelope, but this will produce an audible artifact in the audio, and it's up to you to time this right by whatever methods your playback routine is using.

4) This is the shape setting in an LSDj noise instrument. The hardware has a Fibonacci linear feedback shift register which is producing pseudorandom data. The bit setting determines where the taps are located. The other settings determine how fast the generator is clocked, and in effect which frequency, or period it has. 7-bit means that period is so short that it sound tonal. 15-bit means the period is long enough to sound like white noise, but nevertheless, the output is periodical This can be heard in LSDj with a standard noise instrument. When played at "C-3" you can hear repetitions a couple of times per second.  At "C-4", it repeats so fast that the repetition starts to sound rhythmical.
The data is output as a single bit tapped from the shift register, so it actually just flips between 0 and 1 really fast. This can be clearly seen in a recorded waveform on some shape settings.

Hope that helped. Also, you should totally hang out in the IRC channel #gbdev on EFNet.

Offline
Michigan

Thanks a ton, I had not seen the updated pandocs before! I will print them out immediately.
All of your answers helped, but the LSDj examples went over my head. I know nothing about that software and hate trackers TBH. I am writing my own assembly code, so that is why I have these questions.

The fibonacci LFSR is something you used in Shitwave, correct? I have a few questions about that software in particular, so I will join #gbdev at some point.

Cheers