The k project

VGA driver

Description

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

NAME
    setvideo, swap_frontbuffer - graphic mode management
SYNOPSIS
    int setvideo(int mode);
    void swap_frontbuffer(const void *buffer);
DESCRIPTION
    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.
RETURN VALUE
    setvideo() returns 0 on success, or -1 on error.
NOTES
    swap_frontbuffer() must be called in video mode.