home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / 1991 / 10 / embedcp / test / mem3.c < prev    next >
C/C++ Source or Header  |  1991-03-23  |  471b  |  23 lines

  1. #include <stdio.h>
  2.  
  3. struct    ctrl_reg    {    unsigned short offset;
  4.                         unsigned short segment;
  5.                         unsigned short count;
  6.                         unsigned char command;
  7.                     };
  8. main()
  9. {
  10.     struct ctrl_reg *ctrl;
  11.     unsigned short i=0,j,count = 0;
  12.  
  13.     ctrl = (struct ctrl_reg *)(((long) 0xC800 << 16) + 0x100);
  14.     while (1){
  15.         ctrl->count = i;
  16.         if ((j = ctrl->count) != i) goto error;
  17.         i++;
  18.         printf ("Cycle %d\n",count++);
  19.     }
  20.     error:
  21.         printf("Expected %d - got %d\n",i,j);
  22. }
  23.