## Re: [stella] TIA polynomials revisited

 Subject: Re: [stella] TIA polynomials revisited From: Adam Wozniak Date: Fri, 5 Dec 2003 21:36:57 -0800 (PST)
```On Fri, 5 Dec 2003, Eckhard Stolberg wrote:
> > I had mode 3 and 15 slightly off.
>
> > static const int poly5[] = { // 5 bit LFSR [5 3]
> >         5, 3, 2, 1, 3, 1, 1, 1, 1, 4, 1, 2, 1, 1, 2, 2, -1 };
>
> > static const int poly68[] = { // used by mode 15
> >         5, 6, 4, 5, 10, 5, 3, 7, 4, 10, 6, 3, 6, 4, 9, 6, -1 };
>
> This is the same poly as in your previous version. If it
> was off, what's the correct poly?

poly5[] is definately correct.

I don't have all my work right in front of me, so I'll have to double
check poly68 changes later.  Did the poly465[] array change between the
two versions you're looking at?

> You said that mode 15 is the same as mode 7 except that
> it is driving the div6 device instead of the div 2 device.
> I think this is achieved by using the CPU clock as the
> input into the 5-bit poly instead of the pixel clock.

No.  There is no simple multiplier that will convert between poly5[] and
poly68[].  The "divide by 6" and "divide by 2" are clocked by the 5 bit
polynomial, NOT the other way around.  f(g(x)) != g(f(x)).
Mode 15 is NOT "mode 7 only slower".

> Also you said that the math for mode 7 works out to be
> the same as mode 9.

Yes.

> So the output of the poly in mode 15
> should be the same as the output of the 5 bit poly at
> a third of the speed. So the following should be correct,
> right?

No, see above.

> > static const int divisors[] = { // frequency dividers
> >         1, 1, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1 };
>
> For mode 2 you have a divisor of 15. Since that isn't used
> anywhere else in the TIA audio circuit, I'm wondering if
> mode 2 actually has the 4-bit poly clocked by the output
> of the div31 device with it's 13:18 duty cycle. Since this
> device only changes it's state twice during it's 31 bits,
> this would be similar to a div15.

Possible.  I'd have to go back and look at the original data again to
be sure.  Maybe this weekend.

--