home *** CD-ROM | disk | FTP | other *** search
/ Compu-Fix / Compu-Fix.iso / misc / fonts / c_demo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-01  |  2.7 KB  |  85 lines

  1. #include <dos.h>
  2. #include <conio.h>
  3. #include "demo.h"
  4. #include <stdio.h>
  5.  
  6.  /*-------------------------------------------------------------------------
  7.     Font is saved in the file named DEMO.H.  To use the font, you must call
  8.    interrupt 10h, function 11h, sub-function 10h to load the font.
  9.    
  10.    The following are the parameters needed to call the function:
  11.   
  12.                   AX  =  0x1110      (ah = 0x11, al = 0x10)
  13.           BH  =  bytes per character 
  14.           BL  =  block to load to.  (use 0)
  15.           CX  =  number of character defined by table
  16.           DX  =  starting character value
  17.           ES  =  segment of the table 
  18.           BP  =  offset of the table 
  19.  
  20.    Notice: The character should always be loaded immediately after setting
  21.            the Video mode.  If it is not called immediately after the video 
  22.            mode is set, some side effects may occur.  We have experienced 
  23.            some palette errors when this function is called without setting
  24.            the video mode.  The appearance of this effect is intermittent and
  25.            unpredictable, but it may be avoided by following the recommend-
  26.            ation in this paragraph.
  27.    
  28.    FONT MANIA will supply you with the height of the font.  It is defined
  29.    by your label name with "_POINTS" added at the end of the string.  For
  30.    example, if your label reference is called DEMO, then DEMO_POINTS will 
  31.    represent the bytes-per-character of the font (the height of the font).
  32.    
  33.    Set the CX to 256 if you want to load the whole font. If you want to 
  34.    load only part of the font,  set CX to the number of the character 
  35.    you want to load, and set DX to the first character you want to load.
  36.    
  37.    For example, suppose you want to upload the characters 65 to 88, (A to Z) 
  38.    and the label reference is DEMO.  Here are the parameters needed:
  39.    
  40.          AX  =  0x1110;
  41.          BH  =  DEMO_POINTS;
  42.          BL  =  0;
  43.          CX  =  24;               ( 24 characters to load )
  44.          DX  =  65;               ( first character to load )
  45.          ES  =  FP_SEG(DEMO);
  46.          BP  =  FP_OFF(DEMO);
  47.          
  48.    See below for examples of how to set the registers. 
  49.          
  50.  
  51.  --------------------------------------------------------------------------*/
  52.  
  53.  
  54. void main(void) {
  55.   int i;
  56.   struct REGPACK r;
  57.  
  58.   printf("This is font test\n\n");
  59.  
  60.   for (i=0; i<256; i++) {
  61.     cprintf(" %c", i);
  62.     if (!(i % 32) && (i != 0))
  63.       printf("\n");
  64.   }
  65.   printf("\n\nPress any key to load the font...\n");
  66.   getch();
  67.  
  68.   r.r_ax = 3;                /* always set video mode first */
  69.   intr(0x10, &r);
  70.  
  71.   r.r_ax = 0x1110;
  72.   r.r_bx = 0x0e00;
  73.   r.r_cx = 256;
  74.   r.r_dx = 0;
  75.   r.r_es = FP_SEG(TEST);
  76.   r.r_bp = FP_OFF(TEST);
  77.   intr(0x10, &r);
  78.  
  79.   printf("\nFont loaded\nPress any key...");
  80.   getch();
  81.  
  82. }
  83.  
  84.  
  85.