(* FONT MANIA pascal font *)

uses
    DOS, CRT;

(*--------------------------------------------------------------------------

   Font is saved in the file named DEMO.PAS.  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  =  $1110      (ah = $11, al = $10)
		  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 (use Seg())
		  BP  =  offset of the table (use Ofs())

   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 load characters 65 to 88, (A to Z) and
   the label reference is DEMO.  Here are the parameters needed:
   
		 AX  =  $1110;
		 BH  =  DEMO_POINTS;
		 BL  =  0;
		 CX  =  24;               ( 24 characters to load )
		 DX  =  65;               ( first character to load )
		 ES  =  Seg(DEMO);
		 BP  =  Ofs(DEMO);
		 
   See below for examples of how to set the registers. 
		 
		  
---------------------------------------------------------------------------*)

{$I DEMO.PAS}			
Var
   r : registers;
   temp : char;

BEGIN
  WriteLn('This is a font test');
  WriteLn('Press any key to begin upload the font');
  temp := readkey;

  r.ax := $0500;			(* make sure that it's page 0 *)
  intr($10, r);
  
  r.ax := 3;				(* must set the vdo mode first *)
  intr($10, r);

  r.ax := $1110;
  r.bh := test_points;                   (* bytes per character *)
  r.bl := 0;                             (* load to block 0 *)
  r.cx := 256;                           (* 256 characters *)
  r.dx := 0;                             (* start with character 0 *)
  r.es := Seg(test);                     (* segment of table *)
  r.bp := Ofs(test);                     (* offset of the table *)
  intr($10, r);

  WriteLn('Font loadded');
  temp := readkey;

END.