-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathop_81.c
53 lines (43 loc) · 1.4 KB
/
op_81.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include"bin2inc.h"
boolean op_81(void){
char * mod_rm_str;
char * o_size;
char * mnems[8] = { "add", "or", "adc", 0, "and", "sub", "xor", "cmp" };
char * mnemonic;
char * imm_str;
address_mode = read_byte();
mod_rm_str = mod_rm();
if(operand_size == 32){
o_size = "dword ";
fx = le_checkFixup(current_va.obj_n, current_va.offset);
if((fx->type == 7)&&(fx->size == 4)){
read_dword();
imm_str = getLabel(fx->object_n, fx->target);
}
else{
imm_str = hexbyte(read_dword());
}
}
else if(operand_size == 16){
o_size = "word ";
fx = le_checkFixup(current_va.obj_n, current_va.offset);
if(fx->size != 0){
printf("[DISASM] ::: %s %s %d\n", __FILE__, __FUNCTION__, __LINE__);
printf("[DISASM] [TODO] 16-bit offset fixup\n");
return boolean(0);
}
else{
imm_str = hexbyte(read_word());
}
}
else return boolean(0);
mnemonic = mnems[(address_mode >> 3) & 7];
if(!mnemonic) return boolean(0);
if(((address_mode >> 6) & 3) == 3) o_size = "";
sprintf(ibuffer, iFORMAT"%s%s, %s",
mnemonic, o_size, mod_rm_str, imm_str);
mark_instruction();// comment_instruction();
// push next instruction offset to stack
IDisasm.pushAddress(¤t_va);
return boolean(1);
}