X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=bootcensus;a=blobdiff_plain;f=src%2Fkmain.c;h=99104a2880d0e0a34abf3dc9ad67d643c2108234;hp=ad76287a321df2aaf885e45473b64db07dfa1b48;hb=10843571c724084c68d33d0438167d400cc8de2e;hpb=f9194c22d8073b69b3e64fc26b9e245b6b54d009 diff --git a/src/kmain.c b/src/kmain.c index ad76287..99104a2 100644 --- a/src/kmain.c +++ b/src/kmain.c @@ -29,12 +29,14 @@ along with this program. If not, see . #include "vbe.h" #include "audio.h" #include "panic.h" +#include "census/census.h" static int video_init(void); static int modecmp(const void *a, const void *b); static struct video_mode vmode; -static void *fbptr; +static void *fbptr, *backbuf; +static int fbsize; void pcboot_main(void) @@ -60,10 +62,17 @@ void pcboot_main(void) if(video_init() == -1) { panic("Failed to find suitable video mode"); } + fbsize = vmode.width * vmode.height * vmode.bpp / 8; + if(!(backbuf = malloc(fbsize))) { + panic("Failed to allocate back buffer"); + } + init_census(backbuf, vmode.width, vmode.height); for(;;) { + draw_census(); + wait_vsync(); - memset(fbptr, 0x80, vmode.width * vmode.height * vmode.bpp / 8); + memcpy(fbptr, backbuf, fbsize); } } @@ -75,7 +84,7 @@ static int video_init(void) const char *vendor; if(mode_idx == -1 && (vendor = get_video_vendor()) && strstr(vendor, "SeaBIOS")) { - mode_idx = find_video_mode_idx(800, 600, 0); + mode_idx = find_video_mode_idx(800, 600, 32); } if(mode_idx == -1 && vbe_get_edid(&edid) == 0 && edid_preferred_resolution(&edid, &xres, &yres) == 0) {