#include <dos.h>
#include <conio.h>
#include "demo.h"
#include <stdio.h>

 /*-------------------------------------------------------------------------
    Font is saved in the file named DEMO.H.  To use the font, you must call
   interrupt 10h, function 11h, sub-function 10h to load the font.
   
   The following are the parameters needed to call the function:
  
                  AX  =  0x1110      (ah = 0x11, al = 0x10)
		  BH  =  bytes per character 
		  BL  =  block to load to.  (use 0)
		  CX  =  number of character defined by table
		  DX  =  starting character value
		  ES  =  segment of the table 
		  BP  =  offset of the table 

   Notice: The character should always be loaded immediately after setting
           the Video mode.  If it is not called immediately after the video 
           mode is set, some side effects may occur.  We have experienced 
           some palette errors when this function is called without setting
           the video mode.  The appearance of this effect is intermittent and
           unpredictable, but it may be avoided by following the recommend-
           ation in this paragraph.
   
   FONT MANIA will supply you with the height of the font.  It is defined
   by your label name with "_POINTS" added at the end of the string.  For
   example, if your label reference is called DEMO, then DEMO_POINTS will 
   represent the bytes-per-character of the font (the height of the font).
   
   Set the CX to 256 if you want to load the whole font. If you want to 
   load only part of the font,  set CX to the number of the character 
   you want to load, and set DX to the first character you want to load.
   
   For example, suppose you want to upload the characters 65 to 88, (A to Z) 
   and the label reference is DEMO.  Here are the parameters needed:
   
		 AX  =  0x1110;
		 BH  =  DEMO_POINTS;
		 BL  =  0;
		 CX  =  24;               ( 24 characters to load )
		 DX  =  65;               ( first character to load )
		 ES  =  FP_SEG(DEMO);
		 BP  =  FP_OFF(DEMO);
		 
   See below for examples of how to set the registers. 
		 

 --------------------------------------------------------------------------*/


void main(void) {
  int i;
  struct REGPACK r;

  printf("This is font test\n\n");

  for (i=0; i<256; i++) {
    cprintf(" %c", i);
    if (!(i % 32) && (i != 0))
      printf("\n");
  }
  printf("\n\nPress any key to load the font...\n");
  getch();

  r.r_ax = 3;				/* always set video mode first */
  intr(0x10, &r);

  r.r_ax = 0x1110;
  r.r_bx = 0x0e00;
  r.r_cx = 256;
  r.r_dx = 0;
  r.r_es = FP_SEG(TEST);
  r.r_bp = FP_OFF(TEST);
  intr(0x10, &r);

  printf("\nFont loaded\nPress any key...");
  getch();

}


