#define BITMAP_DISPLAY_ADDR (0x7000)
#define DISPLAY_WIDTH (160)
#define DISPLAY_HEIGHT (160)

int fill_rect(unsigned char* dest, int x0, int y0, int width, int height, int red, int green, int blue)
{
  int i, j, line, xpos;
  for(i = 0; i < height; i++){
	line = (i+y0) * DISPLAY_WIDTH;
	for(j = 0; j < width; j++){
	  xpos = (line + j + x0) * 3;
	  *(dest + xpos)   = red;
	  *(dest + xpos + 1) = green;
	  *(dest + xpos + 2) = blue;
	}
  }
}

int main()
{
  unsigned char * dest;
  dest = (unsigned char*)BITMAP_DISPLAY_ADDR;
  fill_rect(dest, 10, 10, 20, 20, 255, 0, 0);
  fill_rect(dest, 30, 10, 20, 20, 0, 255, 0);
  fill_rect(dest, 50, 10, 20, 20, 0, 0, 255);
}
