summaryrefslogtreecommitdiffstats
path: root/master/tools.patch
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2019-05-27 03:47:23 +0100
committerfishsoupisgood <github@madingley.org>2019-05-27 03:47:23 +0100
commit1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6 (patch)
tree1d275bd33a06be5649e69a1e7b59c021878b93b3 /master/tools.patch
downloadqemu-pq-1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6.tar.gz
qemu-pq-1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6.tar.bz2
qemu-pq-1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6.zip
initial commitHEADmaster
Diffstat (limited to 'master/tools.patch')
-rw-r--r--master/tools.patch159
1 files changed, 159 insertions, 0 deletions
diff --git a/master/tools.patch b/master/tools.patch
new file mode 100644
index 0000000..e23a1e4
--- /dev/null
+++ b/master/tools.patch
@@ -0,0 +1,159 @@
+diff --git a/tools/ana.c b/tools/ana.c
+new file mode 100644
+index 0000000..7fe56f9
+--- /dev/null
++++ b/tools/ana.c
+@@ -0,0 +1,153 @@
++#include <stdio.h>
++
++unsigned line = 0, frame = 0;
++
++
++void
++byte (FILE * f, unsigned c)
++{
++ static int len;
++ static int plen;
++ static int state;
++ static unsigned last_frame;
++
++ unsigned diff;
++
++ diff = frame - last_frame;
++ last_frame = frame;
++
++
++ if (diff > 1)
++ printf ("/* GAP ~%d frames */\n", diff);
++
++ if (state == 0)
++ {
++ if (c == 0x55)
++ return;
++ if (c == 0xaa)
++ state++;
++ else
++ printf ("ERR %02x ERR\n", c);
++ }
++ if (state == 1)
++ {
++ if (c == 0xaa)
++ return;
++ state++;
++ }
++
++ if (state == 2)
++ {
++ plen = c;
++ len = 1;
++ state++;
++ printf ("0x%02x, ", c);
++ putc (c, f);
++ return;
++ }
++
++ if (state == 3)
++ {
++ printf ("0x%02x, ", c);
++ putc (c, f);
++ len++;
++
++ if (len == plen)
++ {
++ if (plen & 1)
++ {
++ state = 4;
++ printf ("/* 0x00, */\n");
++ }
++ else
++ {
++ state = 2;
++ printf ("\n");
++ }
++ }
++ else
++ {
++ if ((len % 16) == 15)
++ {
++ printf ("\n/**/ ");
++ }
++ }
++
++ return;
++ }
++
++ if (state == 4)
++ {
++ if (c)
++ printf ("ERR %02x ERR\n", c);
++ state = 2;
++ }
++
++
++
++}
++
++int
++main (int argc, char *argv)
++{
++ char buf[1024];
++ unsigned i, j, c, b;
++
++ FILE *f = fopen ("timex.dat", "r");
++ FILE *fo = fopen ("foo.bin", "w");
++
++ fwrite ("Timex", 5, 1, fo);
++
++ while (fgets (buf, sizeof (buf), f))
++ {
++
++ while (line > 480)
++ {
++ line -= 480;
++ frame++;
++ }
++
++ line++;
++
++ if (strncmp (buf, "255\n", 4))
++ continue;
++
++ c = 0;
++
++ fgets (buf, sizeof (buf), f);
++ fgets (buf, sizeof (buf), f);
++ fgets (buf, sizeof (buf), f);
++ fgets (buf, sizeof (buf), f);
++
++ line += 4;
++
++ for (i = 0; i < 8; ++i)
++ {
++
++ for (j = 0; j < 7; ++j)
++ fgets (buf, sizeof (buf), f);
++ line += 7;
++
++ b = 0;
++ for (j = 0; j < 8; ++j)
++ {
++ fgets (buf, sizeof (buf), f);
++ line++;
++ b = b || (!strncmp (buf, "255\n", 4));
++ }
++ b = !b;
++
++//printf("%d",b);
++
++ c |= b << i;
++ }
++
++ byte (fo, c);
++
++
++
++ }
++ fclose (fo);
++
++
++}