source: Daodan/src/beaengine/Includes/instr_set/opcodes_Grp5.c@ 1017

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

Daodan: TV code

File size: 5.9 KB
RevLine 
[984]1/* Copyright 2006-2009, BeatriX
2 * File coded by BeatriX
3 *
4 * This file is part of BeaEngine.
5 *
6 * BeaEngine is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * BeaEngine is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with BeaEngine. If not, see <http://www.gnu.org/licenses/>. */
18
19/* ====================================================================
20 * 0ffh
21 * ==================================================================== */
22void __bea_callspec__ G5_Ev(PDISASM pMyDisasm)
23{
24 GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
25 if (GV.REGOPCODE == 0) {
26 if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) {
27 (*pMyDisasm).Prefix.LockPrefix = InUsePrefix;
28 }
29 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
30 #ifndef BEA_LIGHT_DISASSEMBLY
31 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "inc ");
32 #endif
33 Ev(pMyDisasm);
34 FillFlags(pMyDisasm, 40);
35 }
36 else if (GV.REGOPCODE == 1) {
37 if ((*pMyDisasm).Prefix.LockPrefix == InvalidPrefix) {
38 (*pMyDisasm).Prefix.LockPrefix = InUsePrefix;
39 }
40 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+ARITHMETIC_INSTRUCTION;
41 #ifndef BEA_LIGHT_DISASSEMBLY
42 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "dec ");
43 #endif
44 Ev(pMyDisasm);
45 FillFlags(pMyDisasm, 30);
46 }
47 else if (GV.REGOPCODE == 2) {
48 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER;
49 (*pMyDisasm).Instruction.BranchType = CallType;
50 #ifndef BEA_LIGHT_DISASSEMBLY
51 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call ");
52 #endif
53 if (GV.Architecture == 64) {
54 GV.OperandSize = 64;
55 }
56 if (GV.OperandSize == 64) {
57 GV.MemDecoration = Arg1qword;
58 }
59 else if (GV.OperandSize == 32) {
60 GV.MemDecoration = Arg1dword;
61 }
62 else {
63 GV.MemDecoration = Arg1word;
64 }
65 MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
66 GV.EIP_ += GV.DECALAGE_EIP+2;
67 (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4;
68 }
69 else if (GV.REGOPCODE == 3) {
70 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER;
71 (*pMyDisasm).Instruction.BranchType = CallType;
72 if (GV.SYNTAX_ == ATSyntax) {
73 #ifndef BEA_LIGHT_DISASSEMBLY
74 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lcall ");
75 #endif
76 }
77 else {
78 #ifndef BEA_LIGHT_DISASSEMBLY
79 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "call far ");
80 #endif
81 }
82 GV.MemDecoration = Arg1fword;
83 MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
84 GV.EIP_ += GV.DECALAGE_EIP+2;
85 (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4;
86 }
87 else if (GV.REGOPCODE == 4) {
88 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER;
89 (*pMyDisasm).Instruction.BranchType = JmpType;
90 #ifndef BEA_LIGHT_DISASSEMBLY
91 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp ");
92 #endif
93 if (GV.Architecture == 64) {
94 GV.OperandSize = 64;
95 }
96 if (GV.OperandSize == 64) {
97 GV.MemDecoration = Arg1qword;
98 }
99 else if (GV.OperandSize == 32) {
100 GV.MemDecoration = Arg1dword;
101 }
102 else {
103 GV.MemDecoration = Arg1word;
104 }
105 MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
106 GV.EIP_ += GV.DECALAGE_EIP+2;
107 }
108 else if (GV.REGOPCODE == 5) {
109 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+CONTROL_TRANSFER;
110 (*pMyDisasm).Instruction.BranchType = JmpType;
111 if (GV.SYNTAX_ == ATSyntax) {
112 #ifndef BEA_LIGHT_DISASSEMBLY
113 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "ljmp ");
114 #endif
115 }
116 else {
117 #ifndef BEA_LIGHT_DISASSEMBLY
118 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "jmp far ");
119 #endif
120 }
121 GV.MemDecoration = Arg1fword;
122 MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
123 GV.EIP_ += GV.DECALAGE_EIP+2;
124 }
125 else if (GV.REGOPCODE == 6) {
126 (*pMyDisasm).Instruction.Category = GENERAL_PURPOSE_INSTRUCTION+DATA_TRANSFER;
127 #ifndef BEA_LIGHT_DISASSEMBLY
128 (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "push ");
129 #endif
130 if (GV.Architecture == 64) {
131 GV.OperandSize = 64;
132 }
133 if (GV.OperandSize == 64) {
134 GV.MemDecoration = Arg2qword;
135 }
136 else if (GV.OperandSize == 32) {
137 GV.MemDecoration = Arg2dword;
138 }
139 else {
140 GV.MemDecoration = Arg2word;
141 }
142 MOD_RM(&(*pMyDisasm).Argument2, pMyDisasm);
143 GV.EIP_ += GV.DECALAGE_EIP+2;
144 (*pMyDisasm).Argument1.ArgType = MEMORY_TYPE;
145 (*pMyDisasm).Argument1.ArgSize = GV.OperandSize;
146 (*pMyDisasm).Argument1.Memory.BaseRegister = REG4;
147 (*pMyDisasm).Instruction.ImplicitModifiedRegs = GENERAL_REG+REG4;
148 }
149 else {
150 FailDecode(pMyDisasm);
151 }
152}
153
Note: See TracBrowser for help on using the repository browser.