Stupid Programming Trick Code

#include <stdio.h>
#include <stdlib.h>
#include <vga.h>
#include <vgagl.h>
#define VGAMODE G320x200x256
#define FONTW 8 // font width
#define FONTH 8 // font height
#define TEXTL 600 // text length
int main(void)
{
  char d;
  char text[TEXTL]="                                         Megagreetings from whomever this happens to be! This is where the scrolltext words are, so fill them as you like. Fun rarely entices everyone. Keep enjoying video interfaces nevertheless................. There is space to be filled!! ";
  short int text_pos;
  unsigned char pixel_pos;
  unsigned char speed;
  GraphicsContext *physical_screen;
  GraphicsContext *virtual_screen;
  GraphicsContext *scroll_board;
  vga_init();
  vga_setmode(VGAMODE);
  gl_setcontextvga(VGAMODE);
  physical_screen = gl_allocatecontext();
  gl_getcontext(physical_screen);
  gl_setcontextvgavirtual(VGAMODE);
  virtual_screen = gl_allocatecontext();
  gl_getcontext(virtual_screen);
  gl_clearscreen(0);
  scroll_board = malloc( (WIDTH/FONTW+1) * FONTW *
     FONTH * BYTESPERPIXEL);
  gl_setcontextvirtual(WIDTH+FONTW, FONTH, 
     BYTESPERPIXEL, 8, scroll_board);
  scroll_board = gl_allocatecontext();
  gl_getcontext(scroll_board);
  gl_clearscreen(0);
  gl_setwritemode(FONT_COMPRESSED);
  gl_setfont(8, 8, gl_font8x8);
  gl_setpalettecolor(1,63,63,63);
  text_pos = 0; // text offset
  pixel_pos = 0; // pixel offset
  speed = 1; // scroller speed
  gl_setcontext(virtual_screen);
  for (d=0; d==0; d=vga_getkey()) {
    pixel_pos+=speed;
    while (pixel_pos > FONTW) {
      gl_setcontext(scroll_board);
      gl_writen(0, 0, WIDTH/FONTW,
        &text[text_pos]);
      text_pos++;
      pixel_pos-=FONTW;
      if (text_pos > TEXTL - WIDTH/FONTW)
      text_pos -= (TEXTL-WIDTH/FONTW);
      gl_setcontext(virtual_screen);
    }
    gl_copyboxfromcontext(scroll_board, pixel_pos,
       0, WIDTH, FONTH, 0, HEIGHT-FONTH-1);
    gl_copyscreen(physical_screen);
    vga_waitretrace();
  }
  return 0;
}
