4 * Dump information about what VESA graphics modes are supported.
12 #include "../lib/sys/vesa/vesa.h"
14 /* Wait for a keypress */
15 static void wait_key(void)
18 while (fread(&ch
, 1, 1, stdin
) == 0) ;
21 static void print_modes(void)
24 struct vesa_general_info
*gi
;
25 struct vesa_mode_info
*mi
;
26 uint16_t mode
, *mode_ptr
;
29 struct vesa_info
*vesa
;
31 vesa
= lmalloc(sizeof(*vesa
));
33 printf("vesainfo.c32: fail in lmalloc\n");
39 gi
->signature
= VBE2_MAGIC
; /* Get VBE2 extended data */
40 rm
.eax
.w
[0] = 0x4F00; /* Get SVGA general information */
41 rm
.edi
.w
[0] = OFFS(gi
);
43 __intcall(0x10, &rm
, &rm
);
45 if (rm
.eax
.w
[0] != 0x004F) {
46 printf("No VESA BIOS detected\n");
48 } else if (gi
->signature
!= VESA_MAGIC
) {
49 printf("VESA information structure has bad magic, trying anyway...\n");
52 printf("VBE version %d.%d\n"
53 "Mode attrib h_res v_res bpp layout rpos gpos bpos\n",
54 (gi
->version
>> 8) & 0xff, gi
->version
& 0xff);
58 mode_ptr
= GET_PTR(gi
->video_mode_ptr
);
60 while ((mode
= *mode_ptr
++) != 0xFFFF) {
66 rm
.eax
.w
[0] = 0x4F01; /* Get SVGA mode information */
68 rm
.edi
.w
[0] = OFFS(mi
);
70 __intcall(0x10, &rm
, &rm
);
72 /* Must be a supported mode */
73 if (rm
.eax
.w
[0] != 0x004f)
76 printf("0x%04x 0x%04x %5u %5u %3u %6u %4u %4u %4u\n",
77 mode
, mi
->mode_attr
, mi
->h_res
, mi
->v_res
, mi
->bpp
,
78 mi
->memory_layout
, mi
->rpos
, mi
->gpos
, mi
->bpos
);
86 int main(int argc __unused
, char **argv __unused
)