Example #1
0
char flon_call_instruction(char dir, fdja_value *node, fdja_value *msg)
{
  char *inst = fdja_ls(node, "inst", NULL);

  fgaj_d("dir: %c, inst: %s", dir, inst);

  flon_instruction *i = lookup_instruction(dir, inst);

  char r = '?'; // 'unknown' for now

  if (i == NULL)
  {
    fdja_set(node, "status", fdja_s("failed"));
    push_error(node, "unknown instruction '%s'", inst, NULL);

    goto _over;
  }

  eval_catt_pre(dir, node, msg);

  remove_timer(dir, node, msg);

  r = i(node, msg);

  if (r == 'r') // error
  {
    fdja_set(node, "status", fdja_s("failed"));
    //fdja_set(node, "note", fdja_s("xxx")); // set by the instruction itself
  }

  eval_catt_post(dir, node, msg);

_over:

  free(inst);

  return r;
}
Example #2
0
int
print_insn_dcpu16 (bfd_vma memaddr, struct disassemble_info *info)
{
  int status, result;
  bfd_byte buffer[8];
  u16 opcode, aword, bword;
  const struct dcpu16_opcode *op;

  info->bytes_per_line = 6;
  info->bytes_per_chunk = 2;
  info->display_endian = BFD_ENDIAN_BIG;

  status = (*info->read_memory_func) (memaddr, buffer, 2, info);
  if (status != 0)
    {
      (*info->memory_error_func) (status, memaddr, info);
      return -1;
    }
  opcode = bfd_getb16 (buffer);

  result = 1;

  if (opcode & 0x1f)
    {
      op = lookup_instruction (opcode&0x1f);
      if (op)
	{
	  (*info->fprintf_func) (info->stream, "%s\t", op->name);

	  result += read_word(memaddr+result, info, opcode>>10, &aword);
	  result += read_word(memaddr+result, info, (opcode>>5)&0x1f, &bword);

	  print_operand(info, (opcode>>5)&0x1f, bword, 1);
	  (*info->fprintf_func) (info->stream, ", ");
	  print_operand(info, opcode>>10, aword, 0);
	}
    }