diff options
author | fishsoupisgood <github@madingley.org> | 2019-05-27 03:47:23 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2019-05-27 03:47:23 +0100 |
commit | 1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6 (patch) | |
tree | 1d275bd33a06be5649e69a1e7b59c021878b93b3 | |
download | qemu-pq-1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6.tar.gz qemu-pq-1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6.tar.bz2 qemu-pq-1a457c6fec7e8bfc8880cbe4a69cc9340e3775e6.zip |
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | master/capture-timex.patch | 68 | ||||
-rw-r--r-- | master/endstop | 0 | ||||
-rw-r--r-- | master/series | 3 | ||||
-rw-r--r-- | master/tools.patch | 159 |
5 files changed, 232 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..094a6e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*~ +status diff --git a/master/capture-timex.patch b/master/capture-timex.patch new file mode 100644 index 0000000..14b8904 --- /dev/null +++ b/master/capture-timex.patch @@ -0,0 +1,68 @@ +diff --git a/hw/display/vga.c b/hw/display/vga.c +index b35d523..78a427c 100644 +--- a/hw/display/vga.c ++++ b/hw/display/vga.c +@@ -282,6 +282,42 @@ static void vga_precise_update_retrace_info(VGACommonState *s) + #endif + } + ++ ++/* ++ * Super budget code to capture the timex data ++ * we configure the timex software to use int 10 mode 12h ++ * which is 640x480x4. ++ * ++ * If windows reads the vertical retrace register, and ++ * gets the answer "1", we then check if the first few ++ * bytes of video ram are zero (indicating the a black screen) ++ * if it is we then dump the first byte of each scan line ++ * to a file. ++ * ++ */ ++ ++static void ++timex_hook (VGACommonState * s) ++{ ++ static FILE *f; ++ unsigned i; ++ ++ if (!f) ++ f = fopen ("timex.dat", "w"); ++ ++ /* If the start of the screen isn't black */ ++ for (i = 0; i < 8; ++i) ++ if (s->vram_ptr[i]) ++ return; ++ ++ fprintf (f, "#\n"); ++ ++ for (i = 0; i < 480; ++i) ++ fprintf (f, "%d\n", s->vram_ptr[i * 320]); ++ ++ fflush (f); ++} ++ + static uint8_t vga_precise_retrace(VGACommonState *s) + { + struct vga_precise_retrace *r = &s->retrace_info.precise; +@@ -297,6 +333,7 @@ static uint8_t vga_precise_retrace(VGACommonState *s) + cur_line = cur_char / r->htotal; + + if (cur_line >= r->vstart && cur_line <= r->vend) { ++ timex_hook(s); + val |= ST01_V_RETRACE | ST01_DISP_ENABLE; + } else { + cur_line_char = cur_char % r->htotal; +diff --git a/vl.c b/vl.c +index 6b73934..276baa3 100644 +--- a/vl.c ++++ b/vl.c +@@ -129,7 +129,7 @@ int main(int argc, char **argv) + static const char *data_dir[16]; + static int data_dir_idx; + const char *bios_name = NULL; +-enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB; ++enum vga_retrace_method vga_retrace_method = VGA_RETRACE_PRECISE; + DisplayType display_type = DT_DEFAULT; + int request_opengl = -1; + int display_opengl; diff --git a/master/endstop b/master/endstop new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/master/endstop diff --git a/master/series b/master/series new file mode 100644 index 0000000..02b8587 --- /dev/null +++ b/master/series @@ -0,0 +1,3 @@ +capture-timex.patch +tools.patch +endstop 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); ++ ++ ++} |