示例#1
0
void		print_on_mem(t_cor *cor, int to_add, int pc)
{
  int		i;
  unsigned char	*tmp;

  i = (cor->endian == 1) ? 3 : 1;
  tmp = (unsigned char *)&to_add;
  cor->mem[mod_mem(pc + i)] = tmp[0];
  i += (cor->endian == 1) ? -1 : 1;
  cor->mem[mod_mem(pc + i)] = tmp[1];
  i += (cor->endian == 1) ? -1 : 1;
  cor->mem[mod_mem(pc + i)] = tmp[2];
  i += (cor->endian == 1) ? -1 : 1;
  cor->mem[mod_mem(pc + i)] = tmp[3];
}
示例#2
0
int	get_dir_ind_arg(int *tab, t_champ *champ, unsigned char *mem, int *err)
{
  if (tab[0] <= 1)
    {
      *err = -1;
      return (-1);
    }
  else if (tab[0] == 2)
    return (tab[2]);
  else
    return (get_nbr_action(mem,
			   mod_mem(champ->pc + (tab[2] % IDX_MOD)), tab[1]));
}
示例#3
0
int	get_all_type_arg(int *tab, t_champ *champ, unsigned char *mem, int *err)
{
  if (tab[0] == 0)
    {
      *err = -1;
      return (-1);
    }
  else if (tab[0] == 2)
    return (tab[2]);
  else if (tab[0] == 1)
    {
      *err = (check_reg(tab[2]) == 1) ? *err : -1;
      return ((check_reg(tab[2]) == 1) ? champ->reg[tab[2] - 1] : -1);
    }
  else
    return (get_nbr_action(mem,
			   mod_mem(champ->pc + (tab[2] % IDX_MOD)), tab[1]));
}
示例#4
0
int		get_nbr_action(unsigned char *mem, int pc, int len)
{
  int		i;
  int		nb;

  i = 0;
  nb = 0;
  while (i < len)
    {
      nb = nb * 256 + mem[mod_mem(pc + i)];
      i++;
    }
  if (len == 2)
    nb = (short int)nb;
  else if (len == 1)
    nb = (unsigned char)nb;
  return (nb);
}
示例#5
0
int do_mem_nm ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
	return mod_mem (cmdtp, 0, flag, argc, argv);
}
示例#6
0
文件: cmd_mem.c 项目: ierton/mboot
int do_mem_nm (struct cmd_ctx *ctx, int argc, char * const argv[])
{
	return mod_mem(ctx, 0, argc, argv);
}
示例#7
0
static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	return mod_mem (cmdtp, 1, flag, argc, argv);
}
示例#8
0
int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]){
	return(mod_mem(cmdtp, 1, flag, argc, argv));
}