home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / BEERSRC.ZIP / LOADIFF.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-10  |  1.2 KB  |  67 lines

  1.  
  2. #include <io.h>
  3. #include <fcntl.h>
  4. #include <sys\stat.h>
  5. #include <alloc.h>
  6. #include <mem.h>
  7. #include <dos.h>
  8. #include <stdlib.h>
  9.  
  10. #define     LINESIZE    320
  11. #define        LINES        200
  12.  
  13. #define selectread(plane)       outport(0x3ce, (plane << 8) | 0x04)
  14. #define selectwrite(plane)      outport(0x3c4, (plane << 8) | 0x02)
  15. #define enablewrite(color)      outport(0x3ce, color << 8); outport(0x3ce, 0x0f01)
  16. #define disablewrite()          outport(0x3ce, 1)
  17.  
  18.  
  19. void loadpic(char *filename)
  20. {
  21.    char   *dummy;
  22.    int    filvar;
  23.    int    plane, i;
  24.    unsigned scr;
  25.  
  26.    if ((dummy = malloc(LINESIZE)) == NULL) {
  27.       abort();
  28.    }
  29.  
  30.    filvar = open(filename, O_RDONLY | O_BINARY, S_IREAD);
  31.    lseek(filvar, 104, SEEK_SET);
  32.  
  33.    scr = 0;
  34.    for (i = 0; i < LINES; i++) {
  35.    for (plane = 1; plane <= 8; plane <<= 1) {
  36.       read(filvar, dummy, LINESIZE);
  37.    }
  38.    scr+=80;
  39.    }
  40.    close(filvar);
  41.  
  42.    free(dummy);
  43.  
  44. }
  45.  
  46. void screenmode(int mode)
  47. {
  48.    struct REGPACK regs;
  49.  
  50.    regs.r_ax = mode;
  51.    intr(0x10, ®s);
  52.  
  53.    regs.r_ax = 0x0100;
  54.    regs.r_cx = 0x2000;
  55.    intr(0x10, ®s);
  56.  
  57. }
  58.  
  59. main()
  60. {
  61.    screenmode(16);
  62.  
  63.    loadpic("screens\\font.lbm");
  64.    getch();
  65.  
  66. }
  67.