|
Subject: [stella] TIA audio mode 3 polynomial From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx> Date: Sat, 29 Nov 2003 08:39:58 -0800 (PST) |
#include <stdio.h>
// Ok, here's how the poly for mode 3 is generated
//
// Each incoming audio clock tick,
// clock the 5 bit polynomial [5 3]
// Each time the 5 bit polynomial changes from 0 to 1 or 1 to 0,
// clock the 4 bit polynomial [4 3]
// Output is the output of the 4 bit polynomial
int poly4(void)
{
static int spot = 0;
static int count = 0;
static const int array[] = { 1, 2, 2, 1, 1, 1, 4, 3, -1 };
count++;
if (count == array[spot])
{
spot++;
count = 0;
}
if (array[spot] == -1)
spot = 0;
return !(spot&1);
}
int poly5(void)
{
static int spot = 0;
static int count = 0;
static const int array[] = { 5, 3, 2, 1, 3, 1, 1, 1, 1, 4, 1, 2, 1, 1, 2, 2, -1 };
count++;
if (count == array[spot])
{
spot++;
count = 0;
}
if (array[spot] == -1)
spot = 0;
return !(spot&1);
}
void main (void)
{
int out = 1;
int now, then = -1;
while(1)
{
now = poly5();
if (now != then)
{
out = poly4();
}
then = now;
printf("%d\n", out);
}
}
--
adam@xxxxxxxxxxxxxxxx http://cuddlepuddle.org/~adam/pgp.html
Will code for food. http://cuddlepuddle.org/~adam/resume.html
"The dinosaurs are not around today because they did not have a space program."
-- Arthur C. Clarke
----------------------------------------------------------------------------------------------
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [stella] TIA polynomials revisited, Adam Wozniak | Thread | Re: [stella] TIA audio mode x polyn, Thomas Jentzsch |
| [stella] TIA polynomials revisited, Adam Wozniak | Date | [stella] TIA audio mode 15 polynomi, Adam Wozniak |
| Month |