Subject: [stella] TIA audio mode 15 polynomial From: Adam Wozniak <adam@xxxxxxxxxxxxxxxx> Date: Sat, 29 Nov 2003 08:47:45 -0800 (PST) |
#include <stdio.h> // Ok, here's how the poly for mode 15 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 divide by 6 thing // Output is the output of the divide by 6 thing int div6(void) { static int spot = 0; static int count = 0; static const int array[] = { 3, 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 = div6(); } 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 -> |
---|---|---|
Re: [stella] TIA audio mode x polyn, Adam Wozniak | Thread | [stella] TIA audio mode 7 polynomia, Adam Wozniak |
[stella] TIA audio mode 3 polynomia, Adam Wozniak | Date | [stella] TIA audio mode 7 polynomia, Adam Wozniak |
Month |