MicrOS
opcodes.h
Go to the documentation of this file.
1 #ifndef MICROS_OPCODES_H
2 #define MICROS_OPCODES_H
3 
4 #include "../v8086.h"
5 
6 #define OPCODE_PROTO_NAME(name) v8086_opcode_##name
7 #define OPCODE_PROTO(name) int16_t OPCODE_PROTO_NAME(name)(v8086* machine, uint8_t opcode)
8 #define ASSIGN_NULL(i) machine->operations[i] = NULL
9 #define ASSIGN_NULL_0FH(i) machine->operations_0fh[i] = NULL
10 #define ASSIGN_OPCODE(i, name) machine->operations[i] = OPCODE_PROTO_NAME(name)
11 #define ASSIGN_0FH_OPCODE(i, name) machine->operations_0fh[i] = OPCODE_PROTO_NAME(name)
12 #define GROUP_OF_OPCODES(from, to, name) for(uint8_t i = from; i <= to; i++) ASSIGN_OPCODE(i, name)
13 #define GROUP_OF_0FH_OPCODES(from, to, name) for(uint8_t i = from; i <= to; i++) ASSIGN_0FH_OPCODE(i, name)
14 
15 OPCODE_PROTO(add);
16 OPCODE_PROTO(push_es);
17 OPCODE_PROTO(pop_es);
18 OPCODE_PROTO(or);
19 OPCODE_PROTO(push_cs);
20 OPCODE_PROTO(adc);
21 OPCODE_PROTO(push_ss);
22 OPCODE_PROTO(pop_ss);
23 OPCODE_PROTO(sbb);
24 OPCODE_PROTO(push_ds);
25 OPCODE_PROTO(pop_ds);
26 OPCODE_PROTO(and);
27 OPCODE_PROTO(daa);
28 OPCODE_PROTO(sub);
29 OPCODE_PROTO(das);
30 OPCODE_PROTO(xor);
31 OPCODE_PROTO(aaa);
32 OPCODE_PROTO(cmp);
33 OPCODE_PROTO(aas);
34 OPCODE_PROTO(inc);
35 OPCODE_PROTO(dec);
38 OPCODE_PROTO(jcc);
39 OPCODE_PROTO(group1);
40 OPCODE_PROTO(test);
41 OPCODE_PROTO(xchg);
42 OPCODE_PROTO(mov_rm);
43 OPCODE_PROTO(mov_segment);
44 OPCODE_PROTO(lea);
46 OPCODE_PROTO(xchg_ax);
47 OPCODE_PROTO(cbw);
48 OPCODE_PROTO(cwd);
50 OPCODE_PROTO(pushf);
51 OPCODE_PROTO(popf);
52 OPCODE_PROTO(sahf);
53 OPCODE_PROTO(lahf);
54 OPCODE_PROTO(mov_moffset);
55 OPCODE_PROTO(movsb);
56 OPCODE_PROTO(movsw);
57 OPCODE_PROTO(cmpsb);
58 OPCODE_PROTO(cmpsw);
59 OPCODE_PROTO(test_imm);
60 OPCODE_PROTO(stosb);
61 OPCODE_PROTO(stosw);
62 OPCODE_PROTO(lodsb);
63 OPCODE_PROTO(lodsw);
64 OPCODE_PROTO(scasb);
65 OPCODE_PROTO(scasw);
66 OPCODE_PROTO(mov_gpr_imm);
67 OPCODE_PROTO(retn);
68 OPCODE_PROTO(retn_imm);
69 OPCODE_PROTO(les);
70 OPCODE_PROTO(lds);
71 OPCODE_PROTO(mov_rm_imm);
72 OPCODE_PROTO(retf_imm);
73 OPCODE_PROTO(retf);
74 OPCODE_PROTO(interrupt);
75 OPCODE_PROTO(iret);
76 OPCODE_PROTO(group_2);
77 OPCODE_PROTO(aam);
78 OPCODE_PROTO(aad);
79 OPCODE_PROTO(xlat);
80 OPCODE_PROTO(loop);
81 OPCODE_PROTO(jrcxz);
82 OPCODE_PROTO(inb_imm);
83 OPCODE_PROTO(inw_imm);
84 OPCODE_PROTO(outb_imm);
85 OPCODE_PROTO(outw_imm);
86 OPCODE_PROTO(call_near);
87 OPCODE_PROTO(jmp_near);
88 OPCODE_PROTO(jmp_far);
89 OPCODE_PROTO(jmp_short);
90 OPCODE_PROTO(inb_dx);
91 OPCODE_PROTO(inw_dx);
92 OPCODE_PROTO(outb_dx);
93 OPCODE_PROTO(outw_dx);
94 OPCODE_PROTO(set_flag);
95 OPCODE_PROTO(group_3);
96 OPCODE_PROTO(group_4);
97 OPCODE_PROTO(group_5);
98 
99 //386 PROTOS
102 OPCODE_PROTO(bound);
103 OPCODE_PROTO(push_imm16_32);
104 OPCODE_PROTO(push_imm8);
105 OPCODE_PROTO(imul_reg_reg_imm);
106 OPCODE_PROTO(imul_reg_reg_imm8);
107 OPCODE_PROTO(ins8);
108 OPCODE_PROTO(ins);
109 OPCODE_PROTO(outs8);
110 OPCODE_PROTO(outs);
113 //386 2_bytes_protos 0x0f Prefix
114 OPCODE_PROTO(two_byte_0fh);
115 OPCODE_PROTO(jcc_l);
116 OPCODE_PROTO(setcc);
117 OPCODE_PROTO(push_fs);
118 OPCODE_PROTO(pop_fs);
119 OPCODE_PROTO(push_gs);
120 OPCODE_PROTO(pop_gs);
121 OPCODE_PROTO(bt);
122 OPCODE_PROTO(bts);
123 OPCODE_PROTO(btr);
124 OPCODE_PROTO(btc);
125 OPCODE_PROTO(group_8);
126 OPCODE_PROTO(shld_imm);
127 OPCODE_PROTO(shld_cl);
128 OPCODE_PROTO(shrd_imm);
129 OPCODE_PROTO(shrd_cl);
130 OPCODE_PROTO(imul_2_byte);
131 OPCODE_PROTO(lss);
132 OPCODE_PROTO(lfs);
133 OPCODE_PROTO(lgs);
134 OPCODE_PROTO(movzx);
135 OPCODE_PROTO(movsx);
136 OPCODE_PROTO(bsf);
137 OPCODE_PROTO(bsr);
138 
139 OPCODE_PROTO(prefix_cs);
140 
141 OPCODE_PROTO(prefix_ds);
142 
143 OPCODE_PROTO(prefix_es);
144 
145 OPCODE_PROTO(prefix_fs);
146 
147 OPCODE_PROTO(prefix_gs);
148 
149 OPCODE_PROTO(prefix_ss);
150 
151 OPCODE_PROTO(prefix_address_32);
152 
153 OPCODE_PROTO(prefix_operand_32);
154 
155 OPCODE_PROTO(prefix_repne);
156 
157 OPCODE_PROTO(prefix_rep_repe);
158 
159 OPCODE_PROTO(prefix_lock);
160 
161 #endif //MICROS_OPCODES_H
int16_t enter(v8086 *machine, uint8_t width)
Definition: stack_operations.c:133
int16_t pop_gpr(v8086 *machine, uint8_t opcode)
Definition: stack_operations.c:20
int16_t far_call(v8086 *machine)
Definition: procedure_operations.c:19
int16_t push_all(v8086 *machine)
Definition: stack_operations.c:47
int16_t pop_all(v8086 *machine)
Definition: stack_operations.c:75
#define OPCODE_PROTO(name)
Definition: opcodes.h:7
int16_t push_gpr(v8086 *machine, uint8_t opcode)
Definition: stack_operations.c:8
int16_t leave(v8086 *machine, uint8_t width)
Definition: stack_operations.c:189
int16_t pop_rm(v8086 *machine)
Definition: stack_operations.c:32