source: Daodan/src/beaengine/Includes/Routines_ModRM.c

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

Daodan: TV code

File size: 128.2 KB
Line 
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 * ======================================= */
21void __bea_callspec__ MOD_RM(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
22{
23 GV.DECALAGE_EIP = 0;
24 if (!Security(1, pMyDisasm)) return;
25 GV.MOD_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 6) & 0x3;
26 GV.RM_ = (*((UInt8*)(UIntPtr) (GV.EIP_+1))) & 0x7;
27 if (GV.MOD_ == 0) {
28 ModRM_0[GV.RM_](pMyArgument, pMyDisasm);
29 }
30 else if (GV.MOD_ == 1) {
31 GV.DECALAGE_EIP++;
32 ModRM_1[GV.RM_](pMyArgument, pMyDisasm);
33 }
34 else if (GV.MOD_ == 2) {
35 if (GV.AddressSize >= 32) {
36 GV.DECALAGE_EIP += 4;
37 }
38 else {
39 GV.DECALAGE_EIP += 2;
40 }
41 ModRM_2[GV.RM_](pMyArgument, pMyDisasm);
42 }
43 else {
44 ModRM_3[GV.RM_](pMyArgument, pMyDisasm);
45 }
46
47}
48/* =======================================
49 *
50 * ======================================= */
51void __bea_callspec__ Reg_Opcode(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
52{
53 size_t i = 0;
54 if (!Security(1, pMyDisasm)) return;
55 GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
56 if (GV.REX.R_ == 1) {
57 GV.REGOPCODE += 0x8;
58 }
59 if (GV.MMX_ == 1) {
60 #ifndef BEA_LIGHT_DISASSEMBLY
61 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[GV.REGOPCODE]);
62 #endif
63 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[GV.REGOPCODE];
64 (*pMyArgument).ArgSize = 64;
65 }
66 else if (GV.SEG_ == 1) {
67 #ifndef BEA_LIGHT_DISASSEMBLY
68 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSEG[GV.REGOPCODE]);
69 #endif
70 (*pMyArgument).ArgType = REGISTER_TYPE+SEGMENT_REG+REGS[GV.REGOPCODE];
71 (*pMyArgument).ArgSize = 16;
72 }
73 else if (GV.CR_ == 1) {
74 #ifndef BEA_LIGHT_DISASSEMBLY
75 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersCR[GV.REGOPCODE]);
76 #endif
77 (*pMyArgument).ArgType = REGISTER_TYPE+CR_REG+REGS[GV.REGOPCODE];
78 (*pMyArgument).ArgSize = 32;
79 }
80 else if (GV.DR_ == 1) {
81 if (GV.SYNTAX_ == ATSyntax) {
82 #ifndef BEA_LIGHT_DISASSEMBLY
83 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR_AT[GV.REGOPCODE]);
84 #endif
85 }
86 else {
87 #ifndef BEA_LIGHT_DISASSEMBLY
88 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersDR[GV.REGOPCODE]);
89 #endif
90 }
91 (*pMyArgument).ArgType = REGISTER_TYPE+DR_REG+REGS[GV.REGOPCODE];
92 (*pMyArgument).ArgSize = 32;
93 }
94 else if (GV.SSE_ == 1) {
95 #ifndef BEA_LIGHT_DISASSEMBLY
96 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[GV.REGOPCODE]);
97 #endif
98 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[GV.REGOPCODE];
99 (*pMyArgument).ArgSize = 128;
100 }
101 else if (GV.OperandSize == 8) {
102 if (GV.REX.state == 0) {
103 #ifndef BEA_LIGHT_DISASSEMBLY
104 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[GV.REGOPCODE]);
105 #endif
106 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[GV.REGOPCODE];
107 if (GV.REGOPCODE >= 4) {
108 (*pMyArgument).ArgPosition = HighPosition;
109 }
110 (*pMyArgument).ArgSize = 8;
111 }
112 else {
113 #ifndef BEA_LIGHT_DISASSEMBLY
114 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[GV.REGOPCODE]);
115 #endif
116 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
117 (*pMyArgument).ArgSize = 8;
118 }
119 }
120 else if (GV.OperandSize == 16) {
121 #ifndef BEA_LIGHT_DISASSEMBLY
122 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[GV.REGOPCODE]);
123 #endif
124 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
125 (*pMyArgument).ArgSize = 16;
126 }
127 else if (GV.OperandSize == 32) {
128 #ifndef BEA_LIGHT_DISASSEMBLY
129 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.REGOPCODE]);
130 #endif
131 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
132 (*pMyArgument).ArgSize = 32;
133 }
134 else if (GV.OperandSize == 64) {
135 #ifndef BEA_LIGHT_DISASSEMBLY
136 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.REGOPCODE]);
137 #endif
138 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[GV.REGOPCODE];
139 (*pMyArgument).ArgSize = 64;
140 }
141}
142/* =======================================
143 * ModRM_0
144 * ======================================= */
145void __bea_callspec__ Addr_EAX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
146{
147 #ifndef BEA_LIGHT_DISASSEMBLY
148 size_t i = 0;
149 if (GV.SYNTAX_ == ATSyntax) {
150 (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%");
151 i += 2;
152 }
153 #endif
154 (*pMyArgument).ArgType = MEMORY_TYPE;
155 if (GV.AddressSize == 64) {
156 if (GV.REX.B_ == 1) {
157 #ifndef BEA_LIGHT_DISASSEMBLY
158 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]);
159 #endif
160 (*pMyArgument).Memory.BaseRegister = REGS[8];
161 }
162 else {
163 #ifndef BEA_LIGHT_DISASSEMBLY
164 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]);
165 #endif
166 (*pMyArgument).Memory.BaseRegister = REGS[0];
167 }
168 }
169 else if (GV.AddressSize == 32) {
170
171 if (GV.REX.B_ == 1) {
172 #ifndef BEA_LIGHT_DISASSEMBLY
173 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]);
174 #endif
175 (*pMyArgument).Memory.BaseRegister = REGS[8];
176
177 }
178 else {
179 #ifndef BEA_LIGHT_DISASSEMBLY
180 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]);
181 #endif
182 (*pMyArgument).Memory.BaseRegister = REGS[0];
183 }
184 }
185 else {
186 #ifndef BEA_LIGHT_DISASSEMBLY
187 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_);
188 #endif
189 (*pMyArgument).Memory.BaseRegister = REGS[3];
190 (*pMyArgument).Memory.IndexRegister = REGS[6];
191 }
192 #ifndef BEA_LIGHT_DISASSEMBLY
193 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
194 if (GV.SYNTAX_ == ATSyntax) {
195 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
196 i += 1;
197 }
198 #endif
199
200}
201/* =======================================
202 *
203 * ======================================= */
204void __bea_callspec__ Addr_ECX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
205{
206 #ifndef BEA_LIGHT_DISASSEMBLY
207 size_t i = 0;
208 if (GV.SYNTAX_ == ATSyntax) {
209 (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%");
210 i += 2;
211 }
212 #endif
213
214 (*pMyArgument).ArgType = MEMORY_TYPE;
215 if (GV.AddressSize == 64) {
216 if (GV.REX.B_ == 1) {
217 #ifndef BEA_LIGHT_DISASSEMBLY
218 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]);
219 #endif
220 (*pMyArgument).Memory.BaseRegister = REGS[1+8];
221 }
222 else {
223 #ifndef BEA_LIGHT_DISASSEMBLY
224 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]);
225 #endif
226 (*pMyArgument).Memory.BaseRegister = REGS[1];
227 }
228 }
229 else if (GV.AddressSize == 32) {
230
231 if (GV.REX.B_ == 1) {
232 #ifndef BEA_LIGHT_DISASSEMBLY
233 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]);
234 #endif
235 (*pMyArgument).Memory.BaseRegister = REGS[1+8];
236
237 }
238 else {
239 #ifndef BEA_LIGHT_DISASSEMBLY
240 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]);
241 #endif
242 (*pMyArgument).Memory.BaseRegister = REGS[1];
243 }
244 }
245 else {
246 #ifndef BEA_LIGHT_DISASSEMBLY
247 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_);
248 #endif
249 (*pMyArgument).Memory.BaseRegister = REGS[3];
250 (*pMyArgument).Memory.IndexRegister = REGS[7];
251 }
252 #ifndef BEA_LIGHT_DISASSEMBLY
253 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
254 if (GV.SYNTAX_ == ATSyntax) {
255 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
256 i += 1;
257 }
258 #endif
259
260}
261
262/* =======================================
263 *
264 * ======================================= */
265void __bea_callspec__ Addr_EDX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
266{
267 #ifndef BEA_LIGHT_DISASSEMBLY
268 size_t i = 0;
269 if (GV.SYNTAX_ == ATSyntax) {
270 (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%");
271 i += 2;
272 }
273 #endif
274 (*pMyArgument).ArgType = MEMORY_TYPE;
275 if (GV.AddressSize == 64) {
276 if (GV.REX.B_ == 1) {
277 #ifndef BEA_LIGHT_DISASSEMBLY
278 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]);
279 #endif
280 (*pMyArgument).Memory.BaseRegister = REGS[2+8];
281 }
282 else {
283 #ifndef BEA_LIGHT_DISASSEMBLY
284 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]);
285 #endif
286 (*pMyArgument).Memory.BaseRegister = REGS[2];
287 }
288 }
289 else if (GV.AddressSize == 32) {
290
291 if (GV.REX.B_ == 1) {
292 #ifndef BEA_LIGHT_DISASSEMBLY
293 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]);
294 #endif
295 (*pMyArgument).Memory.BaseRegister = REGS[2+8];
296 }
297 else {
298 #ifndef BEA_LIGHT_DISASSEMBLY
299 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]);
300 #endif
301 (*pMyArgument).Memory.BaseRegister = REGS[2];
302 }
303 }
304 else {
305 #ifndef BEA_LIGHT_DISASSEMBLY
306 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_);
307 #endif
308 (*pMyArgument).Memory.BaseRegister = REGS[5];
309 (*pMyArgument).Memory.IndexRegister = REGS[6];
310 }
311 #ifndef BEA_LIGHT_DISASSEMBLY
312 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
313 if (GV.SYNTAX_ == ATSyntax) {
314 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
315 i += 1;
316 }
317 #endif
318}
319
320
321/* =======================================
322 *
323 * ======================================= */
324void __bea_callspec__ Addr_EBX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
325{
326 #ifndef BEA_LIGHT_DISASSEMBLY
327 size_t i = 0;
328 if (GV.SYNTAX_ == ATSyntax) {
329 (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%");
330 i += 2;
331 }
332 #endif
333 (*pMyArgument).ArgType = MEMORY_TYPE;
334 if (GV.AddressSize == 64) {
335 if (GV.REX.B_ == 1) {
336 #ifndef BEA_LIGHT_DISASSEMBLY
337 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]);
338 #endif
339 (*pMyArgument).Memory.BaseRegister = REGS[3+8];
340 }
341 else {
342 #ifndef BEA_LIGHT_DISASSEMBLY
343 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]);
344 #endif
345 (*pMyArgument).Memory.BaseRegister = REGS[3];
346 }
347 }
348 else if (GV.AddressSize == 32) {
349
350 if (GV.REX.B_ == 1) {
351 #ifndef BEA_LIGHT_DISASSEMBLY
352 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]);
353 #endif
354 (*pMyArgument).Memory.BaseRegister = REGS[3+8];
355 }
356 else {
357 #ifndef BEA_LIGHT_DISASSEMBLY
358 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]);
359 #endif
360 (*pMyArgument).Memory.BaseRegister = REGS[3];
361 }
362 }
363 else {
364 #ifndef BEA_LIGHT_DISASSEMBLY
365 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_);
366 #endif
367 (*pMyArgument).Memory.BaseRegister = REGS[5];
368 (*pMyArgument).Memory.IndexRegister = REGS[7];
369 }
370 #ifndef BEA_LIGHT_DISASSEMBLY
371 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
372 if (GV.SYNTAX_ == ATSyntax) {
373 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
374 i += 1;
375 }
376 #endif
377
378}
379
380/* =======================================
381 *
382 * ======================================= */
383void __bea_callspec__ Addr_SIB(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
384{
385 if (!Security(2, pMyDisasm)) return;
386 (*pMyArgument).ArgType = MEMORY_TYPE;
387 if (GV.AddressSize >= 32) {
388 GV.DECALAGE_EIP++;
389 GV.BASE_ = ((UInt8) *((UInt8*) (UIntPtr) (GV.EIP_+2))) & 0x7;
390 GV.SCALE_ = (((UInt8) *((UInt8*) (UIntPtr)(GV.EIP_+2))) & 0xc0) >> 6;
391 GV.INDEX_ = (((UInt8) *((UInt8*) (UIntPtr)(GV.EIP_+2))) & 0x38) >> 3;
392 (void) SIB[GV.SCALE_ ](pMyArgument, 0, pMyDisasm);
393 }
394 else {
395 #ifndef BEA_LIGHT_DISASSEMBLY
396 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]);
397 #endif
398 (*pMyArgument).Memory.BaseRegister = REGS[6];
399 }
400}
401
402/* =======================================
403 *
404 * ======================================= */
405void __bea_callspec__ Addr_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
406{
407 Int32 MyNumber;
408 UInt64 MyAddress;
409 size_t i = 0;
410 (*pMyArgument).ArgType = MEMORY_TYPE;
411 if (GV.AddressSize >= 32) {
412 if (!Security(6, pMyDisasm)) return;
413 GV.DECALAGE_EIP+=4;
414 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
415 (*pMyArgument).Memory.Displacement = MyNumber;
416 if (GV.Architecture == 64) {
417 MyNumber += 6;
418 MyNumber += GV.NB_PREFIX;
419 if (GV.ImmediatSize == 32) {
420 MyNumber += 4;
421 }
422 if (GV.ImmediatSize == 16) {
423 MyNumber += 2;
424 }
425 if (GV.ImmediatSize == 8) {
426 MyNumber += 1;
427 }
428 if ((*pMyDisasm).Instruction.Opcode >= 0x0F3800) { /* add two bytes if opcode is a 3-bytes */
429 MyNumber +=2;
430 }
431 else if ((*pMyDisasm).Instruction.Opcode >= 0x0100) { /* add one byte if opcode is a 2-bytes */
432 MyNumber +=1;
433 }
434 CalculateRelativeAddress(&MyAddress, (Int64)MyNumber, pMyDisasm);
435 (*pMyDisasm).Instruction.AddrValue = MyAddress;
436 #ifndef BEA_LIGHT_DISASSEMBLY
437 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.16llX", (Int64)MyAddress);
438 #endif
439 (*pMyArgument).ArgType |= RELATIVE_;
440 }
441 else {
442 #ifndef BEA_LIGHT_DISASSEMBLY
443 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X", (Int64)MyNumber);
444 #endif
445 }
446 }
447 else {
448 #ifndef BEA_LIGHT_DISASSEMBLY
449 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[7]);
450 #endif
451 (*pMyArgument).Memory.BaseRegister = REGS[7];
452 }
453}
454
455/* =======================================
456 *
457 * ======================================= */
458void __bea_callspec__ Addr_ESI(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
459{
460 long MyNumber;
461 #ifndef BEA_LIGHT_DISASSEMBLY
462 size_t i = 0;
463 if (GV.SYNTAX_ == ATSyntax) {
464 (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%");
465 i += 2;
466 }
467 #endif
468 (*pMyArgument).ArgType = MEMORY_TYPE;
469 if (GV.AddressSize == 64) {
470 if (GV.REX.B_ == 1) {
471 #ifndef BEA_LIGHT_DISASSEMBLY
472 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]);
473 #endif
474 (*pMyArgument).Memory.BaseRegister = REGS[6+8];
475 }
476 else {
477 #ifndef BEA_LIGHT_DISASSEMBLY
478 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]);
479 #endif
480 (*pMyArgument).Memory.BaseRegister = REGS[6];
481 }
482 }
483 else if (GV.AddressSize == 32) {
484
485 if (GV.REX.B_ == 1) {
486 #ifndef BEA_LIGHT_DISASSEMBLY
487 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]);
488 #endif
489 (*pMyArgument).Memory.BaseRegister = REGS[6+8];
490 }
491 else {
492 #ifndef BEA_LIGHT_DISASSEMBLY
493 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]);
494 #endif
495 (*pMyArgument).Memory.BaseRegister = REGS[6];
496 }
497 }
498 else {
499 GV.DECALAGE_EIP+=2;
500 MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+2));
501 (*pMyArgument).Memory.Displacement = MyNumber;
502 if (!Security(2, pMyDisasm)) return;
503 #ifndef BEA_LIGHT_DISASSEMBLY
504 (void) CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.4X", (Int64)MyNumber);
505 #endif
506 }
507 #ifndef BEA_LIGHT_DISASSEMBLY
508 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
509 if (GV.SYNTAX_ == ATSyntax) {
510 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
511 i += 1;
512 }
513 #endif
514}
515
516/* =======================================
517 *
518 * ======================================= */
519void __bea_callspec__ Addr_EDI(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
520{
521 #ifndef BEA_LIGHT_DISASSEMBLY
522 size_t i = 0;
523 if (GV.SYNTAX_ == ATSyntax) {
524 (void) strcpy((char*) (*pMyArgument).ArgMnemonic, "(%");
525 i += 2;
526 }
527 #endif
528 (*pMyArgument).ArgType = MEMORY_TYPE;
529 if (GV.AddressSize == 64) {
530 if (GV.REX.B_ == 1) {
531 #ifndef BEA_LIGHT_DISASSEMBLY
532 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]);
533 #endif
534 (*pMyArgument).Memory.BaseRegister = REGS[7+8];
535 }
536 else {
537 #ifndef BEA_LIGHT_DISASSEMBLY
538 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]);
539 #endif
540 (*pMyArgument).Memory.BaseRegister = REGS[7];
541 }
542 }
543 else if (GV.AddressSize == 32) {
544
545 if (GV.REX.B_ == 1) {
546 #ifndef BEA_LIGHT_DISASSEMBLY
547 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]);
548 #endif
549 (*pMyArgument).Memory.BaseRegister = REGS[7+8];
550 }
551 else {
552 #ifndef BEA_LIGHT_DISASSEMBLY
553 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]);
554 #endif
555 (*pMyArgument).Memory.BaseRegister = REGS[7];
556 }
557 }
558 else {
559 #ifndef BEA_LIGHT_DISASSEMBLY
560 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]);
561 #endif
562 (*pMyArgument).Memory.BaseRegister = REGS[3];
563 }
564 #ifndef BEA_LIGHT_DISASSEMBLY
565 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
566 if (GV.SYNTAX_ == ATSyntax) {
567 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
568 i += 1;
569 }
570 #endif
571}
572
573/* =======================================
574 * ModRM_1
575 * ======================================= */
576void __bea_callspec__ Addr_EAX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
577{
578 size_t i = 0, j;
579 long MyNumber;
580 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
581 (*pMyArgument).Memory.Displacement = MyNumber;
582 if (GV.SYNTAX_ == ATSyntax) {
583 if (MyNumber < 0) {
584 #ifndef BEA_LIGHT_DISASSEMBLY
585 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
586 #endif
587 i++;
588 j=i;
589 #ifndef BEA_LIGHT_DISASSEMBLY
590 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
591 #endif
592 }
593 else {
594 j=i;
595 #ifndef BEA_LIGHT_DISASSEMBLY
596 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
597 #endif
598 }
599 #ifndef BEA_LIGHT_DISASSEMBLY
600 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
601 #endif
602 i+=2;
603 }
604 (*pMyArgument).ArgType = MEMORY_TYPE;
605 if (GV.AddressSize == 64) {
606 if (GV.REX.B_ == 1) {
607 #ifndef BEA_LIGHT_DISASSEMBLY
608 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]);
609 #endif
610 (*pMyArgument).Memory.BaseRegister = REGS[8];
611 }
612 else {
613 #ifndef BEA_LIGHT_DISASSEMBLY
614 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]);
615 #endif
616 (*pMyArgument).Memory.BaseRegister = REGS[0];
617 }
618 }
619 else if (GV.AddressSize == 32) {
620
621 if (GV.REX.B_ == 1) {
622 #ifndef BEA_LIGHT_DISASSEMBLY
623 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]);
624 #endif
625 (*pMyArgument).Memory.BaseRegister = REGS[8];
626
627 }
628 else {
629 #ifndef BEA_LIGHT_DISASSEMBLY
630 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]);
631 #endif
632 (*pMyArgument).Memory.BaseRegister = REGS[0];
633 }
634 }
635 else {
636 #ifndef BEA_LIGHT_DISASSEMBLY
637 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_);
638 #endif
639 (*pMyArgument).Memory.BaseRegister = REGS[3];
640 (*pMyArgument).Memory.IndexRegister = REGS[6];
641 }
642 #ifndef BEA_LIGHT_DISASSEMBLY
643 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
644 if (GV.SYNTAX_ == ATSyntax) {
645 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
646 i += 1;
647 }
648 else {
649 #else
650 if(1) {
651 #endif
652 if (MyNumber < 0) {
653 #ifndef BEA_LIGHT_DISASSEMBLY
654 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
655 #endif
656 i++;
657 #ifndef BEA_LIGHT_DISASSEMBLY
658 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
659 #endif
660 }
661 else {
662 #ifndef BEA_LIGHT_DISASSEMBLY
663 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
664 #endif
665 i++;
666 #ifndef BEA_LIGHT_DISASSEMBLY
667 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
668 #endif
669 }
670 }
671}
672
673/* =======================================
674 * ModRM_1
675 * ======================================= */
676void __bea_callspec__ Addr_ECX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
677{
678 size_t i = 0, j;
679 long MyNumber;
680 MyNumber = (Int8) *((UInt8*) (UIntPtr)GV.EIP_+2);
681 (*pMyArgument).Memory.Displacement = MyNumber;
682 if (GV.SYNTAX_ == ATSyntax) {
683 if (MyNumber < 0) {
684 #ifndef BEA_LIGHT_DISASSEMBLY
685 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
686 #endif
687 i++;
688 j=i;
689 #ifndef BEA_LIGHT_DISASSEMBLY
690 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
691 #endif
692 }
693 else {
694 j=i;
695 #ifndef BEA_LIGHT_DISASSEMBLY
696 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
697 #endif
698 }
699 #ifndef BEA_LIGHT_DISASSEMBLY
700 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
701 #endif
702 i+=2;
703 }
704 (*pMyArgument).ArgType = MEMORY_TYPE;
705 if (GV.AddressSize == 64) {
706 if (GV.REX.B_ == 1) {
707 #ifndef BEA_LIGHT_DISASSEMBLY
708 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]);
709 #endif
710 (*pMyArgument).Memory.BaseRegister = REGS[1+8];
711 }
712 else {
713 #ifndef BEA_LIGHT_DISASSEMBLY
714 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]);
715 #endif
716 (*pMyArgument).Memory.BaseRegister = REGS[1];
717 }
718 }
719 else if (GV.AddressSize == 32) {
720
721 if (GV.REX.B_ == 1) {
722 #ifndef BEA_LIGHT_DISASSEMBLY
723 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]);
724 #endif
725 (*pMyArgument).Memory.BaseRegister = REGS[1+8];
726
727 }
728 else {
729 #ifndef BEA_LIGHT_DISASSEMBLY
730 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]);
731 #endif
732 (*pMyArgument).Memory.BaseRegister = REGS[1];
733 }
734 }
735 else {
736 #ifndef BEA_LIGHT_DISASSEMBLY
737 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_);
738 #endif
739 (*pMyArgument).Memory.BaseRegister = REGS[3];
740 (*pMyArgument).Memory.IndexRegister = REGS[7];
741 }
742 #ifndef BEA_LIGHT_DISASSEMBLY
743 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
744 if (GV.SYNTAX_ == ATSyntax) {
745 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
746 i += 1;
747 }
748 else {
749 #else
750 if(1) {
751 #endif
752 if (MyNumber < 0) {
753 #ifndef BEA_LIGHT_DISASSEMBLY
754 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
755 #endif
756 i++;
757 #ifndef BEA_LIGHT_DISASSEMBLY
758 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
759 #endif
760 }
761 else {
762 #ifndef BEA_LIGHT_DISASSEMBLY
763 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
764 #endif
765 i++;
766 #ifndef BEA_LIGHT_DISASSEMBLY
767 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
768 #endif
769 }
770 }
771}
772
773/* =======================================
774 * ModRM_1
775 * ======================================= */
776void __bea_callspec__ Addr_EDX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
777{
778 size_t i = 0, j;
779 long MyNumber;
780 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
781 (*pMyArgument).Memory.Displacement = MyNumber;
782 if (GV.SYNTAX_ == ATSyntax) {
783 if (MyNumber < 0) {
784 #ifndef BEA_LIGHT_DISASSEMBLY
785 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
786 #endif
787 i++;
788 j=i;
789 #ifndef BEA_LIGHT_DISASSEMBLY
790 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
791 #endif
792 }
793 else {
794 j=i;
795 #ifndef BEA_LIGHT_DISASSEMBLY
796 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
797 #endif
798 }
799 #ifndef BEA_LIGHT_DISASSEMBLY
800 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
801 #endif
802 i+=2;
803 }
804 (*pMyArgument).ArgType = MEMORY_TYPE;
805 if (GV.AddressSize == 64) {
806 if (GV.REX.B_ == 1) {
807 #ifndef BEA_LIGHT_DISASSEMBLY
808 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]);
809 #endif
810 (*pMyArgument).Memory.BaseRegister = REGS[2+8];
811 }
812 else {
813 #ifndef BEA_LIGHT_DISASSEMBLY
814 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]);
815 #endif
816 (*pMyArgument).Memory.BaseRegister = REGS[2];
817 }
818 }
819 else if (GV.AddressSize == 32) {
820 if (GV.REX.B_ == 1) {
821 #ifndef BEA_LIGHT_DISASSEMBLY
822 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]);
823 #endif
824 (*pMyArgument).Memory.BaseRegister = REGS[2+8];
825
826 }
827 else {
828 #ifndef BEA_LIGHT_DISASSEMBLY
829 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]);
830 #endif
831 (*pMyArgument).Memory.BaseRegister = REGS[2];
832 }
833 }
834 else {
835 #ifndef BEA_LIGHT_DISASSEMBLY
836 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_);
837 #endif
838 (*pMyArgument).Memory.BaseRegister = REGS[5];
839 (*pMyArgument).Memory.IndexRegister = REGS[6];
840 }
841 #ifndef BEA_LIGHT_DISASSEMBLY
842 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
843 if (GV.SYNTAX_ == ATSyntax) {
844 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
845 i += 1;
846 }
847 else {
848 #else
849 if(1) {
850 #endif
851 if (MyNumber < 0) {
852 #ifndef BEA_LIGHT_DISASSEMBLY
853 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
854 #endif
855 i++;
856 #ifndef BEA_LIGHT_DISASSEMBLY
857 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
858 #endif
859 }
860 else {
861 #ifndef BEA_LIGHT_DISASSEMBLY
862 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
863 #endif
864 i++;
865 #ifndef BEA_LIGHT_DISASSEMBLY
866 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
867 #endif
868 }
869 }
870}
871
872/* =======================================
873 * ModRM_1
874 * ======================================= */
875void __bea_callspec__ Addr_EBX_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
876{
877 size_t i = 0, j;
878 long MyNumber;
879 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
880 (*pMyArgument).Memory.Displacement = MyNumber;
881 if (GV.SYNTAX_ == ATSyntax) {
882 if (MyNumber < 0) {
883 #ifndef BEA_LIGHT_DISASSEMBLY
884 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
885 #endif
886 i++;
887 j=i;
888 #ifndef BEA_LIGHT_DISASSEMBLY
889 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
890 #endif
891 }
892 else {
893 j=i;
894 #ifndef BEA_LIGHT_DISASSEMBLY
895 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
896 #endif
897 }
898 #ifndef BEA_LIGHT_DISASSEMBLY
899 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
900 #endif
901 i+=2;
902 }
903 (*pMyArgument).ArgType = MEMORY_TYPE;
904 if (GV.AddressSize == 64) {
905 if (GV.REX.B_ == 1) {
906 #ifndef BEA_LIGHT_DISASSEMBLY
907 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]);
908 #endif
909 (*pMyArgument).Memory.BaseRegister = REGS[3+8];
910 }
911 else {
912 #ifndef BEA_LIGHT_DISASSEMBLY
913 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]);
914 #endif
915 (*pMyArgument).Memory.BaseRegister = REGS[3];
916 }
917 }
918 else if (GV.AddressSize == 32) {
919 if (GV.REX.B_ == 1) {
920 #ifndef BEA_LIGHT_DISASSEMBLY
921 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]);
922 #endif
923 (*pMyArgument).Memory.BaseRegister = REGS[3+8];
924
925 }
926 else {
927 #ifndef BEA_LIGHT_DISASSEMBLY
928 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]);
929 #endif
930 (*pMyArgument).Memory.BaseRegister = REGS[3];
931 }
932 }
933 else {
934 #ifndef BEA_LIGHT_DISASSEMBLY
935 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_);
936 #endif
937 (*pMyArgument).Memory.BaseRegister = REGS[5];
938 (*pMyArgument).Memory.IndexRegister = REGS[7];
939 }
940 #ifndef BEA_LIGHT_DISASSEMBLY
941 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
942 if (GV.SYNTAX_ == ATSyntax) {
943 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
944 i += 1;
945 }
946 else {
947 #else
948 if(1) {
949 #endif
950 if (MyNumber < 0) {
951 #ifndef BEA_LIGHT_DISASSEMBLY
952 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
953 #endif
954 i++;
955 #ifndef BEA_LIGHT_DISASSEMBLY
956 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
957 #endif
958 }
959 else {
960 #ifndef BEA_LIGHT_DISASSEMBLY
961 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
962 #endif
963 i++;
964 #ifndef BEA_LIGHT_DISASSEMBLY
965 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
966 #endif
967 }
968 }
969}
970
971/* =======================================
972 *
973 * ======================================= */
974void __bea_callspec__ Addr_SIB_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
975{
976 size_t i = 0, j;
977 long MyNumber;
978 if (!Security(2, pMyDisasm)) return;
979 if (GV.AddressSize >= 32) {
980 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+3));
981 }
982 else {
983 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
984 }
985 (*pMyArgument).Memory.Displacement = MyNumber;
986 if (GV.SYNTAX_ == ATSyntax) {
987 if (MyNumber < 0) {
988 #ifndef BEA_LIGHT_DISASSEMBLY
989 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
990 #endif
991 i++;
992 j=i;
993 #ifndef BEA_LIGHT_DISASSEMBLY
994 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
995 #endif
996 }
997 else {
998 j=i;
999 #ifndef BEA_LIGHT_DISASSEMBLY
1000 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
1001 #endif
1002 }
1003 /*#ifndef BEA_LIGHT_DISASSEMBLY
1004 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1005#endif
1006 *i+=2; */
1007 }
1008 (*pMyArgument).ArgType = MEMORY_TYPE;
1009 if (GV.AddressSize >= 32) {
1010 GV.DECALAGE_EIP++;
1011 GV.BASE_ = (*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0x7;
1012 GV.SCALE_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0xc0) >> 6;
1013 GV.INDEX_ = ((*((UInt8*)(UIntPtr) (GV.EIP_+2))) & 0x38) >> 3;
1014 j = i;
1015 i += SIB[GV.SCALE_ ](pMyArgument, j, pMyDisasm);
1016 }
1017 else {
1018 #ifndef BEA_LIGHT_DISASSEMBLY
1019 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]);
1020 #endif
1021 i += strlen (Registers16Bits[6]);
1022 (*pMyArgument).Memory.BaseRegister = REGS[6];
1023
1024 }
1025
1026 if (GV.SYNTAX_ == ATSyntax) {
1027 #ifndef BEA_LIGHT_DISASSEMBLY
1028 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1029 #endif
1030 i++;
1031 }
1032 else {
1033 if (MyNumber < 0) {
1034 #ifndef BEA_LIGHT_DISASSEMBLY
1035 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1036 #endif
1037 i++;
1038 #ifndef BEA_LIGHT_DISASSEMBLY
1039 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
1040 #endif
1041 }
1042 else {
1043 #ifndef BEA_LIGHT_DISASSEMBLY
1044 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1045 #endif
1046 i++;
1047 #ifndef BEA_LIGHT_DISASSEMBLY
1048 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
1049 #endif
1050 }
1051 }
1052
1053}
1054
1055/* =======================================
1056 * ModRM_1
1057 * ======================================= */
1058void __bea_callspec__ Addr_EBP_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1059{
1060 size_t i = 0, j;
1061 long MyNumber;
1062 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
1063 (*pMyArgument).Memory.Displacement = MyNumber;
1064 if (GV.SYNTAX_ == ATSyntax) {
1065 if (MyNumber < 0) {
1066 #ifndef BEA_LIGHT_DISASSEMBLY
1067 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1068 #endif
1069 i++;
1070 j=i;
1071 #ifndef BEA_LIGHT_DISASSEMBLY
1072 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
1073 #endif
1074 }
1075 else {
1076 j=i;
1077 #ifndef BEA_LIGHT_DISASSEMBLY
1078 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
1079 #endif
1080 }
1081 #ifndef BEA_LIGHT_DISASSEMBLY
1082 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1083 #endif
1084 i+=2;
1085 }
1086 (*pMyArgument).ArgType = MEMORY_TYPE;
1087 if (GV.AddressSize == 64) {
1088 if (GV.REX.B_ == 1) {
1089 #ifndef BEA_LIGHT_DISASSEMBLY
1090 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[13]);
1091 #endif
1092 (*pMyArgument).Memory.BaseRegister = REGS[5+8];
1093 }
1094 else {
1095 #ifndef BEA_LIGHT_DISASSEMBLY
1096 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5]);
1097 #endif
1098 (*pMyArgument).Memory.BaseRegister = REGS[5];
1099 }
1100 }
1101 else if (GV.AddressSize == 32) {
1102 if (GV.REX.B_ == 1) {
1103 #ifndef BEA_LIGHT_DISASSEMBLY
1104 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[13]);
1105 #endif
1106 (*pMyArgument).Memory.BaseRegister = REGS[5+8];
1107
1108 }
1109 else {
1110 #ifndef BEA_LIGHT_DISASSEMBLY
1111 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5]);
1112 #endif
1113 (*pMyArgument).Memory.BaseRegister = REGS[5];
1114 }
1115 }
1116 else {
1117 #ifndef BEA_LIGHT_DISASSEMBLY
1118 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7]);
1119 #endif
1120 (*pMyArgument).Memory.BaseRegister = REGS[7];
1121 }
1122 #ifndef BEA_LIGHT_DISASSEMBLY
1123 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1124 if (GV.SYNTAX_ == ATSyntax) {
1125 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1126 i += 1;
1127 }
1128 else {
1129 #else
1130 if(1) {
1131 #endif
1132 if (MyNumber < 0) {
1133 #ifndef BEA_LIGHT_DISASSEMBLY
1134 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1135 #endif
1136 i++;
1137 #ifndef BEA_LIGHT_DISASSEMBLY
1138 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
1139 #endif
1140 }
1141 else {
1142 #ifndef BEA_LIGHT_DISASSEMBLY
1143 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1144 #endif
1145 i++;
1146 #ifndef BEA_LIGHT_DISASSEMBLY
1147 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
1148 #endif
1149 }
1150 }
1151}
1152
1153/* =======================================
1154 * ModRM_1
1155 * ======================================= */
1156void __bea_callspec__ Addr_ESI_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1157{
1158 size_t i = 0, j;
1159 long MyNumber;
1160 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
1161 (*pMyArgument).Memory.Displacement = MyNumber;
1162 if (GV.SYNTAX_ == ATSyntax) {
1163 if (MyNumber < 0) {
1164 #ifndef BEA_LIGHT_DISASSEMBLY
1165 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1166 #endif
1167 i++;
1168 j=i;
1169 #ifndef BEA_LIGHT_DISASSEMBLY
1170 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
1171 #endif
1172 }
1173 else {
1174 j=i;
1175 #ifndef BEA_LIGHT_DISASSEMBLY
1176 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
1177 #endif
1178 }
1179 #ifndef BEA_LIGHT_DISASSEMBLY
1180 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1181 #endif
1182 i+=2;
1183 }
1184 (*pMyArgument).ArgType = MEMORY_TYPE;
1185 if (GV.AddressSize == 64) {
1186 if (GV.REX.B_ == 1) {
1187 #ifndef BEA_LIGHT_DISASSEMBLY
1188 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]);
1189 #endif
1190 (*pMyArgument).Memory.BaseRegister = REGS[6+8];
1191 }
1192 else {
1193 #ifndef BEA_LIGHT_DISASSEMBLY
1194 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]);
1195 #endif
1196 (*pMyArgument).Memory.BaseRegister = REGS[6];
1197 }
1198 }
1199 else if (GV.AddressSize == 32) {
1200 if (GV.REX.B_ == 1) {
1201 #ifndef BEA_LIGHT_DISASSEMBLY
1202 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]);
1203 #endif
1204 (*pMyArgument).Memory.BaseRegister = REGS[6+8];
1205
1206 }
1207 else {
1208 #ifndef BEA_LIGHT_DISASSEMBLY
1209 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]);
1210 #endif
1211 (*pMyArgument).Memory.BaseRegister = REGS[6];
1212 }
1213 }
1214 else {
1215 #ifndef BEA_LIGHT_DISASSEMBLY
1216 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5]);
1217 #endif
1218 (*pMyArgument).Memory.BaseRegister = REGS[5];
1219 }
1220 #ifndef BEA_LIGHT_DISASSEMBLY
1221 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1222 if (GV.SYNTAX_ == ATSyntax) {
1223 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1224 i += 1;
1225 }
1226 else {
1227 #else
1228 if(1) {
1229 #endif
1230 if (MyNumber < 0) {
1231 #ifndef BEA_LIGHT_DISASSEMBLY
1232 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1233 #endif
1234 i++;
1235 #ifndef BEA_LIGHT_DISASSEMBLY
1236 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
1237 #endif
1238 }
1239 else {
1240 #ifndef BEA_LIGHT_DISASSEMBLY
1241 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1242 #endif
1243 i++;
1244 #ifndef BEA_LIGHT_DISASSEMBLY
1245 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
1246 #endif
1247 }
1248 }
1249}
1250
1251/* =======================================
1252 * ModRM_1
1253 * ======================================= */
1254void __bea_callspec__ Addr_EDI_disp8(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1255{
1256 size_t i = 0, j;
1257 long MyNumber;
1258 MyNumber = *((Int8*)(UIntPtr) (GV.EIP_+2));
1259 (*pMyArgument).Memory.Displacement = MyNumber;
1260 if (GV.SYNTAX_ == ATSyntax) {
1261 if (MyNumber < 0) {
1262 #ifndef BEA_LIGHT_DISASSEMBLY
1263 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1264 #endif
1265 i++;
1266 j=i;
1267 #ifndef BEA_LIGHT_DISASSEMBLY
1268 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) ~MyNumber+1);
1269 #endif
1270 }
1271 else {
1272 j=i;
1273 #ifndef BEA_LIGHT_DISASSEMBLY
1274 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.2X",(Int64) MyNumber);
1275 #endif
1276 }
1277 #ifndef BEA_LIGHT_DISASSEMBLY
1278 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1279 #endif
1280 i+=2;
1281 }
1282 (*pMyArgument).ArgType = MEMORY_TYPE;
1283 if (GV.AddressSize == 64) {
1284 if (GV.REX.B_ == 1) {
1285 #ifndef BEA_LIGHT_DISASSEMBLY
1286 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]);
1287 #endif
1288 (*pMyArgument).Memory.BaseRegister = REGS[7+8];
1289 }
1290 else {
1291 #ifndef BEA_LIGHT_DISASSEMBLY
1292 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]);
1293 #endif
1294 (*pMyArgument).Memory.BaseRegister = REGS[7];
1295 }
1296 }
1297 else if (GV.AddressSize == 32) {
1298 if (GV.REX.B_ == 1) {
1299 #ifndef BEA_LIGHT_DISASSEMBLY
1300 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]);
1301 #endif
1302 (*pMyArgument).Memory.BaseRegister = REGS[7+8];
1303
1304 }
1305 else {
1306 #ifndef BEA_LIGHT_DISASSEMBLY
1307 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]);
1308 #endif
1309 (*pMyArgument).Memory.BaseRegister = REGS[7];
1310 }
1311 }
1312 else {
1313 #ifndef BEA_LIGHT_DISASSEMBLY
1314 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]);
1315 #endif
1316 (*pMyArgument).Memory.BaseRegister = REGS[3];
1317 }
1318 #ifndef BEA_LIGHT_DISASSEMBLY
1319 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1320 if (GV.SYNTAX_ == ATSyntax) {
1321 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1322 i += 1;
1323 }
1324 else {
1325 #else
1326 if(1) {
1327 #endif
1328 if (MyNumber < 0) {
1329 #ifndef BEA_LIGHT_DISASSEMBLY
1330 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1331 #endif
1332 i++;
1333 #ifndef BEA_LIGHT_DISASSEMBLY
1334 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) ~MyNumber+1);
1335 #endif
1336 }
1337 else {
1338 #ifndef BEA_LIGHT_DISASSEMBLY
1339 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1340 #endif
1341 i++;
1342 #ifndef BEA_LIGHT_DISASSEMBLY
1343 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.2X",(Int64) MyNumber);
1344 #endif
1345 }
1346 }
1347}
1348
1349/* =======================================
1350 * ModRM_2
1351 * ======================================= */
1352void __bea_callspec__ Addr_EAX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1353{
1354 size_t i = 0, j;
1355 long MyNumber;
1356 if (GV.AddressSize == 16) {
1357 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1358 }
1359 else{
1360 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
1361 }
1362 (*pMyArgument).Memory.Displacement = MyNumber;
1363 if (GV.SYNTAX_ == ATSyntax) {
1364 if (MyNumber < 0) {
1365 #ifndef BEA_LIGHT_DISASSEMBLY
1366 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1367 #endif
1368 i ++;
1369 j=i;
1370 #ifndef BEA_LIGHT_DISASSEMBLY
1371 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1372 #endif
1373 }
1374 else {
1375 j = i;
1376 #ifndef BEA_LIGHT_DISASSEMBLY
1377 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1378 #endif
1379 }
1380 #ifndef BEA_LIGHT_DISASSEMBLY
1381 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1382 #endif
1383 i+=2;
1384 }
1385 (*pMyArgument).ArgType = MEMORY_TYPE;
1386 if (GV.AddressSize == 64) {
1387 if (GV.REX.B_ == 1) {
1388 #ifndef BEA_LIGHT_DISASSEMBLY
1389 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]);
1390 #endif
1391 (*pMyArgument).Memory.BaseRegister = REGS[8];
1392 }
1393 else {
1394 #ifndef BEA_LIGHT_DISASSEMBLY
1395 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]);
1396 #endif
1397 (*pMyArgument).Memory.BaseRegister = REGS[0];
1398 }
1399 }
1400 else if (GV.AddressSize == 32) {
1401 if (GV.REX.B_ == 1) {
1402 #ifndef BEA_LIGHT_DISASSEMBLY
1403 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]);
1404 #endif
1405 (*pMyArgument).Memory.BaseRegister = REGS[8];
1406 }
1407 else {
1408 #ifndef BEA_LIGHT_DISASSEMBLY
1409 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]);
1410 #endif
1411 (*pMyArgument).Memory.BaseRegister = REGS[0];
1412 }
1413 }
1414 else {
1415 #ifndef BEA_LIGHT_DISASSEMBLY
1416 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXSI_);
1417 #endif
1418 (*pMyArgument).Memory.BaseRegister = REGS[3];
1419 (*pMyArgument).Memory.IndexRegister = REGS[6];
1420 }
1421 #ifndef BEA_LIGHT_DISASSEMBLY
1422 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1423 if (GV.SYNTAX_ == ATSyntax) {
1424 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1425 i += 1;
1426 }
1427 else {
1428 #else
1429 if(1) {
1430 #endif
1431 if (MyNumber < 0) {
1432 #ifndef BEA_LIGHT_DISASSEMBLY
1433 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1434 #endif
1435 i++;
1436 #ifndef BEA_LIGHT_DISASSEMBLY
1437 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
1438 #endif
1439 }
1440 else {
1441 #ifndef BEA_LIGHT_DISASSEMBLY
1442 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1443 #endif
1444 i++;
1445 #ifndef BEA_LIGHT_DISASSEMBLY
1446 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
1447 #endif
1448 }
1449 }
1450}
1451
1452
1453/* =======================================
1454 * ModRM_2
1455 * ======================================= */
1456void __bea_callspec__ Addr_ECX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1457{
1458 size_t i = 0, j;
1459 long MyNumber;
1460 if (GV.AddressSize == 16) {
1461 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1462 }
1463 else{
1464 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
1465 }
1466 (*pMyArgument).Memory.Displacement = MyNumber;
1467 if (GV.SYNTAX_ == ATSyntax) {
1468 if (MyNumber < 0) {
1469 #ifndef BEA_LIGHT_DISASSEMBLY
1470 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1471 #endif
1472 i ++;
1473 j=i;
1474 #ifndef BEA_LIGHT_DISASSEMBLY
1475 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1476 #endif
1477 }
1478 else {
1479 j = i;
1480 #ifndef BEA_LIGHT_DISASSEMBLY
1481 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1482 #endif
1483 }
1484 #ifndef BEA_LIGHT_DISASSEMBLY
1485 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1486 #endif
1487 i+=2;
1488 }
1489 (*pMyArgument).ArgType = MEMORY_TYPE;
1490 if (GV.AddressSize == 64) {
1491 if (GV.REX.B_ == 1) {
1492 #ifndef BEA_LIGHT_DISASSEMBLY
1493 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[9]);
1494 #endif
1495 (*pMyArgument).Memory.BaseRegister = REGS[1+8];
1496 }
1497 else {
1498 #ifndef BEA_LIGHT_DISASSEMBLY
1499 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]);
1500 #endif
1501 (*pMyArgument).Memory.BaseRegister = REGS[1];
1502 }
1503 }
1504 else if (GV.AddressSize == 32) {
1505 if (GV.REX.B_ == 1) {
1506 #ifndef BEA_LIGHT_DISASSEMBLY
1507 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[9]);
1508 #endif
1509 (*pMyArgument).Memory.BaseRegister = REGS[1+8];
1510
1511 }
1512 else {
1513 #ifndef BEA_LIGHT_DISASSEMBLY
1514 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]);
1515 #endif
1516 (*pMyArgument).Memory.BaseRegister = REGS[1];
1517 }
1518 }
1519 else {
1520 #ifndef BEA_LIGHT_DISASSEMBLY
1521 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BXDI_);
1522 #endif
1523 (*pMyArgument).Memory.BaseRegister = REGS[3];
1524 (*pMyArgument).Memory.IndexRegister = REGS[7];
1525 }
1526 #ifndef BEA_LIGHT_DISASSEMBLY
1527 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1528 if (GV.SYNTAX_ == ATSyntax) {
1529 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1530 i += 1;
1531 }
1532 else {
1533 #else
1534 if(1) {
1535 #endif
1536 if (MyNumber < 0) {
1537 #ifndef BEA_LIGHT_DISASSEMBLY
1538 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1539 #endif
1540 i++;
1541 #ifndef BEA_LIGHT_DISASSEMBLY
1542 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
1543 #endif
1544 }
1545 else {
1546 #ifndef BEA_LIGHT_DISASSEMBLY
1547 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1548 #endif
1549 i++;
1550 #ifndef BEA_LIGHT_DISASSEMBLY
1551 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
1552 #endif
1553 }
1554 }
1555}
1556
1557/* =======================================
1558 * ModRM_2
1559 * ======================================= */
1560void __bea_callspec__ Addr_EDX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1561{
1562 size_t i = 0, j;
1563 long MyNumber;
1564 if (GV.AddressSize == 16) {
1565 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1566 }
1567 else{
1568 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
1569 }
1570 (*pMyArgument).Memory.Displacement = MyNumber;
1571 if (GV.SYNTAX_ == ATSyntax) {
1572 if (MyNumber < 0) {
1573 #ifndef BEA_LIGHT_DISASSEMBLY
1574 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1575 #endif
1576 i ++;
1577 j=i;
1578 #ifndef BEA_LIGHT_DISASSEMBLY
1579 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1580 #endif
1581 }
1582 else {
1583 j = i;
1584 #ifndef BEA_LIGHT_DISASSEMBLY
1585 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1586 #endif
1587 }
1588 #ifndef BEA_LIGHT_DISASSEMBLY
1589 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1590 #endif
1591 i+=2;
1592 }
1593 (*pMyArgument).ArgType = MEMORY_TYPE;
1594 if (GV.AddressSize == 64) {
1595 if (GV.REX.B_ == 1) {
1596 #ifndef BEA_LIGHT_DISASSEMBLY
1597 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[10]);
1598 #endif
1599 (*pMyArgument).Memory.BaseRegister = REGS[2+8];
1600 }
1601 else {
1602 #ifndef BEA_LIGHT_DISASSEMBLY
1603 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2]);
1604 #endif
1605 (*pMyArgument).Memory.BaseRegister = REGS[2];
1606 }
1607 }
1608 else if (GV.AddressSize == 32) {
1609 if (GV.REX.B_ == 1) {
1610 #ifndef BEA_LIGHT_DISASSEMBLY
1611 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[10]);
1612 #endif
1613 (*pMyArgument).Memory.BaseRegister = REGS[2+8];
1614
1615 }
1616 else {
1617 #ifndef BEA_LIGHT_DISASSEMBLY
1618 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2]);
1619 #endif
1620 (*pMyArgument).Memory.BaseRegister = REGS[2];
1621 }
1622 }
1623 else {
1624 #ifndef BEA_LIGHT_DISASSEMBLY
1625 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPSI_);
1626 #endif
1627 (*pMyArgument).Memory.BaseRegister = REGS[5];
1628 (*pMyArgument).Memory.IndexRegister = REGS[6];
1629 }
1630 #ifndef BEA_LIGHT_DISASSEMBLY
1631 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1632 if (GV.SYNTAX_ == ATSyntax) {
1633 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1634 i += 1;
1635 }
1636 else {
1637 #else
1638 if(1) {
1639 #endif
1640 if (MyNumber < 0) {
1641 #ifndef BEA_LIGHT_DISASSEMBLY
1642 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1643 #endif
1644 i++;
1645 #ifndef BEA_LIGHT_DISASSEMBLY
1646 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
1647 #endif
1648 }
1649 else {
1650 #ifndef BEA_LIGHT_DISASSEMBLY
1651 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1652 #endif
1653 i++;
1654 #ifndef BEA_LIGHT_DISASSEMBLY
1655 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
1656 #endif
1657 }
1658 }
1659}
1660
1661/* =======================================
1662 * ModRM_2
1663 * ======================================= */
1664void __bea_callspec__ Addr_EBX_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1665{
1666 size_t i = 0, j;
1667 long MyNumber;
1668 if (GV.AddressSize == 16) {
1669 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1670 }
1671 else{
1672 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
1673 }
1674 (*pMyArgument).Memory.Displacement = MyNumber;
1675 if (GV.SYNTAX_ == ATSyntax) {
1676 if (MyNumber < 0) {
1677 #ifndef BEA_LIGHT_DISASSEMBLY
1678 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1679 #endif
1680 i ++;
1681 j=i;
1682 #ifndef BEA_LIGHT_DISASSEMBLY
1683 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1684 #endif
1685 }
1686 else {
1687 j = i;
1688 #ifndef BEA_LIGHT_DISASSEMBLY
1689 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1690 #endif
1691 }
1692 #ifndef BEA_LIGHT_DISASSEMBLY
1693 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1694 #endif
1695 i+=2;
1696 }
1697 (*pMyArgument).ArgType = MEMORY_TYPE;
1698 if (GV.AddressSize == 64) {
1699 if (GV.REX.B_ == 1) {
1700 #ifndef BEA_LIGHT_DISASSEMBLY
1701 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[11]);
1702 #endif
1703 (*pMyArgument).Memory.BaseRegister = REGS[3+8];
1704 }
1705 else {
1706 #ifndef BEA_LIGHT_DISASSEMBLY
1707 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3]);
1708 #endif
1709 (*pMyArgument).Memory.BaseRegister = REGS[3];
1710 }
1711 }
1712 else if (GV.AddressSize == 32) {
1713 if (GV.REX.B_ == 1) {
1714 #ifndef BEA_LIGHT_DISASSEMBLY
1715 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[11]);
1716 #endif
1717 (*pMyArgument).Memory.BaseRegister = REGS[3+8];
1718
1719 }
1720 else {
1721 #ifndef BEA_LIGHT_DISASSEMBLY
1722 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3]);
1723 #endif
1724 (*pMyArgument).Memory.BaseRegister = REGS[3];
1725 }
1726 }
1727 else {
1728 #ifndef BEA_LIGHT_DISASSEMBLY
1729 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, BPDI_);
1730 #endif
1731 (*pMyArgument).Memory.BaseRegister = REGS[5];
1732 (*pMyArgument).Memory.IndexRegister = REGS[7];
1733 }
1734 #ifndef BEA_LIGHT_DISASSEMBLY
1735 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1736 if (GV.SYNTAX_ == ATSyntax) {
1737 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1738 i += 1;
1739 }
1740 else {
1741 #else
1742 if(1) {
1743 #endif
1744 if (MyNumber < 0) {
1745 #ifndef BEA_LIGHT_DISASSEMBLY
1746 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1747 #endif
1748 i++;
1749 #ifndef BEA_LIGHT_DISASSEMBLY
1750 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
1751 #endif
1752 }
1753 else {
1754 #ifndef BEA_LIGHT_DISASSEMBLY
1755 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1756 #endif
1757 i++;
1758 #ifndef BEA_LIGHT_DISASSEMBLY
1759 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
1760 #endif
1761 }
1762 }
1763}
1764
1765/* =======================================
1766 *
1767 * ======================================= */
1768void __bea_callspec__ Addr_SIB_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1769{
1770 size_t i = 0, j;
1771 long MyNumber;
1772 if (!Security(2, pMyDisasm)) return;
1773 if (GV.AddressSize >= 32) {
1774 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+3));
1775 }
1776 else {
1777 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1778 }
1779
1780 (*pMyArgument).Memory.Displacement = MyNumber;
1781 if (GV.SYNTAX_ == ATSyntax) {
1782 if (MyNumber < 0) {
1783 #ifndef BEA_LIGHT_DISASSEMBLY
1784 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1785 #endif
1786 i ++;
1787 j=i;
1788 #ifndef BEA_LIGHT_DISASSEMBLY
1789 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1790 #endif
1791 }
1792 else {
1793 j = i;
1794 #ifndef BEA_LIGHT_DISASSEMBLY
1795 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1796 #endif
1797 }
1798 /*#ifndef BEA_LIGHT_DISASSEMBLY
1799 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1800#endif
1801 *i+=2; */
1802 }
1803 (*pMyArgument).ArgType = MEMORY_TYPE;
1804 if (GV.AddressSize >= 32) {
1805 GV.DECALAGE_EIP++;
1806 GV.BASE_ = ((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0x7;
1807 GV.SCALE_ = (((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0xc0) >> 6;
1808 GV.INDEX_ = (((UInt8) *((UInt8*) (UIntPtr)GV.EIP_+2)) & 0x38) >> 3;
1809 j = i;
1810 i += SIB[GV.SCALE_ ](pMyArgument, j, pMyDisasm);
1811 }
1812 else {
1813 #ifndef BEA_LIGHT_DISASSEMBLY
1814 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic, Registers16Bits[6]);
1815 #endif
1816 (*pMyArgument).Memory.BaseRegister = REGS[6];
1817 i += strlen (Registers16Bits[6]);
1818 }
1819
1820 if (GV.SYNTAX_ == ATSyntax) {
1821 #ifndef BEA_LIGHT_DISASSEMBLY
1822 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1823 #endif
1824 i += 1;
1825 }
1826 else {
1827 if (MyNumber < 0) {
1828 #ifndef BEA_LIGHT_DISASSEMBLY
1829 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1830 #endif
1831 i++;
1832 #ifndef BEA_LIGHT_DISASSEMBLY
1833 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
1834 #endif
1835 }
1836 else {
1837 #ifndef BEA_LIGHT_DISASSEMBLY
1838 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1839 #endif
1840 i++;
1841 #ifndef BEA_LIGHT_DISASSEMBLY
1842 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
1843 #endif
1844 }
1845 }
1846
1847}
1848
1849/* =======================================
1850 * ModRM_2
1851 * ======================================= */
1852void __bea_callspec__ Addr_EBP_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1853{
1854 size_t i = 0, j;
1855 long MyNumber;
1856 if (GV.AddressSize == 16) {
1857 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1858 }
1859 else{
1860 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
1861 }
1862 (*pMyArgument).Memory.Displacement = MyNumber;
1863 if (GV.SYNTAX_ == ATSyntax) {
1864 if (MyNumber < 0) {
1865 #ifndef BEA_LIGHT_DISASSEMBLY
1866 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1867 #endif
1868 i ++;
1869 j=i;
1870 #ifndef BEA_LIGHT_DISASSEMBLY
1871 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1872 #endif
1873 }
1874 else {
1875 j = i;
1876 #ifndef BEA_LIGHT_DISASSEMBLY
1877 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1878 #endif
1879 }
1880 #ifndef BEA_LIGHT_DISASSEMBLY
1881 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1882 #endif
1883 i+=2;
1884 }
1885 (*pMyArgument).ArgType = MEMORY_TYPE;
1886 if (GV.AddressSize == 64) {
1887 if (GV.REX.B_ == 1) {
1888 #ifndef BEA_LIGHT_DISASSEMBLY
1889 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[13]);
1890 #endif
1891 (*pMyArgument).Memory.BaseRegister = REGS[5+8];
1892 }
1893 else {
1894 #ifndef BEA_LIGHT_DISASSEMBLY
1895 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5]);
1896 #endif
1897 (*pMyArgument).Memory.BaseRegister = REGS[5];
1898 }
1899 }
1900 else if (GV.AddressSize == 32) {
1901 if (GV.REX.B_ == 1) {
1902 #ifndef BEA_LIGHT_DISASSEMBLY
1903 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[13]);
1904 #endif
1905 (*pMyArgument).Memory.BaseRegister = REGS[5+8];
1906
1907 }
1908 else {
1909 #ifndef BEA_LIGHT_DISASSEMBLY
1910 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5]);
1911 #endif
1912 (*pMyArgument).Memory.BaseRegister = REGS[5];
1913 }
1914 }
1915 else {
1916 #ifndef BEA_LIGHT_DISASSEMBLY
1917 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7]);
1918 #endif
1919 (*pMyArgument).Memory.BaseRegister = REGS[7];
1920 }
1921 #ifndef BEA_LIGHT_DISASSEMBLY
1922 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
1923 if (GV.SYNTAX_ == ATSyntax) {
1924 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
1925 i += 1;
1926 }
1927 else {
1928 #else
1929 if(1) {
1930 #endif
1931 if (MyNumber < 0) {
1932 #ifndef BEA_LIGHT_DISASSEMBLY
1933 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1934 #endif
1935 i++;
1936 #ifndef BEA_LIGHT_DISASSEMBLY
1937 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
1938 #endif
1939 }
1940 else {
1941 #ifndef BEA_LIGHT_DISASSEMBLY
1942 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
1943 #endif
1944 i++;
1945 #ifndef BEA_LIGHT_DISASSEMBLY
1946 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
1947 #endif
1948 }
1949 }
1950}
1951
1952/* =======================================
1953 * ModRM_2
1954 * ======================================= */
1955void __bea_callspec__ Addr_ESI_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
1956{
1957 size_t i = 0, j;
1958 long MyNumber;
1959 if (GV.AddressSize == 16) {
1960 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
1961 }
1962 else{
1963 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
1964 }
1965 (*pMyArgument).Memory.Displacement = MyNumber;
1966 if (GV.SYNTAX_ == ATSyntax) {
1967 if (MyNumber < 0) {
1968 #ifndef BEA_LIGHT_DISASSEMBLY
1969 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
1970 #endif
1971 i ++;
1972 j=i;
1973 #ifndef BEA_LIGHT_DISASSEMBLY
1974 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
1975 #endif
1976 }
1977 else {
1978 j = i;
1979 #ifndef BEA_LIGHT_DISASSEMBLY
1980 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
1981 #endif
1982 }
1983 #ifndef BEA_LIGHT_DISASSEMBLY
1984 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
1985 #endif
1986 i+=2;
1987 }
1988 (*pMyArgument).ArgType = MEMORY_TYPE;
1989 if (GV.AddressSize == 64) {
1990 if (GV.REX.B_ == 1) {
1991 #ifndef BEA_LIGHT_DISASSEMBLY
1992 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[14]);
1993 #endif
1994 (*pMyArgument).Memory.BaseRegister = REGS[6+8];
1995 }
1996 else {
1997 #ifndef BEA_LIGHT_DISASSEMBLY
1998 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6]);
1999 #endif
2000 (*pMyArgument).Memory.BaseRegister = REGS[6];
2001 }
2002 }
2003 else if (GV.AddressSize == 32) {
2004 if (GV.REX.B_ == 1) {
2005 #ifndef BEA_LIGHT_DISASSEMBLY
2006 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[14]);
2007 #endif
2008 (*pMyArgument).Memory.BaseRegister = REGS[6+8];
2009
2010 }
2011 else {
2012 #ifndef BEA_LIGHT_DISASSEMBLY
2013 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6]);
2014 #endif
2015 (*pMyArgument).Memory.BaseRegister = REGS[6];
2016 }
2017 }
2018 else {
2019 #ifndef BEA_LIGHT_DISASSEMBLY
2020 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5]);
2021 #endif
2022 (*pMyArgument).Memory.BaseRegister = REGS[5];
2023 }
2024 #ifndef BEA_LIGHT_DISASSEMBLY
2025 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
2026 if (GV.SYNTAX_ == ATSyntax) {
2027 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
2028 i += 1;
2029 }
2030 else {
2031 #else
2032 if(1) {
2033 #endif
2034 if (MyNumber < 0) {
2035 #ifndef BEA_LIGHT_DISASSEMBLY
2036 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
2037 #endif
2038 i++;
2039 #ifndef BEA_LIGHT_DISASSEMBLY
2040 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
2041 #endif
2042 }
2043 else {
2044 #ifndef BEA_LIGHT_DISASSEMBLY
2045 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
2046 #endif
2047 i++;
2048 #ifndef BEA_LIGHT_DISASSEMBLY
2049 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
2050 #endif
2051 }
2052 }
2053}
2054
2055/* =======================================
2056 * ModRM_2
2057 * ======================================= */
2058void __bea_callspec__ Addr_EDI_disp32(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2059{
2060 size_t i = 0, j;
2061 long MyNumber;
2062 if (GV.AddressSize == 16) {
2063 MyNumber = *((Int16*)(UIntPtr) (GV.EIP_+2));
2064 }
2065 else{
2066 MyNumber = *((Int32*)(UIntPtr) (GV.EIP_+2));
2067 }
2068 (*pMyArgument).Memory.Displacement = MyNumber;
2069 if (GV.SYNTAX_ == ATSyntax) {
2070 if (MyNumber < 0) {
2071 #ifndef BEA_LIGHT_DISASSEMBLY
2072 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
2073 #endif
2074 i ++;
2075 j=i;
2076 #ifndef BEA_LIGHT_DISASSEMBLY
2077 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) ~MyNumber+1);
2078 #endif
2079 }
2080 else {
2081 j = i;
2082 #ifndef BEA_LIGHT_DISASSEMBLY
2083 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) MyNumber);
2084 #endif
2085 }
2086 #ifndef BEA_LIGHT_DISASSEMBLY
2087 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
2088 #endif
2089 i+=2;
2090 }
2091 (*pMyArgument).ArgType = MEMORY_TYPE;
2092 if (GV.AddressSize == 64) {
2093 if (GV.REX.B_ == 1) {
2094 #ifndef BEA_LIGHT_DISASSEMBLY
2095 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[15]);
2096 #endif
2097 (*pMyArgument).Memory.BaseRegister = REGS[7+8];
2098 }
2099 else {
2100 #ifndef BEA_LIGHT_DISASSEMBLY
2101 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7]);
2102 #endif
2103 (*pMyArgument).Memory.BaseRegister = REGS[7];
2104 }
2105 }
2106 else if (GV.AddressSize == 32) {
2107 if (GV.REX.B_ == 1) {
2108 #ifndef BEA_LIGHT_DISASSEMBLY
2109 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[15]);
2110 #endif
2111 (*pMyArgument).Memory.BaseRegister = REGS[7+8];
2112
2113 }
2114 else {
2115 #ifndef BEA_LIGHT_DISASSEMBLY
2116 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7]);
2117 #endif
2118 (*pMyArgument).Memory.BaseRegister = REGS[7];
2119 }
2120 }
2121 else {
2122 #ifndef BEA_LIGHT_DISASSEMBLY
2123 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3]);
2124 #endif
2125 (*pMyArgument).Memory.BaseRegister = REGS[3];
2126 }
2127 #ifndef BEA_LIGHT_DISASSEMBLY
2128 i = strlen ((char*) &(*pMyArgument).ArgMnemonic);
2129 if (GV.SYNTAX_ == ATSyntax) {
2130 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
2131 i += 1;
2132 }
2133 else {
2134 #else
2135 if(1) {
2136 #endif
2137 if (MyNumber < 0) {
2138 #ifndef BEA_LIGHT_DISASSEMBLY
2139 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "-");
2140 #endif
2141 i++;
2142 #ifndef BEA_LIGHT_DISASSEMBLY
2143 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) ~MyNumber+1);
2144 #endif
2145 }
2146 else {
2147 #ifndef BEA_LIGHT_DISASSEMBLY
2148 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
2149 #endif
2150 i++;
2151 #ifndef BEA_LIGHT_DISASSEMBLY
2152 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+i,"%.8X",(Int64) MyNumber);
2153 #endif
2154 }
2155 }
2156}
2157
2158/* =======================================
2159 * ModRM_3
2160 * ======================================= */
2161void __bea_callspec__ _rEAX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2162{
2163 int i = 0;
2164 GV.MemDecoration = 0;
2165 if (GV.MMX_ == 1) {
2166 #ifndef BEA_LIGHT_DISASSEMBLY
2167 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[0]);
2168 #endif
2169 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[0];
2170 (*pMyArgument).ArgSize = 64;
2171 return;
2172 }
2173
2174 if (GV.SSE_ == 1) {
2175 if (GV.REX.B_ == 1) {
2176 #ifndef BEA_LIGHT_DISASSEMBLY
2177 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[8]);
2178 #endif
2179 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[8];
2180 (*pMyArgument).ArgSize = 128;
2181 }
2182 else {
2183 #ifndef BEA_LIGHT_DISASSEMBLY
2184 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[0]);
2185 #endif
2186 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[0];
2187 (*pMyArgument).ArgSize = 128;
2188 }
2189 return;
2190 }
2191 if (GV.OperandSize == 64) {
2192 if (GV.REX.B_ == 1) {
2193 #ifndef BEA_LIGHT_DISASSEMBLY
2194 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[8]);
2195 #endif
2196 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8];
2197 (*pMyArgument).ArgSize = 64;
2198 }
2199 else {
2200 #ifndef BEA_LIGHT_DISASSEMBLY
2201 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[0]);
2202 #endif
2203 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0];
2204 (*pMyArgument).ArgSize = 64;
2205 }
2206 }
2207 else if (GV.OperandSize == 32) {
2208 if (GV.REX.B_ == 1) {
2209 #ifndef BEA_LIGHT_DISASSEMBLY
2210 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[8]);
2211 #endif
2212 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8];
2213 (*pMyArgument).ArgSize = 32;
2214 }
2215 else {
2216 #ifndef BEA_LIGHT_DISASSEMBLY
2217 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[0]);
2218 #endif
2219 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0];
2220 (*pMyArgument).ArgSize = 32;
2221 }
2222 }
2223 else if (GV.OperandSize == 16) {
2224 if (GV.REX.B_ == 1) {
2225 #ifndef BEA_LIGHT_DISASSEMBLY
2226 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[8]);
2227 #endif
2228 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8];
2229 (*pMyArgument).ArgSize = 16;
2230 }
2231 else {
2232 #ifndef BEA_LIGHT_DISASSEMBLY
2233 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[0]);
2234 #endif
2235 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0];
2236 (*pMyArgument).ArgSize = 16;
2237 }
2238 }
2239 else if (GV.OperandSize == 8) {
2240 if (GV.REX.B_ == 1) {
2241 #ifndef BEA_LIGHT_DISASSEMBLY
2242 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[8]);
2243 #endif
2244 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[8];
2245 (*pMyArgument).ArgSize = 8;
2246 }
2247 else {
2248 if (GV.REX.state == 0) {
2249 #ifndef BEA_LIGHT_DISASSEMBLY
2250 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[0]);
2251 #endif
2252 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[0];
2253 (*pMyArgument).ArgSize = 8;
2254 }
2255 else {
2256 #ifndef BEA_LIGHT_DISASSEMBLY
2257 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[0]);
2258 #endif
2259 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[0];
2260 (*pMyArgument).ArgSize = 8;
2261 }
2262 }
2263 }
2264}
2265
2266
2267/* =======================================
2268 * ModRM_3
2269 * ======================================= */
2270void __bea_callspec__ _rECX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2271{
2272 int i = 0;
2273 GV.MemDecoration = 0;
2274 if (GV.MMX_ == 1) {
2275 #ifndef BEA_LIGHT_DISASSEMBLY
2276 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[1]);
2277 #endif
2278 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[1];
2279 (*pMyArgument).ArgSize = 64;
2280 return;
2281 }
2282
2283 if (GV.SSE_ == 1) {
2284 if (GV.REX.B_ == 1) {
2285 #ifndef BEA_LIGHT_DISASSEMBLY
2286 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[1+8]);
2287 #endif
2288 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[1+8];
2289 (*pMyArgument).ArgSize = 128;
2290 }
2291 else {
2292 #ifndef BEA_LIGHT_DISASSEMBLY
2293 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[1]);
2294 #endif
2295 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[1];
2296 (*pMyArgument).ArgSize = 128;
2297 }
2298 return;
2299 }
2300 if (GV.OperandSize == 64) {
2301 if (GV.REX.B_ == 1) {
2302 #ifndef BEA_LIGHT_DISASSEMBLY
2303 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1+8]);
2304 #endif
2305 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8];
2306 (*pMyArgument).ArgSize = 64;
2307 }
2308 else {
2309 #ifndef BEA_LIGHT_DISASSEMBLY
2310 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[1]);
2311 #endif
2312 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1];
2313 (*pMyArgument).ArgSize = 64;
2314 }
2315 }
2316 else if (GV.OperandSize == 32) {
2317 if (GV.REX.B_ == 1) {
2318 #ifndef BEA_LIGHT_DISASSEMBLY
2319 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1+8]);
2320 #endif
2321 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8];
2322 (*pMyArgument).ArgSize = 32;
2323 }
2324 else {
2325 #ifndef BEA_LIGHT_DISASSEMBLY
2326 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[1]);
2327 #endif
2328 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1];
2329 (*pMyArgument).ArgSize = 32;
2330 }
2331 }
2332 else if (GV.OperandSize == 16) {
2333 if (GV.REX.B_ == 1) {
2334 #ifndef BEA_LIGHT_DISASSEMBLY
2335 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[1+8]);
2336 #endif
2337 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8];
2338 (*pMyArgument).ArgSize = 16;
2339 }
2340 else {
2341 #ifndef BEA_LIGHT_DISASSEMBLY
2342 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[1]);
2343 #endif
2344 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1];
2345 (*pMyArgument).ArgSize = 16;
2346 }
2347 }
2348 else if (GV.OperandSize == 8) {
2349 if (GV.REX.B_ == 1) {
2350 #ifndef BEA_LIGHT_DISASSEMBLY
2351 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[1+8]);
2352 #endif
2353 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1+8];
2354 (*pMyArgument).ArgSize = 8;
2355 }
2356 else {
2357 if (GV.REX.state == 0) {
2358 #ifndef BEA_LIGHT_DISASSEMBLY
2359 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[1]);
2360 #endif
2361 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[1];
2362 (*pMyArgument).ArgSize = 8;
2363 }
2364 else {
2365 #ifndef BEA_LIGHT_DISASSEMBLY
2366 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[1]);
2367 #endif
2368 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[1];
2369 (*pMyArgument).ArgSize = 8;
2370 }
2371 }
2372 }
2373}
2374
2375
2376
2377/* =======================================
2378 * ModRM_3
2379 * ======================================= */
2380void __bea_callspec__ _rEDX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2381{
2382 int i = 0;
2383 GV.MemDecoration = 0;
2384 if (GV.MMX_ == 1) {
2385 #ifndef BEA_LIGHT_DISASSEMBLY
2386 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[2+0]);
2387 #endif
2388 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[2+0];
2389 (*pMyArgument).ArgSize = 64;
2390 return;
2391 }
2392
2393 if (GV.SSE_ == 1) {
2394 if (GV.REX.B_ == 1) {
2395 #ifndef BEA_LIGHT_DISASSEMBLY
2396 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[2+8]);
2397 #endif
2398 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[2+8];
2399 (*pMyArgument).ArgSize = 128;
2400 }
2401 else {
2402 #ifndef BEA_LIGHT_DISASSEMBLY
2403 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[2+0]);
2404 #endif
2405 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[2+0];
2406 (*pMyArgument).ArgSize = 128;
2407 }
2408 return;
2409 }
2410 if (GV.OperandSize == 64) {
2411 if (GV.REX.B_ == 1) {
2412 #ifndef BEA_LIGHT_DISASSEMBLY
2413 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2+8]);
2414 #endif
2415 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8];
2416 (*pMyArgument).ArgSize = 64;
2417 }
2418 else {
2419 #ifndef BEA_LIGHT_DISASSEMBLY
2420 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[2+0]);
2421 #endif
2422 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0];
2423 (*pMyArgument).ArgSize = 64;
2424 }
2425 }
2426 else if (GV.OperandSize == 32) {
2427 if (GV.REX.B_ == 1) {
2428 #ifndef BEA_LIGHT_DISASSEMBLY
2429 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2+8]);
2430 #endif
2431 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8];
2432 (*pMyArgument).ArgSize = 32;
2433 }
2434 else {
2435 #ifndef BEA_LIGHT_DISASSEMBLY
2436 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[2+0]);
2437 #endif
2438 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0];
2439 (*pMyArgument).ArgSize = 32;
2440 }
2441 }
2442 else if (GV.OperandSize == 16) {
2443 if (GV.REX.B_ == 1) {
2444 #ifndef BEA_LIGHT_DISASSEMBLY
2445 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[2+8]);
2446 #endif
2447 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8];
2448 (*pMyArgument).ArgSize = 16;
2449 }
2450 else {
2451 #ifndef BEA_LIGHT_DISASSEMBLY
2452 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[2+0]);
2453 #endif
2454 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0];
2455 (*pMyArgument).ArgSize = 16;
2456 }
2457 }
2458 else if (GV.OperandSize == 8) {
2459 if (GV.REX.B_ == 1) {
2460 #ifndef BEA_LIGHT_DISASSEMBLY
2461 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[2+8]);
2462 #endif
2463 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+8];
2464 (*pMyArgument).ArgSize = 8;
2465 }
2466 else {
2467 if (GV.REX.state == 0) {
2468 #ifndef BEA_LIGHT_DISASSEMBLY
2469 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[2+0]);
2470 #endif
2471 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[2+0];
2472 (*pMyArgument).ArgSize = 8;
2473 }
2474 else {
2475 #ifndef BEA_LIGHT_DISASSEMBLY
2476 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[2+0]);
2477 #endif
2478 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[2+0];
2479 (*pMyArgument).ArgSize = 8;
2480 }
2481 }
2482 }
2483}
2484
2485
2486
2487/* =======================================
2488 * ModRM_3
2489 * ======================================= */
2490void __bea_callspec__ _rEBX(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2491{
2492 int i = 0;
2493 GV.MemDecoration = 0;
2494 if (GV.MMX_ == 1) {
2495 #ifndef BEA_LIGHT_DISASSEMBLY
2496 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[3+0]);
2497 #endif
2498 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[3+0];
2499 (*pMyArgument).ArgSize = 64;
2500 return;
2501 }
2502
2503 if (GV.SSE_ == 1) {
2504 if (GV.REX.B_ == 1) {
2505 #ifndef BEA_LIGHT_DISASSEMBLY
2506 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[3+8]);
2507 #endif
2508 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[3+8];
2509 (*pMyArgument).ArgSize = 128;
2510 }
2511 else {
2512 #ifndef BEA_LIGHT_DISASSEMBLY
2513 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[3+0]);
2514 #endif
2515 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[3+0];
2516 (*pMyArgument).ArgSize = 128;
2517 }
2518 return;
2519 }
2520 if (GV.OperandSize == 64) {
2521 if (GV.REX.B_ == 1) {
2522 #ifndef BEA_LIGHT_DISASSEMBLY
2523 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3+8]);
2524 #endif
2525 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8];
2526 (*pMyArgument).ArgSize = 64;
2527 }
2528 else {
2529 #ifndef BEA_LIGHT_DISASSEMBLY
2530 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[3+0]);
2531 #endif
2532 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0];
2533 (*pMyArgument).ArgSize = 64;
2534 }
2535 }
2536 else if (GV.OperandSize == 32) {
2537 if (GV.REX.B_ == 1) {
2538 #ifndef BEA_LIGHT_DISASSEMBLY
2539 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3+8]);
2540 #endif
2541 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8];
2542 (*pMyArgument).ArgSize = 32;
2543 }
2544 else {
2545 #ifndef BEA_LIGHT_DISASSEMBLY
2546 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[3+0]);
2547 #endif
2548 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0];
2549 (*pMyArgument).ArgSize = 32;
2550 }
2551 }
2552 else if (GV.OperandSize == 16) {
2553 if (GV.REX.B_ == 1) {
2554 #ifndef BEA_LIGHT_DISASSEMBLY
2555 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3+8]);
2556 #endif
2557 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8];
2558 (*pMyArgument).ArgSize = 16;
2559 }
2560 else {
2561 #ifndef BEA_LIGHT_DISASSEMBLY
2562 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[3+0]);
2563 #endif
2564 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0];
2565 (*pMyArgument).ArgSize = 16;
2566 }
2567 }
2568 else if (GV.OperandSize == 8) {
2569 if (GV.REX.B_ == 1) {
2570 #ifndef BEA_LIGHT_DISASSEMBLY
2571 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[3+8]);
2572 #endif
2573 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+8];
2574 (*pMyArgument).ArgSize = 8;
2575 }
2576 else {
2577 if (GV.REX.state == 0) {
2578 #ifndef BEA_LIGHT_DISASSEMBLY
2579 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[3+0]);
2580 #endif
2581 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[3+0];
2582 (*pMyArgument).ArgSize = 8;
2583 }
2584 else {
2585 #ifndef BEA_LIGHT_DISASSEMBLY
2586 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[3+0]);
2587 #endif
2588 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[3+0];
2589 (*pMyArgument).ArgSize = 8;
2590 }
2591 }
2592 }
2593}
2594
2595
2596
2597/* =======================================
2598 * ModRM_3
2599 * ======================================= */
2600void __bea_callspec__ _rESP(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2601{
2602 int i = 0;
2603 GV.MemDecoration = 0;
2604 if (GV.MMX_ == 1) {
2605 #ifndef BEA_LIGHT_DISASSEMBLY
2606 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[4+0]);
2607 #endif
2608 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[4+0];
2609 (*pMyArgument).ArgSize = 64;
2610 return;
2611 }
2612
2613 if (GV.SSE_ == 1) {
2614 if (GV.REX.B_ == 1) {
2615 #ifndef BEA_LIGHT_DISASSEMBLY
2616 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[4+8]);
2617 #endif
2618 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[4+8];
2619 (*pMyArgument).ArgSize = 128;
2620 }
2621 else {
2622 #ifndef BEA_LIGHT_DISASSEMBLY
2623 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[4+0]);
2624 #endif
2625 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[4+0];
2626 (*pMyArgument).ArgSize = 128;
2627 }
2628 return;
2629 }
2630 if (GV.OperandSize == 64) {
2631 if (GV.REX.B_ == 1) {
2632 #ifndef BEA_LIGHT_DISASSEMBLY
2633 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[4+8]);
2634 #endif
2635 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8];
2636 (*pMyArgument).ArgSize = 64;
2637 }
2638 else {
2639 #ifndef BEA_LIGHT_DISASSEMBLY
2640 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[4+0]);
2641 #endif
2642 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0];
2643 (*pMyArgument).ArgSize = 64;
2644 }
2645 }
2646 else if (GV.OperandSize == 32) {
2647 if (GV.REX.B_ == 1) {
2648 #ifndef BEA_LIGHT_DISASSEMBLY
2649 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[4+8]);
2650 #endif
2651 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8];
2652 (*pMyArgument).ArgSize = 32;
2653 }
2654 else {
2655 #ifndef BEA_LIGHT_DISASSEMBLY
2656 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[4+0]);
2657 #endif
2658 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0];
2659 (*pMyArgument).ArgSize = 32;
2660 }
2661 }
2662 else if (GV.OperandSize == 16) {
2663 if (GV.REX.B_ == 1) {
2664 #ifndef BEA_LIGHT_DISASSEMBLY
2665 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[4+8]);
2666 #endif
2667 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8];
2668 (*pMyArgument).ArgSize = 16;
2669 }
2670 else {
2671 #ifndef BEA_LIGHT_DISASSEMBLY
2672 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[4+0]);
2673 #endif
2674 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0];
2675 (*pMyArgument).ArgSize = 16;
2676 }
2677 }
2678 else if (GV.OperandSize == 8) {
2679 if (GV.REX.B_ == 1) {
2680 #ifndef BEA_LIGHT_DISASSEMBLY
2681 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[4+8]);
2682 #endif
2683 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+8];
2684 (*pMyArgument).ArgSize = 8;
2685 }
2686 else {
2687 if (GV.REX.state == 0) {
2688 #ifndef BEA_LIGHT_DISASSEMBLY
2689 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[4+0]);
2690 #endif
2691 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[4+0];
2692 (*pMyArgument).ArgPosition = HighPosition;
2693 (*pMyArgument).ArgSize = 8;
2694 }
2695 else {
2696 #ifndef BEA_LIGHT_DISASSEMBLY
2697 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[4+0]);
2698 #endif
2699 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[4+0];
2700 (*pMyArgument).ArgSize = 8;
2701 }
2702 }
2703 }
2704}
2705
2706
2707
2708/* =======================================
2709 * ModRM_3
2710 * ======================================= */
2711void __bea_callspec__ _rEBP(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2712{
2713 int i = 0;
2714 GV.MemDecoration = 0;
2715 if (GV.MMX_ == 1) {
2716 #ifndef BEA_LIGHT_DISASSEMBLY
2717 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[5+0]);
2718 #endif
2719 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[5+0];
2720 (*pMyArgument).ArgSize = 64;
2721 return;
2722 }
2723
2724 if (GV.SSE_ == 1) {
2725 if (GV.REX.B_ == 1) {
2726 #ifndef BEA_LIGHT_DISASSEMBLY
2727 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[5+8]);
2728 #endif
2729 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[5+8];
2730 (*pMyArgument).ArgSize = 128;
2731 }
2732 else {
2733 #ifndef BEA_LIGHT_DISASSEMBLY
2734 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[5+0]);
2735 #endif
2736 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[5+0];
2737 (*pMyArgument).ArgSize = 128;
2738 }
2739 return;
2740 }
2741 if (GV.OperandSize == 64) {
2742 if (GV.REX.B_ == 1) {
2743 #ifndef BEA_LIGHT_DISASSEMBLY
2744 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5+8]);
2745 #endif
2746 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8];
2747 (*pMyArgument).ArgSize = 64;
2748 }
2749 else {
2750 #ifndef BEA_LIGHT_DISASSEMBLY
2751 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[5+0]);
2752 #endif
2753 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0];
2754 (*pMyArgument).ArgSize = 64;
2755 }
2756 }
2757 else if (GV.OperandSize == 32) {
2758 if (GV.REX.B_ == 1) {
2759 #ifndef BEA_LIGHT_DISASSEMBLY
2760 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5+8]);
2761 #endif
2762 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8];
2763 (*pMyArgument).ArgSize = 32;
2764 }
2765 else {
2766 #ifndef BEA_LIGHT_DISASSEMBLY
2767 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[5+0]);
2768 #endif
2769 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0];
2770 (*pMyArgument).ArgSize = 32;
2771 }
2772 }
2773 else if (GV.OperandSize == 16) {
2774 if (GV.REX.B_ == 1) {
2775 #ifndef BEA_LIGHT_DISASSEMBLY
2776 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5+8]);
2777 #endif
2778 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8];
2779 (*pMyArgument).ArgSize = 16;
2780 }
2781 else {
2782 #ifndef BEA_LIGHT_DISASSEMBLY
2783 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[5+0]);
2784 #endif
2785 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0];
2786 (*pMyArgument).ArgSize = 16;
2787 }
2788 }
2789 else if (GV.OperandSize == 8) {
2790 if (GV.REX.B_ == 1) {
2791 #ifndef BEA_LIGHT_DISASSEMBLY
2792 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[5+8]);
2793 #endif
2794 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+8];
2795 (*pMyArgument).ArgSize = 8;
2796 }
2797 else {
2798 if (GV.REX.state == 0) {
2799 #ifndef BEA_LIGHT_DISASSEMBLY
2800 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[5+0]);
2801 #endif
2802 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[5+0];
2803 (*pMyArgument).ArgPosition = HighPosition;
2804 (*pMyArgument).ArgSize = 8;
2805 }
2806 else {
2807 #ifndef BEA_LIGHT_DISASSEMBLY
2808 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[5+0]);
2809 #endif
2810 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[5+0];
2811 (*pMyArgument).ArgSize = 8;
2812 }
2813 }
2814 }
2815}
2816
2817
2818
2819/* =======================================
2820 * ModRM_3
2821 * ======================================= */
2822void __bea_callspec__ _rESI(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2823{
2824 int i = 0;
2825 GV.MemDecoration = 0;
2826 if (GV.MMX_ == 1) {
2827 #ifndef BEA_LIGHT_DISASSEMBLY
2828 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[6+0]);
2829 #endif
2830 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[6+0];
2831 (*pMyArgument).ArgSize = 64;
2832 return;
2833 }
2834
2835 if (GV.SSE_ == 1) {
2836 if (GV.REX.B_ == 1) {
2837 #ifndef BEA_LIGHT_DISASSEMBLY
2838 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[6+8]);
2839 #endif
2840 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[6+8];
2841 (*pMyArgument).ArgSize = 128;
2842 }
2843 else {
2844 #ifndef BEA_LIGHT_DISASSEMBLY
2845 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[6+0]);
2846 #endif
2847 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[6+0];
2848 (*pMyArgument).ArgSize = 128;
2849 }
2850 return;
2851 }
2852 if (GV.OperandSize == 64) {
2853 if (GV.REX.B_ == 1) {
2854 #ifndef BEA_LIGHT_DISASSEMBLY
2855 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6+8]);
2856 #endif
2857 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8];
2858 (*pMyArgument).ArgSize = 64;
2859 }
2860 else {
2861 #ifndef BEA_LIGHT_DISASSEMBLY
2862 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[6+0]);
2863 #endif
2864 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0];
2865 (*pMyArgument).ArgSize = 64;
2866 }
2867 }
2868 else if (GV.OperandSize == 32) {
2869 if (GV.REX.B_ == 1) {
2870 #ifndef BEA_LIGHT_DISASSEMBLY
2871 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6+8]);
2872 #endif
2873 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8];
2874 (*pMyArgument).ArgSize = 32;
2875 }
2876 else {
2877 #ifndef BEA_LIGHT_DISASSEMBLY
2878 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[6+0]);
2879 #endif
2880 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0];
2881 (*pMyArgument).ArgSize = 32;
2882 }
2883 }
2884 else if (GV.OperandSize == 16) {
2885 if (GV.REX.B_ == 1) {
2886 #ifndef BEA_LIGHT_DISASSEMBLY
2887 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[6+8]);
2888 #endif
2889 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8];
2890 (*pMyArgument).ArgSize = 16;
2891 }
2892 else {
2893 #ifndef BEA_LIGHT_DISASSEMBLY
2894 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[6+0]);
2895 #endif
2896 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0];
2897 (*pMyArgument).ArgSize = 16;
2898 }
2899 }
2900 else if (GV.OperandSize == 8) {
2901 if (GV.REX.B_ == 1) {
2902 #ifndef BEA_LIGHT_DISASSEMBLY
2903 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[6+8]);
2904 #endif
2905 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+8];
2906 (*pMyArgument).ArgSize = 8;
2907 }
2908 else {
2909 if (GV.REX.state == 0) {
2910 #ifndef BEA_LIGHT_DISASSEMBLY
2911 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[6+0]);
2912 #endif
2913 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[6+0];
2914 (*pMyArgument).ArgPosition = HighPosition;
2915 (*pMyArgument).ArgSize = 8;
2916 }
2917 else {
2918 #ifndef BEA_LIGHT_DISASSEMBLY
2919 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[6+0]);
2920 #endif
2921 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[6+0];
2922 (*pMyArgument).ArgSize = 8;
2923 }
2924 }
2925 }
2926}
2927
2928
2929
2930/* =======================================
2931 * ModRM_3
2932 * ======================================= */
2933void __bea_callspec__ _rEDI(ARGTYPE* pMyArgument, PDISASM pMyDisasm)
2934{
2935 int i = 0;
2936 GV.MemDecoration = 0;
2937 if (GV.MMX_ == 1) {
2938 #ifndef BEA_LIGHT_DISASSEMBLY
2939 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersMMX[7+0]);
2940 #endif
2941 (*pMyArgument).ArgType = REGISTER_TYPE+MMX_REG+REGS[7+0];
2942 (*pMyArgument).ArgSize = 64;
2943 return;
2944 }
2945
2946 if (GV.SSE_ == 1) {
2947 if (GV.REX.B_ == 1) {
2948 #ifndef BEA_LIGHT_DISASSEMBLY
2949 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[7+8]);
2950 #endif
2951 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[7+8];
2952 (*pMyArgument).ArgSize = 128;
2953 }
2954 else {
2955 #ifndef BEA_LIGHT_DISASSEMBLY
2956 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, RegistersSSE[7+0]);
2957 #endif
2958 (*pMyArgument).ArgType = REGISTER_TYPE+SSE_REG+REGS[7+0];
2959 (*pMyArgument).ArgSize = 128;
2960 }
2961 return;
2962 }
2963 if (GV.OperandSize == 64) {
2964 if (GV.REX.B_ == 1) {
2965 #ifndef BEA_LIGHT_DISASSEMBLY
2966 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7+8]);
2967 #endif
2968 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8];
2969 (*pMyArgument).ArgSize = 64;
2970 }
2971 else {
2972 #ifndef BEA_LIGHT_DISASSEMBLY
2973 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[7+0]);
2974 #endif
2975 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0];
2976 (*pMyArgument).ArgSize = 64;
2977 }
2978 }
2979 else if (GV.OperandSize == 32) {
2980 if (GV.REX.B_ == 1) {
2981 #ifndef BEA_LIGHT_DISASSEMBLY
2982 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7+8]);
2983 #endif
2984 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8];
2985 (*pMyArgument).ArgSize = 32;
2986 }
2987 else {
2988 #ifndef BEA_LIGHT_DISASSEMBLY
2989 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[7+0]);
2990 #endif
2991 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0];
2992 (*pMyArgument).ArgSize = 32;
2993 }
2994 }
2995 else if (GV.OperandSize == 16) {
2996 if (GV.REX.B_ == 1) {
2997 #ifndef BEA_LIGHT_DISASSEMBLY
2998 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7+8]);
2999 #endif
3000 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8];
3001 (*pMyArgument).ArgSize = 16;
3002 }
3003 else {
3004 #ifndef BEA_LIGHT_DISASSEMBLY
3005 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers16Bits[7+0]);
3006 #endif
3007 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0];
3008 (*pMyArgument).ArgSize = 16;
3009 }
3010 }
3011 else if (GV.OperandSize == 8) {
3012 if (GV.REX.B_ == 1) {
3013 #ifndef BEA_LIGHT_DISASSEMBLY
3014 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[7+8]);
3015 #endif
3016 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+8];
3017 (*pMyArgument).ArgSize = 8;
3018 }
3019 else {
3020 if (GV.REX.state == 0) {
3021 #ifndef BEA_LIGHT_DISASSEMBLY
3022 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8BitsLegacy[7+0]);
3023 #endif
3024 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS8BITS[7+0];
3025 (*pMyArgument).ArgPosition = HighPosition;
3026 (*pMyArgument).ArgSize = 8;
3027 }
3028 else {
3029 #ifndef BEA_LIGHT_DISASSEMBLY
3030 (void) strcpy ((char*) (*pMyArgument).ArgMnemonic+i, Registers8Bits[7+0]);
3031 #endif
3032 (*pMyArgument).ArgType = REGISTER_TYPE+GENERAL_REG+REGS[7+0];
3033 (*pMyArgument).ArgSize = 8;
3034 }
3035 }
3036 }
3037}
3038
3039
3040/* =======================================
3041 *
3042 * ======================================= */
3043size_t __bea_callspec__ SIB_0(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm)
3044{
3045
3046 /* ========================= Interpret Base */
3047 size_t j;
3048 if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) {
3049 GV.DECALAGE_EIP += 4;
3050 if (!Security(7, pMyDisasm)) return i;
3051 j = i;
3052 #ifndef BEA_LIGHT_DISASSEMBLY
3053 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3)));
3054 #endif
3055 (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3));
3056
3057 }
3058 else {
3059
3060 if (GV.SYNTAX_ == ATSyntax) {
3061 #ifndef BEA_LIGHT_DISASSEMBLY
3062 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
3063 #endif
3064 i += 2;
3065 }
3066 if (GV.AddressSize == 64) {
3067 if (GV.REX.B_ == 0) {
3068 #ifndef BEA_LIGHT_DISASSEMBLY
3069 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]);
3070 #endif
3071 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3072 i += strlen(Registers64Bits[GV.BASE_ ]);
3073 }
3074 else {
3075 #ifndef BEA_LIGHT_DISASSEMBLY
3076 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]);
3077 #endif
3078 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3079 i += strlen( Registers64Bits[GV.BASE_ +8]);
3080 }
3081 }
3082 else if (GV.AddressSize == 32) {
3083 if (GV.REX.B_ == 0) {
3084 #ifndef BEA_LIGHT_DISASSEMBLY
3085 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]);
3086 #endif
3087 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3088 i += strlen( Registers32Bits[GV.BASE_ ]);
3089 }
3090 else {
3091 #ifndef BEA_LIGHT_DISASSEMBLY
3092 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]);
3093 #endif
3094 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3095 i += strlen( Registers32Bits[GV.BASE_ +8]);
3096 }
3097 }
3098 }
3099 /* ======================== Interpret Index */
3100
3101
3102 if (GV.INDEX_ != 4 || GV.REX.X_) {
3103 if (GV.SYNTAX_ == ATSyntax) {
3104 if (GV.BASE_ == 5) {
3105 #ifndef BEA_LIGHT_DISASSEMBLY
3106 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%");
3107 #endif
3108 i+=3;
3109 }
3110 else {
3111 #ifndef BEA_LIGHT_DISASSEMBLY
3112 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%");
3113 #endif
3114 i+=2;
3115 }
3116 }
3117 else {
3118 #ifndef BEA_LIGHT_DISASSEMBLY
3119 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
3120 #endif
3121 i+=1;
3122 }
3123
3124 if (GV.AddressSize == 64) {
3125 if (GV.REX.X_ == 0) {
3126 #ifndef BEA_LIGHT_DISASSEMBLY
3127 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]);
3128 #endif
3129 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3130 i += strlen( Registers64Bits[GV.INDEX_ ]);
3131 }
3132 else {
3133 #ifndef BEA_LIGHT_DISASSEMBLY
3134 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]);
3135 #endif
3136 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3137 i += strlen( Registers64Bits[GV.INDEX_ +8]);
3138 }
3139 }
3140 else if (GV.AddressSize == 32) {
3141 if (GV.REX.X_ == 0) {
3142 #ifndef BEA_LIGHT_DISASSEMBLY
3143 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]);
3144 #endif
3145 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3146 i += strlen( Registers32Bits[GV.INDEX_ ]);
3147 }
3148 else {
3149 #ifndef BEA_LIGHT_DISASSEMBLY
3150 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]);
3151 #endif
3152 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3153 i += strlen( Registers32Bits[GV.INDEX_ +8]);
3154 }
3155 }
3156 }
3157 (*pMyArgument).Memory.Scale = 1;
3158 if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) {
3159 #ifndef BEA_LIGHT_DISASSEMBLY
3160 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
3161 #endif
3162 i++;
3163 }
3164 return i;
3165}
3166
3167/* =======================================
3168 *
3169 * ======================================= */
3170size_t __bea_callspec__ SIB_1(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm)
3171{
3172 size_t j;
3173 /* ========================= Interpret Base */
3174
3175 if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) {
3176 GV.DECALAGE_EIP += 4;
3177 if (!Security(7, pMyDisasm)) return i;
3178 j = i;
3179 #ifndef BEA_LIGHT_DISASSEMBLY
3180 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3)));
3181 #endif
3182 (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3));
3183 }
3184 else {
3185
3186 if (GV.SYNTAX_ == ATSyntax) {
3187 #ifndef BEA_LIGHT_DISASSEMBLY
3188 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
3189 #endif
3190 i += 2;
3191 }
3192 if (GV.AddressSize == 64) {
3193 if (GV.REX.B_ == 0) {
3194 #ifndef BEA_LIGHT_DISASSEMBLY
3195 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]);
3196 #endif
3197 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3198 i += strlen( Registers64Bits[GV.BASE_ ]);
3199 }
3200 else {
3201 #ifndef BEA_LIGHT_DISASSEMBLY
3202 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]);
3203 #endif
3204 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3205 i += strlen( Registers64Bits[GV.BASE_ +8]);
3206 }
3207 }
3208 else if (GV.AddressSize == 32) {
3209 if (GV.REX.B_ == 0) {
3210 #ifndef BEA_LIGHT_DISASSEMBLY
3211 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]);
3212 #endif
3213 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3214 i += strlen( Registers32Bits[GV.BASE_ ]);
3215 }
3216 else {
3217 #ifndef BEA_LIGHT_DISASSEMBLY
3218 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]);
3219 #endif
3220 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3221 i += strlen( Registers32Bits[GV.BASE_ +8]);
3222 }
3223 }
3224 }
3225 /* ======================== Interpret Index */
3226
3227 if (GV.INDEX_ != 4 || GV.REX.X_) {
3228 if (GV.SYNTAX_ == ATSyntax) {
3229 if (GV.BASE_ == 5) {
3230 #ifndef BEA_LIGHT_DISASSEMBLY
3231 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%");
3232 #endif
3233 i+=3;
3234 }
3235 else {
3236 #ifndef BEA_LIGHT_DISASSEMBLY
3237 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%");
3238 #endif
3239 i+=2;
3240 }
3241 }
3242 else {
3243 #ifndef BEA_LIGHT_DISASSEMBLY
3244 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
3245 #endif
3246 i+=1;
3247 }
3248
3249 if (GV.AddressSize == 64) {
3250 if (GV.REX.X_ == 0) {
3251 #ifndef BEA_LIGHT_DISASSEMBLY
3252 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]);
3253 #endif
3254 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3255 i += strlen( Registers64Bits[GV.INDEX_ ]);
3256 }
3257 else {
3258 #ifndef BEA_LIGHT_DISASSEMBLY
3259 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]);
3260 #endif
3261 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3262 i += strlen( Registers64Bits[GV.INDEX_ +8]);
3263 }
3264 }
3265 else if (GV.AddressSize == 32) {
3266 if (GV.REX.X_ == 0) {
3267 #ifndef BEA_LIGHT_DISASSEMBLY
3268 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]);
3269 #endif
3270 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3271 i += strlen( Registers32Bits[GV.INDEX_ ]);
3272 }
3273 else {
3274 #ifndef BEA_LIGHT_DISASSEMBLY
3275 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]);
3276 #endif
3277 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3278 i += strlen( Registers32Bits[GV.INDEX_ +8]);
3279 }
3280 }
3281 (*pMyArgument).Memory.Scale = 2;
3282 if (GV.SYNTAX_ == ATSyntax) {
3283 if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) {
3284 #ifndef BEA_LIGHT_DISASSEMBLY
3285 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",2");
3286 #endif
3287 i+=2;
3288 }
3289 }
3290 else {
3291 #ifndef BEA_LIGHT_DISASSEMBLY
3292 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*2");
3293 #endif
3294
3295 i+=2;
3296 }
3297 }
3298 if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) {
3299 #ifndef BEA_LIGHT_DISASSEMBLY
3300 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
3301 #endif
3302 i++;
3303 }
3304 return i;
3305}
3306
3307/* =======================================
3308 *
3309 * ======================================= */
3310size_t __bea_callspec__ SIB_2(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm)
3311{
3312 size_t j;
3313 /* ========================= Interpret Base */
3314
3315 if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) {
3316 GV.DECALAGE_EIP += 4;
3317 if (!Security(7, pMyDisasm)) return i;
3318 j = i;
3319 #ifndef BEA_LIGHT_DISASSEMBLY
3320 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3)));
3321 #endif
3322 (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3));
3323 }
3324 else {
3325
3326 if (GV.SYNTAX_ == ATSyntax) {
3327 #ifndef BEA_LIGHT_DISASSEMBLY
3328 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
3329 #endif
3330 i += 2;
3331 }
3332 if (GV.AddressSize == 64) {
3333 if (GV.REX.B_ == 0) {
3334 #ifndef BEA_LIGHT_DISASSEMBLY
3335 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]);
3336 #endif
3337 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3338 i += strlen( Registers64Bits[GV.BASE_ ]);
3339 }
3340 else {
3341 #ifndef BEA_LIGHT_DISASSEMBLY
3342 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]);
3343 #endif
3344 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3345 i += strlen( Registers64Bits[GV.BASE_ +8]);
3346 }
3347 }
3348 else if (GV.AddressSize == 32) {
3349 if (GV.REX.B_ == 0) {
3350 #ifndef BEA_LIGHT_DISASSEMBLY
3351 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]);
3352 #endif
3353 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3354 i += strlen( Registers32Bits[GV.BASE_ ]);
3355 }
3356 else {
3357 #ifndef BEA_LIGHT_DISASSEMBLY
3358 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]);
3359 #endif
3360 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3361 i += strlen( Registers32Bits[GV.BASE_ +8]);
3362 }
3363 }
3364 }
3365 /* ======================== Interpret Index */
3366
3367 if (GV.INDEX_ != 4) {
3368 if (GV.SYNTAX_ == ATSyntax) {
3369 if (GV.BASE_ == 5) {
3370 #ifndef BEA_LIGHT_DISASSEMBLY
3371 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%");
3372 #endif
3373 i+=3;
3374 }
3375 else {
3376 #ifndef BEA_LIGHT_DISASSEMBLY
3377 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%");
3378 #endif
3379 i+=2;
3380 }
3381 }
3382 else {
3383 #ifndef BEA_LIGHT_DISASSEMBLY
3384 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
3385 #endif
3386 i+=1;
3387 }
3388
3389 if (GV.AddressSize == 64) {
3390 if (GV.REX.X_ == 0) {
3391 #ifndef BEA_LIGHT_DISASSEMBLY
3392 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]);
3393 #endif
3394 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3395 i += strlen( Registers64Bits[GV.INDEX_ ]);
3396 }
3397 else {
3398 #ifndef BEA_LIGHT_DISASSEMBLY
3399 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]);
3400 #endif
3401 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3402 i += strlen( Registers64Bits[GV.INDEX_ +8]);
3403 }
3404 }
3405 else if (GV.AddressSize == 32) {
3406 if (GV.REX.X_ == 0) {
3407 #ifndef BEA_LIGHT_DISASSEMBLY
3408 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]);
3409 #endif
3410 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3411 i += strlen( Registers32Bits[GV.INDEX_ ]);
3412 }
3413 else {
3414 #ifndef BEA_LIGHT_DISASSEMBLY
3415 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]);
3416 #endif
3417 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3418 i += strlen( Registers32Bits[GV.INDEX_ +8]);
3419 }
3420 }
3421 (*pMyArgument).Memory.Scale = 4;
3422 if (GV.SYNTAX_ == ATSyntax) {
3423 if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) {
3424 #ifndef BEA_LIGHT_DISASSEMBLY
3425 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",4");
3426 #endif
3427 i+=2;
3428 }
3429 }
3430 else {
3431 #ifndef BEA_LIGHT_DISASSEMBLY
3432 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*4");
3433 #endif
3434 i+=2;
3435 }
3436 }
3437 if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) {
3438 #ifndef BEA_LIGHT_DISASSEMBLY
3439 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
3440 #endif
3441 i++;
3442 }
3443 return i;
3444}
3445
3446/* =======================================
3447 *
3448 * ======================================= */
3449size_t __bea_callspec__ SIB_3(ARGTYPE* pMyArgument, size_t i, PDISASM pMyDisasm)
3450{
3451 size_t j;
3452 /* ========================= Interpret Base */
3453
3454 if ((GV.BASE_ == 5) && (GV.MOD_ == 0)) {
3455 GV.DECALAGE_EIP += 4;
3456 if (!Security(7, pMyDisasm)) return i;
3457 j = i;
3458 #ifndef BEA_LIGHT_DISASSEMBLY
3459 i+= CopyFormattedNumber(pMyDisasm, (char*) (*pMyArgument).ArgMnemonic+j,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_+3)));
3460 #endif
3461 (*pMyArgument).Memory.Displacement = *((UInt32*)(UIntPtr) (GV.EIP_+3));
3462 }
3463 else {
3464
3465 if (GV.SYNTAX_ == ATSyntax) {
3466 #ifndef BEA_LIGHT_DISASSEMBLY
3467 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(%");
3468 #endif
3469 i += 2;
3470 }
3471 if (GV.AddressSize == 64) {
3472 if (GV.REX.B_ == 0) {
3473 #ifndef BEA_LIGHT_DISASSEMBLY
3474 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ ]);
3475 #endif
3476 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3477 i += strlen( Registers64Bits[GV.BASE_ ]);
3478 }
3479 else {
3480 #ifndef BEA_LIGHT_DISASSEMBLY
3481 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.BASE_ +8]);
3482 #endif
3483 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3484 i += strlen( Registers64Bits[GV.BASE_ +8]);
3485 }
3486 }
3487 else if (GV.AddressSize == 32) {
3488 if (GV.REX.B_ == 0) {
3489 #ifndef BEA_LIGHT_DISASSEMBLY
3490 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ ]);
3491 #endif
3492 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ ];
3493 i += strlen( Registers32Bits[GV.BASE_ ]);
3494 }
3495 else {
3496 #ifndef BEA_LIGHT_DISASSEMBLY
3497 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.BASE_ +8]);
3498 #endif
3499 (*pMyArgument).Memory.BaseRegister = REGS[GV.BASE_ +8];
3500 i += strlen( Registers32Bits[GV.BASE_ +8]);
3501 }
3502 }
3503 }
3504 /* ======================== Interpret Index */
3505
3506 if (GV.INDEX_ != 4 || GV.REX.X_) {
3507 if (GV.SYNTAX_ == ATSyntax) {
3508 if (GV.BASE_ == 5) {
3509 #ifndef BEA_LIGHT_DISASSEMBLY
3510 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "(,%");
3511 #endif
3512 i+=3;
3513 }
3514 else {
3515 #ifndef BEA_LIGHT_DISASSEMBLY
3516 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",%");
3517 #endif
3518 i+=2;
3519 }
3520 }
3521 else {
3522 #ifndef BEA_LIGHT_DISASSEMBLY
3523 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "+");
3524 #endif
3525 i+=1;
3526 }
3527
3528 if (GV.AddressSize == 64) {
3529 if (GV.REX.X_ == 0) {
3530 #ifndef BEA_LIGHT_DISASSEMBLY
3531 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ ]);
3532 #endif
3533 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3534 i += strlen( Registers64Bits[GV.INDEX_ ]);
3535 }
3536 else {
3537 #ifndef BEA_LIGHT_DISASSEMBLY
3538 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers64Bits[GV.INDEX_ +8]);
3539 #endif
3540 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3541 i += strlen( Registers64Bits[GV.INDEX_ +8]);
3542 }
3543 }
3544 else if (GV.AddressSize == 32) {
3545 if (GV.REX.X_ == 0) {
3546 #ifndef BEA_LIGHT_DISASSEMBLY
3547 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ ]);
3548 #endif
3549 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ ];
3550 i += strlen( Registers32Bits[GV.INDEX_ ]);
3551 }
3552 else {
3553 #ifndef BEA_LIGHT_DISASSEMBLY
3554 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, Registers32Bits[GV.INDEX_ +8]);
3555 #endif
3556 (*pMyArgument).Memory.IndexRegister = REGS[GV.INDEX_ +8];
3557 i += strlen( Registers32Bits[GV.INDEX_ +8]);
3558 }
3559 }
3560 (*pMyArgument).Memory.Scale = 8;
3561 if (GV.SYNTAX_ == ATSyntax) {
3562 if ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_)) {
3563 #ifndef BEA_LIGHT_DISASSEMBLY
3564 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ",8");
3565 #endif
3566 i+=2;
3567 }
3568 }
3569 else {
3570 #ifndef BEA_LIGHT_DISASSEMBLY
3571 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, "*8");
3572 #endif
3573 i+=2;
3574 }
3575 }
3576 if ((GV.SYNTAX_ == ATSyntax) && ((GV.BASE_ != 5) || (GV.INDEX_ != 4 || GV.REX.X_))) {
3577 #ifndef BEA_LIGHT_DISASSEMBLY
3578 (void) strcpy((char*) (*pMyArgument).ArgMnemonic+i, ")");
3579 #endif
3580 i++;
3581 }
3582 return i;
3583}
Note: See TracBrowser for help on using the repository browser.