#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <linux/fb.h>
#include "fbtools.h"


int main()
{
   unsigned char *scr;
   unsigned int x, y;
   unsigned long location = 0;
   unsigned short color;
   int red, green, blue;

   fb_init(NULL, NULL, 0);
   lut_init(16);

   color = lut_red[255] | lut_green[255] | lut_blue[255];

   for (x = 0; x < 1024; x++) {
       y = 0;
       location = (x * (fb_var.bits_per_pixel/8)) + (y * fb_fix.line_length);
       *((unsigned short *)(fb_mem + location)) = color;
       y = 767;
       location = (x * (fb_var.bits_per_pixel/8)) + (y * fb_fix.line_length);
       *((unsigned short *)(fb_mem + location)) = color;
   }

   for (y = 0; y < 768; y++) {
       x = 0;
       location = (x * (fb_var.bits_per_pixel/8)) + (y * fb_fix.line_length);
       *((unsigned short *)(fb_mem + location)) = color;
       x = 1023;
       location = (x * (fb_var.bits_per_pixel/8)) + (y * fb_fix.line_length);
       *((unsigned short *)(fb_mem + location)) = color;
   }

   getchar();
   fb_cleanup();
}