Example #1
0
bool Print(string & mode , int count_inst , int ret_inst, string Inst , bool & be)
{
  string tmp="";
  char input[100];input[0]=0;
  strcpy(input,mode.c_str());
  if (mode == "m")
    {
      cout << "\tLast microinstruction : "<< Inst <<"\n";
      Disp.AllRegisterValues(RG, PC, SP, AC, OP);
      SelectOperations(mode,be);
    }
  else if (ret_inst == 0 && mode == "i")
    {
      cout << "Last Instruction : " << Mem.Memory[PageID][count_inst]<<"\n";
      Disp.AllRegisterValues(RG, PC, SP, AC, OP);
      SelectOperations(mode,be);
    }
  else if (be == true && breaks.find(count_inst)!=breaks.end())
    {
      breaks.erase(count_inst);
      cout << "Break-point at address : "<< toHexS(ToStr(count_inst))<<"\n";
      SelectOperations(mode,be);
    }
  return true;
}
Example #2
0
void SelectOperations(string &mode, bool &be)
{
  char input[100];input[0]=0;
  string tmp = "";
  while (1)
    {
      printf("                                   ");
      getchar();
      scanf("%[^\n]",input);   // input a keyword eg. 'rc' for changing register etc.
      tmp = input;
      if (tmp == "rc")  // Change register values 
	{
	  ChangeRegisterValue();
	}
      if (tmp == "rd" || tmp == "r")  // Display Register and state values
	{
	  Disp.AllRegisterValues(RG,PC,SP,AC,OP); // Print all register values PC,SP,AR,OR including
	}
      if (tmp == "md")  // Display Register and  memory state values
	{
	  // Disp.FinalMap(DM,RG,PC,AC,OP,SP);// Print all register and memory values PC,SP,AR,OR including
	  Disp.MemoryMap(Mem, RG);
	  Disp.AllRegisterValues(RG, PC, SP, AC, OP);
	}
      if (tmp == "mc") // Change execution mode
	{
	  ChangeExecutionModeValue(mode);
	}
      if (tmp == "fp")  // Print All Flags
	{
	  PrintFlagValues();
	}
      if (tmp == "bc") // Change break point state
	{
	  ChangeBreakPointState(be);
	}
      if (strlen(input) == 0)
	break;
      input[0]=0;
    }
}