The k project

VGA driver


VGA driver allows to switch between graphical and text mode in k. It allows k roms to display pixels on screen with a resolution of 320 x 200 and a palette of 256 pixels. Programming the vga controller is a difficult part because it uses a lot of registers (over 300), so we provide you some code that will help you to implement VGA syscalls.

Syscall interface

    setvideo, swap_frontbuffer - graphic mode management
    int setvideo(int mode);
    void swap_frontbuffer(const void *buffer);
    setvideo() sets the current video mode to mode. Available modes are:
        VIDEO TEXT text mode (80x25 characters).
        VIDEO GRAPHIC graphic mode (320*200, 8bpp color).
    swap_frontbuffer() swap the content of the front buffer with the
    data given by the user.
    setvideo() returns 0 on success, or -1 on error.
    swap_frontbuffer() must be called in video mode.