	    /* SIMULATION OF 8085 USING C */
 #include"simu.h"
 int main()                        /* START OF FUNCTION "main()" */
 {
  int k; 
  char ch;
  /* initgraph(&gdriver, &gmode,  ""); */
  clrscr();
  rf[2] = rf[4] = rf[6] = 0;
  rsp = 0x2700;
  rpc = 0x2200;
  create();
  rom_write();
  for(k = 0; k<8; k++) reg[k] = k;
  decorate();

  while(1) {
	clear_help();
	gotoxy(1, 0);
	if(ch!='g') write(1, "_ups  85", 8);
	else write(1, "E         ", 8);
	gotoxy(1, 21);
	write(1, "SELECT A MODE", 13);

	ch = getch();

	if(ch == 'r' || ch == 'R')   continue;      /*RESET*/

	if(ch == 'y' || ch == 'Y')  {        /*EXIT*/
		closegraph();
		return(0);
	}
	if(ch == 'v' || ch == 'V')  {        /*DEMO*/
		demo();
		decorate();
		continue;
	}
	if(ch == 's' || ch == 'S')  {        /*SHIFT*/
		shift_help();
		block_move();
		continue;
	}
	if(ch == 'w' || ch == 'W')  {        /*EXAM.REG*/
		exam_reg_help();
		modify_reg();
		continue;
	}
	if(ch == 'i' || ch == 'I')  {        /*INSERT*/
		insert_help();
		inserts();
		continue;
	}

	if(ch == 'k' || ch == 'K')         /*DELETE*/ {
		delete_help();
		deletes();
		clear_help();
		continue;
	}

	if(ch == 'm' || ch == 'M')    /* EXAM MEMORY*/ {
		gotoxy(1, 0);
		write(1, "   .    ", 8);
		clear_help();
		gotoxy(0, 21);
		write(1, "ENTER ADDRESS AND ENTER n TO EXAM DATA AT THAT ADDRESS", 54);
		k = adr(ch);
		clear_help();
		if(k<0)	 continue;
	}
	if(ch == 't' || ch == 'g' || ch == 'T' || ch == 'G') {
		gotoxy(1, 0);
		write(1, "-us-    ", 8);
		clear_help();
		gotoxy(0, 21);
		write(1, "ENTER ADDRESS AND ENTER x TO RUN .", 34);
		k = adr(ch);
		clear_help();
		if(k<0) continue;
	}
	if(ch == 'g' || ch == 'G')         /*CALLING RUN*/ {
		run(k, NORMAL_RUN_MODE);
		continue;
	}
	if(ch == 't' || ch == 'T')         /*GOING TO TRACE*/ {
		run(k, TRACE_MODE);
		continue;
	}
	if(ch == 'm' || ch == 'M') {
		exam_memory_help();
		memo(k);
		continue;
	}
	reset();
  }
 }                        /* END OF FUNCTION MAIN */

