/* 8051/931 Example - Robert Boys, Copyright 1997 Keil Software Dallas, Texas  */
/* This is a simple program used to demonstrate the Keil debugger dScope */


#include <reg931.h>			/* declare 931 SFRs */
#include <stdio.h>			/* not -really- needed, but here it is anyhow ! */

int var = 1;				/* declare an integer variable to be pointed to */
int *ptr;				/* declare a pointer to point to an integer */


void stepout(int q)			/* declare a simple function called stepout */
{					/* does not really do much but demonstrate the */
int count; 		       		/* stepout, stepin and stepover functions of dScope */
int total = 0;

	for (count = 1; count <= 10; count++)
		q = q*2;
}


struct cord {				/* declare the structure named cord */
int x;					/* with member variables x and y */
int y;
} first, second;			/* declare two structures with members x and y */


void main(void) {			/* start of the main program here */
	
        int b = 0;                      /* declare a few integer local variables */
	int count = 0;
	long bigcount = 0;

	ptr = &var;			/* declare ptr to point to the variable var */
	*ptr = 3;
	first.x = 5;			/* and initialize them */
	first.y = 5;
	second.x = 2;
	second.y = 2;
  
   while(1) 	{			/* start an endless loop here */
        P1 = 0;
	first.x++;			/* increment all the pointers */
	second.y++;  			/* just for something to do */
	first.y++;
	second.x++;
     
	count++;   		       	/* increment this thing while we are here  */
	stepout(b);			/* pay a visit to the function for a time  */
	bigcount=bigcount+2; 		/* add two to this long variable */
 
	*ptr=*ptr*3;			/* multiply var by three using its pointer */  
	P1=0xff;
		}
}


