コード例 #1
0
ファイル: buttons.c プロジェクト: Bpara001/CS_UCR
static void
clear_program_state_action (Widget w, XtPointer client_data,
			    XtPointer call_data)
{
  long clear_op = (long) client_data;

  switch (clear_op)
    {
    case CLEAR_REGS:
      write_output (message_out, "Registers cleared\n\n");
      initialize_registers ();
      break;

    case CLEAR_MEM_REGS:
      write_output (message_out, "Memory and registers cleared\n\n");
      initialize_world (load_exception_handler ? exception_file_name : NULL);
      write_startup_message ();
      break;

    case CLEAR_CONSOLE:
      write_output (message_out, "Console display cleared\n\n");
      clear_console_display ();
      break;

    default:
      fatal_error("Unknown action: %d\n", clear_op);
    }

  redisplay_text ();
  redisplay_data ();
}
コード例 #2
0
Computer initialize_computer() {
  Computer c;

  c.instruction_pointer = 0;
  c.instruction_counter = 0;
  c = initialize_registers(c);
  c = initialize_ram(c);

  return c;
}
コード例 #3
0
ファイル: registers.c プロジェクト: nickdrozd/lispinc
void initialize(void) {
    reset_stats();
    initialize_registers();
    initialize_stack();
    return;
}
コード例 #4
0
ファイル: spim-utils.c プロジェクト: peach07up/CS398
void
initialize_world (int context, char *exception_file_paths, char *exception_file_name)
{
  reg_image_t &reg_image = reg_images[context];
  reg_image.context = context;
  reg_image.auto_alignment = 1;

  /* Allocate the floating point registers */
  if (reg_image.FGR == NULL)
    reg_image.FPR = (double *) xmalloc (FPR_LENGTH * sizeof (double));
  /* Allocate the memory */
  make_memory (context,
	       initial_text_size,
	       initial_data_size, initial_data_limit,
	       initial_stack_size, initial_stack_limit,
	       initial_k_text_size,
	       initial_k_data_size, initial_k_data_limit);
  initialize_registers (context);
  initialize_inst_tables ();
  initialize_symbol_table ();
  k_text_begins_at_point (context, K_TEXT_BOT);
  k_data_begins_at_point (context, K_DATA_BOT);
  data_begins_at_point (context, DATA_BOT);
  text_begins_at_point (context, TEXT_BOT);

  if (exception_file_paths != NULL)
    {
      bool old_bare = bare_machine;
      bool old_accept = accept_pseudo_insts;
      char *filename;
      char *files;

      /* Save machine state */
      bare_machine = false;     /* Exception handler uses extended machine */
      accept_pseudo_insts = true;

      /* strtok modifies the string, so we must back up the string prior to use. */
      if ((files = strdup (exception_file_paths)) == NULL)
         fatal_error ("Insufficient memory to complete.\n");

      for (filename = strtok (files, ";"); filename != NULL; filename = strtok (NULL, ";"))
         {
            /* if you pass in non-NULL second parameter, I assume one exception file */
            if (!read_assembly_file (context, filename, exception_file_name))
               fatal_error ("Cannot read exception handler: %s\n", filename);

            write_output (message_out, "Loaded: %s\n", filename);
         }

      free (files);

      /* Restore machine state */
      bare_machine = old_bare;
      accept_pseudo_insts = old_accept;

      if (!bare_machine)
      {
        (void)make_label_global ("main"); /* In case .globl main forgotten */
        (void)record_label ("main", 0, 0);
      }
    }
  initialize_scanner (stdin, "");
  delete_all_breakpoints ();
}