home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / tfont10.zip / dosFont.c next >
C/C++ Source or Header  |  1996-08-13  |  1KB  |  49 lines

  1. #define COPYRIGHT "(C) Tomas Ögren '96"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <dos.h>
  5.  
  6. int main(int argc,char*argv[])
  7. {
  8.     char buf[32768];
  9.     FILE*f;
  10.     int bseg, bofs;
  11.     printf("dosFont v1.0 by Tomas Ögren <stric@freenet.hut.fi>\n\n");
  12.     if (argc!=2)
  13.     {
  14.         printf("Usage: dosFont.exe <Filename>\n");
  15.         printf("\nThis program changes the current font in a fullscreen DOS session\n");
  16.         printf("See docs for more information.\n");
  17.         printf("%s\n",COPYRIGHT);
  18.     return 1;
  19.     }
  20.     if ((f=fopen(argv[1],"rb"))==NULL)
  21.     {
  22.         printf("Error opening file!\n");
  23.         return 2;
  24.     }
  25.     fread(buf,1,4096,f);
  26.     bofs = ((unsigned long)buf)&0xFFFF;
  27.     bseg = (((unsigned long)buf>>16)&0xFFFF);
  28.  
  29.     asm {
  30.         push bp
  31.         mov ax,bseg
  32.         mov es,ax
  33.         mov ah,0x11
  34.         mov al,0x00
  35.         mov bh,0x10
  36.         mov bl,0x00
  37.         mov cx,0x100
  38.         mov dx,0x00
  39.         mov bp,bofs
  40.         int 0x10
  41.         pop bp
  42.     }                                                      /* Trust me.. */
  43.  
  44.     printf("%s installed (un)successfully.\n",argv[1]);
  45.                         /* Dont know really if it went ok.. You decide.. */
  46.     return 0;
  47. }
  48.  
  49.