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;