home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l350 / 3.ddi / EXAMPLES / WINDOWS / POKEB800.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-29  |  1.0 KB  |  46 lines

  1. /* 
  2. POKEB800.C -- poke video display memory 1 million times
  3. */ 
  4.  
  5. #include <stdlib.h> 
  6. #include <stdio.h> 
  7. #include <dos.h> 
  8. #include <time.h> 
  9. #include <pharlap.h>
  10.  
  11. #define MAX 1000000 
  12.  
  13. main()
  14.     FARPTR basep;
  15.     FARPTR fp;
  16.     time_t t1, t2; 
  17.     unsigned i; 
  18.  
  19. /*  Either of the following techniques will work. */     
  20. #if 1 
  21. /*  Selector 1Ch maps physical memory for the screen, and is 
  22.     automatically updated by 386|DOS Extender any time the 
  23.     BIOS Set Video Mode call (INT 10h AH=0) call is made. */ 
  24.  
  25.     FP_SET(basep, 0, 0x1c);
  26. #else 
  27. /*  Selector 34h maps the entire first megabyte of memory:   
  28.     real mode pointers such as B800:0000 become offsets into 
  29.     this large 32 bit segment. */ 
  30.  
  31.     FP_SET(basep, 0xb8000, 0x34);
  32. #endif 
  33.  
  34.     time(&t1); 
  35.     for (i=MAX; i--; ) 
  36.     {
  37.     FP_SET(fp, FP_OFF(basep) + (i%2000)*2, FP_SEL(basep));
  38.     PokeFarWord(fp, (USHORT)i);
  39.     }
  40.     time(&t2); 
  41.     printf("\n\n%u POKEB800/second (%u seconds)\n",  
  42.         MAX/(t2-t1), t2-t1); 
  43.     return 0; 
  44.