
/*
 *
 * This functions diplays the contents of various registers
 * including flag register.
 *
 * This function returns 1 if the exection is to be stopped.
 * Returns 0 if the exection to be continued.
 */

 int show_trace(void)
 {
  char print_buff[512];
  int trace_flag;
  gotoxy(0, 3);
  sprintf(print_buff,"B  C  D  E  H  L  M  A  RPC->code  RSP ->DATA \n%02x %02x %02x %02x %02x %02x %02x %02x %04x  %02x   %04x  %02x %02x\nS Z X A X P X C \n%1d %1d %1d %1d %1d %1d %1d %1d ",reg[0],reg[1],reg[2],reg[3],reg[4],reg[5],reg[6],reg[7], rpc, memr(rpc), rsp, memr(rsp + 1), memr(rsp), rf[0], rf[1], rf[2], rf[3], rf[4], rf[5], rf[6], rf[7]);

  write(1,print_buff,127);
  trace_flag = getch();
  if(trace_flag == 'r' || trace_flag == 'x') {
	decorate();
	return(1);
  }
  if(trace_flag != 'n') {
	clrscr();
	decorate();
	reset();
	return(-1);
  }
  return(0);
 }
