- added licence information for referenced source code
    - corrected type used for poly9bit
This commit is contained in:
steve 2019-12-21 07:59:11 +00:00
parent a7d5da43cd
commit bdb4fe6a83
3 changed files with 9 additions and 6 deletions

View file

@ -30,7 +30,7 @@ type Audio struct {
poly4bit [15]uint8
poly5bit [31]uint8
poly9bit [511]uint8
poly9bit [511]uint16
div31 [31]uint8
// From the "Stella Programmer's Guide":
@ -71,7 +71,7 @@ func NewAudio() *Audio {
// "Rather than have a table with 511 entries, I use a random number
// generator."
for i := 0; i < len(au.poly9bit); i++ {
au.poly9bit[i] = uint8(rand.Int() & 0x01)
au.poly9bit[i] = uint16(rand.Int() & 0x01)
}
// from TIASound.c:

View file

@ -51,9 +51,6 @@ func (ch *channel) String() string {
// tick should be called at a frequency of 30Khz. when the 10Khz clock is
// required, the frequency clock is increased by a factor of three.
//
// the logic in this function is taken almost directly from the TIA_process()
// function in Ron Fries' TIASound.c
func (ch *channel) tick() {
// tick frequency clock
if ch.freqClk > 1 {
@ -83,7 +80,7 @@ func (ch *channel) tick() {
if (ch.regControl&0x02 == 0x0) ||
((ch.regControl&0x01 == 0x0) && ch.au.div31[ch.poly5ct] != 0) ||
((ch.regControl&0x01 == 0x1) && ch.au.poly5bit[ch.poly5ct] != 0) ||
((ch.regControl&0x0f == 0xf) && ch.au.poly5bit[ch.poly5ct] == prevBit5) {
((ch.regControl&0x0f == 0xf) && ch.au.poly5bit[ch.poly5ct] != prevBit5) {
if ch.regControl&0x04 == 0x04 {
// use pure clock

View file

@ -8,4 +8,10 @@
// function in Frie's implementation meanwhile is called to fill a buffer. The
// samepl buffer in this emulation must sit outside of the TIA emulation and
// somwhere inside the television implementation.
//
// TIASound.c is published under the GNU Library GPL v2.0
//
// Some modifications were made to Fries' alogorithm in accordance to similar
// modifications made to the TIASnd.cxx file of the Stella emulator v5.1.3.
// Stella is published under the GNU GPL v2.0
package audio