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

  1. /* 
  2. POKE_OFS.C -- poke video display memory one million  
  3. times, using Phar Lap Map Physical Memory at End of 
  4. Segment (INT 21h AX=250Ah) call
  5. */ 
  6.  
  7. #include <stdlib.h> 
  8. #include <stdio.h> 
  9. #include <string.h>
  10. #include <dos.h> 
  11. #include <time.h> 
  12. #include <pharlap.h>
  13.  
  14. #define MAX 1000000 
  15.  
  16. void fail(char *s) { puts(s); exit(1); } 
  17.  
  18. main() 
  19.     CONFIG_INF config;
  20.     UCHAR buf[256];
  21.     unsigned short *p;  /* NEAR pointer */ 
  22.     time_t t1, t2; 
  23.     unsigned i; 
  24.      
  25.     _dx_config_inf(&config, buf);
  26.     // map 4k at b800:0000
  27.     if (_dx_map_phys(config.c_ds_sel, 0xb8000, 1, (ULONG *) (&p)) != 0) 
  28.         fail("can't map physical memory"); 
  29.     time(&t1); 
  30.     for (i=MAX; i--; ) 
  31.         p[i%2000] = i; 
  32.     time(&t2); 
  33.     printf("\n\n%u POKE_OFS/second (%u seconds)\n",  
  34.         MAX/(t2-t1), t2-t1); 
  35.     return 0; 
  36.  
  37.