示例#1
0
void disassembler::decode_modrm(x86_insn *insn)
{
  insn->modrm = fetch_byte();
  BX_DECODE_MODRM(insn->modrm, insn->mod, insn->nnn, insn->rm);
  // MOVs with CRx and DRx always use register ops and ignore the mod field.
  if ((insn->b1 & ~3) == 0x120) insn->mod = 3;

  if (insn->mod == 3) {
    /* mod, reg, reg */
    return;
  }
      /* 16 bit addressing modes. */
      switch (insn->mod) {
        case 0:
          resolve_modrm = &disassembler::resolve16_mod0;
          if(insn->rm == 6)
            insn->displacement.displ16 = fetch_word();
          break;
        case 1:
          /* reg, 8-bit displacement, sign extend */
          resolve_modrm = &disassembler::resolve16_mod1or2;
          insn->displacement.displ16 = (int8) fetch_byte();
          break;
        case 2:
          resolve_modrm = &disassembler::resolve16_mod1or2;
          insn->displacement.displ16 = fetch_word();
          break;
      } /* switch (mod) ... */

}
示例#2
0
文件: 6510.c 项目: trieck/source
void _jmpInd(void)
{
    word iaddr;
    word eaddr;
    iaddr = fetch_word((word)(cpu.pc + 1));
    eaddr = fetch_word(iaddr);
    cpu.pc = eaddr;
}
示例#3
0
int do_command(void)
{
	const char *cmd;
	int i;
	char lbuf[10];

	cmd = word + 1;

	/* Comments don't need the space */
	if (strncmp(cmd, "\\\"", 2) == 0)
		cmd = "\\\"";

	for (i = 0; cmd_list[i].cmd[0]; i++) {
		if (strcmp(cmd_list[i].cmd, cmd) == 0)
			break;
	}

	if (cmd_list[i].cmd[0] == 0) {
		if (verbose) {
			strncpy(lbuf, cmd, 3);
			lbuf[3] = 0;
			line_break();
			i = left_indent;
			left_indent = 0;
			strcpy(word, "**** Unknown formatter command: .");
			strcat(word, lbuf);
			print_word(word);
			line_break();
			left_indent = i;
		}

		i = 0;		/* Treat as comment */
	}

	switch (cmd_list[i].class) {
	case 1:		/* Parametered commands */
		return do_argvcmd(cmd_list[i].id);

	case 2:		/* Font changers */
		return do_fontwords(cmd_list[i].id / 10,
				    cmd_list[i].id % 10, 0);

	case 3:		/* .so */
		fetch_word();
		strcat(man_file, word);
		close_page();
		if (find_page(man_file, (char *) 0) < 0) {
			fprintf(stderr, "Cannot open .so file %s\n", word);
			return -1;
		}
		ungetc('\r', ifd);
		break;

	default:
		do_skipeol();
		if (cmd_list[i].id)
			return do_noargs(cmd_list[i].id);
	}
	return 0;
}
示例#4
0
文件: 6510.c 项目: trieck/source
void _styAbsl(void)
{
    word addr;
    addr = fetch_word((word)(cpu.pc + 1));
    store_byte(addr, cpu.y);

    cpu.pc += 3;
}
示例#5
0
文件: 6510.c 项目: trieck/source
void _jsr(void)
{
    word addr;
    push(hibyte(cpu.pc + 3));
    push(lobyte(cpu.pc + 3));
    addr = fetch_word((word)(cpu.pc + 1));
    cpu.pc = addr;
}
示例#6
0
文件: 6510.c 项目: trieck/source
void _staAby(void)
{
    word addr;
    addr = fetch_word((word)(cpu.pc + 1));
    addr += cpu.y;
    store_byte(addr, cpu.a);

    cpu.pc += 3;
}
示例#7
0
文件: 6510.c 项目: trieck/source
void _rorAbx(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    ROR((word)(addr + cpu.x));

    cpu.pc += 3;
}
示例#8
0
文件: 6510.c 项目: trieck/source
void _aslAbsl(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    ASL(addr);

    cpu.pc += 3;
}
示例#9
0
文件: 6510.c 项目: trieck/source
void _oraAbsl(void)
{
    word addr;
    word res;
    addr = fetch_word((word)(cpu.pc + 1));
    res = cpu.a |= fetch_byte(addr);
    set_nz(res);

    cpu.pc += 3;
}
示例#10
0
文件: 6510.c 项目: trieck/source
void _lsrAbx(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    LSR((word)(addr + cpu.x));

    cpu.pc += 3;
}
示例#11
0
文件: 6510.c 项目: trieck/source
void _lsrAbsl(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    LSR(addr);

    cpu.pc += 3;
}
示例#12
0
文件: decode.c 项目: daic0r/icejpeg
int process_dri(void)
{
    if (iceenv.cur_segment_len != 4)
        return ERR_INVALID_SEGMENT_SIZE;
    
    iceenv.restart_interval = fetch_word();
    iceenv.rstcount = iceenv.restart_interval;
    
    return ERR_OK;
}
示例#13
0
文件: 6510.c 项目: trieck/source
void _brk(void)
{
    push(hibyte(cpu.pc + sizeof(word)));
    push(lobyte(cpu.pc + sizeof(word)));
    push(cpu.sr);
    set_brk_flag();

    set_int_disable_flag();
    cpu.pc = fetch_word(IRQ_VECTOR);
}
示例#14
0
文件: 6510.c 项目: trieck/source
void _aslAbx(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    ASL((word)(addr + cpu.x));

    cpu.pc += 3;
}
示例#15
0
文件: 6510.c 项目: trieck/source
void _bitAbsl(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    BIT(addr);

    cpu.pc += 3;
}
示例#16
0
文件: 6510.c 项目: trieck/source
void _rorAbsl(void)
{
    word addr;

    addr = fetch_word((word)(cpu.pc + 1));

    ROR(addr);

    cpu.pc += 3;
}
示例#17
0
文件: 6510.c 项目: trieck/source
/*
 * add with carry, absolute mode
 */
