source: Daodan/src/beaengine/Includes/instr_set/opcodes_Grp3.c@ 1086

Last change on this file since 1086 was 984, checked in by alloc, 11 years ago

Daodan: TV code

File size: 10.6 KB
RevLine 
[984]1/* Copyright 2006-2009, BeatriX
2 * File coded by BeatriX
3 *
4 * This file is part of BeaEngine.
5 *
6 * BeaEngine is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * BeaEngine is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */
18
19/* ====================================================================
20 * 0f6h
21 * ==================================================================== */
22void __bea_callspec__ G3_Eb(PDISASM pMyDisasm)
23{
24 GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
25 if (GV.REGOPCODE == 0) {
26 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8;
27 #ifndef BEA_LIGHT_DISASSEMBLY
28 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test ");
29 #endif
30 EbIb(pMyDisasm);
31 (*pMyDisasm).Argument1.AccessMode = READ;
32 FillFlags(pMyDisasm, 104);
33 }
34 else if (GV.REGOPCODE == 1) {
35 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8;
36 #ifndef BEA_LIGHT_DISASSEMBLY
37 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test ");
38 #endif
39 EbIb(pMyDisasm);
40 (*pMyDisasm).Argument1.AccessMode = READ;
41 FillFlags(pMyDisasm, 104);
42 }
43 else if (GV.REGOPCODE == 2) {
44 if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) {
45 (*pMyDisasm).Prefix.LockPrefix = InUsePrefix;
46 }
47 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION;
48 #ifndef BEA_LIGHT_DISASSEMBLY
49 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not ");
50 #endif
51 Eb(pMyDisasm);
52 FillFlags(pMyDisasm, 73);
53 }
54 else if (GV.REGOPCODE == 3) {
55 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
56 #ifndef BEA_LIGHT_DISASSEMBLY
57 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg ");
58 #endif
59 Eb(pMyDisasm);
60 FillFlags(pMyDisasm, 71);
61 }
62 else if (GV.REGOPCODE == 4) {
63 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
64 #ifndef BEA_LIGHT_DISASSEMBLY
65 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul ");
66 #endif
67 GV.MemDecoration = Arg2byte;
68 GV.OperandSize = 8;
69 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
70 GV.OperandSize = 32;
71 GV.EIP_ += GV.DECALAGE_EIP+2;
72 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
73 (*pMyDisasm).Argument1.ArgSize = 8;
74 (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0;
75 FillFlags(pMyDisasm, 70);
76 }
77 else if (GV.REGOPCODE == 5) {
78 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
79 #ifndef BEA_LIGHT_DISASSEMBLY
80 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul ");
81 #endif
82 GV.MemDecoration = Arg2byte;
83 GV.OperandSize = 8;
84 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
85 GV.OperandSize = 32;
86 GV.EIP_ += GV.DECALAGE_EIP+2;
87 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
88 (*pMyDisasm).Argument1.ArgSize = 8;
89 FillFlags(pMyDisasm, 38);
90 }
91 else if (GV.REGOPCODE == 6) {
92 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
93 #ifndef BEA_LIGHT_DISASSEMBLY
94 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div ");
95 #endif
96 GV.MemDecoration = Arg2byte;
97 GV.OperandSize = 8;
98 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
99 GV.OperandSize = 32;
100 GV.EIP_ += GV.DECALAGE_EIP+2;
101 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
102 (*pMyDisasm).Argument1.ArgSize = 8;
103 FillFlags(pMyDisasm, 31);
104 }
105 else if (GV.REGOPCODE == 7) {
106 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
107 #ifndef BEA_LIGHT_DISASSEMBLY
108 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv ");
109 #endif
110 GV.MemDecoration = Arg2byte;
111 GV.OperandSize = 8;
112 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
113 GV.OperandSize = 32;
114 GV.EIP_ += GV.DECALAGE_EIP+2;
115 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
116 (*pMyDisasm).Argument1.ArgSize = 8;
117 (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0;
118 FillFlags(pMyDisasm, 37);
119 }
120}
121
122/* ====================================================================
123 * 0f7h
124 * ==================================================================== */
125void __bea_callspec__ G3_Ev(PDISASM pMyDisasm)
126{
127 GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
128 if (GV.REGOPCODE == 0) {
129 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8;
130 #ifndef BEA_LIGHT_DISASSEMBLY
131 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test ");
132 #endif
133 EvIv(pMyDisasm);
134 (*pMyDisasm).Argument1.AccessMode = READ;
135 FillFlags(pMyDisasm, 104);
136 }
137 else if (GV.REGOPCODE == 1) {
138 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+BIT_UInt8;
139 #ifndef BEA_LIGHT_DISASSEMBLY
140 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "test ");
141 #endif
142 EvIv(pMyDisasm);
143 (*pMyDisasm).Argument1.AccessMode = READ;
144 FillFlags(pMyDisasm, 104);
145 }
146 else if (GV.REGOPCODE == 2) {
147 if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) {
148 (*pMyDisasm).Prefix.LockPrefix = InUsePrefix;
149 }
150 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+LOGICAL_INSTRUCTION;
151 #ifndef BEA_LIGHT_DISASSEMBLY
152 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "not ");
153 #endif
154 Ev(pMyDisasm);
155 FillFlags(pMyDisasm, 73);
156 }
157 else if (GV.REGOPCODE == 3) {
158 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
159 #ifndef BEA_LIGHT_DISASSEMBLY
160 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "neg ");
161 #endif
162 Ev(pMyDisasm);
163 FillFlags(pMyDisasm, 71);
164 }
165 else if (GV.REGOPCODE == 4) {
166 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
167 #ifndef BEA_LIGHT_DISASSEMBLY
168 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "mul ");
169 #endif
170 if (GV.OperandSize == 64) {
171 GV.MemDecoration = Arg2qword;
172 (*pMyDisasm).Argument1.ArgSize = 64;
173 }
174 else if (GV.OperandSize == 32) {
175 GV.MemDecoration = Arg2dword;
176 (*pMyDisasm).Argument1.ArgSize = 32;
177 }
178 else {
179 GV.MemDecoration = Arg2word;
180 (*pMyDisasm).Argument1.ArgSize = 16;
181 }
182 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
183 GV.EIP_ += GV.DECALAGE_EIP+2;
184 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
185 (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
186 FillFlags(pMyDisasm, 70);
187 }
188 else if (GV.REGOPCODE == 5) {
189 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
190 #ifndef BEA_LIGHT_DISASSEMBLY
191 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "imul ");
192 #endif
193 if (GV.OperandSize == 64) {
194 GV.MemDecoration = Arg2qword;
195 (*pMyDisasm).Argument1.ArgSize = 64;
196 }
197 else if (GV.OperandSize == 32) {
198 GV.MemDecoration = Arg2dword;
199 (*pMyDisasm).Argument1.ArgSize = 32;
200 }
201 else {
202 GV.MemDecoration = Arg2word;
203 (*pMyDisasm).Argument1.ArgSize = 16;
204 }
205 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
206 GV.EIP_ += GV.DECALAGE_EIP+2;
207 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
208 (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
209 FillFlags(pMyDisasm, 38);
210 }
211 else if (GV.REGOPCODE == 6) {
212 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
213 #ifndef BEA_LIGHT_DISASSEMBLY
214 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "div ");
215 #endif
216 if (GV.OperandSize == 64) {
217 GV.MemDecoration = Arg2qword;
218 (*pMyDisasm).Argument1.ArgSize = 64;
219 }
220 else if (GV.OperandSize == 32) {
221 GV.MemDecoration = Arg2dword;
222 (*pMyDisasm).Argument1.ArgSize = 32;
223 }
224 else {
225 GV.MemDecoration = Arg2word;
226 (*pMyDisasm).Argument1.ArgSize = 16;
227 }
228 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
229 GV.EIP_ += GV.DECALAGE_EIP+2;
230 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
231 (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
232 FillFlags(pMyDisasm, 31);
233 }
234 else if (GV.REGOPCODE == 7) {
235 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
236 #ifndef BEA_LIGHT_DISASSEMBLY
237 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "idiv ");
238 #endif
239 if (GV.OperandSize == 64) {
240 GV.MemDecoration = Arg2qword;
241 (*pMyDisasm).Argument1.ArgSize = 64;
242 }
243 else if (GV.OperandSize == 32) {
244 GV.MemDecoration = Arg2dword;
245 (*pMyDisasm).Argument1.ArgSize = 32;
246 }
247 else {
248 GV.MemDecoration = Arg2word;
249 (*pMyDisasm).Argument1.ArgSize = 16;
250 }
251 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
252 GV.EIP_ += GV.DECALAGE_EIP+2;
253 (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
254 (*pMyDisasm).Instruction.ImplicitModifiedRegs = REGISTER_TYPE+GENERAL_REG+REG0+REG2;
255 FillFlags(pMyDisasm, 37);
256 }
257}
Note: See TracBrowser for help on using the repository browser.