12 #define reg16(reg) (reg & 0xffff)
13 #define failed(tsk) (reg16(tsk.regs.eax) != 0x004f)
15 int main(int argc
, char *argv
[])
17 struct uvesafb_task tsk
;
25 memset(&tsk
, 0, sizeof(tsk
));
26 tsk
.regs
.eax
= 0x4f00;
28 tsk
.buf_len
= sizeof(ib
);
29 strncpy((char*)&ib
.vbe_signature
, "VBE2", 4);
31 if (v86_task(&tsk
, (u8
*)&ib
))
35 fprintf(stderr
, "Getting VBE Info Block failed with eax = %.4x\n",
42 printf("VBE Version: %x.%.2x\n", ((ib
.vbe_version
& 0xf00) >> 8), (ib
.vbe_version
& 0xff));
43 printf("OEM String: %s\n", ib
.oem_string_ptr
+ t
);
44 printf("OEM Vendor Name: %s\n", ib
.oem_vendor_name_ptr
+ t
);
45 printf("OEM Prod. Name: %s\n", ib
.oem_product_name_ptr
+ t
);
46 printf("OEM Prod. Rev: %s\n", ib
.oem_product_rev_ptr
+ t
);
48 printf("\n%-6s %-6s mode\n", "ID", "attr");
49 printf("---------------------------\n");
51 for (s
= t
+ ib
.mode_list_ptr
; *s
!= 0xffff; s
++) {
52 struct vbe_mode_ib mib
;
54 memset(&tsk
, 0, sizeof(tsk
));
55 tsk
.regs
.eax
= 0x4f01;
57 tsk
.flags
= TF_BUF_RET
| TF_BUF_ESDI
;
58 tsk
.buf_len
= sizeof(mib
);
60 if (v86_task(&tsk
, (u8
*)&mib
))
64 fprintf(stderr
, "Getting Mode Info Block for mode %.4x "
65 "failed with eax = %.4x\n", *s
, reg16(tsk
.regs
.eax
));
69 printf("%-6.4x %-6.4x %dx%d-%d %x\n", *s
, mib
.mode_attr
,
70 mib
.x_res
, mib
.y_res
, mib
.bits_per_pixel
, mib
.phys_base_ptr
);