https://github.com/akkartik/mu/blob/master/subx/017jump_disp8.cc
1
2
3
4
5 :(before "End Initialize Op Names")
6 put_new(Name, "eb", "jump disp8 bytes away (jmp)");
7
8 :(scenario jump_rel8)
9 == 0x1
10
11 eb 05
12 05 00 00 00 01
13 05 00 00 00 02
14 +run: inst: 0x00000001
15 +run: jump 5
16 +run: inst: 0x00000008
17 -run: inst: 0x00000003
18
19 :(before "End Single-Byte Opcodes")
20 case 0xeb: {
21 int8_t offset = static_cast<int>(next());
22 trace(90, "run") << "jump " << NUM(offset) << end();
23 EIP += offset;
24 break;
25 }
26
27
28
29 :(before "End Initialize Op Names")
30 put_new(Name, "74", "jump disp8 bytes away if equal, if ZF is set (jcc/jz/je)");
31
32 :(scenario je_rel8_success)
33 % ZF = true;
34 == 0x1
35
36 74 05
37 05 00 00 00 01
38 05 00 00 00 02
39 +run: inst: 0x00000001
40 +run: jump 5
41 +run: inst: 0x00000008
42 -run: inst: 0x00000003
43
44 :(before "End Single-Byte Opcodes")
45 case 0x74: {
46 const int8_t offset = static_cast<int>(next());
47 if (ZF) {
48 trace(90, "run") << "jump " << NUM(offset) << end();
49 EIP += offset;
50 }
51 break;
52 }
53
54 :(scenario je_rel8_fail)
55 % ZF = false;
56 == 0x1
57
58 74 05
59 05 00 00 00 01
60 05 00 00 00 02
61 +run: inst: 0x00000001
62 +run: inst: 0x00000003
63 +run: inst: 0x00000008
64 -run: jump 5
65
66
67
68 :(before "End Initialize Op Names")
69 put_new(Name, "75", "jump disp8 bytes away if not equal, if ZF is not set (jcc/jnz/jne)");
70
71 :(scenario jne_rel8_success)
72 % ZF = false;
73 == 0x1
74
75 75 05
76 05 00 00 00 01
77 05 00 00 00 02
78 +run: inst: 0x00000001
79 +run: jump 5
80 +run: inst: 0x00000008
81 -run: inst: 0x00000003
82
83 :(before "End Single-Byte Opcodes")
84 case 0x75: {
85 const int8_t offset = static_cast<int>(next());
86 if (!ZF) {
87 trace(90, "run") << "jump " << NUM(offset) << end();
88 EIP += offset;
89 }
90 break;
91 }
92
93 :(scenario jne_rel8_fail)
94 % ZF = true;
95 == 0x1
96
97 75 05
98 05 00 00 00 01
99 05 00 00 00 02
100 +run: inst: 0x00000001
101 +run: inst: 0x00000003
102 +run: inst: 0x00000008
103 -run: jump 5
104
105
106
107 :(before "End Initialize Op Names")
108 put_new(Name, "7f", "jump disp8 bytes away if greater, if ZF is unset and SF == OF (jcc/jg/jnle)");
109
110 :(scenario jg_rel8_success)
111 % ZF = false;
112 % SF = false;
113 % OF = false;
114 == 0x1
115
116 7f 05
117 05 00 00 00 01
118 05 00 00 00 02
119 +run: inst: 0x00000001
120 +run: jump 5
121 +run: inst: 0x00000008
122 -run: inst: 0x00000003
123
124 :(before "End Single-Byte Opcodes")
125 case 0x7f: {
126 const int8_t offset = static_cast<int>(next());
127 if (!ZF && SF == OF) {
128 trace(90, "run") << "jump " << NUM(offset) << end();
129 EIP += offset;
130 }
131 break;
132 }
133
134 :(scenario jg_rel8_fail)
135 % ZF = false;
136 % SF = true;
137 % OF = false;
138 == 0x1
139
140 7f 05
141 05 00 00 00 01
142 05 00 00 00 02
143 +run: inst: 0x00000001
144 +run: inst: 0x00000003
145 +run: inst: 0x00000008
146 -run: jump 5
147
148
149
150 :(before "End Initialize Op Names")
151 put_new(Name, "7d", "jump disp8 bytes away if greater or equal, if SF == OF (jcc/jge/jnl)");
152
153 :(scenario jge_rel8_success)
154 % SF = false;
155 % OF = false;
156 == 0x1
157
158 7d 05
159 05 00 00 00 01
160 05 00 00 00 02
161 +run: inst: 0x00000001
162 +run: jump 5
163 +run: inst: 0x00000008
164 -run: inst: 0x00000003
165
166 :(before "End Single-Byte Opcodes")
167 case 0x7d: {
168 const int8_t offset = static_cast<int>(next());
169 if (SF == OF) {
170 trace(90, "run") << "jump " << NUM(offset) << end();
171 EIP += offset;
172 }
173 break;
174 }
175
176 :(scenario jge_rel8_fail)
177 % SF = true;
178 % OF = false;
179 == 0x1
180
181 7d 05
182 05 00 00 00 01
183 05 00 00 00 02
184 +run: inst: 0x00000001
185 +run: inst: 0x00000003
186 +run: inst: 0x00000008
187 -run: jump 5
188
189
190
191 :(before "End Initialize Op Names")
192 put_new(Name, "7c", "jump disp8 bytes away if lesser, if SF != OF (jcc/jl/jnge)");
193
194 :(scenario jl_rel8_success)
195 % ZF = false;
196 % SF = true;
197 % OF = false;
198 == 0x1
199
200 7c 05
201 05 00 00 00 01
202 05 00 00 00 02
203 +run: inst: 0x00000001
204 +run: jump 5
205 +run: inst: 0x00000008
206 -run: inst: 0x00000003
207
208 :(before "End Single-Byte Opcodes")
209 case 0x7c: {
210 const int8_t offset = static_cast<int>(next());
211 if (SF != OF) {
212 trace(90, "run") << "jump " << NUM(offset) << end();
213 EIP += offset;
214 }
215 break;
216 }
217
218 :(scenario jl_rel8_fail)
219 % ZF = false;
220 % SF = false;
221 % OF = false;
222 == 0x1
223
224 7c 05
225 05 00 00 00 01
226 05 00 00 00 02
227 +run: inst: 0x00000001
228 +run: inst: 0x00000003
229 +run: inst: 0x00000008
230 -run: jump 5
231
232
233
234 :(before "End Initialize Op Names")
235 put_new(Name, "7e", "jump disp8 bytes away if lesser or equal, if ZF is set or SF != OF (jcc/jle/jng)");
236
237 :(scenario jle_rel8_equal)
238 % ZF = true;
239 % SF = false;
240 % OF = false;
241 == 0x1
242
243 7e 05
244 05 00 00 00 01
245 05 00 00 00 02
246 +run: inst: 0x00000001
247 +run: jump 5
248 +run: inst: 0x00000008
249 -run: inst: 0x00000003
250
251 :(scenario jle_rel8_lesser)
252 % ZF = false;
253 % SF = true;
254 % OF = false;
255 == 0x1
256
257 7e 05
258 05 00 00 00 01
259 05 00 00 00 02
260 +run: inst: 0x00000001
261 +run: jump 5
262 +run: inst: 0x00000008
263 -run: inst: 0x00000003
264
265 :(before "End Single-Byte Opcodes")
266 case 0x7e: {
267 const int8_t offset = static_cast<int>(next());
268 if (ZF || SF != OF) {
269 trace(90, "run") << "jump " << NUM(offset) << end();
270 EIP += offset;
271 }
272 break;
273 }
274
275 :(scenario jle_rel8_greater)
276 % ZF = false;
277 % SF = false;
278 % OF = false;
279 == 0x1
280
281 7e 05
282 05 00 00 00 01
283 05 00 00 00 02
284 +run: inst: 0x00000001
285 +run: inst: 0x00000003
286 +run: inst: 0x00000008
287 -run: jump 5