home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / bbs / mikes30c.arc / SCRNPUT.C < prev    next >
Text File  |  1985-09-25  |  5KB  |  99 lines

  1. /**************************************************************************
  2.   This program demonstrates the program NOSNOW.ASM which significantly
  3.   increases the speed of full screen displays and updates as opposed to
  4.   using printf.  This program and NOSNOW was written for Microsoft 3.0
  5.   C and displays a screen without the usual snow assosiated with movedata.
  6.   The following command and switches where used to compile:
  7.  
  8.      cl -Ox -Ze scrnput.c nosnow
  9.  
  10.         Enjoy!!   Mike Elkins    Sysop Mike's "C" Board
  11. ***************************************************************************/
  12.  
  13. #include <stdio.h>
  14. #include <dos.h>
  15.  
  16. void flash(unsigned int, unsigned int);
  17. void scrnsave(unsigned int, unsigned int);
  18. char *malloc();
  19.  
  20. main()
  21. {
  22.    char far *hold;
  23.    unsigned  i;
  24.  
  25.    hold = (char far * ) malloc(4001);       /* Allocate memory for save */
  26.    scrnsave(FP_SEG(hold), FP_OFF(hold));    /* Save current screen */
  27.    screen0();                               /* Display new screen */
  28.    for(i=0; i<60000; i++);                  /* Stall */
  29.    for(i=0; i<60000; i++); 
  30.    for(i=0; i<60000; i++); 
  31.    flash(FP_SEG(hold), FP_OFF(hold));       /* Put orig. screen back */
  32.    free(hold);                              /* Free space */
  33. }
  34.  
  35. screen0() /* This screen was created with SG3 and the C code edited in */
  36. {
  37.     char    *scrn0;
  38.  
  39.     scrn0 = malloc(2001);
  40.     strcpy(scrn0, "████████████████████████████████████████████████████████████████████████████████");
  41.     strcat(scrn0, "█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█");
  42.     strcat(scrn0, "█▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█");
  43.     strcat(scrn0, "█▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓█");
  44.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  45.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  46.     strcat(scrn0, "█▓▒░                             W E L C O M E                              ░▒▓█");
  47.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  48.     strcat(scrn0, "█▓▒░                                  T O                                   ░▒▓█");
  49.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  50.     strcat(scrn0, "█▓▒░                           MIKE'S  'C'  BOARD                           ░▒▓█");
  51.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  52.     strcat(scrn0, "█▓▒░              ┌─────────────────────────────────────────┐               ░▒▓█");
  53.     strcat(scrn0, "█▓▒░              │           FIDO  NODE  102/201           │               ░▒▓█");
  54.     strcat(scrn0, "█▓▒░              │            619 - 722 - 8724             │               ░▒▓█");
  55.     strcat(scrn0, "█▓▒░              │               24 HRS DAY                │               ░▒▓█");
  56.     strcat(scrn0, "█▓▒░              │             300/1200 BAUD               │               ░▒▓█");
  57.     strcat(scrn0, "█▓▒░              │           SYSOP  MIKE ELKINS            │               ░▒▓█");
  58.     strcat(scrn0, "█▓▒░              └─────────────────────────────────────────┘               ░▒▓█");
  59.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  60.     strcat(scrn0, "█▓▒░                                                                        ░▒▓█");
  61.     strcat(scrn0, "█▓▒░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓█");
  62.     strcat(scrn0, "█▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓█");
  63.     strcat(scrn0, "█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█");
  64.     strcat(scrn0, "████████████████████████████████████████████████████████████████████████████████");
  65.  
  66.     quik_scrn(scrn0);
  67.     free(scrn0);
  68. }
  69.  
  70. /*********************************************************************
  71.   These routines take an array containing a screen layout and injects
  72.   attribute bytes preparing it for direct move to screen memory.
  73. *********************************************************************/
  74. quik_scrn(strng)
  75. char    *strng;
  76. {
  77.     char    far *scrn;
  78.     int    i, j;
  79.  
  80.     scrn = (char far * ) malloc(4001);
  81.     build_scrn(scrn,strng);             /* Insert attribute bytes */
  82.     flash(FP_SEG(scrn), FP_OFF(scrn));  /* Display new screen */
  83.     free(scrn);
  84.  
  85. }
  86.  
  87. build_scrn(hld, scrn) /* Convert scrn to screen memory format and store in hld */
  88. char    far *hld;
  89. char    *scrn;
  90. {
  91.     int    i, j;
  92.  
  93.     for (i = 1; i < 4001; i += 2) /* Fill every other byte with std. screen */
  94.         hld[i] = 0x07;            /* attribute starting with second */
  95.     for (i = 0, j = 0; hld[i] = scrn[j]; i += 2, j++) /* Put above screen in*/
  96.         ;                         /* in every other byte */
  97. }
  98.  
  99.