void _adcAbsl(void)
{
    word addr;
    byte value;
    addr = fetch_word((word)(cpu.pc + 1));
    value = fetch_byte(addr);

    ADC(value);

    cpu.pc += 3;
}
示例#18
0
文件: 6510.c 项目: trieck/source
void _ldaAby(void)
{
    word addr;
    word res;
    addr = fetch_word((word)(cpu.pc + 1));
    addr += cpu.y;
    res = cpu.a = fetch_byte(addr);
    set_nz(res);

    cpu.pc += 3;
}
示例#19
0
文件: 6510.c 项目: trieck/source
void _staIdy(void)
{
    byte zaddr;
    word addr;
    zaddr = fetch_byte((word)(cpu.pc + 1));

    addr = fetch_word(zaddr) + cpu.y;
    store_byte(addr, cpu.a);

    cpu.pc += 2;
}
示例#20
0
文件: 6510.c 项目: trieck/source
void _ldyAbx(void)
{
    word addr;
    word res;
    addr = fetch_word((word)(cpu.pc + 1));
    addr += cpu.x;
    res = cpu.y = fetch_byte(addr);
    set_nz(res);

    cpu.pc += 3;
}
示例#21
0
文件: 6510.c 项目: trieck/source
void _sbcAby(void)
{
    word addr;
    byte value;
    addr = fetch_word((word)(cpu.pc + 1));
    value = fetch_byte((word)(addr + cpu.y));

    SBC(value);

    cpu.pc += 3;
}
示例#22
0
文件: 6510.c 项目: trieck/source
void _staIdx(void)
{
    byte zaddr;
    word addr;
    zaddr = fetch_byte((word)(cpu.pc + 1));
    zaddr += cpu.x;
    addr = fetch_word(zaddr);
    store_byte(addr, cpu.a);

    cpu.pc += 2;
}
示例#23
0
void disassembler::IwIb(const x86_insn *insn)
{
  Bit16u iw = fetch_word();
  Bit8u  ib = fetch_byte();

  if (intel_mode) {
     dis_sprintf("0x%04x, 0x%02x", iw, ib);
  }
  else {
     dis_sprintf("$0x%02x, $0x%04x", ib, iw);
  }
}
示例#24
0
文件: 6510.c 项目: trieck/source
/*
 * add with carry absolute, y mode
 */
void _adcAby(void)
{
    word addr;
    byte value;
    addr = fetch_word((word)(cpu.pc + 1));
    addr += cpu.y;

    value = fetch_byte(addr);
    ADC(addr);

    cpu.pc += 3;
}
示例#25
0
文件: 6510.c 项目: trieck/source
void _ldaIdy(void)
{
    byte zaddr;
    word addr;
    word res;
    zaddr = fetch_byte((word)(cpu.pc + 1));
    addr = fetch_word(zaddr) + cpu.y;
    res = cpu.a = fetch_byte(addr);
    set_nz(res);

    cpu.pc += 2;
}
示例#26
0
文件: 6510.c 项目: trieck/source
void _oraIdx(void)
{
    byte zaddr;
    word addr;
    word res;
    zaddr = fetch_byte((word)(cpu.pc + 1));
    zaddr += cpu.x;
    addr = fetch_word(zaddr);
    res = cpu.a |= fetch_byte(addr);
    set_nz(res);

    cpu.pc += 2;
}
示例#27
0
文件: 6510.c 项目: trieck/source
/*
 * add with carry indirect, y mode
 */
void _adcIdy(void)
{
    byte zaddr, value;
    word addr;

    zaddr = fetch_byte((word)(cpu.pc + 1));

    addr = fetch_word(zaddr) + cpu.y;
    value = fetch_byte(addr);
    ADC(value);

    cpu.pc += 2;
}
示例#28
0
文件: 6510.c 项目: trieck/source
void _cpyAbsl(void)
{
    word addr;
    word res;

    addr = fetch_word((word)(cpu.pc + 1));

    res = cpu.y - fetch_byte(addr);

    set_carry(res < 0x100);
    set_nz(res);

    cpu.pc += 3;
}
示例#29
0
文件: 6510.c 项目: trieck/source
void _sbcIdx(void)
{
    byte zaddr, value;
    word addr;

    zaddr = fetch_byte((word)(cpu.pc + 1));
    zaddr += cpu.x;

    addr = fetch_word(zaddr);
    value = fetch_byte(addr);
    SBC(value);

    cpu.pc += 2;
}
示例#30
0
文件: 6510.c 项目: trieck/source
void _decAbsl(void)
{
    word addr;
    word res;

    addr = fetch_word((word)(cpu.pc + 1));

    res = fetch_byte(addr);
    res = (res - 1) & 0xFF;

    store_byte(addr, (byte)res);

    set_nz(res);

    cpu.pc += 3;
}