Update testvbe to display basic information about the Video BIOS.
[v86d.git] / testvbe.c
blob8f6468d87469f28c61038f27120fb9c86eb47b11
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <unistd.h>
4 #include <string.h>
5 #include <errno.h>
6 #include <time.h>
7 #include <fcntl.h>
9 #include "v86.h"
10 #include "testvbe.h"
12 int main(int argc, char *argv[])
14 struct uvesafb_task tsk;
15 struct vbe_ib ib;
16 u16 *s;
17 u8 *t;
19 if (v86_init())
20 return -1;
21 tsk.regs.eax = 0x4f00;
22 tsk.flags = TF_VBEIB;
23 tsk.buf_len = sizeof(ib);
24 strncpy(&ib.vbe_signature, "VBE2", 4);
26 v86_task(&tsk, &ib);
28 t = &ib;
30 printf("VBE Version: %x\n", ib.vbe_version);
31 printf("OEM String: %s\n", ib.oem_string_ptr + t);
32 printf("OEM Vendor Name: %s\n", ib.oem_vendor_name_ptr + t);
33 printf("OEM Prod. Name: %s\n", ib.oem_product_name_ptr + t);
34 printf("OEM Prod. Rev: %s\n", ib.oem_product_rev_ptr + t);
36 for (s = ib.mode_list_ptr + t; *s != 0xffff; s++) {
37 struct vbe_mode_ib mib;
39 tsk.regs.eax = 0x4f01;
40 tsk.regs.ecx = *s;
41 tsk.flags = TF_BUF_RET | TF_BUF_ESDI;
42 tsk.buf_len = sizeof(mib);
44 v86_task(&tsk, &mib);
46 printf("%6.4x %6.4x %dx%d-%d\n", *s, mib.mode_attr,
47 mib.x_res, mib.y_res, mib.bits_per_pixel);
50 /* tsk.regs.eax = 0x4f02;
51 tsk.regs.ebx = 0xc161;
52 tsk.buf_len = 0;
53 tsk.flags = 0;
55 v86_task(&tsk, buf);
57 printf("got eax = %x\n", tsk.regs.eax);
59 v86_cleanup();
61 return 0;