Subversion Repositories Kolibri OS

Rev

Rev 2665 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2665 Rev 3010
1
; flat assembler core
1
; flat assembler core
2
; Copyright (c) 1999-2012, Tomasz Grysztar.
2
; Copyright (c) 1999-2012, Tomasz Grysztar.
3
; All rights reserved.
3
; All rights reserved.
4
 
4
 
5
simple_instruction_except64:
5
simple_instruction_except64:
6
	cmp	[code_type],64
6
	cmp	[code_type],64
7
	je	illegal_instruction
7
	je	illegal_instruction
8
simple_instruction:
8
simple_instruction:
9
	stos	byte [edi]
9
	stos	byte [edi]
10
	jmp	instruction_assembled
10
	jmp	instruction_assembled
11
simple_instruction_only64:
11
simple_instruction_only64:
12
	cmp	[code_type],64
12
	cmp	[code_type],64
13
	jne	illegal_instruction
13
	jne	illegal_instruction
14
	jmp	simple_instruction
14
	jmp	simple_instruction
15
simple_instruction_16bit_except64:
15
simple_instruction_16bit_except64:
16
	cmp	[code_type],64
16
	cmp	[code_type],64
17
	je	illegal_instruction
17
	je	illegal_instruction
18
simple_instruction_16bit:
18
simple_instruction_16bit:
19
	cmp	[code_type],16
19
	cmp	[code_type],16
20
	jne	size_prefix
20
	jne	size_prefix
21
	stos	byte [edi]
21
	stos	byte [edi]
22
	jmp	instruction_assembled
22
	jmp	instruction_assembled
23
      size_prefix:
23
      size_prefix:
24
	mov	ah,al
24
	mov	ah,al
25
	mov	al,66h
25
	mov	al,66h
26
	stos	word [edi]
26
	stos	word [edi]
27
	jmp	instruction_assembled
27
	jmp	instruction_assembled
28
simple_instruction_32bit_except64:
28
simple_instruction_32bit_except64:
29
	cmp	[code_type],64
29
	cmp	[code_type],64
30
	je	illegal_instruction
30
	je	illegal_instruction
31
simple_instruction_32bit:
31
simple_instruction_32bit:
32
	cmp	[code_type],16
32
	cmp	[code_type],16
33
	je	size_prefix
33
	je	size_prefix
34
	stos	byte [edi]
34
	stos	byte [edi]
35
	jmp	instruction_assembled
35
	jmp	instruction_assembled
36
iret_instruction:
36
iret_instruction:
37
	cmp	[code_type],64
37
	cmp	[code_type],64
38
	jne	simple_instruction
38
	jne	simple_instruction
39
simple_instruction_64bit:
39
simple_instruction_64bit:
40
	cmp	[code_type],64
40
	cmp	[code_type],64
41
	jne	illegal_instruction
41
	jne	illegal_instruction
42
	mov	ah,al
42
	mov	ah,al
43
	mov	al,48h
43
	mov	al,48h
44
	stos	word [edi]
44
	stos	word [edi]
45
	jmp	instruction_assembled
45
	jmp	instruction_assembled
46
simple_extended_instruction_64bit:
46
simple_extended_instruction_64bit:
47
	cmp	[code_type],64
47
	cmp	[code_type],64
48
	jne	illegal_instruction
48
	jne	illegal_instruction
49
	mov	byte [edi],48h
49
	mov	byte [edi],48h
50
	inc	edi
50
	inc	edi
51
simple_extended_instruction:
51
simple_extended_instruction:
52
	mov	ah,al
52
	mov	ah,al
53
	mov	al,0Fh
53
	mov	al,0Fh
54
	stos	word [edi]
54
	stos	word [edi]
55
	jmp	instruction_assembled
55
	jmp	instruction_assembled
56
prefix_instruction:
56
prefix_instruction:
57
	stos	byte [edi]
57
	stos	byte [edi]
58
	or	[prefixed_instruction],-1
58
	or	[prefixed_instruction],-1
59
	jmp	continue_line
59
	jmp	continue_line
60
segment_prefix:
60
segment_prefix:
61
	mov	ah,al
61
	mov	ah,al
62
	shr	ah,4
62
	shr	ah,4
63
	cmp	ah,6
63
	cmp	ah,6
64
	jne	illegal_instruction
64
	jne	illegal_instruction
65
	and	al,1111b
65
	and	al,1111b
66
	mov	[segment_register],al
66
	mov	[segment_register],al
67
	call	store_segment_prefix
67
	call	store_segment_prefix
68
	or	[prefixed_instruction],-1
68
	or	[prefixed_instruction],-1
69
	jmp	continue_line
69
	jmp	continue_line
70
int_instruction:
70
int_instruction:
71
	lods	byte [esi]
71
	lods	byte [esi]
72
	call	get_size_operator
72
	call	get_size_operator
73
	cmp	ah,1
73
	cmp	ah,1
74
	ja	invalid_operand_size
74
	ja	invalid_operand_size
75
	cmp	al,'('
75
	cmp	al,'('
76
	jne	invalid_operand
76
	jne	invalid_operand
77
	call	get_byte_value
77
	call	get_byte_value
78
	test	eax,eax
78
	test	eax,eax
79
	jns	int_imm_ok
79
	jns	int_imm_ok
80
	call	recoverable_overflow
80
	call	recoverable_overflow
81
      int_imm_ok:
81
      int_imm_ok:
82
	mov	ah,al
82
	mov	ah,al
83
	mov	al,0CDh
83
	mov	al,0CDh
84
	stos	word [edi]
84
	stos	word [edi]
85
	jmp	instruction_assembled
85
	jmp	instruction_assembled
86
aa_instruction:
86
aa_instruction:
87
	cmp	[code_type],64
87
	cmp	[code_type],64
88
	je	illegal_instruction
88
	je	illegal_instruction
89
	push	eax
89
	push	eax
90
	mov	bl,10
90
	mov	bl,10
91
	cmp	byte [esi],'('
91
	cmp	byte [esi],'('
92
	jne	aa_store
92
	jne	aa_store
93
	inc	esi
93
	inc	esi
94
	xor	al,al
94
	xor	al,al
95
	xchg	al,[operand_size]
95
	xchg	al,[operand_size]
96
	cmp	al,1
96
	cmp	al,1
97
	ja	invalid_operand_size
97
	ja	invalid_operand_size
98
	call	get_byte_value
98
	call	get_byte_value
99
	mov	bl,al
99
	mov	bl,al
100
      aa_store:
100
      aa_store:
101
	cmp	[operand_size],0
101
	cmp	[operand_size],0
102
	jne	invalid_operand
102
	jne	invalid_operand
103
	pop	eax
103
	pop	eax
104
	mov	ah,bl
104
	mov	ah,bl
105
	stos	word [edi]
105
	stos	word [edi]
106
	jmp	instruction_assembled
106
	jmp	instruction_assembled
107
 
107
 
108
basic_instruction:
108
basic_instruction:
109
	mov	[base_code],al
109
	mov	[base_code],al
110
	lods	byte [esi]
110
	lods	byte [esi]
111
	call	get_size_operator
111
	call	get_size_operator
112
	cmp	al,10h
112
	cmp	al,10h
113
	je	basic_reg
113
	je	basic_reg
114
	cmp	al,'['
114
	cmp	al,'['
115
	jne	invalid_operand
115
	jne	invalid_operand
116
      basic_mem:
116
      basic_mem:
117
	call	get_address
117
	call	get_address
118
	push	edx ebx ecx
118
	push	edx ebx ecx
119
	lods	byte [esi]
119
	lods	byte [esi]
120
	cmp	al,','
120
	cmp	al,','
121
	jne	invalid_operand
121
	jne	invalid_operand
122
	lods	byte [esi]
122
	lods	byte [esi]
123
	call	get_size_operator
123
	call	get_size_operator
124
	cmp	al,'('
124
	cmp	al,'('
125
	je	basic_mem_imm
125
	je	basic_mem_imm
126
	cmp	al,10h
126
	cmp	al,10h
127
	jne	invalid_operand
127
	jne	invalid_operand
128
      basic_mem_reg:
128
      basic_mem_reg:
129
	lods	byte [esi]
129
	lods	byte [esi]
130
	call	convert_register
130
	call	convert_register
131
	mov	[postbyte_register],al
131
	mov	[postbyte_register],al
132
	pop	ecx ebx edx
132
	pop	ecx ebx edx
133
	mov	al,ah
133
	mov	al,ah
134
	cmp	al,1
134
	cmp	al,1
135
	je	instruction_ready
135
	je	instruction_ready
136
	call	operand_autodetect
136
	call	operand_autodetect
137
	inc	[base_code]
137
	inc	[base_code]
138
      instruction_ready:
138
      instruction_ready:
139
	call	store_instruction
139
	call	store_instruction
140
	jmp	instruction_assembled
140
	jmp	instruction_assembled
141
      basic_mem_imm:
141
      basic_mem_imm:
142
	mov	al,[operand_size]
142
	mov	al,[operand_size]
143
	cmp	al,1
143
	cmp	al,1
144
	jb	basic_mem_imm_nosize
144
	jb	basic_mem_imm_nosize
145
	je	basic_mem_imm_8bit
145
	je	basic_mem_imm_8bit
146
	cmp	al,2
146
	cmp	al,2
147
	je	basic_mem_imm_16bit
147
	je	basic_mem_imm_16bit
148
	cmp	al,4
148
	cmp	al,4
149
	je	basic_mem_imm_32bit
149
	je	basic_mem_imm_32bit
150
	cmp	al,8
150
	cmp	al,8
151
	jne	invalid_operand_size
151
	jne	invalid_operand_size
152
      basic_mem_imm_64bit:
152
      basic_mem_imm_64bit:
153
	cmp	[size_declared],0
153
	cmp	[size_declared],0
154
	jne	long_immediate_not_encodable
154
	jne	long_immediate_not_encodable
155
	call	operand_64bit
155
	call	operand_64bit
156
	call	get_simm32
156
	call	get_simm32
157
	cmp	[value_type],4
157
	cmp	[value_type],4
158
	jae	long_immediate_not_encodable
158
	jae	long_immediate_not_encodable
159
	jmp	basic_mem_imm_32bit_ok
159
	jmp	basic_mem_imm_32bit_ok
160
      basic_mem_imm_nosize:
160
      basic_mem_imm_nosize:
161
	call	recoverable_unknown_size
161
	call	recoverable_unknown_size
162
      basic_mem_imm_8bit:
162
      basic_mem_imm_8bit:
163
	call	get_byte_value
163
	call	get_byte_value
164
	mov	byte [value],al
164
	mov	byte [value],al
165
	mov	al,[base_code]
165
	mov	al,[base_code]
166
	shr	al,3
166
	shr	al,3
167
	mov	[postbyte_register],al
167
	mov	[postbyte_register],al
168
	pop	ecx ebx edx
168
	pop	ecx ebx edx
169
	mov	[base_code],80h
169
	mov	[base_code],80h
170
	call	store_instruction_with_imm8
170
	call	store_instruction_with_imm8
171
	jmp	instruction_assembled
171
	jmp	instruction_assembled
172
      basic_mem_imm_16bit:
172
      basic_mem_imm_16bit:
173
	call	operand_16bit
173
	call	operand_16bit
174
	call	get_word_value
174
	call	get_word_value
175
	mov	word [value],ax
175
	mov	word [value],ax
176
	mov	al,[base_code]
176
	mov	al,[base_code]
177
	shr	al,3
177
	shr	al,3
178
	mov	[postbyte_register],al
178
	mov	[postbyte_register],al
179
	pop	ecx ebx edx
179
	pop	ecx ebx edx
180
	cmp	[value_type],0
180
	cmp	[value_type],0
181
	jne	basic_mem_imm_16bit_store
181
	jne	basic_mem_imm_16bit_store
182
	cmp	[size_declared],0
182
	cmp	[size_declared],0
183
	jne	basic_mem_imm_16bit_store
183
	jne	basic_mem_imm_16bit_store
184
	cmp	word [value],80h
184
	cmp	word [value],80h
185
	jb	basic_mem_simm_8bit
185
	jb	basic_mem_simm_8bit
186
	cmp	word [value],-80h
186
	cmp	word [value],-80h
187
	jae	basic_mem_simm_8bit
187
	jae	basic_mem_simm_8bit
188
      basic_mem_imm_16bit_store:
188
      basic_mem_imm_16bit_store:
189
	mov	[base_code],81h
189
	mov	[base_code],81h
190
	call	store_instruction_with_imm16
190
	call	store_instruction_with_imm16
191
	jmp	instruction_assembled
191
	jmp	instruction_assembled
192
      basic_mem_simm_8bit:
192
      basic_mem_simm_8bit:
193
	mov	[base_code],83h
193
	mov	[base_code],83h
194
	call	store_instruction_with_imm8
194
	call	store_instruction_with_imm8
195
	jmp	instruction_assembled
195
	jmp	instruction_assembled
196
      basic_mem_imm_32bit:
196
      basic_mem_imm_32bit:
197
	call	operand_32bit
197
	call	operand_32bit
198
	call	get_dword_value
198
	call	get_dword_value
199
      basic_mem_imm_32bit_ok:
199
      basic_mem_imm_32bit_ok:
200
	mov	dword [value],eax
200
	mov	dword [value],eax
201
	mov	al,[base_code]
201
	mov	al,[base_code]
202
	shr	al,3
202
	shr	al,3
203
	mov	[postbyte_register],al
203
	mov	[postbyte_register],al
204
	pop	ecx ebx edx
204
	pop	ecx ebx edx
205
	cmp	[value_type],0
205
	cmp	[value_type],0
206
	jne	basic_mem_imm_32bit_store
206
	jne	basic_mem_imm_32bit_store
207
	cmp	[size_declared],0
207
	cmp	[size_declared],0
208
	jne	basic_mem_imm_32bit_store
208
	jne	basic_mem_imm_32bit_store
209
	cmp	dword [value],80h
209
	cmp	dword [value],80h
210
	jb	basic_mem_simm_8bit
210
	jb	basic_mem_simm_8bit
211
	cmp	dword [value],-80h
211
	cmp	dword [value],-80h
212
	jae	basic_mem_simm_8bit
212
	jae	basic_mem_simm_8bit
213
      basic_mem_imm_32bit_store:
213
      basic_mem_imm_32bit_store:
214
	mov	[base_code],81h
214
	mov	[base_code],81h
215
	call	store_instruction_with_imm32
215
	call	store_instruction_with_imm32
216
	jmp	instruction_assembled
216
	jmp	instruction_assembled
217
      get_simm32:
217
      get_simm32:
218
	call	get_qword_value
218
	call	get_qword_value
219
	mov	ecx,edx
219
	mov	ecx,edx
220
	cdq
220
	cdq
221
	cmp	ecx,edx
221
	cmp	ecx,edx
222
	jne	value_out_of_range
222
	jne	value_out_of_range
223
	cmp	[value_type],4
223
	cmp	[value_type],4
224
	jne	get_simm32_ok
224
	jne	get_simm32_ok
225
	mov	[value_type],2
225
	mov	[value_type],2
226
      get_simm32_ok:
226
      get_simm32_ok:
227
	ret
227
	ret
228
      basic_reg:
228
      basic_reg:
229
	lods	byte [esi]
229
	lods	byte [esi]
230
	call	convert_register
230
	call	convert_register
231
	mov	[postbyte_register],al
231
	mov	[postbyte_register],al
232
	lods	byte [esi]
232
	lods	byte [esi]
233
	cmp	al,','
233
	cmp	al,','
234
	jne	invalid_operand
234
	jne	invalid_operand
235
	lods	byte [esi]
235
	lods	byte [esi]
236
	call	get_size_operator
236
	call	get_size_operator
237
	cmp	al,10h
237
	cmp	al,10h
238
	je	basic_reg_reg
238
	je	basic_reg_reg
239
	cmp	al,'('
239
	cmp	al,'('
240
	je	basic_reg_imm
240
	je	basic_reg_imm
241
	cmp	al,'['
241
	cmp	al,'['
242
	jne	invalid_operand
242
	jne	invalid_operand
243
      basic_reg_mem:
243
      basic_reg_mem:
244
	call	get_address
244
	call	get_address
245
	mov	al,[operand_size]
245
	mov	al,[operand_size]
246
	cmp	al,1
246
	cmp	al,1
247
	je	basic_reg_mem_8bit
247
	je	basic_reg_mem_8bit
248
	call	operand_autodetect
248
	call	operand_autodetect
249
	add	[base_code],3
249
	add	[base_code],3
250
	jmp	instruction_ready
250
	jmp	instruction_ready
251
      basic_reg_mem_8bit:
251
      basic_reg_mem_8bit:
252
	add	[base_code],2
252
	add	[base_code],2
253
	jmp	instruction_ready
253
	jmp	instruction_ready
254
      basic_reg_reg:
254
      basic_reg_reg:
255
	lods	byte [esi]
255
	lods	byte [esi]
256
	call	convert_register
256
	call	convert_register
257
	mov	bl,[postbyte_register]
257
	mov	bl,[postbyte_register]
258
	mov	[postbyte_register],al
258
	mov	[postbyte_register],al
259
	mov	al,ah
259
	mov	al,ah
260
	cmp	al,1
260
	cmp	al,1
261
	je	nomem_instruction_ready
261
	je	nomem_instruction_ready
262
	call	operand_autodetect
262
	call	operand_autodetect
263
	inc	[base_code]
263
	inc	[base_code]
264
      nomem_instruction_ready:
264
      nomem_instruction_ready:
265
	call	store_nomem_instruction
265
	call	store_nomem_instruction
266
	jmp	instruction_assembled
266
	jmp	instruction_assembled
267
      basic_reg_imm:
267
      basic_reg_imm:
268
	mov	al,[operand_size]
268
	mov	al,[operand_size]
269
	cmp	al,1
269
	cmp	al,1
270
	je	basic_reg_imm_8bit
270
	je	basic_reg_imm_8bit
271
	cmp	al,2
271
	cmp	al,2
272
	je	basic_reg_imm_16bit
272
	je	basic_reg_imm_16bit
273
	cmp	al,4
273
	cmp	al,4
274
	je	basic_reg_imm_32bit
274
	je	basic_reg_imm_32bit
275
	cmp	al,8
275
	cmp	al,8
276
	jne	invalid_operand_size
276
	jne	invalid_operand_size
277
      basic_reg_imm_64bit:
277
      basic_reg_imm_64bit:
278
	cmp	[size_declared],0
278
	cmp	[size_declared],0
279
	jne	long_immediate_not_encodable
279
	jne	long_immediate_not_encodable
280
	call	operand_64bit
280
	call	operand_64bit
281
	call	get_simm32
281
	call	get_simm32
282
	cmp	[value_type],4
282
	cmp	[value_type],4
283
	jae	long_immediate_not_encodable
283
	jae	long_immediate_not_encodable
284
	jmp	basic_reg_imm_32bit_ok
284
	jmp	basic_reg_imm_32bit_ok
285
      basic_reg_imm_8bit:
285
      basic_reg_imm_8bit:
286
	call	get_byte_value
286
	call	get_byte_value
287
	mov	dl,al
287
	mov	dl,al
288
	mov	bl,[base_code]
288
	mov	bl,[base_code]
289
	shr	bl,3
289
	shr	bl,3
290
	xchg	bl,[postbyte_register]
290
	xchg	bl,[postbyte_register]
291
	or	bl,bl
291
	or	bl,bl
292
	jz	basic_al_imm
292
	jz	basic_al_imm
293
	mov	[base_code],80h
293
	mov	[base_code],80h
294
	call	store_nomem_instruction
294
	call	store_nomem_instruction
295
	mov	al,dl
295
	mov	al,dl
296
	stos	byte [edi]
296
	stos	byte [edi]
297
	jmp	instruction_assembled
297
	jmp	instruction_assembled
298
      basic_al_imm:
298
      basic_al_imm:
299
	mov	al,[base_code]
299
	mov	al,[base_code]
300
	add	al,4
300
	add	al,4
301
	stos	byte [edi]
301
	stos	byte [edi]
302
	mov	al,dl
302
	mov	al,dl
303
	stos	byte [edi]
303
	stos	byte [edi]
304
	jmp	instruction_assembled
304
	jmp	instruction_assembled
305
      basic_reg_imm_16bit:
305
      basic_reg_imm_16bit:
306
	call	operand_16bit
306
	call	operand_16bit
307
	call	get_word_value
307
	call	get_word_value
308
	mov	dx,ax
308
	mov	dx,ax
309
	mov	bl,[base_code]
309
	mov	bl,[base_code]
310
	shr	bl,3
310
	shr	bl,3
311
	xchg	bl,[postbyte_register]
311
	xchg	bl,[postbyte_register]
312
	cmp	[value_type],0
312
	cmp	[value_type],0
313
	jne	basic_reg_imm_16bit_store
313
	jne	basic_reg_imm_16bit_store
314
	cmp	[size_declared],0
314
	cmp	[size_declared],0
315
	jne	basic_reg_imm_16bit_store
315
	jne	basic_reg_imm_16bit_store
316
	cmp	dx,80h
316
	cmp	dx,80h
317
	jb	basic_reg_simm_8bit
317
	jb	basic_reg_simm_8bit
318
	cmp	dx,-80h
318
	cmp	dx,-80h
319
	jae	basic_reg_simm_8bit
319
	jae	basic_reg_simm_8bit
320
      basic_reg_imm_16bit_store:
320
      basic_reg_imm_16bit_store:
321
	or	bl,bl
321
	or	bl,bl
322
	jz	basic_ax_imm
322
	jz	basic_ax_imm
323
	mov	[base_code],81h
323
	mov	[base_code],81h
324
	call	store_nomem_instruction
324
	call	store_nomem_instruction
325
      basic_store_imm_16bit:
325
      basic_store_imm_16bit:
326
	mov	ax,dx
326
	mov	ax,dx
327
	call	mark_relocation
327
	call	mark_relocation
328
	stos	word [edi]
328
	stos	word [edi]
329
	jmp	instruction_assembled
329
	jmp	instruction_assembled
330
      basic_reg_simm_8bit:
330
      basic_reg_simm_8bit:
331
	mov	[base_code],83h
331
	mov	[base_code],83h
332
	call	store_nomem_instruction
332
	call	store_nomem_instruction
333
	mov	al,dl
333
	mov	al,dl
334
	stos	byte [edi]
334
	stos	byte [edi]
335
	jmp	instruction_assembled
335
	jmp	instruction_assembled
336
      basic_ax_imm:
336
      basic_ax_imm:
337
	add	[base_code],5
337
	add	[base_code],5
338
	call	store_instruction_code
338
	call	store_instruction_code
339
	jmp	basic_store_imm_16bit
339
	jmp	basic_store_imm_16bit
340
      basic_reg_imm_32bit:
340
      basic_reg_imm_32bit:
341
	call	operand_32bit
341
	call	operand_32bit
342
	call	get_dword_value
342
	call	get_dword_value
343
      basic_reg_imm_32bit_ok:
343
      basic_reg_imm_32bit_ok:
344
	mov	edx,eax
344
	mov	edx,eax
345
	mov	bl,[base_code]
345
	mov	bl,[base_code]
346
	shr	bl,3
346
	shr	bl,3
347
	xchg	bl,[postbyte_register]
347
	xchg	bl,[postbyte_register]
348
	cmp	[value_type],0
348
	cmp	[value_type],0
349
	jne	basic_reg_imm_32bit_store
349
	jne	basic_reg_imm_32bit_store
350
	cmp	[size_declared],0
350
	cmp	[size_declared],0
351
	jne	basic_reg_imm_32bit_store
351
	jne	basic_reg_imm_32bit_store
352
	cmp	edx,80h
352
	cmp	edx,80h
353
	jb	basic_reg_simm_8bit
353
	jb	basic_reg_simm_8bit
354
	cmp	edx,-80h
354
	cmp	edx,-80h
355
	jae	basic_reg_simm_8bit
355
	jae	basic_reg_simm_8bit
356
      basic_reg_imm_32bit_store:
356
      basic_reg_imm_32bit_store:
357
	or	bl,bl
357
	or	bl,bl
358
	jz	basic_eax_imm
358
	jz	basic_eax_imm
359
	mov	[base_code],81h
359
	mov	[base_code],81h
360
	call	store_nomem_instruction
360
	call	store_nomem_instruction
361
      basic_store_imm_32bit:
361
      basic_store_imm_32bit:
362
	mov	eax,edx
362
	mov	eax,edx
363
	call	mark_relocation
363
	call	mark_relocation
364
	stos	dword [edi]
364
	stos	dword [edi]
365
	jmp	instruction_assembled
365
	jmp	instruction_assembled
366
      basic_eax_imm:
366
      basic_eax_imm:
367
	add	[base_code],5
367
	add	[base_code],5
368
	call	store_instruction_code
368
	call	store_instruction_code
369
	jmp	basic_store_imm_32bit
369
	jmp	basic_store_imm_32bit
370
      recoverable_unknown_size:
370
      recoverable_unknown_size:
371
	cmp	[error_line],0
371
	cmp	[error_line],0
372
	jne	ignore_unknown_size
372
	jne	ignore_unknown_size
373
	push	[current_line]
373
	push	[current_line]
374
	pop	[error_line]
374
	pop	[error_line]
375
	mov	[error],operand_size_not_specified
375
	mov	[error],operand_size_not_specified
376
      ignore_unknown_size:
376
      ignore_unknown_size:
377
	ret
377
	ret
378
single_operand_instruction:
378
single_operand_instruction:
379
	mov	[base_code],0F6h
379
	mov	[base_code],0F6h
380
	mov	[postbyte_register],al
380
	mov	[postbyte_register],al
381
	lods	byte [esi]
381
	lods	byte [esi]
382
	call	get_size_operator
382
	call	get_size_operator
383
	cmp	al,10h
383
	cmp	al,10h
384
	je	single_reg
384
	je	single_reg
385
	cmp	al,'['
385
	cmp	al,'['
386
	jne	invalid_operand
386
	jne	invalid_operand
387
      single_mem:
387
      single_mem:
388
	call	get_address
388
	call	get_address
389
	mov	al,[operand_size]
389
	mov	al,[operand_size]
390
	cmp	al,1
390
	cmp	al,1
391
	je	single_mem_8bit
391
	je	single_mem_8bit
392
	jb	single_mem_nosize
392
	jb	single_mem_nosize
393
	call	operand_autodetect
393
	call	operand_autodetect
394
	inc	[base_code]
394
	inc	[base_code]
395
	jmp	instruction_ready
395
	jmp	instruction_ready
396
      single_mem_nosize:
396
      single_mem_nosize:
397
	call	recoverable_unknown_size
397
	call	recoverable_unknown_size
398
      single_mem_8bit:
398
      single_mem_8bit:
399
	jmp	instruction_ready
399
	jmp	instruction_ready
400
      single_reg:
400
      single_reg:
401
	lods	byte [esi]
401
	lods	byte [esi]
402
	call	convert_register
402
	call	convert_register
403
	mov	bl,al
403
	mov	bl,al
404
	mov	al,ah
404
	mov	al,ah
405
	cmp	al,1
405
	cmp	al,1
406
	je	single_reg_8bit
406
	je	single_reg_8bit
407
	call	operand_autodetect
407
	call	operand_autodetect
408
	inc	[base_code]
408
	inc	[base_code]
409
      single_reg_8bit:
409
      single_reg_8bit:
410
	jmp	nomem_instruction_ready
410
	jmp	nomem_instruction_ready
411
mov_instruction:
411
mov_instruction:
412
	mov	[base_code],88h
412
	mov	[base_code],88h
413
	lods	byte [esi]
413
	lods	byte [esi]
414
	call	get_size_operator
414
	call	get_size_operator
415
	cmp	al,10h
415
	cmp	al,10h
416
	je	mov_reg
416
	je	mov_reg
417
	cmp	al,'['
417
	cmp	al,'['
418
	jne	invalid_operand
418
	jne	invalid_operand
419
      mov_mem:
419
      mov_mem:
420
	call	get_address
420
	call	get_address
421
	push	edx ebx ecx
421
	push	edx ebx ecx
422
	lods	byte [esi]
422
	lods	byte [esi]
423
	cmp	al,','
423
	cmp	al,','
424
	jne	invalid_operand
424
	jne	invalid_operand
425
	lods	byte [esi]
425
	lods	byte [esi]
426
	call	get_size_operator
426
	call	get_size_operator
427
	cmp	al,'('
427
	cmp	al,'('
428
	je	mov_mem_imm
428
	je	mov_mem_imm
429
	cmp	al,10h
429
	cmp	al,10h
430
	jne	invalid_operand
430
	jne	invalid_operand
431
      mov_mem_reg:
431
      mov_mem_reg:
432
	lods	byte [esi]
432
	lods	byte [esi]
433
	cmp	al,60h
433
	cmp	al,60h
434
	jb	mov_mem_general_reg
434
	jb	mov_mem_general_reg
435
	cmp	al,70h
435
	cmp	al,70h
436
	jb	mov_mem_sreg
436
	jb	mov_mem_sreg
437
      mov_mem_general_reg:
437
      mov_mem_general_reg:
438
	call	convert_register
438
	call	convert_register
439
	mov	[postbyte_register],al
439
	mov	[postbyte_register],al
440
	pop	ecx ebx edx
440
	pop	ecx ebx edx
441
	cmp	ah,1
441
	cmp	ah,1
442
	je	mov_mem_reg_8bit
442
	je	mov_mem_reg_8bit
443
	mov	al,ah
443
	mov	al,ah
444
	call	operand_autodetect
444
	call	operand_autodetect
445
	mov	al,[postbyte_register]
445
	mov	al,[postbyte_register]
446
	or	al,bl
446
	or	al,bl
447
	or	al,bh
447
	or	al,bh
448
	jz	mov_mem_ax
448
	jz	mov_mem_ax
449
	inc	[base_code]
449
	inc	[base_code]
450
	jmp	instruction_ready
450
	jmp	instruction_ready
451
      mov_mem_reg_8bit:
451
      mov_mem_reg_8bit:
452
	or	al,bl
452
	or	al,bl
453
	or	al,bh
453
	or	al,bh
454
	jnz	instruction_ready
454
	jnz	instruction_ready
455
      mov_mem_al:
455
      mov_mem_al:
456
	test	ch,22h
456
	test	ch,22h
457
	jnz	mov_mem_address16_al
457
	jnz	mov_mem_address16_al
458
	test	ch,44h
458
	test	ch,44h
459
	jnz	mov_mem_address32_al
459
	jnz	mov_mem_address32_al
460
	test	ch,88h
460
	test	ch,88h
461
	jnz	mov_mem_address64_al
461
	jnz	mov_mem_address64_al
462
	or	ch,ch
462
	or	ch,ch
463
	jnz	invalid_address_size
463
	jnz	invalid_address_size
464
	cmp	[code_type],64
464
	cmp	[code_type],64
465
	je	mov_mem_address64_al
465
	je	mov_mem_address64_al
466
	cmp	[code_type],32
466
	cmp	[code_type],32
467
	je	mov_mem_address32_al
467
	je	mov_mem_address32_al
468
	cmp	edx,10000h
468
	cmp	edx,10000h
469
	jb	mov_mem_address16_al
469
	jb	mov_mem_address16_al
470
      mov_mem_address32_al:
470
      mov_mem_address32_al:
471
	call	store_segment_prefix_if_necessary
471
	call	store_segment_prefix_if_necessary
472
	call	address_32bit_prefix
472
	call	address_32bit_prefix
473
	mov	[base_code],0A2h
473
	mov	[base_code],0A2h
474
      store_mov_address32:
474
      store_mov_address32:
475
	call	store_instruction_code
475
	call	store_instruction_code
476
	call	store_address_32bit_value
476
	call	store_address_32bit_value
477
	jmp	instruction_assembled
477
	jmp	instruction_assembled
478
      mov_mem_address16_al:
478
      mov_mem_address16_al:
479
	call	store_segment_prefix_if_necessary
479
	call	store_segment_prefix_if_necessary
480
	call	address_16bit_prefix
480
	call	address_16bit_prefix
481
	mov	[base_code],0A2h
481
	mov	[base_code],0A2h
482
      store_mov_address16:
482
      store_mov_address16:
483
	cmp	[code_type],64
483
	cmp	[code_type],64
484
	je	invalid_address
484
	je	invalid_address
485
	call	store_instruction_code
485
	call	store_instruction_code
486
	mov	eax,edx
486
	mov	eax,edx
487
	stos	word [edi]
487
	stos	word [edi]
488
	cmp	edx,10000h
488
	cmp	edx,10000h
489
	jge	value_out_of_range
489
	jge	value_out_of_range
490
	jmp	instruction_assembled
490
	jmp	instruction_assembled
491
      mov_mem_address64_al:
491
      mov_mem_address64_al:
492
	call	store_segment_prefix_if_necessary
492
	call	store_segment_prefix_if_necessary
493
	mov	[base_code],0A2h
493
	mov	[base_code],0A2h
494
      store_mov_address64:
494
      store_mov_address64:
495
	call	store_instruction_code
495
	call	store_instruction_code
496
	call	store_address_64bit_value
496
	call	store_address_64bit_value
497
	jmp	instruction_assembled
497
	jmp	instruction_assembled
498
      mov_mem_ax:
498
      mov_mem_ax:
499
	test	ch,22h
499
	test	ch,22h
500
	jnz	mov_mem_address16_ax
500
	jnz	mov_mem_address16_ax
501
	test	ch,44h
501
	test	ch,44h
502
	jnz	mov_mem_address32_ax
502
	jnz	mov_mem_address32_ax
503
	test	ch,88h
503
	test	ch,88h
504
	jnz	mov_mem_address64_ax
504
	jnz	mov_mem_address64_ax
505
	or	ch,ch
505
	or	ch,ch
506
	jnz	invalid_address_size
506
	jnz	invalid_address_size
507
	cmp	[code_type],64
507
	cmp	[code_type],64
508
	je	mov_mem_address64_ax
508
	je	mov_mem_address64_ax
509
	cmp	[code_type],32
509
	cmp	[code_type],32
510
	je	mov_mem_address32_ax
510
	je	mov_mem_address32_ax
511
	cmp	edx,10000h
511
	cmp	edx,10000h
512
	jb	mov_mem_address16_ax
512
	jb	mov_mem_address16_ax
513
      mov_mem_address32_ax:
513
      mov_mem_address32_ax:
514
	call	store_segment_prefix_if_necessary
514
	call	store_segment_prefix_if_necessary
515
	call	address_32bit_prefix
515
	call	address_32bit_prefix
516
	mov	[base_code],0A3h
516
	mov	[base_code],0A3h
517
	jmp	store_mov_address32
517
	jmp	store_mov_address32
518
      mov_mem_address16_ax:
518
      mov_mem_address16_ax:
519
	call	store_segment_prefix_if_necessary
519
	call	store_segment_prefix_if_necessary
520
	call	address_16bit_prefix
520
	call	address_16bit_prefix
521
	mov	[base_code],0A3h
521
	mov	[base_code],0A3h
522
	jmp	store_mov_address16
522
	jmp	store_mov_address16
523
      mov_mem_address64_ax:
523
      mov_mem_address64_ax:
524
	call	store_segment_prefix_if_necessary
524
	call	store_segment_prefix_if_necessary
525
	mov	[base_code],0A3h
525
	mov	[base_code],0A3h
526
	jmp	store_mov_address64
526
	jmp	store_mov_address64
527
      mov_mem_sreg:
527
      mov_mem_sreg:
528
	sub	al,61h
528
	sub	al,61h
529
	mov	[postbyte_register],al
529
	mov	[postbyte_register],al
530
	pop	ecx ebx edx
530
	pop	ecx ebx edx
531
	mov	ah,[operand_size]
531
	mov	ah,[operand_size]
532
	or	ah,ah
532
	or	ah,ah
533
	jz	mov_mem_sreg_store
533
	jz	mov_mem_sreg_store
534
	cmp	ah,2
534
	cmp	ah,2
535
	jne	invalid_operand_size
535
	jne	invalid_operand_size
536
      mov_mem_sreg_store:
536
      mov_mem_sreg_store:
537
	mov	[base_code],8Ch
537
	mov	[base_code],8Ch
538
	jmp	instruction_ready
538
	jmp	instruction_ready
539
      mov_mem_imm:
539
      mov_mem_imm:
540
	mov	al,[operand_size]
540
	mov	al,[operand_size]
541
	cmp	al,1
541
	cmp	al,1
542
	jb	mov_mem_imm_nosize
542
	jb	mov_mem_imm_nosize
543
	je	mov_mem_imm_8bit
543
	je	mov_mem_imm_8bit
544
	cmp	al,2
544
	cmp	al,2
545
	je	mov_mem_imm_16bit
545
	je	mov_mem_imm_16bit
546
	cmp	al,4
546
	cmp	al,4
547
	je	mov_mem_imm_32bit
547
	je	mov_mem_imm_32bit
548
	cmp	al,8
548
	cmp	al,8
549
	jne	invalid_operand_size
549
	jne	invalid_operand_size
550
      mov_mem_imm_64bit:
550
      mov_mem_imm_64bit:
551
	cmp	[size_declared],0
551
	cmp	[size_declared],0
552
	jne	long_immediate_not_encodable
552
	jne	long_immediate_not_encodable
553
	call	operand_64bit
553
	call	operand_64bit
554
	call	get_simm32
554
	call	get_simm32
555
	cmp	[value_type],4
555
	cmp	[value_type],4
556
	jae	long_immediate_not_encodable
556
	jae	long_immediate_not_encodable
557
	jmp	mov_mem_imm_32bit_store
557
	jmp	mov_mem_imm_32bit_store
558
      mov_mem_imm_8bit:
558
      mov_mem_imm_8bit:
559
	call	get_byte_value
559
	call	get_byte_value
560
	mov	byte [value],al
560
	mov	byte [value],al
561
	mov	[postbyte_register],0
561
	mov	[postbyte_register],0
562
	mov	[base_code],0C6h
562
	mov	[base_code],0C6h
563
	pop	ecx ebx edx
563
	pop	ecx ebx edx
564
	call	store_instruction_with_imm8
564
	call	store_instruction_with_imm8
565
	jmp	instruction_assembled
565
	jmp	instruction_assembled
566
      mov_mem_imm_16bit:
566
      mov_mem_imm_16bit:
567
	call	operand_16bit
567
	call	operand_16bit
568
	call	get_word_value
568
	call	get_word_value
569
	mov	word [value],ax
569
	mov	word [value],ax
570
	mov	[postbyte_register],0
570
	mov	[postbyte_register],0
571
	mov	[base_code],0C7h
571
	mov	[base_code],0C7h
572
	pop	ecx ebx edx
572
	pop	ecx ebx edx
573
	call	store_instruction_with_imm16
573
	call	store_instruction_with_imm16
574
	jmp	instruction_assembled
574
	jmp	instruction_assembled
575
      mov_mem_imm_nosize:
575
      mov_mem_imm_nosize:
576
	call	recoverable_unknown_size
576
	call	recoverable_unknown_size
577
      mov_mem_imm_32bit:
577
      mov_mem_imm_32bit:
578
	call	operand_32bit
578
	call	operand_32bit
579
	call	get_dword_value
579
	call	get_dword_value
580
      mov_mem_imm_32bit_store:
580
      mov_mem_imm_32bit_store:
581
	mov	dword [value],eax
581
	mov	dword [value],eax
582
	mov	[postbyte_register],0
582
	mov	[postbyte_register],0
583
	mov	[base_code],0C7h
583
	mov	[base_code],0C7h
584
	pop	ecx ebx edx
584
	pop	ecx ebx edx
585
	call	store_instruction_with_imm32
585
	call	store_instruction_with_imm32
586
	jmp	instruction_assembled
586
	jmp	instruction_assembled
587
      mov_reg:
587
      mov_reg:
588
	lods	byte [esi]
588
	lods	byte [esi]
589
	mov	ah,al
589
	mov	ah,al
590
	sub	ah,10h
590
	sub	ah,10h
591
	and	ah,al
591
	and	ah,al
592
	test	ah,0F0h
592
	test	ah,0F0h
593
	jnz	mov_sreg
593
	jnz	mov_sreg
594
	call	convert_register
594
	call	convert_register
595
	mov	[postbyte_register],al
595
	mov	[postbyte_register],al
596
	lods	byte [esi]
596
	lods	byte [esi]
597
	cmp	al,','
597
	cmp	al,','
598
	jne	invalid_operand
598
	jne	invalid_operand
599
	lods	byte [esi]
599
	lods	byte [esi]
600
	call	get_size_operator
600
	call	get_size_operator
601
	cmp	al,'['
601
	cmp	al,'['
602
	je	mov_reg_mem
602
	je	mov_reg_mem
603
	cmp	al,'('
603
	cmp	al,'('
604
	je	mov_reg_imm
604
	je	mov_reg_imm
605
	cmp	al,10h
605
	cmp	al,10h
606
	jne	invalid_operand
606
	jne	invalid_operand
607
      mov_reg_reg:
607
      mov_reg_reg:
608
	lods	byte [esi]
608
	lods	byte [esi]
609
	mov	ah,al
609
	mov	ah,al
610
	sub	ah,10h
610
	sub	ah,10h
611
	and	ah,al
611
	and	ah,al
612
	test	ah,0F0h
612
	test	ah,0F0h
613
	jnz	mov_reg_sreg
613
	jnz	mov_reg_sreg
614
	call	convert_register
614
	call	convert_register
615
	mov	bl,[postbyte_register]
615
	mov	bl,[postbyte_register]
616
	mov	[postbyte_register],al
616
	mov	[postbyte_register],al
617
	mov	al,ah
617
	mov	al,ah
618
	cmp	al,1
618
	cmp	al,1
619
	je	mov_reg_reg_8bit
619
	je	mov_reg_reg_8bit
620
	call	operand_autodetect
620
	call	operand_autodetect
621
	inc	[base_code]
621
	inc	[base_code]
622
      mov_reg_reg_8bit:
622
      mov_reg_reg_8bit:
623
	jmp	nomem_instruction_ready
623
	jmp	nomem_instruction_ready
624
      mov_reg_sreg:
624
      mov_reg_sreg:
625
	mov	bl,[postbyte_register]
625
	mov	bl,[postbyte_register]
626
	mov	ah,al
626
	mov	ah,al
627
	and	al,1111b
627
	and	al,1111b
628
	mov	[postbyte_register],al
628
	mov	[postbyte_register],al
629
	shr	ah,4
629
	shr	ah,4
630
	cmp	ah,5
630
	cmp	ah,5
631
	je	mov_reg_creg
631
	je	mov_reg_creg
632
	cmp	ah,7
632
	cmp	ah,7
633
	je	mov_reg_dreg
633
	je	mov_reg_dreg
634
	ja	mov_reg_treg
634
	ja	mov_reg_treg
635
	dec	[postbyte_register]
635
	dec	[postbyte_register]
636
	cmp	[operand_size],8
636
	cmp	[operand_size],8
637
	je	mov_reg_sreg64
637
	je	mov_reg_sreg64
638
	cmp	[operand_size],4
638
	cmp	[operand_size],4
639
	je	mov_reg_sreg32
639
	je	mov_reg_sreg32
640
	cmp	[operand_size],2
640
	cmp	[operand_size],2
641
	jne	invalid_operand_size
641
	jne	invalid_operand_size
642
	call	operand_16bit
642
	call	operand_16bit
643
	jmp	mov_reg_sreg_store
643
	jmp	mov_reg_sreg_store
644
      mov_reg_sreg64:
644
      mov_reg_sreg64:
645
	call	operand_64bit
645
	call	operand_64bit
646
	jmp	mov_reg_sreg_store
646
	jmp	mov_reg_sreg_store
647
      mov_reg_sreg32:
647
      mov_reg_sreg32:
648
	call	operand_32bit
648
	call	operand_32bit
649
      mov_reg_sreg_store:
649
      mov_reg_sreg_store:
650
	mov	[base_code],8Ch
650
	mov	[base_code],8Ch
651
	jmp	nomem_instruction_ready
651
	jmp	nomem_instruction_ready
652
      mov_reg_treg:
652
      mov_reg_treg:
653
	cmp	ah,9
653
	cmp	ah,9
654
	jne	invalid_operand
654
	jne	invalid_operand
655
	mov	[extended_code],24h
655
	mov	[extended_code],24h
656
	jmp	mov_reg_xrx
656
	jmp	mov_reg_xrx
657
      mov_reg_dreg:
657
      mov_reg_dreg:
658
	mov	[extended_code],21h
658
	mov	[extended_code],21h
659
	jmp	mov_reg_xrx
659
	jmp	mov_reg_xrx
660
      mov_reg_creg:
660
      mov_reg_creg:
661
	mov	[extended_code],20h
661
	mov	[extended_code],20h
662
      mov_reg_xrx:
662
      mov_reg_xrx:
663
	mov	[base_code],0Fh
663
	mov	[base_code],0Fh
664
	cmp	[code_type],64
664
	cmp	[code_type],64
665
	je	mov_reg_xrx_64bit
665
	je	mov_reg_xrx_64bit
666
	cmp	[operand_size],4
666
	cmp	[operand_size],4
667
	jne	invalid_operand_size
667
	jne	invalid_operand_size
668
	cmp	[postbyte_register],8
668
	cmp	[postbyte_register],8
669
	jne	mov_reg_xrx_store
669
	jne	mov_reg_xrx_store
670
	cmp	[extended_code],20h
670
	cmp	[extended_code],20h
671
	jne	mov_reg_xrx_store
671
	jne	mov_reg_xrx_store
672
	mov	al,0F0h
672
	mov	al,0F0h
673
	stos	byte [edi]
673
	stos	byte [edi]
674
	mov	[postbyte_register],0
674
	mov	[postbyte_register],0
675
      mov_reg_xrx_store:
675
      mov_reg_xrx_store:
676
	jmp	nomem_instruction_ready
676
	jmp	nomem_instruction_ready
677
      mov_reg_xrx_64bit:
677
      mov_reg_xrx_64bit:
678
	cmp	[operand_size],8
678
	cmp	[operand_size],8
679
	jne	invalid_operand_size
679
	jne	invalid_operand_size
680
	jmp	nomem_instruction_ready
680
	jmp	nomem_instruction_ready
681
      mov_reg_mem:
681
      mov_reg_mem:
682
	call	get_address
682
	call	get_address
683
	mov	al,[operand_size]
683
	mov	al,[operand_size]
684
	cmp	al,1
684
	cmp	al,1
685
	je	mov_reg_mem_8bit
685
	je	mov_reg_mem_8bit
686
	call	operand_autodetect
686
	call	operand_autodetect
687
	mov	al,[postbyte_register]
687
	mov	al,[postbyte_register]
688
	or	al,bl
688
	or	al,bl
689
	or	al,bh
689
	or	al,bh
690
	jz	mov_ax_mem
690
	jz	mov_ax_mem
691
	add	[base_code],3
691
	add	[base_code],3
692
	jmp	instruction_ready
692
	jmp	instruction_ready
693
      mov_reg_mem_8bit:
693
      mov_reg_mem_8bit:
694
	mov	al,[postbyte_register]
694
	mov	al,[postbyte_register]
695
	or	al,bl
695
	or	al,bl
696
	or	al,bh
696
	or	al,bh
697
	jz	mov_al_mem
697
	jz	mov_al_mem
698
	add	[base_code],2
698
	add	[base_code],2
699
	jmp	instruction_ready
699
	jmp	instruction_ready
700
      mov_al_mem:
700
      mov_al_mem:
701
	test	ch,22h
701
	test	ch,22h
702
	jnz	mov_al_mem_address16
702
	jnz	mov_al_mem_address16
703
	test	ch,44h
703
	test	ch,44h
704
	jnz	mov_al_mem_address32
704
	jnz	mov_al_mem_address32
705
	test	ch,88h
705
	test	ch,88h
706
	jnz	mov_al_mem_address64
706
	jnz	mov_al_mem_address64
707
	or	ch,ch
707
	or	ch,ch
708
	jnz	invalid_address_size
708
	jnz	invalid_address_size
709
	cmp	[code_type],64
709
	cmp	[code_type],64
710
	je	mov_al_mem_address64
710
	je	mov_al_mem_address64
711
	cmp	[code_type],32
711
	cmp	[code_type],32
712
	je	mov_al_mem_address32
712
	je	mov_al_mem_address32
713
	cmp	edx,10000h
713
	cmp	edx,10000h
714
	jb	mov_al_mem_address16
714
	jb	mov_al_mem_address16
715
      mov_al_mem_address32:
715
      mov_al_mem_address32:
716
	call	store_segment_prefix_if_necessary
716
	call	store_segment_prefix_if_necessary
717
	call	address_32bit_prefix
717
	call	address_32bit_prefix
718
	mov	[base_code],0A0h
718
	mov	[base_code],0A0h
719
	jmp	store_mov_address32
719
	jmp	store_mov_address32
720
      mov_al_mem_address16:
720
      mov_al_mem_address16:
721
	call	store_segment_prefix_if_necessary
721
	call	store_segment_prefix_if_necessary
722
	call	address_16bit_prefix
722
	call	address_16bit_prefix
723
	mov	[base_code],0A0h
723
	mov	[base_code],0A0h
724
	jmp	store_mov_address16
724
	jmp	store_mov_address16
725
      mov_al_mem_address64:
725
      mov_al_mem_address64:
726
	call	store_segment_prefix_if_necessary
726
	call	store_segment_prefix_if_necessary
727
	mov	[base_code],0A0h
727
	mov	[base_code],0A0h
728
	jmp	store_mov_address64
728
	jmp	store_mov_address64
729
      mov_ax_mem:
729
      mov_ax_mem:
730
	test	ch,22h
730
	test	ch,22h
731
	jnz	mov_ax_mem_address16
731
	jnz	mov_ax_mem_address16
732
	test	ch,44h
732
	test	ch,44h
733
	jnz	mov_ax_mem_address32
733
	jnz	mov_ax_mem_address32
734
	test	ch,88h
734
	test	ch,88h
735
	jnz	mov_ax_mem_address64
735
	jnz	mov_ax_mem_address64
736
	or	ch,ch
736
	or	ch,ch
737
	jnz	invalid_address_size
737
	jnz	invalid_address_size
738
	cmp	[code_type],64
738
	cmp	[code_type],64
739
	je	mov_ax_mem_address64
739
	je	mov_ax_mem_address64
740
	cmp	[code_type],32
740
	cmp	[code_type],32
741
	je	mov_ax_mem_address32
741
	je	mov_ax_mem_address32
742
	cmp	edx,10000h
742
	cmp	edx,10000h
743
	jb	mov_ax_mem_address16
743
	jb	mov_ax_mem_address16
744
      mov_ax_mem_address32:
744
      mov_ax_mem_address32:
745
	call	store_segment_prefix_if_necessary
745
	call	store_segment_prefix_if_necessary
746
	call	address_32bit_prefix
746
	call	address_32bit_prefix
747
	mov	[base_code],0A1h
747
	mov	[base_code],0A1h
748
	jmp	store_mov_address32
748
	jmp	store_mov_address32
749
      mov_ax_mem_address16:
749
      mov_ax_mem_address16:
750
	call	store_segment_prefix_if_necessary
750
	call	store_segment_prefix_if_necessary
751
	call	address_16bit_prefix
751
	call	address_16bit_prefix
752
	mov	[base_code],0A1h
752
	mov	[base_code],0A1h
753
	jmp	store_mov_address16
753
	jmp	store_mov_address16
754
      mov_ax_mem_address64:
754
      mov_ax_mem_address64:
755
	call	store_segment_prefix_if_necessary
755
	call	store_segment_prefix_if_necessary
756
	mov	[base_code],0A1h
756
	mov	[base_code],0A1h
757
	jmp	store_mov_address64
757
	jmp	store_mov_address64
758
      mov_reg_imm:
758
      mov_reg_imm:
759
	mov	al,[operand_size]
759
	mov	al,[operand_size]
760
	cmp	al,1
760
	cmp	al,1
761
	je	mov_reg_imm_8bit
761
	je	mov_reg_imm_8bit
762
	cmp	al,2
762
	cmp	al,2
763
	je	mov_reg_imm_16bit
763
	je	mov_reg_imm_16bit
764
	cmp	al,4
764
	cmp	al,4
765
	je	mov_reg_imm_32bit
765
	je	mov_reg_imm_32bit
766
	cmp	al,8
766
	cmp	al,8
767
	jne	invalid_operand_size
767
	jne	invalid_operand_size
768
      mov_reg_imm_64bit:
768
      mov_reg_imm_64bit:
769
	call	operand_64bit
769
	call	operand_64bit
770
	call	get_qword_value
770
	call	get_qword_value
771
	mov	ecx,edx
771
	mov	ecx,edx
772
	cmp	[size_declared],0
772
	cmp	[size_declared],0
773
	jne	mov_reg_imm_64bit_store
773
	jne	mov_reg_imm_64bit_store
774
	cmp	[value_type],4
774
	cmp	[value_type],4
775
	jae	mov_reg_imm_64bit_store
775
	jae	mov_reg_imm_64bit_store
776
	cdq
776
	cdq
777
	cmp	ecx,edx
777
	cmp	ecx,edx
778
	je	mov_reg_64bit_imm_32bit
778
	je	mov_reg_64bit_imm_32bit
779
      mov_reg_imm_64bit_store:
779
      mov_reg_imm_64bit_store:
780
	push	eax ecx
780
	push	eax ecx
781
	mov	al,0B8h
781
	mov	al,0B8h
782
	call	store_mov_reg_imm_code
782
	call	store_mov_reg_imm_code
783
	pop	edx eax
783
	pop	edx eax
784
	call	mark_relocation
784
	call	mark_relocation
785
	stos	dword [edi]
785
	stos	dword [edi]
786
	mov	eax,edx
786
	mov	eax,edx
787
	stos	dword [edi]
787
	stos	dword [edi]
788
	jmp	instruction_assembled
788
	jmp	instruction_assembled
789
      mov_reg_imm_8bit:
789
      mov_reg_imm_8bit:
790
	call	get_byte_value
790
	call	get_byte_value
791
	mov	dl,al
791
	mov	dl,al
792
	mov	al,0B0h
792
	mov	al,0B0h
793
	call	store_mov_reg_imm_code
793
	call	store_mov_reg_imm_code
794
	mov	al,dl
794
	mov	al,dl
795
	stos	byte [edi]
795
	stos	byte [edi]
796
	jmp	instruction_assembled
796
	jmp	instruction_assembled
797
      mov_reg_imm_16bit:
797
      mov_reg_imm_16bit:
798
	call	get_word_value
798
	call	get_word_value
799
	mov	dx,ax
799
	mov	dx,ax
800
	call	operand_16bit
800
	call	operand_16bit
801
	mov	al,0B8h
801
	mov	al,0B8h
802
	call	store_mov_reg_imm_code
802
	call	store_mov_reg_imm_code
803
	mov	ax,dx
803
	mov	ax,dx
804
	call	mark_relocation
804
	call	mark_relocation
805
	stos	word [edi]
805
	stos	word [edi]
806
	jmp	instruction_assembled
806
	jmp	instruction_assembled
807
      mov_reg_imm_32bit:
807
      mov_reg_imm_32bit:
808
	call	operand_32bit
808
	call	operand_32bit
809
	call	get_dword_value
809
	call	get_dword_value
810
	mov	edx,eax
810
	mov	edx,eax
811
	mov	al,0B8h
811
	mov	al,0B8h
812
	call	store_mov_reg_imm_code
812
	call	store_mov_reg_imm_code
813
      mov_store_imm_32bit:
813
      mov_store_imm_32bit:
814
	mov	eax,edx
814
	mov	eax,edx
815
	call	mark_relocation
815
	call	mark_relocation
816
	stos	dword [edi]
816
	stos	dword [edi]
817
	jmp	instruction_assembled
817
	jmp	instruction_assembled
818
      store_mov_reg_imm_code:
818
      store_mov_reg_imm_code:
819
	mov	ah,[postbyte_register]
819
	mov	ah,[postbyte_register]
820
	test	ah,1000b
820
	test	ah,1000b
821
	jz	mov_reg_imm_prefix_ok
821
	jz	mov_reg_imm_prefix_ok
822
	or	[rex_prefix],41h
822
	or	[rex_prefix],41h
823
      mov_reg_imm_prefix_ok:
823
      mov_reg_imm_prefix_ok:
824
	and	ah,111b
824
	and	ah,111b
825
	add	al,ah
825
	add	al,ah
826
	mov	[base_code],al
826
	mov	[base_code],al
827
	call	store_instruction_code
827
	call	store_instruction_code
828
	ret
828
	ret
829
      mov_reg_64bit_imm_32bit:
829
      mov_reg_64bit_imm_32bit:
830
	mov	edx,eax
830
	mov	edx,eax
831
	mov	bl,[postbyte_register]
831
	mov	bl,[postbyte_register]
832
	mov	[postbyte_register],0
832
	mov	[postbyte_register],0
833
	mov	[base_code],0C7h
833
	mov	[base_code],0C7h
834
	call	store_nomem_instruction
834
	call	store_nomem_instruction
835
	jmp	mov_store_imm_32bit
835
	jmp	mov_store_imm_32bit
836
      mov_sreg:
836
      mov_sreg:
837
	mov	ah,al
837
	mov	ah,al
838
	and	al,1111b
838
	and	al,1111b
839
	mov	[postbyte_register],al
839
	mov	[postbyte_register],al
840
	shr	ah,4
840
	shr	ah,4
841
	cmp	ah,5
841
	cmp	ah,5
842
	je	mov_creg
842
	je	mov_creg
843
	cmp	ah,7
843
	cmp	ah,7
844
	je	mov_dreg
844
	je	mov_dreg
845
	ja	mov_treg
845
	ja	mov_treg
846
	cmp	al,2
846
	cmp	al,2
847
	je	illegal_instruction
847
	je	illegal_instruction
848
	dec	[postbyte_register]
848
	dec	[postbyte_register]
849
	lods	byte [esi]
849
	lods	byte [esi]
850
	cmp	al,','
850
	cmp	al,','
851
	jne	invalid_operand
851
	jne	invalid_operand
852
	lods	byte [esi]
852
	lods	byte [esi]
853
	call	get_size_operator
853
	call	get_size_operator
854
	cmp	al,'['
854
	cmp	al,'['
855
	je	mov_sreg_mem
855
	je	mov_sreg_mem
856
	cmp	al,10h
856
	cmp	al,10h
857
	jne	invalid_operand
857
	jne	invalid_operand
858
      mov_sreg_reg:
858
      mov_sreg_reg:
859
	lods	byte [esi]
859
	lods	byte [esi]
860
	call	convert_register
860
	call	convert_register
861
	or	ah,ah
861
	or	ah,ah
862
	jz	mov_sreg_reg_size_ok
862
	jz	mov_sreg_reg_size_ok
863
	cmp	ah,2
863
	cmp	ah,2
864
	jne	invalid_operand_size
864
	jne	invalid_operand_size
865
	mov	bl,al
865
	mov	bl,al
866
      mov_sreg_reg_size_ok:
866
      mov_sreg_reg_size_ok:
867
	mov	[base_code],8Eh
867
	mov	[base_code],8Eh
868
	jmp	nomem_instruction_ready
868
	jmp	nomem_instruction_ready
869
      mov_sreg_mem:
869
      mov_sreg_mem:
870
	call	get_address
870
	call	get_address
871
	mov	al,[operand_size]
871
	mov	al,[operand_size]
872
	or	al,al
872
	or	al,al
873
	jz	mov_sreg_mem_size_ok
873
	jz	mov_sreg_mem_size_ok
874
	cmp	al,2
874
	cmp	al,2
875
	jne	invalid_operand_size
875
	jne	invalid_operand_size
876
      mov_sreg_mem_size_ok:
876
      mov_sreg_mem_size_ok:
877
	mov	[base_code],8Eh
877
	mov	[base_code],8Eh
878
	jmp	instruction_ready
878
	jmp	instruction_ready
879
      mov_treg:
879
      mov_treg:
880
	cmp	ah,9
880
	cmp	ah,9
881
	jne	invalid_operand
881
	jne	invalid_operand
882
	mov	[extended_code],26h
882
	mov	[extended_code],26h
883
	jmp	mov_xrx
883
	jmp	mov_xrx
884
      mov_dreg:
884
      mov_dreg:
885
	mov	[extended_code],23h
885
	mov	[extended_code],23h
886
	jmp	mov_xrx
886
	jmp	mov_xrx
887
      mov_creg:
887
      mov_creg:
888
	mov	[extended_code],22h
888
	mov	[extended_code],22h
889
      mov_xrx:
889
      mov_xrx:
890
	mov	[base_code],0Fh
890
	mov	[base_code],0Fh
891
	lods	byte [esi]
891
	lods	byte [esi]
892
	cmp	al,','
892
	cmp	al,','
893
	jne	invalid_operand
893
	jne	invalid_operand
894
	lods	byte [esi]
894
	lods	byte [esi]
895
	cmp	al,10h
895
	cmp	al,10h
896
	jne	invalid_operand
896
	jne	invalid_operand
897
	lods	byte [esi]
897
	lods	byte [esi]
898
	call	convert_register
898
	call	convert_register
899
	mov	bl,al
899
	mov	bl,al
900
	cmp	[code_type],64
900
	cmp	[code_type],64
901
	je	mov_xrx_64bit
901
	je	mov_xrx_64bit
902
	cmp	ah,4
902
	cmp	ah,4
903
	jne	invalid_operand_size
903
	jne	invalid_operand_size
904
	cmp	[postbyte_register],8
904
	cmp	[postbyte_register],8
905
	jne	mov_xrx_store
905
	jne	mov_xrx_store
906
	cmp	[extended_code],22h
906
	cmp	[extended_code],22h
907
	jne	mov_xrx_store
907
	jne	mov_xrx_store
908
	mov	al,0F0h
908
	mov	al,0F0h
909
	stos	byte [edi]
909
	stos	byte [edi]
910
	mov	[postbyte_register],0
910
	mov	[postbyte_register],0
911
      mov_xrx_store:
911
      mov_xrx_store:
912
	jmp	nomem_instruction_ready
912
	jmp	nomem_instruction_ready
913
      mov_xrx_64bit:
913
      mov_xrx_64bit:
914
	cmp	ah,8
914
	cmp	ah,8
915
	je	mov_xrx_store
915
	je	mov_xrx_store
916
	jmp	invalid_operand_size
916
	jmp	invalid_operand_size
917
test_instruction:
917
test_instruction:
918
	mov	[base_code],84h
918
	mov	[base_code],84h
919
	lods	byte [esi]
919
	lods	byte [esi]
920
	call	get_size_operator
920
	call	get_size_operator
921
	cmp	al,10h
921
	cmp	al,10h
922
	je	test_reg
922
	je	test_reg
923
	cmp	al,'['
923
	cmp	al,'['
924
	jne	invalid_operand
924
	jne	invalid_operand
925
      test_mem:
925
      test_mem:
926
	call	get_address
926
	call	get_address
927
	push	edx ebx ecx
927
	push	edx ebx ecx
928
	lods	byte [esi]
928
	lods	byte [esi]
929
	cmp	al,','
929
	cmp	al,','
930
	jne	invalid_operand
930
	jne	invalid_operand
931
	lods	byte [esi]
931
	lods	byte [esi]
932
	call	get_size_operator
932
	call	get_size_operator
933
	cmp	al,'('
933
	cmp	al,'('
934
	je	test_mem_imm
934
	je	test_mem_imm
935
	cmp	al,10h
935
	cmp	al,10h
936
	jne	invalid_operand
936
	jne	invalid_operand
937
      test_mem_reg:
937
      test_mem_reg:
938
	lods	byte [esi]
938
	lods	byte [esi]
939
	call	convert_register
939
	call	convert_register
940
	mov	[postbyte_register],al
940
	mov	[postbyte_register],al
941
	pop	ecx ebx edx
941
	pop	ecx ebx edx
942
	mov	al,ah
942
	mov	al,ah
943
	cmp	al,1
943
	cmp	al,1
944
	je	test_mem_reg_8bit
944
	je	test_mem_reg_8bit
945
	call	operand_autodetect
945
	call	operand_autodetect
946
	inc	[base_code]
946
	inc	[base_code]
947
      test_mem_reg_8bit:
947
      test_mem_reg_8bit:
948
	jmp	instruction_ready
948
	jmp	instruction_ready
949
      test_mem_imm:
949
      test_mem_imm:
950
	mov	al,[operand_size]
950
	mov	al,[operand_size]
951
	cmp	al,1
951
	cmp	al,1
952
	jb	test_mem_imm_nosize
952
	jb	test_mem_imm_nosize
953
	je	test_mem_imm_8bit
953
	je	test_mem_imm_8bit
954
	cmp	al,2
954
	cmp	al,2
955
	je	test_mem_imm_16bit
955
	je	test_mem_imm_16bit
956
	cmp	al,4
956
	cmp	al,4
957
	je	test_mem_imm_32bit
957
	je	test_mem_imm_32bit
958
	cmp	al,8
958
	cmp	al,8
959
	jne	invalid_operand_size
959
	jne	invalid_operand_size
960
      test_mem_imm_64bit:
960
      test_mem_imm_64bit:
961
	cmp	[size_declared],0
961
	cmp	[size_declared],0
962
	jne	long_immediate_not_encodable
962
	jne	long_immediate_not_encodable
963
	call	operand_64bit
963
	call	operand_64bit
964
	call	get_simm32
964
	call	get_simm32
965
	cmp	[value_type],4
965
	cmp	[value_type],4
966
	jae	long_immediate_not_encodable
966
	jae	long_immediate_not_encodable
967
	jmp	test_mem_imm_32bit_store
967
	jmp	test_mem_imm_32bit_store
968
      test_mem_imm_8bit:
968
      test_mem_imm_8bit:
969
	call	get_byte_value
969
	call	get_byte_value
970
	mov	byte [value],al
970
	mov	byte [value],al
971
	mov	[postbyte_register],0
971
	mov	[postbyte_register],0
972
	mov	[base_code],0F6h
972
	mov	[base_code],0F6h
973
	pop	ecx ebx edx
973
	pop	ecx ebx edx
974
	call	store_instruction_with_imm8
974
	call	store_instruction_with_imm8
975
	jmp	instruction_assembled
975
	jmp	instruction_assembled
976
      test_mem_imm_16bit:
976
      test_mem_imm_16bit:
977
	call	operand_16bit
977
	call	operand_16bit
978
	call	get_word_value
978
	call	get_word_value
979
	mov	word [value],ax
979
	mov	word [value],ax
980
	mov	[postbyte_register],0
980
	mov	[postbyte_register],0
981
	mov	[base_code],0F7h
981
	mov	[base_code],0F7h
982
	pop	ecx ebx edx
982
	pop	ecx ebx edx
983
	call	store_instruction_with_imm16
983
	call	store_instruction_with_imm16
984
	jmp	instruction_assembled
984
	jmp	instruction_assembled
985
      test_mem_imm_nosize:
985
      test_mem_imm_nosize:
986
	call	recoverable_unknown_size
986
	call	recoverable_unknown_size
987
      test_mem_imm_32bit:
987
      test_mem_imm_32bit:
988
	call	operand_32bit
988
	call	operand_32bit
989
	call	get_dword_value
989
	call	get_dword_value
990
      test_mem_imm_32bit_store:
990
      test_mem_imm_32bit_store:
991
	mov	dword [value],eax
991
	mov	dword [value],eax
992
	mov	[postbyte_register],0
992
	mov	[postbyte_register],0
993
	mov	[base_code],0F7h
993
	mov	[base_code],0F7h
994
	pop	ecx ebx edx
994
	pop	ecx ebx edx
995
	call	store_instruction_with_imm32
995
	call	store_instruction_with_imm32
996
	jmp	instruction_assembled
996
	jmp	instruction_assembled
997
      test_reg:
997
      test_reg:
998
	lods	byte [esi]
998
	lods	byte [esi]
999
	call	convert_register
999
	call	convert_register
1000
	mov	[postbyte_register],al
1000
	mov	[postbyte_register],al
1001
	lods	byte [esi]
1001
	lods	byte [esi]
1002
	cmp	al,','
1002
	cmp	al,','
1003
	jne	invalid_operand
1003
	jne	invalid_operand
1004
	lods	byte [esi]
1004
	lods	byte [esi]
1005
	call	get_size_operator
1005
	call	get_size_operator
1006
	cmp	al,'['
1006
	cmp	al,'['
1007
	je	test_reg_mem
1007
	je	test_reg_mem
1008
	cmp	al,'('
1008
	cmp	al,'('
1009
	je	test_reg_imm
1009
	je	test_reg_imm
1010
	cmp	al,10h
1010
	cmp	al,10h
1011
	jne	invalid_operand
1011
	jne	invalid_operand
1012
      test_reg_reg:
1012
      test_reg_reg:
1013
	lods	byte [esi]
1013
	lods	byte [esi]
1014
	call	convert_register
1014
	call	convert_register
1015
	mov	bl,[postbyte_register]
1015
	mov	bl,[postbyte_register]
1016
	mov	[postbyte_register],al
1016
	mov	[postbyte_register],al
1017
	mov	al,ah
1017
	mov	al,ah
1018
	cmp	al,1
1018
	cmp	al,1
1019
	je	test_reg_reg_8bit
1019
	je	test_reg_reg_8bit
1020
	call	operand_autodetect
1020
	call	operand_autodetect
1021
	inc	[base_code]
1021
	inc	[base_code]
1022
      test_reg_reg_8bit:
1022
      test_reg_reg_8bit:
1023
	jmp	nomem_instruction_ready
1023
	jmp	nomem_instruction_ready
1024
      test_reg_imm:
1024
      test_reg_imm:
1025
	mov	al,[operand_size]
1025
	mov	al,[operand_size]
1026
	cmp	al,1
1026
	cmp	al,1
1027
	je	test_reg_imm_8bit
1027
	je	test_reg_imm_8bit
1028
	cmp	al,2
1028
	cmp	al,2
1029
	je	test_reg_imm_16bit
1029
	je	test_reg_imm_16bit
1030
	cmp	al,4
1030
	cmp	al,4
1031
	je	test_reg_imm_32bit
1031
	je	test_reg_imm_32bit
1032
	cmp	al,8
1032
	cmp	al,8
1033
	jne	invalid_operand_size
1033
	jne	invalid_operand_size
1034
      test_reg_imm_64bit:
1034
      test_reg_imm_64bit:
1035
	cmp	[size_declared],0
1035
	cmp	[size_declared],0
1036
	jne	long_immediate_not_encodable
1036
	jne	long_immediate_not_encodable
1037
	call	operand_64bit
1037
	call	operand_64bit
1038
	call	get_simm32
1038
	call	get_simm32
1039
	cmp	[value_type],4
1039
	cmp	[value_type],4
1040
	jae	long_immediate_not_encodable
1040
	jae	long_immediate_not_encodable
1041
	jmp	test_reg_imm_32bit_store
1041
	jmp	test_reg_imm_32bit_store
1042
      test_reg_imm_8bit:
1042
      test_reg_imm_8bit:
1043
	call	get_byte_value
1043
	call	get_byte_value
1044
	mov	dl,al
1044
	mov	dl,al
1045
	mov	bl,[postbyte_register]
1045
	mov	bl,[postbyte_register]
1046
	mov	[postbyte_register],0
1046
	mov	[postbyte_register],0
1047
	mov	[base_code],0F6h
1047
	mov	[base_code],0F6h
1048
	or	bl,bl
1048
	or	bl,bl
1049
	jz	test_al_imm
1049
	jz	test_al_imm
1050
	call	store_nomem_instruction
1050
	call	store_nomem_instruction
1051
	mov	al,dl
1051
	mov	al,dl
1052
	stos	byte [edi]
1052
	stos	byte [edi]
1053
	jmp	instruction_assembled
1053
	jmp	instruction_assembled
1054
      test_al_imm:
1054
      test_al_imm:
1055
	mov	[base_code],0A8h
1055
	mov	[base_code],0A8h
1056
	call	store_instruction_code
1056
	call	store_instruction_code
1057
	mov	al,dl
1057
	mov	al,dl
1058
	stos	byte [edi]
1058
	stos	byte [edi]
1059
	jmp	instruction_assembled
1059
	jmp	instruction_assembled
1060
      test_reg_imm_16bit:
1060
      test_reg_imm_16bit:
1061
	call	operand_16bit
1061
	call	operand_16bit
1062
	call	get_word_value
1062
	call	get_word_value
1063
	mov	dx,ax
1063
	mov	dx,ax
1064
	mov	bl,[postbyte_register]
1064
	mov	bl,[postbyte_register]
1065
	mov	[postbyte_register],0
1065
	mov	[postbyte_register],0
1066
	mov	[base_code],0F7h
1066
	mov	[base_code],0F7h
1067
	or	bl,bl
1067
	or	bl,bl
1068
	jz	test_ax_imm
1068
	jz	test_ax_imm
1069
	call	store_nomem_instruction
1069
	call	store_nomem_instruction
1070
	mov	ax,dx
1070
	mov	ax,dx
1071
	call	mark_relocation
1071
	call	mark_relocation
1072
	stos	word [edi]
1072
	stos	word [edi]
1073
	jmp	instruction_assembled
1073
	jmp	instruction_assembled
1074
      test_ax_imm:
1074
      test_ax_imm:
1075
	mov	[base_code],0A9h
1075
	mov	[base_code],0A9h
1076
	call	store_instruction_code
1076
	call	store_instruction_code
1077
	mov	ax,dx
1077
	mov	ax,dx
1078
	stos	word [edi]
1078
	stos	word [edi]
1079
	jmp	instruction_assembled
1079
	jmp	instruction_assembled
1080
      test_reg_imm_32bit:
1080
      test_reg_imm_32bit:
1081
	call	operand_32bit
1081
	call	operand_32bit
1082
	call	get_dword_value
1082
	call	get_dword_value
1083
      test_reg_imm_32bit_store:
1083
      test_reg_imm_32bit_store:
1084
	mov	edx,eax
1084
	mov	edx,eax
1085
	mov	bl,[postbyte_register]
1085
	mov	bl,[postbyte_register]
1086
	mov	[postbyte_register],0
1086
	mov	[postbyte_register],0
1087
	mov	[base_code],0F7h
1087
	mov	[base_code],0F7h
1088
	or	bl,bl
1088
	or	bl,bl
1089
	jz	test_eax_imm
1089
	jz	test_eax_imm
1090
	call	store_nomem_instruction
1090
	call	store_nomem_instruction
1091
	mov	eax,edx
1091
	mov	eax,edx
1092
	call	mark_relocation
1092
	call	mark_relocation
1093
	stos	dword [edi]
1093
	stos	dword [edi]
1094
	jmp	instruction_assembled
1094
	jmp	instruction_assembled
1095
      test_eax_imm:
1095
      test_eax_imm:
1096
	mov	[base_code],0A9h
1096
	mov	[base_code],0A9h
1097
	call	store_instruction_code
1097
	call	store_instruction_code
1098
	mov	eax,edx
1098
	mov	eax,edx
1099
	stos	dword [edi]
1099
	stos	dword [edi]
1100
	jmp	instruction_assembled
1100
	jmp	instruction_assembled
1101
      test_reg_mem:
1101
      test_reg_mem:
1102
	call	get_address
1102
	call	get_address
1103
	mov	al,[operand_size]
1103
	mov	al,[operand_size]
1104
	cmp	al,1
1104
	cmp	al,1
1105
	je	test_reg_mem_8bit
1105
	je	test_reg_mem_8bit
1106
	call	operand_autodetect
1106
	call	operand_autodetect
1107
	inc	[base_code]
1107
	inc	[base_code]
1108
      test_reg_mem_8bit:
1108
      test_reg_mem_8bit:
1109
	jmp	instruction_ready
1109
	jmp	instruction_ready
1110
xchg_instruction:
1110
xchg_instruction:
1111
	mov	[base_code],86h
1111
	mov	[base_code],86h
1112
	lods	byte [esi]
1112
	lods	byte [esi]
1113
	call	get_size_operator
1113
	call	get_size_operator
1114
	cmp	al,10h
1114
	cmp	al,10h
1115
	je	xchg_reg
1115
	je	xchg_reg
1116
	cmp	al,'['
1116
	cmp	al,'['
1117
	jne	invalid_operand
1117
	jne	invalid_operand
1118
      xchg_mem:
1118
      xchg_mem:
1119
	call	get_address
1119
	call	get_address
1120
	push	edx ebx ecx
1120
	push	edx ebx ecx
1121
	lods	byte [esi]
1121
	lods	byte [esi]
1122
	cmp	al,','
1122
	cmp	al,','
1123
	jne	invalid_operand
1123
	jne	invalid_operand
1124
	lods	byte [esi]
1124
	lods	byte [esi]
1125
	call	get_size_operator
1125
	call	get_size_operator
1126
	cmp	al,10h
1126
	cmp	al,10h
1127
	je	test_mem_reg
1127
	je	test_mem_reg
1128
	jmp	invalid_operand
1128
	jmp	invalid_operand
1129
      xchg_reg:
1129
      xchg_reg:
1130
	lods	byte [esi]
1130
	lods	byte [esi]
1131
	call	convert_register
1131
	call	convert_register
1132
	mov	[postbyte_register],al
1132
	mov	[postbyte_register],al
1133
	lods	byte [esi]
1133
	lods	byte [esi]
1134
	cmp	al,','
1134
	cmp	al,','
1135
	jne	invalid_operand
1135
	jne	invalid_operand
1136
	lods	byte [esi]
1136
	lods	byte [esi]
1137
	call	get_size_operator
1137
	call	get_size_operator
1138
	cmp	al,'['
1138
	cmp	al,'['
1139
	je	test_reg_mem
1139
	je	test_reg_mem
1140
	cmp	al,10h
1140
	cmp	al,10h
1141
	jne	invalid_operand
1141
	jne	invalid_operand
1142
      xchg_reg_reg:
1142
      xchg_reg_reg:
1143
	lods	byte [esi]
1143
	lods	byte [esi]
1144
	call	convert_register
1144
	call	convert_register
1145
	mov	bl,al
1145
	mov	bl,al
1146
	mov	al,ah
1146
	mov	al,ah
1147
	cmp	al,1
1147
	cmp	al,1
1148
	je	xchg_reg_reg_8bit
1148
	je	xchg_reg_reg_8bit
1149
	call	operand_autodetect
1149
	call	operand_autodetect
1150
	cmp	[postbyte_register],0
1150
	cmp	[postbyte_register],0
1151
	je	xchg_ax_reg
1151
	je	xchg_ax_reg
1152
	or	bl,bl
1152
	or	bl,bl
1153
	jnz	xchg_reg_reg_store
1153
	jnz	xchg_reg_reg_store
1154
	mov	bl,[postbyte_register]
1154
	mov	bl,[postbyte_register]
1155
      xchg_ax_reg:
1155
      xchg_ax_reg:
1156
	cmp	[code_type],64
1156
	cmp	[code_type],64
1157
	jne	xchg_ax_reg_ok
1157
	jne	xchg_ax_reg_ok
1158
	cmp	ah,4
1158
	cmp	ah,4
1159
	jne	xchg_ax_reg_ok
1159
	jne	xchg_ax_reg_ok
1160
	or	bl,bl
1160
	or	bl,bl
1161
	jz	xchg_reg_reg_store
1161
	jz	xchg_reg_reg_store
1162
      xchg_ax_reg_ok:
1162
      xchg_ax_reg_ok:
1163
	test	bl,1000b
1163
	test	bl,1000b
1164
	jz	xchg_ax_reg_store
1164
	jz	xchg_ax_reg_store
1165
	or	[rex_prefix],41h
1165
	or	[rex_prefix],41h
1166
	and	bl,111b
1166
	and	bl,111b
1167
      xchg_ax_reg_store:
1167
      xchg_ax_reg_store:
1168
	add	bl,90h
1168
	add	bl,90h
1169
	mov	[base_code],bl
1169
	mov	[base_code],bl
1170
	call	store_instruction_code
1170
	call	store_instruction_code
1171
	jmp	instruction_assembled
1171
	jmp	instruction_assembled
1172
      xchg_reg_reg_store:
1172
      xchg_reg_reg_store:
1173
	inc	[base_code]
1173
	inc	[base_code]
1174
      xchg_reg_reg_8bit:
1174
      xchg_reg_reg_8bit:
1175
	jmp	nomem_instruction_ready
1175
	jmp	nomem_instruction_ready
1176
push_instruction:
1176
push_instruction:
1177
	mov	[push_size],al
1177
	mov	[push_size],al
1178
      push_next:
1178
      push_next:
1179
	lods	byte [esi]
1179
	lods	byte [esi]
1180
	call	get_size_operator
1180
	call	get_size_operator
1181
	cmp	al,10h
1181
	cmp	al,10h
1182
	je	push_reg
1182
	je	push_reg
1183
	cmp	al,'('
1183
	cmp	al,'('
1184
	je	push_imm
1184
	je	push_imm
1185
	cmp	al,'['
1185
	cmp	al,'['
1186
	jne	invalid_operand
1186
	jne	invalid_operand
1187
      push_mem:
1187
      push_mem:
1188
	call	get_address
1188
	call	get_address
1189
	mov	al,[operand_size]
1189
	mov	al,[operand_size]
1190
	mov	ah,[push_size]
1190
	mov	ah,[push_size]
1191
	cmp	al,2
1191
	cmp	al,2
1192
	je	push_mem_16bit
1192
	je	push_mem_16bit
1193
	cmp	al,4
1193
	cmp	al,4
1194
	je	push_mem_32bit
1194
	je	push_mem_32bit
1195
	cmp	al,8
1195
	cmp	al,8
1196
	je	push_mem_64bit
1196
	je	push_mem_64bit
1197
	or	al,al
1197
	or	al,al
1198
	jnz	invalid_operand_size
1198
	jnz	invalid_operand_size
1199
	cmp	ah,2
1199
	cmp	ah,2
1200
	je	push_mem_16bit
1200
	je	push_mem_16bit
1201
	cmp	ah,4
1201
	cmp	ah,4
1202
	je	push_mem_32bit
1202
	je	push_mem_32bit
1203
	cmp	ah,8
1203
	cmp	ah,8
1204
	je	push_mem_64bit
1204
	je	push_mem_64bit
1205
	call	recoverable_unknown_size
1205
	call	recoverable_unknown_size
1206
	jmp	push_mem_store
1206
	jmp	push_mem_store
1207
      push_mem_16bit:
1207
      push_mem_16bit:
1208
	test	ah,not 2
1208
	test	ah,not 2
1209
	jnz	invalid_operand_size
1209
	jnz	invalid_operand_size
1210
	call	operand_16bit
1210
	call	operand_16bit
1211
	jmp	push_mem_store
1211
	jmp	push_mem_store
1212
      push_mem_32bit:
1212
      push_mem_32bit:
1213
	test	ah,not 4
1213
	test	ah,not 4
1214
	jnz	invalid_operand_size
1214
	jnz	invalid_operand_size
1215
	cmp	[code_type],64
1215
	cmp	[code_type],64
1216
	je	illegal_instruction
1216
	je	illegal_instruction
1217
	call	operand_32bit
1217
	call	operand_32bit
1218
	jmp	push_mem_store
1218
	jmp	push_mem_store
1219
      push_mem_64bit:
1219
      push_mem_64bit:
1220
	test	ah,not 8
1220
	test	ah,not 8
1221
	jnz	invalid_operand_size
1221
	jnz	invalid_operand_size
1222
	cmp	[code_type],64
1222
	cmp	[code_type],64
1223
	jne	illegal_instruction
1223
	jne	illegal_instruction
1224
      push_mem_store:
1224
      push_mem_store:
1225
	mov	[base_code],0FFh
1225
	mov	[base_code],0FFh
1226
	mov	[postbyte_register],110b
1226
	mov	[postbyte_register],110b
1227
	call	store_instruction
1227
	call	store_instruction
1228
	jmp	push_done
1228
	jmp	push_done
1229
      push_reg:
1229
      push_reg:
1230
	lods	byte [esi]
1230
	lods	byte [esi]
1231
	mov	ah,al
1231
	mov	ah,al
1232
	sub	ah,10h
1232
	sub	ah,10h
1233
	and	ah,al
1233
	and	ah,al
1234
	test	ah,0F0h
1234
	test	ah,0F0h
1235
	jnz	push_sreg
1235
	jnz	push_sreg
1236
	call	convert_register
1236
	call	convert_register
1237
	test	al,1000b
1237
	test	al,1000b
1238
	jz	push_reg_ok
1238
	jz	push_reg_ok
1239
	or	[rex_prefix],41h
1239
	or	[rex_prefix],41h
1240
	and	al,111b
1240
	and	al,111b
1241
      push_reg_ok:
1241
      push_reg_ok:
1242
	add	al,50h
1242
	add	al,50h
1243
	mov	[base_code],al
1243
	mov	[base_code],al
1244
	mov	al,ah
1244
	mov	al,ah
1245
	mov	ah,[push_size]
1245
	mov	ah,[push_size]
1246
	cmp	al,2
1246
	cmp	al,2
1247
	je	push_reg_16bit
1247
	je	push_reg_16bit
1248
	cmp	al,4
1248
	cmp	al,4
1249
	je	push_reg_32bit
1249
	je	push_reg_32bit
1250
	cmp	al,8
1250
	cmp	al,8
1251
	jne	invalid_operand_size
1251
	jne	invalid_operand_size
1252
      push_reg_64bit:
1252
      push_reg_64bit:
1253
	test	ah,not 8
1253
	test	ah,not 8
1254
	jnz	invalid_operand_size
1254
	jnz	invalid_operand_size
1255
	cmp	[code_type],64
1255
	cmp	[code_type],64
1256
	jne	illegal_instruction
1256
	jne	illegal_instruction
1257
	jmp	push_reg_store
1257
	jmp	push_reg_store
1258
      push_reg_32bit:
1258
      push_reg_32bit:
1259
	test	ah,not 4
1259
	test	ah,not 4
1260
	jnz	invalid_operand_size
1260
	jnz	invalid_operand_size
1261
	cmp	[code_type],64
1261
	cmp	[code_type],64
1262
	je	illegal_instruction
1262
	je	illegal_instruction
1263
	call	operand_32bit
1263
	call	operand_32bit
1264
	jmp	push_reg_store
1264
	jmp	push_reg_store
1265
      push_reg_16bit:
1265
      push_reg_16bit:
1266
	test	ah,not 2
1266
	test	ah,not 2
1267
	jnz	invalid_operand_size
1267
	jnz	invalid_operand_size
1268
	call	operand_16bit
1268
	call	operand_16bit
1269
      push_reg_store:
1269
      push_reg_store:
1270
	call	store_instruction_code
1270
	call	store_instruction_code
1271
	jmp	push_done
1271
	jmp	push_done
1272
      push_sreg:
1272
      push_sreg:
1273
	mov	bl,al
1273
	mov	bl,al
1274
	mov	dl,[operand_size]
1274
	mov	dl,[operand_size]
1275
	mov	dh,[push_size]
1275
	mov	dh,[push_size]
1276
	cmp	dl,2
1276
	cmp	dl,2
1277
	je	push_sreg16
1277
	je	push_sreg16
1278
	cmp	dl,4
1278
	cmp	dl,4
1279
	je	push_sreg32
1279
	je	push_sreg32
1280
	cmp	dl,8
1280
	cmp	dl,8
1281
	je	push_sreg64
1281
	je	push_sreg64
1282
	or	dl,dl
1282
	or	dl,dl
1283
	jnz	invalid_operand_size
1283
	jnz	invalid_operand_size
1284
	cmp	dh,2
1284
	cmp	dh,2
1285
	je	push_sreg16
1285
	je	push_sreg16
1286
	cmp	dh,4
1286
	cmp	dh,4
1287
	je	push_sreg32
1287
	je	push_sreg32
1288
	cmp	dh,8
1288
	cmp	dh,8
1289
	je	push_sreg64
1289
	je	push_sreg64
1290
	jmp	push_sreg_store
1290
	jmp	push_sreg_store
1291
      push_sreg16:
1291
      push_sreg16:
1292
	test	dh,not 2
1292
	test	dh,not 2
1293
	jnz	invalid_operand_size
1293
	jnz	invalid_operand_size
1294
	call	operand_16bit
1294
	call	operand_16bit
1295
	jmp	push_sreg_store
1295
	jmp	push_sreg_store
1296
      push_sreg32:
1296
      push_sreg32:
1297
	test	dh,not 4
1297
	test	dh,not 4
1298
	jnz	invalid_operand_size
1298
	jnz	invalid_operand_size
1299
	cmp	[code_type],64
1299
	cmp	[code_type],64
1300
	je	illegal_instruction
1300
	je	illegal_instruction
1301
	call	operand_32bit
1301
	call	operand_32bit
1302
	jmp	push_sreg_store
1302
	jmp	push_sreg_store
1303
      push_sreg64:
1303
      push_sreg64:
1304
	test	dh,not 8
1304
	test	dh,not 8
1305
	jnz	invalid_operand_size
1305
	jnz	invalid_operand_size
1306
	cmp	[code_type],64
1306
	cmp	[code_type],64
1307
	jne	illegal_instruction
1307
	jne	illegal_instruction
1308
      push_sreg_store:
1308
      push_sreg_store:
1309
	mov	al,bl
1309
	mov	al,bl
1310
	cmp	al,70h
1310
	cmp	al,70h
1311
	jae	invalid_operand
1311
	jae	invalid_operand
1312
	sub	al,61h
1312
	sub	al,61h
1313
	jc	invalid_operand
1313
	jc	invalid_operand
1314
	cmp	al,4
1314
	cmp	al,4
1315
	jae	push_sreg_386
1315
	jae	push_sreg_386
1316
	shl	al,3
1316
	shl	al,3
1317
	add	al,6
1317
	add	al,6
1318
	mov	[base_code],al
1318
	mov	[base_code],al
1319
	cmp	[code_type],64
1319
	cmp	[code_type],64
1320
	je	illegal_instruction
1320
	je	illegal_instruction
1321
	jmp	push_reg_store
1321
	jmp	push_reg_store
1322
      push_sreg_386:
1322
      push_sreg_386:
1323
	sub	al,4
1323
	sub	al,4
1324
	shl	al,3
1324
	shl	al,3
1325
	add	al,0A0h
1325
	add	al,0A0h
1326
	mov	[extended_code],al
1326
	mov	[extended_code],al
1327
	mov	[base_code],0Fh
1327
	mov	[base_code],0Fh
1328
	jmp	push_reg_store
1328
	jmp	push_reg_store
1329
      push_imm:
1329
      push_imm:
1330
	mov	al,[operand_size]
1330
	mov	al,[operand_size]
1331
	mov	ah,[push_size]
1331
	mov	ah,[push_size]
1332
	or	al,al
1332
	or	al,al
1333
	je	push_imm_size_ok
1333
	je	push_imm_size_ok
1334
	or	ah,ah
1334
	or	ah,ah
1335
	je	push_imm_size_ok
1335
	je	push_imm_size_ok
1336
	cmp	al,ah
1336
	cmp	al,ah
1337
	jne	invalid_operand_size
1337
	jne	invalid_operand_size
1338
      push_imm_size_ok:
1338
      push_imm_size_ok:
1339
	cmp	al,2
1339
	cmp	al,2
1340
	je	push_imm_16bit
1340
	je	push_imm_16bit
1341
	cmp	al,4
1341
	cmp	al,4
1342
	je	push_imm_32bit
1342
	je	push_imm_32bit
1343
	cmp	al,8
1343
	cmp	al,8
1344
	je	push_imm_64bit
1344
	je	push_imm_64bit
1345
	cmp	ah,2
1345
	cmp	ah,2
1346
	je	push_imm_optimized_16bit
1346
	je	push_imm_optimized_16bit
1347
	cmp	ah,4
1347
	cmp	ah,4
1348
	je	push_imm_optimized_32bit
1348
	je	push_imm_optimized_32bit
1349
	cmp	ah,8
1349
	cmp	ah,8
1350
	je	push_imm_optimized_64bit
1350
	je	push_imm_optimized_64bit
1351
	or	al,al
1351
	or	al,al
1352
	jnz	invalid_operand_size
1352
	jnz	invalid_operand_size
1353
	cmp	[code_type],16
1353
	cmp	[code_type],16
1354
	je	push_imm_optimized_16bit
1354
	je	push_imm_optimized_16bit
1355
	cmp	[code_type],32
1355
	cmp	[code_type],32
1356
	je	push_imm_optimized_32bit
1356
	je	push_imm_optimized_32bit
1357
      push_imm_optimized_64bit:
1357
      push_imm_optimized_64bit:
1358
	cmp	[code_type],64
1358
	cmp	[code_type],64
1359
	jne	illegal_instruction
1359
	jne	illegal_instruction
1360
	call	get_simm32
1360
	call	get_simm32
1361
	mov	edx,eax
1361
	mov	edx,eax
1362
	cmp	[value_type],0
1362
	cmp	[value_type],0
1363
	jne	push_imm_32bit_store
1363
	jne	push_imm_32bit_store
1364
	cmp	eax,-80h
1364
	cmp	eax,-80h
1365
	jl	push_imm_32bit_store
1365
	jl	push_imm_32bit_store
1366
	cmp	eax,80h
1366
	cmp	eax,80h
1367
	jge	push_imm_32bit_store
1367
	jge	push_imm_32bit_store
1368
	jmp	push_imm_8bit
1368
	jmp	push_imm_8bit
1369
      push_imm_optimized_32bit:
1369
      push_imm_optimized_32bit:
1370
	cmp	[code_type],64
1370
	cmp	[code_type],64
1371
	je	illegal_instruction
1371
	je	illegal_instruction
1372
	call	get_dword_value
1372
	call	get_dword_value
1373
	mov	edx,eax
1373
	mov	edx,eax
1374
	call	operand_32bit
1374
	call	operand_32bit
1375
	cmp	[value_type],0
1375
	cmp	[value_type],0
1376
	jne	push_imm_32bit_store
1376
	jne	push_imm_32bit_store
1377
	cmp	eax,-80h
1377
	cmp	eax,-80h
1378
	jl	push_imm_32bit_store
1378
	jl	push_imm_32bit_store
1379
	cmp	eax,80h
1379
	cmp	eax,80h
1380
	jge	push_imm_32bit_store
1380
	jge	push_imm_32bit_store
1381
	jmp	push_imm_8bit
1381
	jmp	push_imm_8bit
1382
      push_imm_optimized_16bit:
1382
      push_imm_optimized_16bit:
1383
	call	get_word_value
1383
	call	get_word_value
1384
	mov	dx,ax
1384
	mov	dx,ax
1385
	call	operand_16bit
1385
	call	operand_16bit
1386
	cmp	[value_type],0
1386
	cmp	[value_type],0
1387
	jne	push_imm_16bit_store
1387
	jne	push_imm_16bit_store
1388
	cmp	ax,-80h
1388
	cmp	ax,-80h
1389
	jl	push_imm_16bit_store
1389
	jl	push_imm_16bit_store
1390
	cmp	ax,80h
1390
	cmp	ax,80h
1391
	jge	push_imm_16bit_store
1391
	jge	push_imm_16bit_store
1392
      push_imm_8bit:
1392
      push_imm_8bit:
1393
	mov	ah,al
1393
	mov	ah,al
1394
	mov	[base_code],6Ah
1394
	mov	[base_code],6Ah
1395
	call	store_instruction_code
1395
	call	store_instruction_code
1396
	mov	al,ah
1396
	mov	al,ah
1397
	stos	byte [edi]
1397
	stos	byte [edi]
1398
	jmp	push_done
1398
	jmp	push_done
1399
      push_imm_16bit:
1399
      push_imm_16bit:
1400
	call	get_word_value
1400
	call	get_word_value
1401
	mov	dx,ax
1401
	mov	dx,ax
1402
	call	operand_16bit
1402
	call	operand_16bit
1403
      push_imm_16bit_store:
1403
      push_imm_16bit_store:
1404
	mov	[base_code],68h
1404
	mov	[base_code],68h
1405
	call	store_instruction_code
1405
	call	store_instruction_code
1406
	mov	ax,dx
1406
	mov	ax,dx
1407
	call	mark_relocation
1407
	call	mark_relocation
1408
	stos	word [edi]
1408
	stos	word [edi]
1409
	jmp	push_done
1409
	jmp	push_done
1410
      push_imm_64bit:
1410
      push_imm_64bit:
1411
	cmp	[code_type],64
1411
	cmp	[code_type],64
1412
	jne	illegal_instruction
1412
	jne	illegal_instruction
1413
	call	get_simm32
1413
	call	get_simm32
1414
	mov	edx,eax
1414
	mov	edx,eax
1415
	jmp	push_imm_32bit_store
1415
	jmp	push_imm_32bit_store
1416
      push_imm_32bit:
1416
      push_imm_32bit:
1417
	cmp	[code_type],64
1417
	cmp	[code_type],64
1418
	je	illegal_instruction
1418
	je	illegal_instruction
1419
	call	get_dword_value
1419
	call	get_dword_value
1420
	mov	edx,eax
1420
	mov	edx,eax
1421
	call	operand_32bit
1421
	call	operand_32bit
1422
      push_imm_32bit_store:
1422
      push_imm_32bit_store:
1423
	mov	[base_code],68h
1423
	mov	[base_code],68h
1424
	call	store_instruction_code
1424
	call	store_instruction_code
1425
	mov	eax,edx
1425
	mov	eax,edx
1426
	call	mark_relocation
1426
	call	mark_relocation
1427
	stos	dword [edi]
1427
	stos	dword [edi]
1428
      push_done:
1428
      push_done:
1429
	lods	byte [esi]
1429
	lods	byte [esi]
1430
	dec	esi
1430
	dec	esi
1431
	cmp	al,0Fh
1431
	cmp	al,0Fh
1432
	je	instruction_assembled
1432
	je	instruction_assembled
1433
	or	al,al
1433
	or	al,al
1434
	jz	instruction_assembled
1434
	jz	instruction_assembled
1435
	mov	[operand_size],0
1435
	mov	[operand_size],0
1436
	mov	[size_override],0
1436
	mov	[size_override],0
1437
	mov	[operand_prefix],0
1437
	mov	[operand_prefix],0
1438
	mov	[rex_prefix],0
1438
	mov	[rex_prefix],0
1439
	jmp	push_next
1439
	jmp	push_next
1440
pop_instruction:
1440
pop_instruction:
1441
	mov	[push_size],al
1441
	mov	[push_size],al
1442
      pop_next:
1442
      pop_next:
1443
	lods	byte [esi]
1443
	lods	byte [esi]
1444
	call	get_size_operator
1444
	call	get_size_operator
1445
	cmp	al,10h
1445
	cmp	al,10h
1446
	je	pop_reg
1446
	je	pop_reg
1447
	cmp	al,'['
1447
	cmp	al,'['
1448
	jne	invalid_operand
1448
	jne	invalid_operand
1449
      pop_mem:
1449
      pop_mem:
1450
	call	get_address
1450
	call	get_address
1451
	mov	al,[operand_size]
1451
	mov	al,[operand_size]
1452
	mov	ah,[push_size]
1452
	mov	ah,[push_size]
1453
	cmp	al,2
1453
	cmp	al,2
1454
	je	pop_mem_16bit
1454
	je	pop_mem_16bit
1455
	cmp	al,4
1455
	cmp	al,4
1456
	je	pop_mem_32bit
1456
	je	pop_mem_32bit
1457
	cmp	al,8
1457
	cmp	al,8
1458
	je	pop_mem_64bit
1458
	je	pop_mem_64bit
1459
	or	al,al
1459
	or	al,al
1460
	jnz	invalid_operand_size
1460
	jnz	invalid_operand_size
1461
	cmp	ah,2
1461
	cmp	ah,2
1462
	je	pop_mem_16bit
1462
	je	pop_mem_16bit
1463
	cmp	ah,4
1463
	cmp	ah,4
1464
	je	pop_mem_32bit
1464
	je	pop_mem_32bit
1465
	cmp	ah,8
1465
	cmp	ah,8
1466
	je	pop_mem_64bit
1466
	je	pop_mem_64bit
1467
	call	recoverable_unknown_size
1467
	call	recoverable_unknown_size
1468
	jmp	pop_mem_store
1468
	jmp	pop_mem_store
1469
      pop_mem_16bit:
1469
      pop_mem_16bit:
1470
	test	ah,not 2
1470
	test	ah,not 2
1471
	jnz	invalid_operand_size
1471
	jnz	invalid_operand_size
1472
	call	operand_16bit
1472
	call	operand_16bit
1473
	jmp	pop_mem_store
1473
	jmp	pop_mem_store
1474
      pop_mem_32bit:
1474
      pop_mem_32bit:
1475
	test	ah,not 4
1475
	test	ah,not 4
1476
	jnz	invalid_operand_size
1476
	jnz	invalid_operand_size
1477
	cmp	[code_type],64
1477
	cmp	[code_type],64
1478
	je	illegal_instruction
1478
	je	illegal_instruction
1479
	call	operand_32bit
1479
	call	operand_32bit
1480
	jmp	pop_mem_store
1480
	jmp	pop_mem_store
1481
      pop_mem_64bit:
1481
      pop_mem_64bit:
1482
	test	ah,not 8
1482
	test	ah,not 8
1483
	jnz	invalid_operand_size
1483
	jnz	invalid_operand_size
1484
	cmp	[code_type],64
1484
	cmp	[code_type],64
1485
	jne	illegal_instruction
1485
	jne	illegal_instruction
1486
      pop_mem_store:
1486
      pop_mem_store:
1487
	mov	[base_code],08Fh
1487
	mov	[base_code],08Fh
1488
	mov	[postbyte_register],0
1488
	mov	[postbyte_register],0
1489
	call	store_instruction
1489
	call	store_instruction
1490
	jmp	pop_done
1490
	jmp	pop_done
1491
      pop_reg:
1491
      pop_reg:
1492
	lods	byte [esi]
1492
	lods	byte [esi]
1493
	mov	ah,al
1493
	mov	ah,al
1494
	sub	ah,10h
1494
	sub	ah,10h
1495
	and	ah,al
1495
	and	ah,al
1496
	test	ah,0F0h
1496
	test	ah,0F0h
1497
	jnz	pop_sreg
1497
	jnz	pop_sreg
1498
	call	convert_register
1498
	call	convert_register
1499
	test	al,1000b
1499
	test	al,1000b
1500
	jz	pop_reg_ok
1500
	jz	pop_reg_ok
1501
	or	[rex_prefix],41h
1501
	or	[rex_prefix],41h
1502
	and	al,111b
1502
	and	al,111b
1503
      pop_reg_ok:
1503
      pop_reg_ok:
1504
	add	al,58h
1504
	add	al,58h
1505
	mov	[base_code],al
1505
	mov	[base_code],al
1506
	mov	al,ah
1506
	mov	al,ah
1507
	mov	ah,[push_size]
1507
	mov	ah,[push_size]
1508
	cmp	al,2
1508
	cmp	al,2
1509
	je	pop_reg_16bit
1509
	je	pop_reg_16bit
1510
	cmp	al,4
1510
	cmp	al,4
1511
	je	pop_reg_32bit
1511
	je	pop_reg_32bit
1512
	cmp	al,8
1512
	cmp	al,8
1513
	je	pop_reg_64bit
1513
	je	pop_reg_64bit
1514
	jmp	invalid_operand_size
1514
	jmp	invalid_operand_size
1515
      pop_reg_64bit:
1515
      pop_reg_64bit:
1516
	test	ah,not 8
1516
	test	ah,not 8
1517
	jnz	invalid_operand_size
1517
	jnz	invalid_operand_size
1518
	cmp	[code_type],64
1518
	cmp	[code_type],64
1519
	jne	illegal_instruction
1519
	jne	illegal_instruction
1520
	jmp	pop_reg_store
1520
	jmp	pop_reg_store
1521
      pop_reg_32bit:
1521
      pop_reg_32bit:
1522
	test	ah,not 4
1522
	test	ah,not 4
1523
	jnz	invalid_operand_size
1523
	jnz	invalid_operand_size
1524
	cmp	[code_type],64
1524
	cmp	[code_type],64
1525
	je	illegal_instruction
1525
	je	illegal_instruction
1526
	call	operand_32bit
1526
	call	operand_32bit
1527
	jmp	pop_reg_store
1527
	jmp	pop_reg_store
1528
      pop_reg_16bit:
1528
      pop_reg_16bit:
1529
	test	ah,not 2
1529
	test	ah,not 2
1530
	jnz	invalid_operand_size
1530
	jnz	invalid_operand_size
1531
	call	operand_16bit
1531
	call	operand_16bit
1532
      pop_reg_store:
1532
      pop_reg_store:
1533
	call	store_instruction_code
1533
	call	store_instruction_code
1534
      pop_done:
1534
      pop_done:
1535
	lods	byte [esi]
1535
	lods	byte [esi]
1536
	dec	esi
1536
	dec	esi
1537
	cmp	al,0Fh
1537
	cmp	al,0Fh
1538
	je	instruction_assembled
1538
	je	instruction_assembled
1539
	or	al,al
1539
	or	al,al
1540
	jz	instruction_assembled
1540
	jz	instruction_assembled
1541
	mov	[operand_size],0
1541
	mov	[operand_size],0
1542
	mov	[size_override],0
1542
	mov	[size_override],0
1543
	mov	[operand_prefix],0
1543
	mov	[operand_prefix],0
1544
	mov	[rex_prefix],0
1544
	mov	[rex_prefix],0
1545
	jmp	pop_next
1545
	jmp	pop_next
1546
      pop_sreg:
1546
      pop_sreg:
1547
	mov	dl,[operand_size]
1547
	mov	dl,[operand_size]
1548
	mov	dh,[push_size]
1548
	mov	dh,[push_size]
1549
	cmp	al,62h
1549
	cmp	al,62h
1550
	je	pop_cs
1550
	je	pop_cs
1551
	mov	bl,al
1551
	mov	bl,al
1552
	cmp	dl,2
1552
	cmp	dl,2
1553
	je	pop_sreg16
1553
	je	pop_sreg16
1554
	cmp	dl,4
1554
	cmp	dl,4
1555
	je	pop_sreg32
1555
	je	pop_sreg32
1556
	cmp	dl,8
1556
	cmp	dl,8
1557
	je	pop_sreg64
1557
	je	pop_sreg64
1558
	or	dl,dl
1558
	or	dl,dl
1559
	jnz	invalid_operand_size
1559
	jnz	invalid_operand_size
1560
	cmp	dh,2
1560
	cmp	dh,2
1561
	je	pop_sreg16
1561
	je	pop_sreg16
1562
	cmp	dh,4
1562
	cmp	dh,4
1563
	je	pop_sreg32
1563
	je	pop_sreg32
1564
	cmp	dh,8
1564
	cmp	dh,8
1565
	je	pop_sreg64
1565
	je	pop_sreg64
1566
	jmp	pop_sreg_store
1566
	jmp	pop_sreg_store
1567
      pop_sreg16:
1567
      pop_sreg16:
1568
	test	dh,not 2
1568
	test	dh,not 2
1569
	jnz	invalid_operand_size
1569
	jnz	invalid_operand_size
1570
	call	operand_16bit
1570
	call	operand_16bit
1571
	jmp	pop_sreg_store
1571
	jmp	pop_sreg_store
1572
      pop_sreg32:
1572
      pop_sreg32:
1573
	test	dh,not 4
1573
	test	dh,not 4
1574
	jnz	invalid_operand_size
1574
	jnz	invalid_operand_size
1575
	cmp	[code_type],64
1575
	cmp	[code_type],64
1576
	je	illegal_instruction
1576
	je	illegal_instruction
1577
	call	operand_32bit
1577
	call	operand_32bit
1578
	jmp	pop_sreg_store
1578
	jmp	pop_sreg_store
1579
      pop_sreg64:
1579
      pop_sreg64:
1580
	test	dh,not 8
1580
	test	dh,not 8
1581
	jnz	invalid_operand_size
1581
	jnz	invalid_operand_size
1582
	cmp	[code_type],64
1582
	cmp	[code_type],64
1583
	jne	illegal_instruction
1583
	jne	illegal_instruction
1584
      pop_sreg_store:
1584
      pop_sreg_store:
1585
	mov	al,bl
1585
	mov	al,bl
1586
	cmp	al,70h
1586
	cmp	al,70h
1587
	jae	invalid_operand
1587
	jae	invalid_operand
1588
	sub	al,61h
1588
	sub	al,61h
1589
	jc	invalid_operand
1589
	jc	invalid_operand
1590
	cmp	al,4
1590
	cmp	al,4
1591
	jae	pop_sreg_386
1591
	jae	pop_sreg_386
1592
	shl	al,3
1592
	shl	al,3
1593
	add	al,7
1593
	add	al,7
1594
	mov	[base_code],al
1594
	mov	[base_code],al
1595
	cmp	[code_type],64
1595
	cmp	[code_type],64
1596
	je	illegal_instruction
1596
	je	illegal_instruction
1597
	jmp	pop_reg_store
1597
	jmp	pop_reg_store
1598
      pop_cs:
1598
      pop_cs:
1599
	cmp	[code_type],16
1599
	cmp	[code_type],16
1600
	jne	illegal_instruction
1600
	jne	illegal_instruction
1601
	cmp	dl,2
1601
	cmp	dl,2
1602
	je	pop_cs_store
1602
	je	pop_cs_store
1603
	or	dl,dl
1603
	or	dl,dl
1604
	jnz	invalid_operand_size
1604
	jnz	invalid_operand_size
1605
	cmp	dh,2
1605
	cmp	dh,2
1606
	je	pop_cs_store
1606
	je	pop_cs_store
1607
	or	dh,dh
1607
	or	dh,dh
1608
	jnz	illegal_instruction
1608
	jnz	illegal_instruction
1609
      pop_cs_store:
1609
      pop_cs_store:
1610
	test	dh,not 2
1610
	test	dh,not 2
1611
	jnz	invalid_operand_size
1611
	jnz	invalid_operand_size
1612
	mov	al,0Fh
1612
	mov	al,0Fh
1613
	stos	byte [edi]
1613
	stos	byte [edi]
1614
	jmp	pop_done
1614
	jmp	pop_done
1615
      pop_sreg_386:
1615
      pop_sreg_386:
1616
	sub	al,4
1616
	sub	al,4
1617
	shl	al,3
1617
	shl	al,3
1618
	add	al,0A1h
1618
	add	al,0A1h
1619
	mov	[extended_code],al
1619
	mov	[extended_code],al
1620
	mov	[base_code],0Fh
1620
	mov	[base_code],0Fh
1621
	jmp	pop_reg_store
1621
	jmp	pop_reg_store
1622
inc_instruction:
1622
inc_instruction:
1623
	mov	[base_code],al
1623
	mov	[base_code],al
1624
	lods	byte [esi]
1624
	lods	byte [esi]
1625
	call	get_size_operator
1625
	call	get_size_operator
1626
	cmp	al,10h
1626
	cmp	al,10h
1627
	je	inc_reg
1627
	je	inc_reg
1628
	cmp	al,'['
1628
	cmp	al,'['
1629
	je	inc_mem
1629
	je	inc_mem
1630
	jne	invalid_operand
1630
	jne	invalid_operand
1631
      inc_mem:
1631
      inc_mem:
1632
	call	get_address
1632
	call	get_address
1633
	mov	al,[operand_size]
1633
	mov	al,[operand_size]
1634
	cmp	al,1
1634
	cmp	al,1
1635
	je	inc_mem_8bit
1635
	je	inc_mem_8bit
1636
	jb	inc_mem_nosize
1636
	jb	inc_mem_nosize
1637
	call	operand_autodetect
1637
	call	operand_autodetect
1638
	mov	al,0FFh
1638
	mov	al,0FFh
1639
	xchg	al,[base_code]
1639
	xchg	al,[base_code]
1640
	mov	[postbyte_register],al
1640
	mov	[postbyte_register],al
1641
	jmp	instruction_ready
1641
	jmp	instruction_ready
1642
      inc_mem_nosize:
1642
      inc_mem_nosize:
1643
	call	recoverable_unknown_size
1643
	call	recoverable_unknown_size
1644
      inc_mem_8bit:
1644
      inc_mem_8bit:
1645
	mov	al,0FEh
1645
	mov	al,0FEh
1646
	xchg	al,[base_code]
1646
	xchg	al,[base_code]
1647
	mov	[postbyte_register],al
1647
	mov	[postbyte_register],al
1648
	jmp	instruction_ready
1648
	jmp	instruction_ready
1649
      inc_reg:
1649
      inc_reg:
1650
	lods	byte [esi]
1650
	lods	byte [esi]
1651
	call	convert_register
1651
	call	convert_register
1652
	mov	bl,al
1652
	mov	bl,al
1653
	mov	al,0FEh
1653
	mov	al,0FEh
1654
	xchg	al,[base_code]
1654
	xchg	al,[base_code]
1655
	mov	[postbyte_register],al
1655
	mov	[postbyte_register],al
1656
	mov	al,ah
1656
	mov	al,ah
1657
	cmp	al,1
1657
	cmp	al,1
1658
	je	inc_reg_8bit
1658
	je	inc_reg_8bit
1659
	call	operand_autodetect
1659
	call	operand_autodetect
1660
	cmp	[code_type],64
1660
	cmp	[code_type],64
1661
	je	inc_reg_long_form
1661
	je	inc_reg_long_form
1662
	mov	al,[postbyte_register]
1662
	mov	al,[postbyte_register]
1663
	shl	al,3
1663
	shl	al,3
1664
	add	al,bl
1664
	add	al,bl
1665
	add	al,40h
1665
	add	al,40h
1666
	mov	[base_code],al
1666
	mov	[base_code],al
1667
	call	store_instruction_code
1667
	call	store_instruction_code
1668
	jmp	instruction_assembled
1668
	jmp	instruction_assembled
1669
      inc_reg_long_form:
1669
      inc_reg_long_form:
1670
	inc	[base_code]
1670
	inc	[base_code]
1671
      inc_reg_8bit:
1671
      inc_reg_8bit:
1672
	jmp	nomem_instruction_ready
1672
	jmp	nomem_instruction_ready
1673
set_instruction:
1673
set_instruction:
1674
	mov	[base_code],0Fh
1674
	mov	[base_code],0Fh
1675
	mov	[extended_code],al
1675
	mov	[extended_code],al
1676
	lods	byte [esi]
1676
	lods	byte [esi]
1677
	call	get_size_operator
1677
	call	get_size_operator
1678
	cmp	al,10h
1678
	cmp	al,10h
1679
	je	set_reg
1679
	je	set_reg
1680
	cmp	al,'['
1680
	cmp	al,'['
1681
	jne	invalid_operand
1681
	jne	invalid_operand
1682
      set_mem:
1682
      set_mem:
1683
	call	get_address
1683
	call	get_address
1684
	cmp	[operand_size],1
1684
	cmp	[operand_size],1
1685
	ja	invalid_operand_size
1685
	ja	invalid_operand_size
1686
	mov	[postbyte_register],0
1686
	mov	[postbyte_register],0
1687
	jmp	instruction_ready
1687
	jmp	instruction_ready
1688
      set_reg:
1688
      set_reg:
1689
	lods	byte [esi]
1689
	lods	byte [esi]
1690
	call	convert_register
1690
	call	convert_register
1691
	cmp	ah,1
1691
	cmp	ah,1
1692
	jne	invalid_operand_size
1692
	jne	invalid_operand_size
1693
	mov	bl,al
1693
	mov	bl,al
1694
	mov	[postbyte_register],0
1694
	mov	[postbyte_register],0
1695
	jmp	nomem_instruction_ready
1695
	jmp	nomem_instruction_ready
1696
arpl_instruction:
1696
arpl_instruction:
1697
	cmp	[code_type],64
1697
	cmp	[code_type],64
1698
	je	illegal_instruction
1698
	je	illegal_instruction
1699
	mov	[base_code],63h
1699
	mov	[base_code],63h
1700
	lods	byte [esi]
1700
	lods	byte [esi]
1701
	call	get_size_operator
1701
	call	get_size_operator
1702
	cmp	al,10h
1702
	cmp	al,10h
1703
	je	arpl_reg
1703
	je	arpl_reg
1704
	cmp	al,'['
1704
	cmp	al,'['
1705
	jne	invalid_operand
1705
	jne	invalid_operand
1706
	call	get_address
1706
	call	get_address
1707
	lods	byte [esi]
1707
	lods	byte [esi]
1708
	cmp	al,','
1708
	cmp	al,','
1709
	jne	invalid_operand
1709
	jne	invalid_operand
1710
	lods	byte [esi]
1710
	lods	byte [esi]
1711
	cmp	al,10h
1711
	cmp	al,10h
1712
	jne	invalid_operand
1712
	jne	invalid_operand
1713
	lods	byte [esi]
1713
	lods	byte [esi]
1714
	call	convert_register
1714
	call	convert_register
1715
	mov	[postbyte_register],al
1715
	mov	[postbyte_register],al
1716
	cmp	ah,2
1716
	cmp	ah,2
1717
	jne	invalid_operand_size
1717
	jne	invalid_operand_size
1718
	jmp	instruction_ready
1718
	jmp	instruction_ready
1719
      arpl_reg:
1719
      arpl_reg:
1720
	lods	byte [esi]
1720
	lods	byte [esi]
1721
	call	convert_register
1721
	call	convert_register
1722
	cmp	ah,2
1722
	cmp	ah,2
1723
	jne	invalid_operand_size
1723
	jne	invalid_operand_size
1724
	mov	bl,al
1724
	mov	bl,al
1725
	lods	byte [esi]
1725
	lods	byte [esi]
1726
	cmp	al,','
1726
	cmp	al,','
1727
	jne	invalid_operand
1727
	jne	invalid_operand
1728
	lods	byte [esi]
1728
	lods	byte [esi]
1729
	cmp	al,10h
1729
	cmp	al,10h
1730
	jne	invalid_operand
1730
	jne	invalid_operand
1731
	lods	byte [esi]
1731
	lods	byte [esi]
1732
	call	convert_register
1732
	call	convert_register
1733
	mov	[postbyte_register],al
1733
	mov	[postbyte_register],al
1734
	jmp	nomem_instruction_ready
1734
	jmp	nomem_instruction_ready
1735
bound_instruction:
1735
bound_instruction:
1736
	cmp	[code_type],64
1736
	cmp	[code_type],64
1737
	je	illegal_instruction
1737
	je	illegal_instruction
1738
	lods	byte [esi]
1738
	lods	byte [esi]
1739
	call	get_size_operator
1739
	call	get_size_operator
1740
	cmp	al,10h
1740
	cmp	al,10h
1741
	jne	invalid_operand
1741
	jne	invalid_operand
1742
	lods	byte [esi]
1742
	lods	byte [esi]
1743
	call	convert_register
1743
	call	convert_register
1744
	mov	[postbyte_register],al
1744
	mov	[postbyte_register],al
1745
	lods	byte [esi]
1745
	lods	byte [esi]
1746
	cmp	al,','
1746
	cmp	al,','
1747
	jne	invalid_operand
1747
	jne	invalid_operand
1748
	lods	byte [esi]
1748
	lods	byte [esi]
1749
	call	get_size_operator
1749
	call	get_size_operator
1750
	cmp	al,'['
1750
	cmp	al,'['
1751
	jne	invalid_operand
1751
	jne	invalid_operand
1752
	call	get_address
1752
	call	get_address
1753
	mov	al,[operand_size]
1753
	mov	al,[operand_size]
1754
	cmp	al,2
1754
	cmp	al,2
1755
	je	bound_store
1755
	je	bound_store
1756
	cmp	al,4
1756
	cmp	al,4
1757
	jne	invalid_operand_size
1757
	jne	invalid_operand_size
1758
      bound_store:
1758
      bound_store:
1759
	call	operand_autodetect
1759
	call	operand_autodetect
1760
	mov	[base_code],62h
1760
	mov	[base_code],62h
1761
	jmp	instruction_ready
1761
	jmp	instruction_ready
1762
enter_instruction:
1762
enter_instruction:
1763
	lods	byte [esi]
1763
	lods	byte [esi]
1764
	call	get_size_operator
1764
	call	get_size_operator
1765
	cmp	ah,2
1765
	cmp	ah,2
1766
	je	enter_imm16_size_ok
1766
	je	enter_imm16_size_ok
1767
	or	ah,ah
1767
	or	ah,ah
1768
	jnz	invalid_operand_size
1768
	jnz	invalid_operand_size
1769
      enter_imm16_size_ok:
1769
      enter_imm16_size_ok:
1770
	cmp	al,'('
1770
	cmp	al,'('
1771
	jne	invalid_operand
1771
	jne	invalid_operand
1772
	call	get_word_value
1772
	call	get_word_value
1773
	cmp	[next_pass_needed],0
1773
	cmp	[next_pass_needed],0
1774
	jne	enter_imm16_ok
1774
	jne	enter_imm16_ok
1775
	cmp	[value_type],0
1775
	cmp	[value_type],0
1776
	jne	invalid_use_of_symbol
1776
	jne	invalid_use_of_symbol
1777
	test	eax,eax
1777
	test	eax,eax
1778
	js	value_out_of_range
1778
	js	value_out_of_range
1779
      enter_imm16_ok:
1779
      enter_imm16_ok:
1780
	push	eax
1780
	push	eax
1781
	mov	[operand_size],0
1781
	mov	[operand_size],0
1782
	lods	byte [esi]
1782
	lods	byte [esi]
1783
	cmp	al,','
1783
	cmp	al,','
1784
	jne	invalid_operand
1784
	jne	invalid_operand
1785
	lods	byte [esi]
1785
	lods	byte [esi]
1786
	call	get_size_operator
1786
	call	get_size_operator
1787
	cmp	ah,1
1787
	cmp	ah,1
1788
	je	enter_imm8_size_ok
1788
	je	enter_imm8_size_ok
1789
	or	ah,ah
1789
	or	ah,ah
1790
	jnz	invalid_operand_size
1790
	jnz	invalid_operand_size
1791
      enter_imm8_size_ok:
1791
      enter_imm8_size_ok:
1792
	cmp	al,'('
1792
	cmp	al,'('
1793
	jne	invalid_operand
1793
	jne	invalid_operand
1794
	call	get_byte_value
1794
	call	get_byte_value
1795
	cmp	[next_pass_needed],0
1795
	cmp	[next_pass_needed],0
1796
	jne	enter_imm8_ok
1796
	jne	enter_imm8_ok
1797
	test	eax,eax
1797
	test	eax,eax
1798
	js	value_out_of_range
1798
	js	value_out_of_range
1799
      enter_imm8_ok:
1799
      enter_imm8_ok:
1800
	mov	dl,al
1800
	mov	dl,al
1801
	pop	ebx
1801
	pop	ebx
1802
	mov	al,0C8h
1802
	mov	al,0C8h
1803
	stos	byte [edi]
1803
	stos	byte [edi]
1804
	mov	ax,bx
1804
	mov	ax,bx
1805
	stos	word [edi]
1805
	stos	word [edi]
1806
	mov	al,dl
1806
	mov	al,dl
1807
	stos	byte [edi]
1807
	stos	byte [edi]
1808
	jmp	instruction_assembled
1808
	jmp	instruction_assembled
1809
ret_instruction_only64:
1809
ret_instruction_only64:
1810
	cmp	[code_type],64
1810
	cmp	[code_type],64
1811
	jne	illegal_instruction
1811
	jne	illegal_instruction
1812
	jmp	ret_instruction
1812
	jmp	ret_instruction
1813
ret_instruction_32bit_except64:
1813
ret_instruction_32bit_except64:
1814
	cmp	[code_type],64
1814
	cmp	[code_type],64
1815
	je	illegal_instruction
1815
	je	illegal_instruction
1816
ret_instruction_32bit:
1816
ret_instruction_32bit:
1817
	call	operand_32bit
1817
	call	operand_32bit
1818
	jmp	ret_instruction
1818
	jmp	ret_instruction
1819
ret_instruction_16bit:
1819
ret_instruction_16bit:
1820
	call	operand_16bit
1820
	call	operand_16bit
1821
	jmp	ret_instruction
1821
	jmp	ret_instruction
1822
retf_instruction:
1822
retf_instruction:
1823
	cmp	[code_type],64
1823
	cmp	[code_type],64
1824
	jne	ret_instruction
1824
	jne	ret_instruction
1825
ret_instruction_64bit:
1825
ret_instruction_64bit:
1826
	call	operand_64bit
1826
	call	operand_64bit
1827
ret_instruction:
1827
ret_instruction:
1828
	mov	[base_code],al
1828
	mov	[base_code],al
1829
	lods	byte [esi]
1829
	lods	byte [esi]
1830
	dec	esi
1830
	dec	esi
1831
	or	al,al
1831
	or	al,al
1832
	jz	simple_ret
1832
	jz	simple_ret
1833
	cmp	al,0Fh
1833
	cmp	al,0Fh
1834
	je	simple_ret
1834
	je	simple_ret
1835
	lods	byte [esi]
1835
	lods	byte [esi]
1836
	call	get_size_operator
1836
	call	get_size_operator
1837
	or	ah,ah
1837
	or	ah,ah
1838
	jz	ret_imm
1838
	jz	ret_imm
1839
	cmp	ah,2
1839
	cmp	ah,2
1840
	je	ret_imm
1840
	je	ret_imm
1841
	jmp	invalid_operand_size
1841
	jmp	invalid_operand_size
1842
      ret_imm:
1842
      ret_imm:
1843
	cmp	al,'('
1843
	cmp	al,'('
1844
	jne	invalid_operand
1844
	jne	invalid_operand
1845
	call	get_word_value
1845
	call	get_word_value
1846
	cmp	[next_pass_needed],0
1846
	cmp	[next_pass_needed],0
1847
	jne	ret_imm_ok
1847
	jne	ret_imm_ok
1848
	cmp	[value_type],0
1848
	cmp	[value_type],0
1849
	jne	invalid_use_of_symbol
1849
	jne	invalid_use_of_symbol
1850
	test	eax,eax
1850
	test	eax,eax
1851
	js	value_out_of_range
1851
	js	value_out_of_range
1852
      ret_imm_ok:
1852
      ret_imm_ok:
1853
	cmp	[size_declared],0
1853
	cmp	[size_declared],0
1854
	jne	ret_imm_store
1854
	jne	ret_imm_store
1855
	or	ax,ax
1855
	or	ax,ax
1856
	jz	simple_ret
1856
	jz	simple_ret
1857
      ret_imm_store:
1857
      ret_imm_store:
1858
	mov	dx,ax
1858
	mov	dx,ax
1859
	call	store_instruction_code
1859
	call	store_instruction_code
1860
	mov	ax,dx
1860
	mov	ax,dx
1861
	stos	word [edi]
1861
	stos	word [edi]
1862
	jmp	instruction_assembled
1862
	jmp	instruction_assembled
1863
      simple_ret:
1863
      simple_ret:
1864
	inc	[base_code]
1864
	inc	[base_code]
1865
	call	store_instruction_code
1865
	call	store_instruction_code
1866
	jmp	instruction_assembled
1866
	jmp	instruction_assembled
1867
lea_instruction:
1867
lea_instruction:
1868
	mov	[base_code],8Dh
1868
	mov	[base_code],8Dh
1869
	lods	byte [esi]
1869
	lods	byte [esi]
1870
	call	get_size_operator
1870
	call	get_size_operator
1871
	cmp	al,10h
1871
	cmp	al,10h
1872
	jne	invalid_operand
1872
	jne	invalid_operand
1873
	lods	byte [esi]
1873
	lods	byte [esi]
1874
	call	convert_register
1874
	call	convert_register
1875
	mov	[postbyte_register],al
1875
	mov	[postbyte_register],al
1876
	lods	byte [esi]
1876
	lods	byte [esi]
1877
	cmp	al,','
1877
	cmp	al,','
1878
	jne	invalid_operand
1878
	jne	invalid_operand
1879
	xor	al,al
1879
	xor	al,al
1880
	xchg	al,[operand_size]
1880
	xchg	al,[operand_size]
1881
	push	eax
1881
	push	eax
1882
	lods	byte [esi]
1882
	lods	byte [esi]
1883
	call	get_size_operator
1883
	call	get_size_operator
1884
	cmp	al,'['
1884
	cmp	al,'['
1885
	jne	invalid_operand
1885
	jne	invalid_operand
1886
	mov	[size_override],-1
1886
	mov	[size_override],-1
1887
	call	get_address
1887
	call	get_address
1888
	pop	eax
1888
	pop	eax
1889
	mov	[operand_size],al
1889
	mov	[operand_size],al
1890
	call	operand_autodetect
1890
	call	operand_autodetect
1891
	jmp	instruction_ready
1891
	jmp	instruction_ready
1892
ls_instruction:
1892
ls_instruction:
1893
	or	al,al
1893
	or	al,al
1894
	jz	les_instruction
1894
	jz	les_instruction
1895
	cmp	al,3
1895
	cmp	al,3
1896
	jz	lds_instruction
1896
	jz	lds_instruction
1897
	add	al,0B0h
1897
	add	al,0B0h
1898
	mov	[extended_code],al
1898
	mov	[extended_code],al
1899
	mov	[base_code],0Fh
1899
	mov	[base_code],0Fh
1900
	jmp	ls_code_ok
1900
	jmp	ls_code_ok
1901
      les_instruction:
1901
      les_instruction:
1902
	mov	[base_code],0C4h
1902
	mov	[base_code],0C4h
1903
	jmp	ls_short_code
1903
	jmp	ls_short_code
1904
      lds_instruction:
1904
      lds_instruction:
1905
	mov	[base_code],0C5h
1905
	mov	[base_code],0C5h
1906
      ls_short_code:
1906
      ls_short_code:
1907
	cmp	[code_type],64
1907
	cmp	[code_type],64
1908
	je	illegal_instruction
1908
	je	illegal_instruction
1909
      ls_code_ok:
1909
      ls_code_ok:
1910
	lods	byte [esi]
1910
	lods	byte [esi]
1911
	call	get_size_operator
1911
	call	get_size_operator
1912
	cmp	al,10h
1912
	cmp	al,10h
1913
	jne	invalid_operand
1913
	jne	invalid_operand
1914
	lods	byte [esi]
1914
	lods	byte [esi]
1915
	call	convert_register
1915
	call	convert_register
1916
	mov	[postbyte_register],al
1916
	mov	[postbyte_register],al
1917
	lods	byte [esi]
1917
	lods	byte [esi]
1918
	cmp	al,','
1918
	cmp	al,','
1919
	jne	invalid_operand
1919
	jne	invalid_operand
1920
	add	[operand_size],2
1920
	add	[operand_size],2
1921
	lods	byte [esi]
1921
	lods	byte [esi]
1922
	call	get_size_operator
1922
	call	get_size_operator
1923
	cmp	al,'['
1923
	cmp	al,'['
1924
	jne	invalid_operand
1924
	jne	invalid_operand
1925
	call	get_address
1925
	call	get_address
1926
	mov	al,[operand_size]
1926
	mov	al,[operand_size]
1927
	cmp	al,4
1927
	cmp	al,4
1928
	je	ls_16bit
1928
	je	ls_16bit
1929
	cmp	al,6
1929
	cmp	al,6
1930
	je	ls_32bit
1930
	je	ls_32bit
1931
	cmp	al,10
1931
	cmp	al,10
1932
	je	ls_64bit
1932
	je	ls_64bit
1933
	jmp	invalid_operand_size
1933
	jmp	invalid_operand_size
1934
      ls_16bit:
1934
      ls_16bit:
1935
	call	operand_16bit
1935
	call	operand_16bit
1936
	jmp	instruction_ready
1936
	jmp	instruction_ready
1937
      ls_32bit:
1937
      ls_32bit:
1938
	call	operand_32bit
1938
	call	operand_32bit
1939
	jmp	instruction_ready
1939
	jmp	instruction_ready
1940
      ls_64bit:
1940
      ls_64bit:
1941
	call	operand_64bit
1941
	call	operand_64bit
1942
	jmp	instruction_ready
1942
	jmp	instruction_ready
1943
sh_instruction:
1943
sh_instruction:
1944
	mov	[postbyte_register],al
1944
	mov	[postbyte_register],al
1945
	lods	byte [esi]
1945
	lods	byte [esi]
1946
	call	get_size_operator
1946
	call	get_size_operator
1947
	cmp	al,10h
1947
	cmp	al,10h
1948
	je	sh_reg
1948
	je	sh_reg
1949
	cmp	al,'['
1949
	cmp	al,'['
1950
	jne	invalid_operand
1950
	jne	invalid_operand
1951
      sh_mem:
1951
      sh_mem:
1952
	call	get_address
1952
	call	get_address
1953
	push	edx ebx ecx
1953
	push	edx ebx ecx
1954
	mov	al,[operand_size]
1954
	mov	al,[operand_size]
1955
	push	eax
1955
	push	eax
1956
	mov	[operand_size],0
1956
	mov	[operand_size],0
1957
	lods	byte [esi]
1957
	lods	byte [esi]
1958
	cmp	al,','
1958
	cmp	al,','
1959
	jne	invalid_operand
1959
	jne	invalid_operand
1960
	lods	byte [esi]
1960
	lods	byte [esi]
1961
	call	get_size_operator
1961
	call	get_size_operator
1962
	cmp	al,'('
1962
	cmp	al,'('
1963
	je	sh_mem_imm
1963
	je	sh_mem_imm
1964
	cmp	al,10h
1964
	cmp	al,10h
1965
	jne	invalid_operand
1965
	jne	invalid_operand
1966
      sh_mem_reg:
1966
      sh_mem_reg:
1967
	lods	byte [esi]
1967
	lods	byte [esi]
1968
	cmp	al,11h
1968
	cmp	al,11h
1969
	jne	invalid_operand
1969
	jne	invalid_operand
1970
	pop	eax ecx ebx edx
1970
	pop	eax ecx ebx edx
1971
	cmp	al,1
1971
	cmp	al,1
1972
	je	sh_mem_cl_8bit
1972
	je	sh_mem_cl_8bit
1973
	jb	sh_mem_cl_nosize
1973
	jb	sh_mem_cl_nosize
1974
	call	operand_autodetect
1974
	call	operand_autodetect
1975
	mov	[base_code],0D3h
1975
	mov	[base_code],0D3h
1976
	jmp	instruction_ready
1976
	jmp	instruction_ready
1977
      sh_mem_cl_nosize:
1977
      sh_mem_cl_nosize:
1978
	call	recoverable_unknown_size
1978
	call	recoverable_unknown_size
1979
      sh_mem_cl_8bit:
1979
      sh_mem_cl_8bit:
1980
	mov	[base_code],0D2h
1980
	mov	[base_code],0D2h
1981
	jmp	instruction_ready
1981
	jmp	instruction_ready
1982
      sh_mem_imm:
1982
      sh_mem_imm:
1983
	mov	al,[operand_size]
1983
	mov	al,[operand_size]
1984
	or	al,al
1984
	or	al,al
1985
	jz	sh_mem_imm_size_ok
1985
	jz	sh_mem_imm_size_ok
1986
	cmp	al,1
1986
	cmp	al,1
1987
	jne	invalid_operand_size
1987
	jne	invalid_operand_size
1988
      sh_mem_imm_size_ok:
1988
      sh_mem_imm_size_ok:
1989
	call	get_byte_value
1989
	call	get_byte_value
1990
	mov	byte [value],al
1990
	mov	byte [value],al
1991
	pop	eax ecx ebx edx
1991
	pop	eax ecx ebx edx
1992
	cmp	al,1
1992
	cmp	al,1
1993
	je	sh_mem_imm_8bit
1993
	je	sh_mem_imm_8bit
1994
	jb	sh_mem_imm_nosize
1994
	jb	sh_mem_imm_nosize
1995
	call	operand_autodetect
1995
	call	operand_autodetect
1996
	cmp	byte [value],1
1996
	cmp	byte [value],1
1997
	je	sh_mem_1
1997
	je	sh_mem_1
1998
	mov	[base_code],0C1h
1998
	mov	[base_code],0C1h
1999
	call	store_instruction_with_imm8
1999
	call	store_instruction_with_imm8
2000
	jmp	instruction_assembled
2000
	jmp	instruction_assembled
2001
      sh_mem_1:
2001
      sh_mem_1:
2002
	mov	[base_code],0D1h
2002
	mov	[base_code],0D1h
2003
	jmp	instruction_ready
2003
	jmp	instruction_ready
2004
      sh_mem_imm_nosize:
2004
      sh_mem_imm_nosize:
2005
	call	recoverable_unknown_size
2005
	call	recoverable_unknown_size
2006
      sh_mem_imm_8bit:
2006
      sh_mem_imm_8bit:
2007
	cmp	byte [value],1
2007
	cmp	byte [value],1
2008
	je	sh_mem_1_8bit
2008
	je	sh_mem_1_8bit
2009
	mov	[base_code],0C0h
2009
	mov	[base_code],0C0h
2010
	call	store_instruction_with_imm8
2010
	call	store_instruction_with_imm8
2011
	jmp	instruction_assembled
2011
	jmp	instruction_assembled
2012
      sh_mem_1_8bit:
2012
      sh_mem_1_8bit:
2013
	mov	[base_code],0D0h
2013
	mov	[base_code],0D0h
2014
	jmp	instruction_ready
2014
	jmp	instruction_ready
2015
      sh_reg:
2015
      sh_reg:
2016
	lods	byte [esi]
2016
	lods	byte [esi]
2017
	call	convert_register
2017
	call	convert_register
2018
	mov	bx,ax
2018
	mov	bx,ax
2019
	mov	[operand_size],0
2019
	mov	[operand_size],0
2020
	lods	byte [esi]
2020
	lods	byte [esi]
2021
	cmp	al,','
2021
	cmp	al,','
2022
	jne	invalid_operand
2022
	jne	invalid_operand
2023
	lods	byte [esi]
2023
	lods	byte [esi]
2024
	call	get_size_operator
2024
	call	get_size_operator
2025
	cmp	al,'('
2025
	cmp	al,'('
2026
	je	sh_reg_imm
2026
	je	sh_reg_imm
2027
	cmp	al,10h
2027
	cmp	al,10h
2028
	jne	invalid_operand
2028
	jne	invalid_operand
2029
      sh_reg_reg:
2029
      sh_reg_reg:
2030
	lods	byte [esi]
2030
	lods	byte [esi]
2031
	cmp	al,11h
2031
	cmp	al,11h
2032
	jne	invalid_operand
2032
	jne	invalid_operand
2033
	mov	al,bh
2033
	mov	al,bh
2034
	cmp	al,1
2034
	cmp	al,1
2035
	je	sh_reg_cl_8bit
2035
	je	sh_reg_cl_8bit
2036
	call	operand_autodetect
2036
	call	operand_autodetect
2037
	mov	[base_code],0D3h
2037
	mov	[base_code],0D3h
2038
	jmp	nomem_instruction_ready
2038
	jmp	nomem_instruction_ready
2039
      sh_reg_cl_8bit:
2039
      sh_reg_cl_8bit:
2040
	mov	[base_code],0D2h
2040
	mov	[base_code],0D2h
2041
	jmp	nomem_instruction_ready
2041
	jmp	nomem_instruction_ready
2042
      sh_reg_imm:
2042
      sh_reg_imm:
2043
	mov	al,[operand_size]
2043
	mov	al,[operand_size]
2044
	or	al,al
2044
	or	al,al
2045
	jz	sh_reg_imm_size_ok
2045
	jz	sh_reg_imm_size_ok
2046
	cmp	al,1
2046
	cmp	al,1
2047
	jne	invalid_operand_size
2047
	jne	invalid_operand_size
2048
      sh_reg_imm_size_ok:
2048
      sh_reg_imm_size_ok:
2049
	push	ebx
2049
	push	ebx
2050
	call	get_byte_value
2050
	call	get_byte_value
2051
	mov	dl,al
2051
	mov	dl,al
2052
	pop	ebx
2052
	pop	ebx
2053
	mov	al,bh
2053
	mov	al,bh
2054
	cmp	al,1
2054
	cmp	al,1
2055
	je	sh_reg_imm_8bit
2055
	je	sh_reg_imm_8bit
2056
	call	operand_autodetect
2056
	call	operand_autodetect
2057
	cmp	dl,1
2057
	cmp	dl,1
2058
	je	sh_reg_1
2058
	je	sh_reg_1
2059
	mov	[base_code],0C1h
2059
	mov	[base_code],0C1h
2060
	call	store_nomem_instruction
2060
	call	store_nomem_instruction
2061
	mov	al,dl
2061
	mov	al,dl
2062
	stos	byte [edi]
2062
	stos	byte [edi]
2063
	jmp	instruction_assembled
2063
	jmp	instruction_assembled
2064
      sh_reg_1:
2064
      sh_reg_1:
2065
	mov	[base_code],0D1h
2065
	mov	[base_code],0D1h
2066
	jmp	nomem_instruction_ready
2066
	jmp	nomem_instruction_ready
2067
      sh_reg_imm_8bit:
2067
      sh_reg_imm_8bit:
2068
	cmp	dl,1
2068
	cmp	dl,1
2069
	je	sh_reg_1_8bit
2069
	je	sh_reg_1_8bit
2070
	mov	[base_code],0C0h
2070
	mov	[base_code],0C0h
2071
	call	store_nomem_instruction
2071
	call	store_nomem_instruction
2072
	mov	al,dl
2072
	mov	al,dl
2073
	stos	byte [edi]
2073
	stos	byte [edi]
2074
	jmp	instruction_assembled
2074
	jmp	instruction_assembled
2075
      sh_reg_1_8bit:
2075
      sh_reg_1_8bit:
2076
	mov	[base_code],0D0h
2076
	mov	[base_code],0D0h
2077
	jmp	nomem_instruction_ready
2077
	jmp	nomem_instruction_ready
2078
shd_instruction:
2078
shd_instruction:
2079
	mov	[base_code],0Fh
2079
	mov	[base_code],0Fh
2080
	mov	[extended_code],al
2080
	mov	[extended_code],al
2081
	lods	byte [esi]
2081
	lods	byte [esi]
2082
	call	get_size_operator
2082
	call	get_size_operator
2083
	cmp	al,10h
2083
	cmp	al,10h
2084
	je	shd_reg
2084
	je	shd_reg
2085
	cmp	al,'['
2085
	cmp	al,'['
2086
	jne	invalid_operand
2086
	jne	invalid_operand
2087
      shd_mem:
2087
      shd_mem:
2088
	call	get_address
2088
	call	get_address
2089
	push	edx ebx ecx
2089
	push	edx ebx ecx
2090
	lods	byte [esi]
2090
	lods	byte [esi]
2091
	cmp	al,','
2091
	cmp	al,','
2092
	jne	invalid_operand
2092
	jne	invalid_operand
2093
	lods	byte [esi]
2093
	lods	byte [esi]
2094
	call	get_size_operator
2094
	call	get_size_operator
2095
	cmp	al,10h
2095
	cmp	al,10h
2096
	jne	invalid_operand
2096
	jne	invalid_operand
2097
	lods	byte [esi]
2097
	lods	byte [esi]
2098
	call	convert_register
2098
	call	convert_register
2099
	mov	[postbyte_register],al
2099
	mov	[postbyte_register],al
2100
	lods	byte [esi]
2100
	lods	byte [esi]
2101
	cmp	al,','
2101
	cmp	al,','
2102
	jne	invalid_operand
2102
	jne	invalid_operand
2103
	mov	al,ah
2103
	mov	al,ah
2104
	mov	[operand_size],0
2104
	mov	[operand_size],0
2105
	push	eax
2105
	push	eax
2106
	lods	byte [esi]
2106
	lods	byte [esi]
2107
	call	get_size_operator
2107
	call	get_size_operator
2108
	cmp	al,'('
2108
	cmp	al,'('
2109
	je	shd_mem_reg_imm
2109
	je	shd_mem_reg_imm
2110
	cmp	al,10h
2110
	cmp	al,10h
2111
	jne	invalid_operand
2111
	jne	invalid_operand
2112
	lods	byte [esi]
2112
	lods	byte [esi]
2113
	cmp	al,11h
2113
	cmp	al,11h
2114
	jne	invalid_operand
2114
	jne	invalid_operand
2115
	pop	eax ecx ebx edx
2115
	pop	eax ecx ebx edx
2116
	call	operand_autodetect
2116
	call	operand_autodetect
2117
	inc	[extended_code]
2117
	inc	[extended_code]
2118
	jmp	instruction_ready
2118
	jmp	instruction_ready
2119
      shd_mem_reg_imm:
2119
      shd_mem_reg_imm:
2120
	mov	al,[operand_size]
2120
	mov	al,[operand_size]
2121
	or	al,al
2121
	or	al,al
2122
	jz	shd_mem_reg_imm_size_ok
2122
	jz	shd_mem_reg_imm_size_ok
2123
	cmp	al,1
2123
	cmp	al,1
2124
	jne	invalid_operand_size
2124
	jne	invalid_operand_size
2125
      shd_mem_reg_imm_size_ok:
2125
      shd_mem_reg_imm_size_ok:
2126
	call	get_byte_value
2126
	call	get_byte_value
2127
	mov	byte [value],al
2127
	mov	byte [value],al
2128
	pop	eax ecx ebx edx
2128
	pop	eax ecx ebx edx
2129
	call	operand_autodetect
2129
	call	operand_autodetect
2130
	call	store_instruction_with_imm8
2130
	call	store_instruction_with_imm8
2131
	jmp	instruction_assembled
2131
	jmp	instruction_assembled
2132
      shd_reg:
2132
      shd_reg:
2133
	lods	byte [esi]
2133
	lods	byte [esi]
2134
	call	convert_register
2134
	call	convert_register
2135
	mov	[postbyte_register],al
2135
	mov	[postbyte_register],al
2136
	lods	byte [esi]
2136
	lods	byte [esi]
2137
	cmp	al,','
2137
	cmp	al,','
2138
	jne	invalid_operand
2138
	jne	invalid_operand
2139
	lods	byte [esi]
2139
	lods	byte [esi]
2140
	call	get_size_operator
2140
	call	get_size_operator
2141
	cmp	al,10h
2141
	cmp	al,10h
2142
	jne	invalid_operand
2142
	jne	invalid_operand
2143
	lods	byte [esi]
2143
	lods	byte [esi]
2144
	call	convert_register
2144
	call	convert_register
2145
	mov	bl,[postbyte_register]
2145
	mov	bl,[postbyte_register]
2146
	mov	[postbyte_register],al
2146
	mov	[postbyte_register],al
2147
	mov	al,ah
2147
	mov	al,ah
2148
	push	eax ebx
2148
	push	eax ebx
2149
	lods	byte [esi]
2149
	lods	byte [esi]
2150
	cmp	al,','
2150
	cmp	al,','
2151
	jne	invalid_operand
2151
	jne	invalid_operand
2152
	mov	[operand_size],0
2152
	mov	[operand_size],0
2153
	lods	byte [esi]
2153
	lods	byte [esi]
2154
	call	get_size_operator
2154
	call	get_size_operator
2155
	cmp	al,'('
2155
	cmp	al,'('
2156
	je	shd_reg_reg_imm
2156
	je	shd_reg_reg_imm
2157
	cmp	al,10h
2157
	cmp	al,10h
2158
	jne	invalid_operand
2158
	jne	invalid_operand
2159
	lods	byte [esi]
2159
	lods	byte [esi]
2160
	cmp	al,11h
2160
	cmp	al,11h
2161
	jne	invalid_operand
2161
	jne	invalid_operand
2162
	pop	ebx eax
2162
	pop	ebx eax
2163
	call	operand_autodetect
2163
	call	operand_autodetect
2164
	inc	[extended_code]
2164
	inc	[extended_code]
2165
	jmp	nomem_instruction_ready
2165
	jmp	nomem_instruction_ready
2166
      shd_reg_reg_imm:
2166
      shd_reg_reg_imm:
2167
	mov	al,[operand_size]
2167
	mov	al,[operand_size]
2168
	or	al,al
2168
	or	al,al
2169
	jz	shd_reg_reg_imm_size_ok
2169
	jz	shd_reg_reg_imm_size_ok
2170
	cmp	al,1
2170
	cmp	al,1
2171
	jne	invalid_operand_size
2171
	jne	invalid_operand_size
2172
      shd_reg_reg_imm_size_ok:
2172
      shd_reg_reg_imm_size_ok:
2173
	call	get_byte_value
2173
	call	get_byte_value
2174
	mov	dl,al
2174
	mov	dl,al
2175
	pop	ebx eax
2175
	pop	ebx eax
2176
	call	operand_autodetect
2176
	call	operand_autodetect
2177
	call	store_nomem_instruction
2177
	call	store_nomem_instruction
2178
	mov	al,dl
2178
	mov	al,dl
2179
	stos	byte [edi]
2179
	stos	byte [edi]
2180
	jmp	instruction_assembled
2180
	jmp	instruction_assembled
2181
movx_instruction:
2181
movx_instruction:
2182
	mov	[base_code],0Fh
2182
	mov	[base_code],0Fh
2183
	mov	[extended_code],al
2183
	mov	[extended_code],al
2184
	lods	byte [esi]
2184
	lods	byte [esi]
2185
	call	get_size_operator
2185
	call	get_size_operator
2186
	cmp	al,10h
2186
	cmp	al,10h
2187
	jne	invalid_operand
2187
	jne	invalid_operand
2188
	lods	byte [esi]
2188
	lods	byte [esi]
2189
	call	convert_register
2189
	call	convert_register
2190
	mov	[postbyte_register],al
2190
	mov	[postbyte_register],al
2191
	mov	al,ah
2191
	mov	al,ah
2192
	push	eax
2192
	push	eax
2193
	lods	byte [esi]
2193
	lods	byte [esi]
2194
	cmp	al,','
2194
	cmp	al,','
2195
	jne	invalid_operand
2195
	jne	invalid_operand
2196
	mov	[operand_size],0
2196
	mov	[operand_size],0
2197
	lods	byte [esi]
2197
	lods	byte [esi]
2198
	call	get_size_operator
2198
	call	get_size_operator
2199
	cmp	al,10h
2199
	cmp	al,10h
2200
	je	movx_reg
2200
	je	movx_reg
2201
	cmp	al,'['
2201
	cmp	al,'['
2202
	jne	invalid_operand
2202
	jne	invalid_operand
2203
	call	get_address
2203
	call	get_address
2204
	pop	eax
2204
	pop	eax
2205
	mov	ah,[operand_size]
2205
	mov	ah,[operand_size]
2206
	or	ah,ah
2206
	or	ah,ah
2207
	jz	movx_unknown_size
2207
	jz	movx_unknown_size
2208
	cmp	ah,al
2208
	cmp	ah,al
2209
	jae	invalid_operand_size
2209
	jae	invalid_operand_size
2210
	cmp	ah,1
2210
	cmp	ah,1
2211
	je	movx_mem_store
2211
	je	movx_mem_store
2212
	cmp	ah,2
2212
	cmp	ah,2
2213
	jne	invalid_operand_size
2213
	jne	invalid_operand_size
2214
	inc	[extended_code]
2214
	inc	[extended_code]
2215
      movx_mem_store:
2215
      movx_mem_store:
2216
	call	operand_autodetect
2216
	call	operand_autodetect
2217
	jmp	instruction_ready
2217
	jmp	instruction_ready
2218
      movx_unknown_size:
2218
      movx_unknown_size:
2219
	call	recoverable_unknown_size
2219
	call	recoverable_unknown_size
2220
	jmp	movx_mem_store
2220
	jmp	movx_mem_store
2221
      movx_reg:
2221
      movx_reg:
2222
	lods	byte [esi]
2222
	lods	byte [esi]
2223
	call	convert_register
2223
	call	convert_register
2224
	pop	ebx
2224
	pop	ebx
2225
	xchg	bl,al
2225
	xchg	bl,al
2226
	cmp	ah,al
2226
	cmp	ah,al
2227
	jae	invalid_operand_size
2227
	jae	invalid_operand_size
2228
	cmp	ah,1
2228
	cmp	ah,1
2229
	je	movx_reg_8bit
2229
	je	movx_reg_8bit
2230
	cmp	ah,2
2230
	cmp	ah,2
2231
	je	movx_reg_16bit
2231
	je	movx_reg_16bit
2232
	jmp	invalid_operand_size
2232
	jmp	invalid_operand_size
2233
      movx_reg_8bit:
2233
      movx_reg_8bit:
2234
	call	operand_autodetect
2234
	call	operand_autodetect
2235
	jmp	nomem_instruction_ready
2235
	jmp	nomem_instruction_ready
2236
      movx_reg_16bit:
2236
      movx_reg_16bit:
2237
	call	operand_autodetect
2237
	call	operand_autodetect
2238
	inc	[extended_code]
2238
	inc	[extended_code]
2239
	jmp	nomem_instruction_ready
2239
	jmp	nomem_instruction_ready
2240
movsxd_instruction:
2240
movsxd_instruction:
2241
	mov	[base_code],al
2241
	mov	[base_code],al
2242
	lods	byte [esi]
2242
	lods	byte [esi]
2243
	call	get_size_operator
2243
	call	get_size_operator
2244
	cmp	al,10h
2244
	cmp	al,10h
2245
	jne	invalid_operand
2245
	jne	invalid_operand
2246
	lods	byte [esi]
2246
	lods	byte [esi]
2247
	call	convert_register
2247
	call	convert_register
2248
	mov	[postbyte_register],al
2248
	mov	[postbyte_register],al
2249
	cmp	ah,8
2249
	cmp	ah,8
2250
	jne	invalid_operand_size
2250
	jne	invalid_operand_size
2251
	lods	byte [esi]
2251
	lods	byte [esi]
2252
	cmp	al,','
2252
	cmp	al,','
2253
	jne	invalid_operand
2253
	jne	invalid_operand
2254
	mov	[operand_size],0
2254
	mov	[operand_size],0
2255
	lods	byte [esi]
2255
	lods	byte [esi]
2256
	call	get_size_operator
2256
	call	get_size_operator
2257
	cmp	al,10h
2257
	cmp	al,10h
2258
	je	movsxd_reg
2258
	je	movsxd_reg
2259
	cmp	al,'['
2259
	cmp	al,'['
2260
	jne	invalid_operand
2260
	jne	invalid_operand
2261
	call	get_address
2261
	call	get_address
2262
	cmp	[operand_size],4
2262
	cmp	[operand_size],4
2263
	je	movsxd_mem_store
2263
	je	movsxd_mem_store
2264
	cmp	[operand_size],0
2264
	cmp	[operand_size],0
2265
	jne	invalid_operand_size
2265
	jne	invalid_operand_size
2266
      movsxd_mem_store:
2266
      movsxd_mem_store:
2267
	call	operand_64bit
2267
	call	operand_64bit
2268
	jmp	instruction_ready
2268
	jmp	instruction_ready
2269
      movsxd_reg:
2269
      movsxd_reg:
2270
	lods	byte [esi]
2270
	lods	byte [esi]
2271
	call	convert_register
2271
	call	convert_register
2272
	cmp	ah,4
2272
	cmp	ah,4
2273
	jne	invalid_operand_size
2273
	jne	invalid_operand_size
2274
	mov	bl,al
2274
	mov	bl,al
2275
	call	operand_64bit
2275
	call	operand_64bit
2276
	jmp	nomem_instruction_ready
2276
	jmp	nomem_instruction_ready
2277
bt_instruction:
2277
bt_instruction:
2278
	mov	[postbyte_register],al
2278
	mov	[postbyte_register],al
2279
	shl	al,3
2279
	shl	al,3
2280
	add	al,83h
2280
	add	al,83h
2281
	mov	[extended_code],al
2281
	mov	[extended_code],al
2282
	mov	[base_code],0Fh
2282
	mov	[base_code],0Fh
2283
	lods	byte [esi]
2283
	lods	byte [esi]
2284
	call	get_size_operator
2284
	call	get_size_operator
2285
	cmp	al,10h
2285
	cmp	al,10h
2286
	je	bt_reg
2286
	je	bt_reg
2287
	cmp	al,'['
2287
	cmp	al,'['
2288
	jne	invalid_operand
2288
	jne	invalid_operand
2289
	call	get_address
2289
	call	get_address
2290
	push	eax ebx ecx
2290
	push	eax ebx ecx
2291
	lods	byte [esi]
2291
	lods	byte [esi]
2292
	cmp	al,','
2292
	cmp	al,','
2293
	jne	invalid_operand
2293
	jne	invalid_operand
2294
	cmp	byte [esi],'('
2294
	cmp	byte [esi],'('
2295
	je	bt_mem_imm
2295
	je	bt_mem_imm
2296
	cmp	byte [esi],11h
2296
	cmp	byte [esi],11h
2297
	jne	bt_mem_reg
2297
	jne	bt_mem_reg
2298
	cmp	byte [esi+2],'('
2298
	cmp	byte [esi+2],'('
2299
	je	bt_mem_imm
2299
	je	bt_mem_imm
2300
      bt_mem_reg:
2300
      bt_mem_reg:
2301
	lods	byte [esi]
2301
	lods	byte [esi]
2302
	call	get_size_operator
2302
	call	get_size_operator
2303
	cmp	al,10h
2303
	cmp	al,10h
2304
	jne	invalid_operand
2304
	jne	invalid_operand
2305
	lods	byte [esi]
2305
	lods	byte [esi]
2306
	call	convert_register
2306
	call	convert_register
2307
	mov	[postbyte_register],al
2307
	mov	[postbyte_register],al
2308
	pop	ecx ebx edx
2308
	pop	ecx ebx edx
2309
	mov	al,ah
2309
	mov	al,ah
2310
	call	operand_autodetect
2310
	call	operand_autodetect
2311
	jmp	instruction_ready
2311
	jmp	instruction_ready
2312
      bt_mem_imm:
2312
      bt_mem_imm:
2313
	xor	al,al
2313
	xor	al,al
2314
	xchg	al,[operand_size]
2314
	xchg	al,[operand_size]
2315
	push	eax
2315
	push	eax
2316
	lods	byte [esi]
2316
	lods	byte [esi]
2317
	call	get_size_operator
2317
	call	get_size_operator
2318
	cmp	al,'('
2318
	cmp	al,'('
2319
	jne	invalid_operand
2319
	jne	invalid_operand
2320
	mov	al,[operand_size]
2320
	mov	al,[operand_size]
2321
	or	al,al
2321
	or	al,al
2322
	jz	bt_mem_imm_size_ok
2322
	jz	bt_mem_imm_size_ok
2323
	cmp	al,1
2323
	cmp	al,1
2324
	jne	invalid_operand_size
2324
	jne	invalid_operand_size
2325
      bt_mem_imm_size_ok:
2325
      bt_mem_imm_size_ok:
2326
	call	get_byte_value
2326
	call	get_byte_value
2327
	mov	byte [value],al
2327
	mov	byte [value],al
2328
	pop	eax
2328
	pop	eax
2329
	or	al,al
2329
	or	al,al
2330
	jz	bt_mem_imm_nosize
2330
	jz	bt_mem_imm_nosize
2331
	call	operand_autodetect
2331
	call	operand_autodetect
2332
      bt_mem_imm_store:
2332
      bt_mem_imm_store:
2333
	pop	ecx ebx edx
2333
	pop	ecx ebx edx
2334
	mov	[extended_code],0BAh
2334
	mov	[extended_code],0BAh
2335
	call	store_instruction_with_imm8
2335
	call	store_instruction_with_imm8
2336
	jmp	instruction_assembled
2336
	jmp	instruction_assembled
2337
      bt_mem_imm_nosize:
2337
      bt_mem_imm_nosize:
2338
	call	recoverable_unknown_size
2338
	call	recoverable_unknown_size
2339
	jmp	bt_mem_imm_store
2339
	jmp	bt_mem_imm_store
2340
      bt_reg:
2340
      bt_reg:
2341
	lods	byte [esi]
2341
	lods	byte [esi]
2342
	call	convert_register
2342
	call	convert_register
2343
	mov	bl,al
2343
	mov	bl,al
2344
	lods	byte [esi]
2344
	lods	byte [esi]
2345
	cmp	al,','
2345
	cmp	al,','
2346
	jne	invalid_operand
2346
	jne	invalid_operand
2347
	cmp	byte [esi],'('
2347
	cmp	byte [esi],'('
2348
	je	bt_reg_imm
2348
	je	bt_reg_imm
2349
	cmp	byte [esi],11h
2349
	cmp	byte [esi],11h
2350
	jne	bt_reg_reg
2350
	jne	bt_reg_reg
2351
	cmp	byte [esi+2],'('
2351
	cmp	byte [esi+2],'('
2352
	je	bt_reg_imm
2352
	je	bt_reg_imm
2353
      bt_reg_reg:
2353
      bt_reg_reg:
2354
	lods	byte [esi]
2354
	lods	byte [esi]
2355
	call	get_size_operator
2355
	call	get_size_operator
2356
	cmp	al,10h
2356
	cmp	al,10h
2357
	jne	invalid_operand
2357
	jne	invalid_operand
2358
	lods	byte [esi]
2358
	lods	byte [esi]
2359
	call	convert_register
2359
	call	convert_register
2360
	mov	[postbyte_register],al
2360
	mov	[postbyte_register],al
2361
	mov	al,ah
2361
	mov	al,ah
2362
	call	operand_autodetect
2362
	call	operand_autodetect
2363
	jmp	nomem_instruction_ready
2363
	jmp	nomem_instruction_ready
2364
      bt_reg_imm:
2364
      bt_reg_imm:
2365
	xor	al,al
2365
	xor	al,al
2366
	xchg	al,[operand_size]
2366
	xchg	al,[operand_size]
2367
	push	eax ebx
2367
	push	eax ebx
2368
	lods	byte [esi]
2368
	lods	byte [esi]
2369
	call	get_size_operator
2369
	call	get_size_operator
2370
	cmp	al,'('
2370
	cmp	al,'('
2371
	jne	invalid_operand
2371
	jne	invalid_operand
2372
	mov	al,[operand_size]
2372
	mov	al,[operand_size]
2373
	or	al,al
2373
	or	al,al
2374
	jz	bt_reg_imm_size_ok
2374
	jz	bt_reg_imm_size_ok
2375
	cmp	al,1
2375
	cmp	al,1
2376
	jne	invalid_operand_size
2376
	jne	invalid_operand_size
2377
      bt_reg_imm_size_ok:
2377
      bt_reg_imm_size_ok:
2378
	call	get_byte_value
2378
	call	get_byte_value
2379
	mov	byte [value],al
2379
	mov	byte [value],al
2380
	pop	ebx eax
2380
	pop	ebx eax
2381
	call	operand_autodetect
2381
	call	operand_autodetect
2382
      bt_reg_imm_store:
2382
      bt_reg_imm_store:
2383
	mov	[extended_code],0BAh
2383
	mov	[extended_code],0BAh
2384
	call	store_nomem_instruction
2384
	call	store_nomem_instruction
2385
	mov	al,byte [value]
2385
	mov	al,byte [value]
2386
	stos	byte [edi]
2386
	stos	byte [edi]
2387
	jmp	instruction_assembled
2387
	jmp	instruction_assembled
2388
bs_instruction:
2388
bs_instruction:
2389
	mov	[extended_code],al
2389
	mov	[extended_code],al
2390
	mov	[base_code],0Fh
2390
	mov	[base_code],0Fh
2391
	call	get_reg_mem
2391
	call	get_reg_mem
2392
	jc	bs_reg_reg
2392
	jc	bs_reg_reg
2393
	mov	al,[operand_size]
2393
	mov	al,[operand_size]
2394
	call	operand_autodetect
2394
	call	operand_autodetect
2395
	jmp	instruction_ready
2395
	jmp	instruction_ready
2396
      bs_reg_reg:
2396
      bs_reg_reg:
2397
	mov	al,ah
2397
	mov	al,ah
2398
	call	operand_autodetect
2398
	call	operand_autodetect
2399
	jmp	nomem_instruction_ready
2399
	jmp	nomem_instruction_ready
2400
      get_reg_mem:
2400
      get_reg_mem:
2401
	lods	byte [esi]
2401
	lods	byte [esi]
2402
	call	get_size_operator
2402
	call	get_size_operator
2403
	cmp	al,10h
2403
	cmp	al,10h
2404
	jne	invalid_operand
2404
	jne	invalid_operand
2405
	lods	byte [esi]
2405
	lods	byte [esi]
2406
	call	convert_register
2406
	call	convert_register
2407
	mov	[postbyte_register],al
2407
	mov	[postbyte_register],al
2408
	lods	byte [esi]
2408
	lods	byte [esi]
2409
	cmp	al,','
2409
	cmp	al,','
2410
	jne	invalid_operand
2410
	jne	invalid_operand
2411
	lods	byte [esi]
2411
	lods	byte [esi]
2412
	call	get_size_operator
2412
	call	get_size_operator
2413
	cmp	al,10h
2413
	cmp	al,10h
2414
	je	get_reg_reg
2414
	je	get_reg_reg
2415
	cmp	al,'['
2415
	cmp	al,'['
2416
	jne	invalid_argument
2416
	jne	invalid_argument
2417
	call	get_address
2417
	call	get_address
2418
	clc
2418
	clc
2419
	ret
2419
	ret
2420
      get_reg_reg:
2420
      get_reg_reg:
2421
	lods	byte [esi]
2421
	lods	byte [esi]
2422
	call	convert_register
2422
	call	convert_register
2423
	mov	bl,al
2423
	mov	bl,al
2424
	stc
2424
	stc
2425
	ret
2425
	ret
2426
 
2426
 
2427
imul_instruction:
2427
imul_instruction:
2428
	mov	[base_code],0F6h
2428
	mov	[base_code],0F6h
2429
	mov	[postbyte_register],5
2429
	mov	[postbyte_register],5
2430
	lods	byte [esi]
2430
	lods	byte [esi]
2431
	call	get_size_operator
2431
	call	get_size_operator
2432
	cmp	al,10h
2432
	cmp	al,10h
2433
	je	imul_reg
2433
	je	imul_reg
2434
	cmp	al,'['
2434
	cmp	al,'['
2435
	jne	invalid_operand
2435
	jne	invalid_operand
2436
      imul_mem:
2436
      imul_mem:
2437
	call	get_address
2437
	call	get_address
2438
	mov	al,[operand_size]
2438
	mov	al,[operand_size]
2439
	cmp	al,1
2439
	cmp	al,1
2440
	je	imul_mem_8bit
2440
	je	imul_mem_8bit
2441
	jb	imul_mem_nosize
2441
	jb	imul_mem_nosize
2442
	call	operand_autodetect
2442
	call	operand_autodetect
2443
	inc	[base_code]
2443
	inc	[base_code]
2444
	jmp	instruction_ready
2444
	jmp	instruction_ready
2445
      imul_mem_nosize:
2445
      imul_mem_nosize:
2446
	call	recoverable_unknown_size
2446
	call	recoverable_unknown_size
2447
      imul_mem_8bit:
2447
      imul_mem_8bit:
2448
	jmp	instruction_ready
2448
	jmp	instruction_ready
2449
      imul_reg:
2449
      imul_reg:
2450
	lods	byte [esi]
2450
	lods	byte [esi]
2451
	call	convert_register
2451
	call	convert_register
2452
	cmp	byte [esi],','
2452
	cmp	byte [esi],','
2453
	je	imul_reg_
2453
	je	imul_reg_
2454
	mov	bl,al
2454
	mov	bl,al
2455
	mov	al,ah
2455
	mov	al,ah
2456
	cmp	al,1
2456
	cmp	al,1
2457
	je	imul_reg_8bit
2457
	je	imul_reg_8bit
2458
	call	operand_autodetect
2458
	call	operand_autodetect
2459
	inc	[base_code]
2459
	inc	[base_code]
2460
      imul_reg_8bit:
2460
      imul_reg_8bit:
2461
	jmp	nomem_instruction_ready
2461
	jmp	nomem_instruction_ready
2462
      imul_reg_:
2462
      imul_reg_:
2463
	mov	[postbyte_register],al
2463
	mov	[postbyte_register],al
2464
	inc	esi
2464
	inc	esi
2465
	cmp	byte [esi],'('
2465
	cmp	byte [esi],'('
2466
	je	imul_reg_imm
2466
	je	imul_reg_imm
2467
	cmp	byte [esi],11h
2467
	cmp	byte [esi],11h
2468
	jne	imul_reg_noimm
2468
	jne	imul_reg_noimm
2469
	cmp	byte [esi+2],'('
2469
	cmp	byte [esi+2],'('
2470
	je	imul_reg_imm
2470
	je	imul_reg_imm
2471
      imul_reg_noimm:
2471
      imul_reg_noimm:
2472
	lods	byte [esi]
2472
	lods	byte [esi]
2473
	call	get_size_operator
2473
	call	get_size_operator
2474
	cmp	al,10h
2474
	cmp	al,10h
2475
	je	imul_reg_reg
2475
	je	imul_reg_reg
2476
	cmp	al,'['
2476
	cmp	al,'['
2477
	jne	invalid_operand
2477
	jne	invalid_operand
2478
      imul_reg_mem:
2478
      imul_reg_mem:
2479
	call	get_address
2479
	call	get_address
2480
	push	edx ebx ecx
2480
	push	edx ebx ecx
2481
	cmp	byte [esi],','
2481
	cmp	byte [esi],','
2482
	je	imul_reg_mem_imm
2482
	je	imul_reg_mem_imm
2483
	mov	al,[operand_size]
2483
	mov	al,[operand_size]
2484
	call	operand_autodetect
2484
	call	operand_autodetect
2485
	pop	ecx ebx edx
2485
	pop	ecx ebx edx
2486
	mov	[base_code],0Fh
2486
	mov	[base_code],0Fh
2487
	mov	[extended_code],0AFh
2487
	mov	[extended_code],0AFh
2488
	jmp	instruction_ready
2488
	jmp	instruction_ready
2489
      imul_reg_mem_imm:
2489
      imul_reg_mem_imm:
2490
	inc	esi
2490
	inc	esi
2491
	lods	byte [esi]
2491
	lods	byte [esi]
2492
	call	get_size_operator
2492
	call	get_size_operator
2493
	cmp	al,'('
2493
	cmp	al,'('
2494
	jne	invalid_operand
2494
	jne	invalid_operand
2495
	mov	al,[operand_size]
2495
	mov	al,[operand_size]
2496
	cmp	al,2
2496
	cmp	al,2
2497
	je	imul_reg_mem_imm_16bit
2497
	je	imul_reg_mem_imm_16bit
2498
	cmp	al,4
2498
	cmp	al,4
2499
	je	imul_reg_mem_imm_32bit
2499
	je	imul_reg_mem_imm_32bit
2500
	cmp	al,8
2500
	cmp	al,8
2501
	jne	invalid_operand_size
2501
	jne	invalid_operand_size
2502
      imul_reg_mem_imm_64bit:
2502
      imul_reg_mem_imm_64bit:
2503
	cmp	[size_declared],0
2503
	cmp	[size_declared],0
2504
	jne	long_immediate_not_encodable
2504
	jne	long_immediate_not_encodable
2505
	call	operand_64bit
2505
	call	operand_64bit
2506
	call	get_simm32
2506
	call	get_simm32
2507
	cmp	[value_type],4
2507
	cmp	[value_type],4
2508
	jae	long_immediate_not_encodable
2508
	jae	long_immediate_not_encodable
2509
	jmp	imul_reg_mem_imm_32bit_ok
2509
	jmp	imul_reg_mem_imm_32bit_ok
2510
      imul_reg_mem_imm_16bit:
2510
      imul_reg_mem_imm_16bit:
2511
	call	operand_16bit
2511
	call	operand_16bit
2512
	call	get_word_value
2512
	call	get_word_value
2513
	mov	word [value],ax
2513
	mov	word [value],ax
2514
	cmp	[value_type],0
2514
	cmp	[value_type],0
2515
	jne	imul_reg_mem_imm_16bit_store
2515
	jne	imul_reg_mem_imm_16bit_store
2516
	cmp	[size_declared],0
2516
	cmp	[size_declared],0
2517
	jne	imul_reg_mem_imm_16bit_store
2517
	jne	imul_reg_mem_imm_16bit_store
2518
	cmp	ax,-80h
2518
	cmp	ax,-80h
2519
	jl	imul_reg_mem_imm_16bit_store
2519
	jl	imul_reg_mem_imm_16bit_store
2520
	cmp	ax,80h
2520
	cmp	ax,80h
2521
	jl	imul_reg_mem_imm_8bit_store
2521
	jl	imul_reg_mem_imm_8bit_store
2522
      imul_reg_mem_imm_16bit_store:
2522
      imul_reg_mem_imm_16bit_store:
2523
	pop	ecx ebx edx
2523
	pop	ecx ebx edx
2524
	mov	[base_code],69h
2524
	mov	[base_code],69h
2525
	call	store_instruction_with_imm16
2525
	call	store_instruction_with_imm16
2526
	jmp	instruction_assembled
2526
	jmp	instruction_assembled
2527
      imul_reg_mem_imm_32bit:
2527
      imul_reg_mem_imm_32bit:
2528
	call	operand_32bit
2528
	call	operand_32bit
2529
	call	get_dword_value
2529
	call	get_dword_value
2530
      imul_reg_mem_imm_32bit_ok:
2530
      imul_reg_mem_imm_32bit_ok:
2531
	mov	dword [value],eax
2531
	mov	dword [value],eax
2532
	cmp	[value_type],0
2532
	cmp	[value_type],0
2533
	jne	imul_reg_mem_imm_32bit_store
2533
	jne	imul_reg_mem_imm_32bit_store
2534
	cmp	[size_declared],0
2534
	cmp	[size_declared],0
2535
	jne	imul_reg_mem_imm_32bit_store
2535
	jne	imul_reg_mem_imm_32bit_store
2536
	cmp	eax,-80h
2536
	cmp	eax,-80h
2537
	jl	imul_reg_mem_imm_32bit_store
2537
	jl	imul_reg_mem_imm_32bit_store
2538
	cmp	eax,80h
2538
	cmp	eax,80h
2539
	jl	imul_reg_mem_imm_8bit_store
2539
	jl	imul_reg_mem_imm_8bit_store
2540
      imul_reg_mem_imm_32bit_store:
2540
      imul_reg_mem_imm_32bit_store:
2541
	pop	ecx ebx edx
2541
	pop	ecx ebx edx
2542
	mov	[base_code],69h
2542
	mov	[base_code],69h
2543
	call	store_instruction_with_imm32
2543
	call	store_instruction_with_imm32
2544
	jmp	instruction_assembled
2544
	jmp	instruction_assembled
2545
      imul_reg_mem_imm_8bit_store:
2545
      imul_reg_mem_imm_8bit_store:
2546
	pop	ecx ebx edx
2546
	pop	ecx ebx edx
2547
	mov	[base_code],6Bh
2547
	mov	[base_code],6Bh
2548
	call	store_instruction_with_imm8
2548
	call	store_instruction_with_imm8
2549
	jmp	instruction_assembled
2549
	jmp	instruction_assembled
2550
      imul_reg_imm:
2550
      imul_reg_imm:
2551
	mov	bl,[postbyte_register]
2551
	mov	bl,[postbyte_register]
2552
	dec	esi
2552
	dec	esi
2553
	jmp	imul_reg_reg_imm
2553
	jmp	imul_reg_reg_imm
2554
      imul_reg_reg:
2554
      imul_reg_reg:
2555
	lods	byte [esi]
2555
	lods	byte [esi]
2556
	call	convert_register
2556
	call	convert_register
2557
	mov	bl,al
2557
	mov	bl,al
2558
	cmp	byte [esi],','
2558
	cmp	byte [esi],','
2559
	je	imul_reg_reg_imm
2559
	je	imul_reg_reg_imm
2560
	mov	al,ah
2560
	mov	al,ah
2561
	call	operand_autodetect
2561
	call	operand_autodetect
2562
	mov	[base_code],0Fh
2562
	mov	[base_code],0Fh
2563
	mov	[extended_code],0AFh
2563
	mov	[extended_code],0AFh
2564
	jmp	nomem_instruction_ready
2564
	jmp	nomem_instruction_ready
2565
      imul_reg_reg_imm:
2565
      imul_reg_reg_imm:
2566
	inc	esi
2566
	inc	esi
2567
	lods	byte [esi]
2567
	lods	byte [esi]
2568
	call	get_size_operator
2568
	call	get_size_operator
2569
	cmp	al,'('
2569
	cmp	al,'('
2570
	jne	invalid_operand
2570
	jne	invalid_operand
2571
	mov	al,[operand_size]
2571
	mov	al,[operand_size]
2572
	cmp	al,2
2572
	cmp	al,2
2573
	je	imul_reg_reg_imm_16bit
2573
	je	imul_reg_reg_imm_16bit
2574
	cmp	al,4
2574
	cmp	al,4
2575
	je	imul_reg_reg_imm_32bit
2575
	je	imul_reg_reg_imm_32bit
2576
	cmp	al,8
2576
	cmp	al,8
2577
	jne	invalid_operand_size
2577
	jne	invalid_operand_size
2578
      imul_reg_reg_imm_64bit:
2578
      imul_reg_reg_imm_64bit:
2579
	cmp	[size_declared],0
2579
	cmp	[size_declared],0
2580
	jne	long_immediate_not_encodable
2580
	jne	long_immediate_not_encodable
2581
	call	operand_64bit
2581
	call	operand_64bit
2582
	push	ebx
2582
	push	ebx
2583
	call	get_simm32
2583
	call	get_simm32
2584
	cmp	[value_type],4
2584
	cmp	[value_type],4
2585
	jae	long_immediate_not_encodable
2585
	jae	long_immediate_not_encodable
2586
	jmp	imul_reg_reg_imm_32bit_ok
2586
	jmp	imul_reg_reg_imm_32bit_ok
2587
      imul_reg_reg_imm_16bit:
2587
      imul_reg_reg_imm_16bit:
2588
	call	operand_16bit
2588
	call	operand_16bit
2589
	push	ebx
2589
	push	ebx
2590
	call	get_word_value
2590
	call	get_word_value
2591
	pop	ebx
2591
	pop	ebx
2592
	mov	dx,ax
2592
	mov	dx,ax
2593
	cmp	[value_type],0
2593
	cmp	[value_type],0
2594
	jne	imul_reg_reg_imm_16bit_store
2594
	jne	imul_reg_reg_imm_16bit_store
2595
	cmp	[size_declared],0
2595
	cmp	[size_declared],0
2596
	jne	imul_reg_reg_imm_16bit_store
2596
	jne	imul_reg_reg_imm_16bit_store
2597
	cmp	ax,-80h
2597
	cmp	ax,-80h
2598
	jl	imul_reg_reg_imm_16bit_store
2598
	jl	imul_reg_reg_imm_16bit_store
2599
	cmp	ax,80h
2599
	cmp	ax,80h
2600
	jl	imul_reg_reg_imm_8bit_store
2600
	jl	imul_reg_reg_imm_8bit_store
2601
      imul_reg_reg_imm_16bit_store:
2601
      imul_reg_reg_imm_16bit_store:
2602
	mov	[base_code],69h
2602
	mov	[base_code],69h
2603
	call	store_nomem_instruction
2603
	call	store_nomem_instruction
2604
	mov	ax,dx
2604
	mov	ax,dx
2605
	call	mark_relocation
2605
	call	mark_relocation
2606
	stos	word [edi]
2606
	stos	word [edi]
2607
	jmp	instruction_assembled
2607
	jmp	instruction_assembled
2608
      imul_reg_reg_imm_32bit:
2608
      imul_reg_reg_imm_32bit:
2609
	call	operand_32bit
2609
	call	operand_32bit
2610
	push	ebx
2610
	push	ebx
2611
	call	get_dword_value
2611
	call	get_dword_value
2612
      imul_reg_reg_imm_32bit_ok:
2612
      imul_reg_reg_imm_32bit_ok:
2613
	pop	ebx
2613
	pop	ebx
2614
	mov	edx,eax
2614
	mov	edx,eax
2615
	cmp	[value_type],0
2615
	cmp	[value_type],0
2616
	jne	imul_reg_reg_imm_32bit_store
2616
	jne	imul_reg_reg_imm_32bit_store
2617
	cmp	[size_declared],0
2617
	cmp	[size_declared],0
2618
	jne	imul_reg_reg_imm_32bit_store
2618
	jne	imul_reg_reg_imm_32bit_store
2619
	cmp	eax,-80h
2619
	cmp	eax,-80h
2620
	jl	imul_reg_reg_imm_32bit_store
2620
	jl	imul_reg_reg_imm_32bit_store
2621
	cmp	eax,80h
2621
	cmp	eax,80h
2622
	jl	imul_reg_reg_imm_8bit_store
2622
	jl	imul_reg_reg_imm_8bit_store
2623
      imul_reg_reg_imm_32bit_store:
2623
      imul_reg_reg_imm_32bit_store:
2624
	mov	[base_code],69h
2624
	mov	[base_code],69h
2625
	call	store_nomem_instruction
2625
	call	store_nomem_instruction
2626
	mov	eax,edx
2626
	mov	eax,edx
2627
	call	mark_relocation
2627
	call	mark_relocation
2628
	stos	dword [edi]
2628
	stos	dword [edi]
2629
	jmp	instruction_assembled
2629
	jmp	instruction_assembled
2630
      imul_reg_reg_imm_8bit_store:
2630
      imul_reg_reg_imm_8bit_store:
2631
	mov	[base_code],6Bh
2631
	mov	[base_code],6Bh
2632
	call	store_nomem_instruction
2632
	call	store_nomem_instruction
2633
	mov	al,dl
2633
	mov	al,dl
2634
	stos	byte [edi]
2634
	stos	byte [edi]
2635
	jmp	instruction_assembled
2635
	jmp	instruction_assembled
2636
in_instruction:
2636
in_instruction:
2637
	lods	byte [esi]
2637
	lods	byte [esi]
2638
	call	get_size_operator
2638
	call	get_size_operator
2639
	cmp	al,10h
2639
	cmp	al,10h
2640
	jne	invalid_operand
2640
	jne	invalid_operand
2641
	lods	byte [esi]
2641
	lods	byte [esi]
2642
	call	convert_register
2642
	call	convert_register
2643
	or	al,al
2643
	or	al,al
2644
	jnz	invalid_operand
2644
	jnz	invalid_operand
2645
	lods	byte [esi]
2645
	lods	byte [esi]
2646
	cmp	al,','
2646
	cmp	al,','
2647
	jne	invalid_operand
2647
	jne	invalid_operand
2648
	mov	al,ah
2648
	mov	al,ah
2649
	push	eax
2649
	push	eax
2650
	mov	[operand_size],0
2650
	mov	[operand_size],0
2651
	lods	byte [esi]
2651
	lods	byte [esi]
2652
	call	get_size_operator
2652
	call	get_size_operator
2653
	cmp	al,'('
2653
	cmp	al,'('
2654
	je	in_imm
2654
	je	in_imm
2655
	cmp	al,10h
2655
	cmp	al,10h
2656
	je	in_reg
2656
	je	in_reg
2657
	jmp	invalid_operand
2657
	jmp	invalid_operand
2658
      in_reg:
2658
      in_reg:
2659
	lods	byte [esi]
2659
	lods	byte [esi]
2660
	cmp	al,22h
2660
	cmp	al,22h
2661
	jne	invalid_operand
2661
	jne	invalid_operand
2662
	pop	eax
2662
	pop	eax
2663
	cmp	al,1
2663
	cmp	al,1
2664
	je	in_al_dx
2664
	je	in_al_dx
2665
	cmp	al,2
2665
	cmp	al,2
2666
	je	in_ax_dx
2666
	je	in_ax_dx
2667
	cmp	al,4
2667
	cmp	al,4
2668
	jne	invalid_operand_size
2668
	jne	invalid_operand_size
2669
      in_ax_dx:
2669
      in_ax_dx:
2670
	call	operand_autodetect
2670
	call	operand_autodetect
2671
	mov	[base_code],0EDh
2671
	mov	[base_code],0EDh
2672
	call	store_instruction_code
2672
	call	store_instruction_code
2673
	jmp	instruction_assembled
2673
	jmp	instruction_assembled
2674
      in_al_dx:
2674
      in_al_dx:
2675
	mov	al,0ECh
2675
	mov	al,0ECh
2676
	stos	byte [edi]
2676
	stos	byte [edi]
2677
	jmp	instruction_assembled
2677
	jmp	instruction_assembled
2678
      in_imm:
2678
      in_imm:
2679
	mov	al,[operand_size]
2679
	mov	al,[operand_size]
2680
	or	al,al
2680
	or	al,al
2681
	jz	in_imm_size_ok
2681
	jz	in_imm_size_ok
2682
	cmp	al,1
2682
	cmp	al,1
2683
	jne	invalid_operand_size
2683
	jne	invalid_operand_size
2684
      in_imm_size_ok:
2684
      in_imm_size_ok:
2685
	call	get_byte_value
2685
	call	get_byte_value
2686
	mov	dl,al
2686
	mov	dl,al
2687
	pop	eax
2687
	pop	eax
2688
	cmp	al,1
2688
	cmp	al,1
2689
	je	in_al_imm
2689
	je	in_al_imm
2690
	cmp	al,2
2690
	cmp	al,2
2691
	je	in_ax_imm
2691
	je	in_ax_imm
2692
	cmp	al,4
2692
	cmp	al,4
2693
	jne	invalid_operand_size
2693
	jne	invalid_operand_size
2694
      in_ax_imm:
2694
      in_ax_imm:
2695
	call	operand_autodetect
2695
	call	operand_autodetect
2696
	mov	[base_code],0E5h
2696
	mov	[base_code],0E5h
2697
	call	store_instruction_code
2697
	call	store_instruction_code
2698
	mov	al,dl
2698
	mov	al,dl
2699
	stos	byte [edi]
2699
	stos	byte [edi]
2700
	jmp	instruction_assembled
2700
	jmp	instruction_assembled
2701
      in_al_imm:
2701
      in_al_imm:
2702
	mov	al,0E4h
2702
	mov	al,0E4h
2703
	stos	byte [edi]
2703
	stos	byte [edi]
2704
	mov	al,dl
2704
	mov	al,dl
2705
	stos	byte [edi]
2705
	stos	byte [edi]
2706
	jmp	instruction_assembled
2706
	jmp	instruction_assembled
2707
out_instruction:
2707
out_instruction:
2708
	lods	byte [esi]
2708
	lods	byte [esi]
2709
	call	get_size_operator
2709
	call	get_size_operator
2710
	cmp	al,'('
2710
	cmp	al,'('
2711
	je	out_imm
2711
	je	out_imm
2712
	cmp	al,10h
2712
	cmp	al,10h
2713
	jne	invalid_operand
2713
	jne	invalid_operand
2714
	lods	byte [esi]
2714
	lods	byte [esi]
2715
	cmp	al,22h
2715
	cmp	al,22h
2716
	jne	invalid_operand
2716
	jne	invalid_operand
2717
	lods	byte [esi]
2717
	lods	byte [esi]
2718
	cmp	al,','
2718
	cmp	al,','
2719
	jne	invalid_operand
2719
	jne	invalid_operand
2720
	mov	[operand_size],0
2720
	mov	[operand_size],0
2721
	lods	byte [esi]
2721
	lods	byte [esi]
2722
	call	get_size_operator
2722
	call	get_size_operator
2723
	cmp	al,10h
2723
	cmp	al,10h
2724
	jne	invalid_operand
2724
	jne	invalid_operand
2725
	lods	byte [esi]
2725
	lods	byte [esi]
2726
	call	convert_register
2726
	call	convert_register
2727
	or	al,al
2727
	or	al,al
2728
	jnz	invalid_operand
2728
	jnz	invalid_operand
2729
	mov	al,ah
2729
	mov	al,ah
2730
	cmp	al,1
2730
	cmp	al,1
2731
	je	out_dx_al
2731
	je	out_dx_al
2732
	cmp	al,2
2732
	cmp	al,2
2733
	je	out_dx_ax
2733
	je	out_dx_ax
2734
	cmp	al,4
2734
	cmp	al,4
2735
	jne	invalid_operand_size
2735
	jne	invalid_operand_size
2736
      out_dx_ax:
2736
      out_dx_ax:
2737
	call	operand_autodetect
2737
	call	operand_autodetect
2738
	mov	[base_code],0EFh
2738
	mov	[base_code],0EFh
2739
	call	store_instruction_code
2739
	call	store_instruction_code
2740
	jmp	instruction_assembled
2740
	jmp	instruction_assembled
2741
      out_dx_al:
2741
      out_dx_al:
2742
	mov	al,0EEh
2742
	mov	al,0EEh
2743
	stos	byte [edi]
2743
	stos	byte [edi]
2744
	jmp	instruction_assembled
2744
	jmp	instruction_assembled
2745
      out_imm:
2745
      out_imm:
2746
	mov	al,[operand_size]
2746
	mov	al,[operand_size]
2747
	or	al,al
2747
	or	al,al
2748
	jz	out_imm_size_ok
2748
	jz	out_imm_size_ok
2749
	cmp	al,1
2749
	cmp	al,1
2750
	jne	invalid_operand_size
2750
	jne	invalid_operand_size
2751
      out_imm_size_ok:
2751
      out_imm_size_ok:
2752
	call	get_byte_value
2752
	call	get_byte_value
2753
	mov	dl,al
2753
	mov	dl,al
2754
	lods	byte [esi]
2754
	lods	byte [esi]
2755
	cmp	al,','
2755
	cmp	al,','
2756
	jne	invalid_operand
2756
	jne	invalid_operand
2757
	mov	[operand_size],0
2757
	mov	[operand_size],0
2758
	lods	byte [esi]
2758
	lods	byte [esi]
2759
	call	get_size_operator
2759
	call	get_size_operator
2760
	cmp	al,10h
2760
	cmp	al,10h
2761
	jne	invalid_operand
2761
	jne	invalid_operand
2762
	lods	byte [esi]
2762
	lods	byte [esi]
2763
	call	convert_register
2763
	call	convert_register
2764
	or	al,al
2764
	or	al,al
2765
	jnz	invalid_operand
2765
	jnz	invalid_operand
2766
	mov	al,ah
2766
	mov	al,ah
2767
	cmp	al,1
2767
	cmp	al,1
2768
	je	out_imm_al
2768
	je	out_imm_al
2769
	cmp	al,2
2769
	cmp	al,2
2770
	je	out_imm_ax
2770
	je	out_imm_ax
2771
	cmp	al,4
2771
	cmp	al,4
2772
	jne	invalid_operand_size
2772
	jne	invalid_operand_size
2773
      out_imm_ax:
2773
      out_imm_ax:
2774
	call	operand_autodetect
2774
	call	operand_autodetect
2775
	mov	[base_code],0E7h
2775
	mov	[base_code],0E7h
2776
	call	store_instruction_code
2776
	call	store_instruction_code
2777
	mov	al,dl
2777
	mov	al,dl
2778
	stos	byte [edi]
2778
	stos	byte [edi]
2779
	jmp	instruction_assembled
2779
	jmp	instruction_assembled
2780
      out_imm_al:
2780
      out_imm_al:
2781
	mov	al,0E6h
2781
	mov	al,0E6h
2782
	stos	byte [edi]
2782
	stos	byte [edi]
2783
	mov	al,dl
2783
	mov	al,dl
2784
	stos	byte [edi]
2784
	stos	byte [edi]
2785
	jmp	instruction_assembled
2785
	jmp	instruction_assembled
2786
 
2786
 
2787
call_instruction:
2787
call_instruction:
2788
	mov	[postbyte_register],10b
2788
	mov	[postbyte_register],10b
2789
	mov	[base_code],0E8h
2789
	mov	[base_code],0E8h
2790
	mov	[extended_code],9Ah
2790
	mov	[extended_code],9Ah
2791
	jmp	process_jmp
2791
	jmp	process_jmp
2792
jmp_instruction:
2792
jmp_instruction:
2793
	mov	[postbyte_register],100b
2793
	mov	[postbyte_register],100b
2794
	mov	[base_code],0E9h
2794
	mov	[base_code],0E9h
2795
	mov	[extended_code],0EAh
2795
	mov	[extended_code],0EAh
2796
      process_jmp:
2796
      process_jmp:
2797
	lods	byte [esi]
2797
	lods	byte [esi]
2798
	call	get_jump_operator
2798
	call	get_jump_operator
2799
	call	get_size_operator
2799
	call	get_size_operator
2800
	cmp	al,'('
2800
	cmp	al,'('
2801
	je	jmp_imm
2801
	je	jmp_imm
2802
	mov	[base_code],0FFh
2802
	mov	[base_code],0FFh
2803
	cmp	al,10h
2803
	cmp	al,10h
2804
	je	jmp_reg
2804
	je	jmp_reg
2805
	cmp	al,'['
2805
	cmp	al,'['
2806
	jne	invalid_operand
2806
	jne	invalid_operand
2807
      jmp_mem:
2807
      jmp_mem:
2808
	cmp	[jump_type],1
2808
	cmp	[jump_type],1
2809
	je	illegal_instruction
2809
	je	illegal_instruction
2810
	call	get_address
2810
	call	get_address
2811
	mov	edx,eax
2811
	mov	edx,eax
2812
	mov	al,[operand_size]
2812
	mov	al,[operand_size]
2813
	or	al,al
2813
	or	al,al
2814
	jz	jmp_mem_size_not_specified
2814
	jz	jmp_mem_size_not_specified
2815
	cmp	al,2
2815
	cmp	al,2
2816
	je	jmp_mem_16bit
2816
	je	jmp_mem_16bit
2817
	cmp	al,4
2817
	cmp	al,4
2818
	je	jmp_mem_32bit
2818
	je	jmp_mem_32bit
2819
	cmp	al,6
2819
	cmp	al,6
2820
	je	jmp_mem_48bit
2820
	je	jmp_mem_48bit
2821
	cmp	al,8
2821
	cmp	al,8
2822
	je	jmp_mem_64bit
2822
	je	jmp_mem_64bit
2823
	cmp	al,10
2823
	cmp	al,10
2824
	je	jmp_mem_80bit
2824
	je	jmp_mem_80bit
2825
	jmp	invalid_operand_size
2825
	jmp	invalid_operand_size
2826
      jmp_mem_size_not_specified:
2826
      jmp_mem_size_not_specified:
2827
	cmp	[jump_type],3
2827
	cmp	[jump_type],3
2828
	je	jmp_mem_far
2828
	je	jmp_mem_far
2829
	cmp	[jump_type],2
2829
	cmp	[jump_type],2
2830
	je	jmp_mem_near
2830
	je	jmp_mem_near
2831
	call	recoverable_unknown_size
2831
	call	recoverable_unknown_size
2832
      jmp_mem_near:
2832
      jmp_mem_near:
2833
	cmp	[code_type],16
2833
	cmp	[code_type],16
2834
	je	jmp_mem_16bit
2834
	je	jmp_mem_16bit
2835
	cmp	[code_type],32
2835
	cmp	[code_type],32
2836
	je	jmp_mem_near_32bit
2836
	je	jmp_mem_near_32bit
2837
      jmp_mem_64bit:
2837
      jmp_mem_64bit:
2838
	cmp	[jump_type],3
2838
	cmp	[jump_type],3
2839
	je	invalid_operand_size
2839
	je	invalid_operand_size
2840
	cmp	[code_type],64
2840
	cmp	[code_type],64
2841
	jne	illegal_instruction
2841
	jne	illegal_instruction
2842
	jmp	instruction_ready
2842
	jmp	instruction_ready
2843
      jmp_mem_far:
2843
      jmp_mem_far:
2844
	cmp	[code_type],16
2844
	cmp	[code_type],16
2845
	je	jmp_mem_far_32bit
2845
	je	jmp_mem_far_32bit
2846
      jmp_mem_48bit:
2846
      jmp_mem_48bit:
2847
	call	operand_32bit
2847
	call	operand_32bit
2848
      jmp_mem_far_store:
2848
      jmp_mem_far_store:
2849
	cmp	[jump_type],2
2849
	cmp	[jump_type],2
2850
	je	invalid_operand_size
2850
	je	invalid_operand_size
2851
	inc	[postbyte_register]
2851
	inc	[postbyte_register]
2852
	jmp	instruction_ready
2852
	jmp	instruction_ready
2853
      jmp_mem_80bit:
2853
      jmp_mem_80bit:
2854
	call	operand_64bit
2854
	call	operand_64bit
2855
	jmp	jmp_mem_far_store
2855
	jmp	jmp_mem_far_store
2856
      jmp_mem_far_32bit:
2856
      jmp_mem_far_32bit:
2857
	call	operand_16bit
2857
	call	operand_16bit
2858
	jmp	jmp_mem_far_store
2858
	jmp	jmp_mem_far_store
2859
      jmp_mem_32bit:
2859
      jmp_mem_32bit:
2860
	cmp	[jump_type],3
2860
	cmp	[jump_type],3
2861
	je	jmp_mem_far_32bit
2861
	je	jmp_mem_far_32bit
2862
	cmp	[jump_type],2
2862
	cmp	[jump_type],2
2863
	je	jmp_mem_near_32bit
2863
	je	jmp_mem_near_32bit
2864
	cmp	[code_type],16
2864
	cmp	[code_type],16
2865
	je	jmp_mem_far_32bit
2865
	je	jmp_mem_far_32bit
2866
      jmp_mem_near_32bit:
2866
      jmp_mem_near_32bit:
2867
	cmp	[code_type],64
2867
	cmp	[code_type],64
2868
	je	illegal_instruction
2868
	je	illegal_instruction
2869
	call	operand_32bit
2869
	call	operand_32bit
2870
	jmp	instruction_ready
2870
	jmp	instruction_ready
2871
      jmp_mem_16bit:
2871
      jmp_mem_16bit:
2872
	cmp	[jump_type],3
2872
	cmp	[jump_type],3
2873
	je	invalid_operand_size
2873
	je	invalid_operand_size
2874
	call	operand_16bit
2874
	call	operand_16bit
2875
	jmp	instruction_ready
2875
	jmp	instruction_ready
2876
      jmp_reg:
2876
      jmp_reg:
2877
	test	[jump_type],1
2877
	test	[jump_type],1
2878
	jnz	invalid_operand
2878
	jnz	invalid_operand
2879
	lods	byte [esi]
2879
	lods	byte [esi]
2880
	call	convert_register
2880
	call	convert_register
2881
	mov	bl,al
2881
	mov	bl,al
2882
	mov	al,ah
2882
	mov	al,ah
2883
	cmp	al,2
2883
	cmp	al,2
2884
	je	jmp_reg_16bit
2884
	je	jmp_reg_16bit
2885
	cmp	al,4
2885
	cmp	al,4
2886
	je	jmp_reg_32bit
2886
	je	jmp_reg_32bit
2887
	cmp	al,8
2887
	cmp	al,8
2888
	jne	invalid_operand_size
2888
	jne	invalid_operand_size
2889
      jmp_reg_64bit:
2889
      jmp_reg_64bit:
2890
	cmp	[code_type],64
2890
	cmp	[code_type],64
2891
	jne	illegal_instruction
2891
	jne	illegal_instruction
2892
	jmp	nomem_instruction_ready
2892
	jmp	nomem_instruction_ready
2893
      jmp_reg_32bit:
2893
      jmp_reg_32bit:
2894
	cmp	[code_type],64
2894
	cmp	[code_type],64
2895
	je	illegal_instruction
2895
	je	illegal_instruction
2896
	call	operand_32bit
2896
	call	operand_32bit
2897
	jmp	nomem_instruction_ready
2897
	jmp	nomem_instruction_ready
2898
      jmp_reg_16bit:
2898
      jmp_reg_16bit:
2899
	call	operand_16bit
2899
	call	operand_16bit
2900
	jmp	nomem_instruction_ready
2900
	jmp	nomem_instruction_ready
2901
      jmp_imm:
2901
      jmp_imm:
2902
	cmp	byte [esi],'.'
2902
	cmp	byte [esi],'.'
2903
	je	invalid_value
2903
	je	invalid_value
2904
	mov	ebx,esi
2904
	mov	ebx,esi
2905
	dec	esi
2905
	dec	esi
2906
	call	skip_symbol
2906
	call	skip_symbol
2907
	xchg	esi,ebx
2907
	xchg	esi,ebx
2908
	cmp	byte [ebx],':'
2908
	cmp	byte [ebx],':'
2909
	je	jmp_far
2909
	je	jmp_far
2910
	cmp	[jump_type],3
2910
	cmp	[jump_type],3
2911
	je	invalid_operand
2911
	je	invalid_operand
2912
      jmp_near:
2912
      jmp_near:
2913
	mov	al,[operand_size]
2913
	mov	al,[operand_size]
2914
	cmp	al,2
2914
	cmp	al,2
2915
	je	jmp_imm_16bit
2915
	je	jmp_imm_16bit
2916
	cmp	al,4
2916
	cmp	al,4
2917
	je	jmp_imm_32bit
2917
	je	jmp_imm_32bit
2918
	cmp	al,8
2918
	cmp	al,8
2919
	je	jmp_imm_64bit
2919
	je	jmp_imm_64bit
2920
	or	al,al
2920
	or	al,al
2921
	jnz	invalid_operand_size
2921
	jnz	invalid_operand_size
2922
	cmp	[code_type],16
2922
	cmp	[code_type],16
2923
	je	jmp_imm_16bit
2923
	je	jmp_imm_16bit
2924
	cmp	[code_type],64
2924
	cmp	[code_type],64
2925
	je	jmp_imm_64bit
2925
	je	jmp_imm_64bit
2926
      jmp_imm_32bit:
2926
      jmp_imm_32bit:
2927
	cmp	[code_type],64
2927
	cmp	[code_type],64
2928
	je	invalid_operand_size
2928
	je	invalid_operand_size
2929
	call	get_address_dword_value
2929
	call	get_address_dword_value
2930
	cmp	[code_type],16
2930
	cmp	[code_type],16
2931
	jne	jmp_imm_32bit_prefix_ok
2931
	jne	jmp_imm_32bit_prefix_ok
2932
	mov	byte [edi],66h
2932
	mov	byte [edi],66h
2933
	inc	edi
2933
	inc	edi
2934
      jmp_imm_32bit_prefix_ok:
2934
      jmp_imm_32bit_prefix_ok:
2935
	call	calculate_jump_offset
2935
	call	calculate_jump_offset
2936
	cdq
2936
	cdq
2937
	call	check_for_short_jump
2937
	call	check_for_short_jump
2938
	jc	jmp_short
2938
	jc	jmp_short
2939
      jmp_imm_32bit_store:
2939
      jmp_imm_32bit_store:
2940
	mov	edx,eax
2940
	mov	edx,eax
2941
	sub	edx,3
2941
	sub	edx,3
2942
	jno	jmp_imm_32bit_ok
2942
	jno	jmp_imm_32bit_ok
2943
	cmp	[code_type],64
2943
	cmp	[code_type],64
2944
	je	relative_jump_out_of_range
2944
	je	relative_jump_out_of_range
2945
      jmp_imm_32bit_ok:
2945
      jmp_imm_32bit_ok:
2946
	mov	al,[base_code]
2946
	mov	al,[base_code]
2947
	stos	byte [edi]
2947
	stos	byte [edi]
2948
	mov	eax,edx
2948
	mov	eax,edx
2949
	call	mark_relocation
2949
	call	mark_relocation
2950
	stos	dword [edi]
2950
	stos	dword [edi]
2951
	jmp	instruction_assembled
2951
	jmp	instruction_assembled
2952
      jmp_imm_64bit:
2952
      jmp_imm_64bit:
2953
	cmp	[code_type],64
2953
	cmp	[code_type],64
2954
	jne	invalid_operand_size
2954
	jne	invalid_operand_size
2955
	call	get_address_qword_value
2955
	call	get_address_qword_value
2956
	call	calculate_jump_offset
2956
	call	calculate_jump_offset
2957
	mov	ecx,edx
2957
	mov	ecx,edx
2958
	cdq
2958
	cdq
2959
	cmp	edx,ecx
2959
	cmp	edx,ecx
2960
	jne	relative_jump_out_of_range
2960
	jne	relative_jump_out_of_range
2961
	call	check_for_short_jump
2961
	call	check_for_short_jump
2962
	jnc	jmp_imm_32bit_store
2962
	jnc	jmp_imm_32bit_store
2963
      jmp_short:
2963
      jmp_short:
2964
	mov	ah,al
2964
	mov	ah,al
2965
	mov	al,0EBh
2965
	mov	al,0EBh
2966
	stos	word [edi]
2966
	stos	word [edi]
2967
	jmp	instruction_assembled
2967
	jmp	instruction_assembled
2968
      jmp_imm_16bit:
2968
      jmp_imm_16bit:
2969
	call	get_address_word_value
2969
	call	get_address_word_value
2970
	cmp	[code_type],16
2970
	cmp	[code_type],16
2971
	je	jmp_imm_16bit_prefix_ok
2971
	je	jmp_imm_16bit_prefix_ok
2972
	mov	byte [edi],66h
2972
	mov	byte [edi],66h
2973
	inc	edi
2973
	inc	edi
2974
      jmp_imm_16bit_prefix_ok:
2974
      jmp_imm_16bit_prefix_ok:
2975
	call	calculate_jump_offset
2975
	call	calculate_jump_offset
2976
	cwde
2976
	cwde
2977
	cdq
2977
	cdq
2978
	call	check_for_short_jump
2978
	call	check_for_short_jump
2979
	jc	jmp_short
2979
	jc	jmp_short
2980
	cmp	[value_type],0
2980
	cmp	[value_type],0
2981
	jne	invalid_use_of_symbol
2981
	jne	invalid_use_of_symbol
2982
	mov	edx,eax
2982
	mov	edx,eax
2983
	dec	edx
2983
	dec	edx
2984
	mov	al,[base_code]
2984
	mov	al,[base_code]
2985
	stos	byte [edi]
2985
	stos	byte [edi]
2986
	mov	eax,edx
2986
	mov	eax,edx
2987
	stos	word [edi]
2987
	stos	word [edi]
2988
	jmp	instruction_assembled
2988
	jmp	instruction_assembled
2989
      calculate_jump_offset:
2989
      calculate_jump_offset:
2990
	add	edi,2
2990
	add	edi,2
2991
	call	calculate_relative_offset
2991
	call	calculate_relative_offset
2992
	sub	edi,2
2992
	sub	edi,2
2993
	ret
2993
	ret
2994
      check_for_short_jump:
2994
      check_for_short_jump:
2995
	cmp	[jump_type],1
2995
	cmp	[jump_type],1
2996
	je	forced_short
2996
	je	forced_short
2997
	ja	no_short_jump
2997
	ja	no_short_jump
2998
	cmp	[base_code],0E8h
2998
	cmp	[base_code],0E8h
2999
	je	no_short_jump
2999
	je	no_short_jump
3000
	cmp	[value_type],0
3000
	cmp	[value_type],0
3001
	jne	no_short_jump
3001
	jne	no_short_jump
3002
	cmp	eax,80h
3002
	cmp	eax,80h
3003
	jb	short_jump
3003
	jb	short_jump
3004
	cmp	eax,-80h
3004
	cmp	eax,-80h
3005
	jae	short_jump
3005
	jae	short_jump
3006
      no_short_jump:
3006
      no_short_jump:
3007
	clc
3007
	clc
3008
	ret
3008
	ret
3009
      forced_short:
3009
      forced_short:
3010
	cmp	[base_code],0E8h
3010
	cmp	[base_code],0E8h
3011
	je	illegal_instruction
3011
	je	illegal_instruction
3012
	cmp	[next_pass_needed],0
3012
	cmp	[next_pass_needed],0
3013
	jne	jmp_short_value_type_ok
3013
	jne	jmp_short_value_type_ok
3014
	cmp	[value_type],0
3014
	cmp	[value_type],0
3015
	jne	invalid_use_of_symbol
3015
	jne	invalid_use_of_symbol
3016
      jmp_short_value_type_ok:
3016
      jmp_short_value_type_ok:
3017
	cmp	eax,-80h
3017
	cmp	eax,-80h
3018
	jae	short_jump
3018
	jae	short_jump
3019
	cmp	eax,80h
3019
	cmp	eax,80h
3020
	jae	jump_out_of_range
3020
	jae	jump_out_of_range
3021
      short_jump:
3021
      short_jump:
3022
	stc
3022
	stc
3023
	ret
3023
	ret
3024
      jump_out_of_range:
3024
      jump_out_of_range:
3025
	cmp	[error_line],0
3025
	cmp	[error_line],0
3026
	jne	instruction_assembled
3026
	jne	instruction_assembled
3027
	mov	eax,[current_line]
3027
	mov	eax,[current_line]
3028
	mov	[error_line],eax
3028
	mov	[error_line],eax
3029
	mov	[error],relative_jump_out_of_range
3029
	mov	[error],relative_jump_out_of_range
3030
	jmp	instruction_assembled
3030
	jmp	instruction_assembled
3031
      jmp_far:
3031
      jmp_far:
3032
	cmp	[jump_type],2
3032
	cmp	[jump_type],2
3033
	je	invalid_operand
3033
	je	invalid_operand
3034
	cmp	[code_type],64
3034
	cmp	[code_type],64
3035
	je	illegal_instruction
3035
	je	illegal_instruction
3036
	mov	al,[extended_code]
3036
	mov	al,[extended_code]
3037
	mov	[base_code],al
3037
	mov	[base_code],al
3038
	call	get_word_value
3038
	call	get_word_value
3039
	push	eax
3039
	push	eax
3040
	inc	esi
3040
	inc	esi
3041
	lods	byte [esi]
3041
	lods	byte [esi]
3042
	cmp	al,'('
3042
	cmp	al,'('
3043
	jne	invalid_operand
3043
	jne	invalid_operand
3044
	mov	al,[value_type]
3044
	mov	al,[value_type]
3045
	push	eax [symbol_identifier]
3045
	push	eax [symbol_identifier]
3046
	cmp	byte [esi],'.'
3046
	cmp	byte [esi],'.'
3047
	je	invalid_value
3047
	je	invalid_value
3048
	mov	al,[operand_size]
3048
	mov	al,[operand_size]
3049
	cmp	al,4
3049
	cmp	al,4
3050
	je	jmp_far_16bit
3050
	je	jmp_far_16bit
3051
	cmp	al,6
3051
	cmp	al,6
3052
	je	jmp_far_32bit
3052
	je	jmp_far_32bit
3053
	or	al,al
3053
	or	al,al
3054
	jnz	invalid_operand_size
3054
	jnz	invalid_operand_size
3055
	cmp	[code_type],16
3055
	cmp	[code_type],16
3056
	jne	jmp_far_32bit
3056
	jne	jmp_far_32bit
3057
      jmp_far_16bit:
3057
      jmp_far_16bit:
3058
	call	get_word_value
3058
	call	get_word_value
3059
	mov	ebx,eax
3059
	mov	ebx,eax
3060
	call	operand_16bit
3060
	call	operand_16bit
3061
	call	store_instruction_code
3061
	call	store_instruction_code
3062
	mov	ax,bx
3062
	mov	ax,bx
3063
	call	mark_relocation
3063
	call	mark_relocation
3064
	stos	word [edi]
3064
	stos	word [edi]
3065
      jmp_far_segment:
3065
      jmp_far_segment:
3066
	pop	[symbol_identifier] eax
3066
	pop	[symbol_identifier] eax
3067
	mov	[value_type],al
3067
	mov	[value_type],al
3068
	pop	eax
3068
	pop	eax
3069
	call	mark_relocation
3069
	call	mark_relocation
3070
	stos	word [edi]
3070
	stos	word [edi]
3071
	jmp	instruction_assembled
3071
	jmp	instruction_assembled
3072
      jmp_far_32bit:
3072
      jmp_far_32bit:
3073
	call	get_dword_value
3073
	call	get_dword_value
3074
	mov	ebx,eax
3074
	mov	ebx,eax
3075
	call	operand_32bit
3075
	call	operand_32bit
3076
	call	store_instruction_code
3076
	call	store_instruction_code
3077
	mov	eax,ebx
3077
	mov	eax,ebx
3078
	call	mark_relocation
3078
	call	mark_relocation
3079
	stos	dword [edi]
3079
	stos	dword [edi]
3080
	jmp	jmp_far_segment
3080
	jmp	jmp_far_segment
3081
conditional_jump:
3081
conditional_jump:
3082
	mov	[base_code],al
3082
	mov	[base_code],al
3083
	lods	byte [esi]
3083
	lods	byte [esi]
3084
	call	get_jump_operator
3084
	call	get_jump_operator
3085
	cmp	[jump_type],3
3085
	cmp	[jump_type],3
3086
	je	invalid_operand
3086
	je	invalid_operand
3087
	call	get_size_operator
3087
	call	get_size_operator
3088
	cmp	al,'('
3088
	cmp	al,'('
3089
	jne	invalid_operand
3089
	jne	invalid_operand
3090
	cmp	byte [esi],'.'
3090
	cmp	byte [esi],'.'
3091
	je	invalid_value
3091
	je	invalid_value
3092
	mov	al,[operand_size]
3092
	mov	al,[operand_size]
3093
	cmp	al,2
3093
	cmp	al,2
3094
	je	conditional_jump_16bit
3094
	je	conditional_jump_16bit
3095
	cmp	al,4
3095
	cmp	al,4
3096
	je	conditional_jump_32bit
3096
	je	conditional_jump_32bit
3097
	cmp	al,8
3097
	cmp	al,8
3098
	je	conditional_jump_64bit
3098
	je	conditional_jump_64bit
3099
	or	al,al
3099
	or	al,al
3100
	jnz	invalid_operand_size
3100
	jnz	invalid_operand_size
3101
	cmp	[code_type],16
3101
	cmp	[code_type],16
3102
	je	conditional_jump_16bit
3102
	je	conditional_jump_16bit
3103
	cmp	[code_type],64
3103
	cmp	[code_type],64
3104
	je	conditional_jump_64bit
3104
	je	conditional_jump_64bit
3105
      conditional_jump_32bit:
3105
      conditional_jump_32bit:
3106
	cmp	[code_type],64
3106
	cmp	[code_type],64
3107
	je	invalid_operand_size
3107
	je	invalid_operand_size
3108
	call	get_address_dword_value
3108
	call	get_address_dword_value
3109
	cmp	[code_type],16
3109
	cmp	[code_type],16
3110
	jne	conditional_jump_32bit_prefix_ok
3110
	jne	conditional_jump_32bit_prefix_ok
3111
	mov	byte [edi],66h
3111
	mov	byte [edi],66h
3112
	inc	edi
3112
	inc	edi
3113
      conditional_jump_32bit_prefix_ok:
3113
      conditional_jump_32bit_prefix_ok:
3114
	call	calculate_jump_offset
3114
	call	calculate_jump_offset
3115
	cdq
3115
	cdq
3116
	call	check_for_short_jump
3116
	call	check_for_short_jump
3117
	jc	conditional_jump_short
3117
	jc	conditional_jump_short
3118
      conditional_jump_32bit_store:
3118
      conditional_jump_32bit_store:
3119
	mov	edx,eax
3119
	mov	edx,eax
3120
	sub	edx,4
3120
	sub	edx,4
3121
	jno	conditional_jump_32bit_range_ok
3121
	jno	conditional_jump_32bit_range_ok
3122
	cmp	[code_type],64
3122
	cmp	[code_type],64
3123
	je	relative_jump_out_of_range
3123
	je	relative_jump_out_of_range
3124
      conditional_jump_32bit_range_ok:
3124
      conditional_jump_32bit_range_ok:
3125
	mov	ah,[base_code]
3125
	mov	ah,[base_code]
3126
	add	ah,10h
3126
	add	ah,10h
3127
	mov	al,0Fh
3127
	mov	al,0Fh
3128
	stos	word [edi]
3128
	stos	word [edi]
3129
	mov	eax,edx
3129
	mov	eax,edx
3130
	call	mark_relocation
3130
	call	mark_relocation
3131
	stos	dword [edi]
3131
	stos	dword [edi]
3132
	jmp	instruction_assembled
3132
	jmp	instruction_assembled
3133
      conditional_jump_64bit:
3133
      conditional_jump_64bit:
3134
	cmp	[code_type],64
3134
	cmp	[code_type],64
3135
	jne	invalid_operand_size
3135
	jne	invalid_operand_size
3136
	call	get_address_qword_value
3136
	call	get_address_qword_value
3137
	call	calculate_jump_offset
3137
	call	calculate_jump_offset
3138
	mov	ecx,edx
3138
	mov	ecx,edx
3139
	cdq
3139
	cdq
3140
	cmp	edx,ecx
3140
	cmp	edx,ecx
3141
	jne	relative_jump_out_of_range
3141
	jne	relative_jump_out_of_range
3142
	call	check_for_short_jump
3142
	call	check_for_short_jump
3143
	jnc	conditional_jump_32bit_store
3143
	jnc	conditional_jump_32bit_store
3144
      conditional_jump_short:
3144
      conditional_jump_short:
3145
	mov	ah,al
3145
	mov	ah,al
3146
	mov	al,[base_code]
3146
	mov	al,[base_code]
3147
	stos	word [edi]
3147
	stos	word [edi]
3148
	jmp	instruction_assembled
3148
	jmp	instruction_assembled
3149
      conditional_jump_16bit:
3149
      conditional_jump_16bit:
3150
	call	get_address_word_value
3150
	call	get_address_word_value
3151
	cmp	[code_type],16
3151
	cmp	[code_type],16
3152
	je	conditional_jump_16bit_prefix_ok
3152
	je	conditional_jump_16bit_prefix_ok
3153
	mov	byte [edi],66h
3153
	mov	byte [edi],66h
3154
	inc	edi
3154
	inc	edi
3155
      conditional_jump_16bit_prefix_ok:
3155
      conditional_jump_16bit_prefix_ok:
3156
	call	calculate_jump_offset
3156
	call	calculate_jump_offset
3157
	cwde
3157
	cwde
3158
	cdq
3158
	cdq
3159
	call	check_for_short_jump
3159
	call	check_for_short_jump
3160
	jc	conditional_jump_short
3160
	jc	conditional_jump_short
3161
	cmp	[value_type],0
3161
	cmp	[value_type],0
3162
	jne	invalid_use_of_symbol
3162
	jne	invalid_use_of_symbol
3163
	mov	edx,eax
3163
	mov	edx,eax
3164
	sub	dx,2
3164
	sub	dx,2
3165
	mov	ah,[base_code]
3165
	mov	ah,[base_code]
3166
	add	ah,10h
3166
	add	ah,10h
3167
	mov	al,0Fh
3167
	mov	al,0Fh
3168
	stos	word [edi]
3168
	stos	word [edi]
3169
	mov	eax,edx
3169
	mov	eax,edx
3170
	stos	word [edi]
3170
	stos	word [edi]
3171
	jmp	instruction_assembled
3171
	jmp	instruction_assembled
3172
loop_instruction_16bit:
3172
loop_instruction_16bit:
3173
	cmp	[code_type],64
3173
	cmp	[code_type],64
3174
	je	illegal_instruction
3174
	je	illegal_instruction
3175
	cmp	[code_type],16
3175
	cmp	[code_type],16
3176
	je	loop_instruction
3176
	je	loop_instruction
3177
	mov	[operand_prefix],67h
3177
	mov	[operand_prefix],67h
3178
	jmp	loop_instruction
3178
	jmp	loop_instruction
3179
loop_instruction_32bit:
3179
loop_instruction_32bit:
3180
	cmp	[code_type],32
3180
	cmp	[code_type],32
3181
	je	loop_instruction
3181
	je	loop_instruction
3182
	mov	[operand_prefix],67h
3182
	mov	[operand_prefix],67h
3183
      jmp     loop_instruction
3183
      jmp     loop_instruction
3184
loop_instruction_64bit:
3184
loop_instruction_64bit:
3185
	cmp	[code_type],64
3185
	cmp	[code_type],64
3186
	jne	illegal_instruction
3186
	jne	illegal_instruction
3187
loop_instruction:
3187
loop_instruction:
3188
	mov	[base_code],al
3188
	mov	[base_code],al
3189
	lods	byte [esi]
3189
	lods	byte [esi]
3190
	call	get_jump_operator
3190
	call	get_jump_operator
3191
	cmp	[jump_type],1
3191
	cmp	[jump_type],1
3192
	ja	invalid_operand
3192
	ja	invalid_operand
3193
	call	get_size_operator
3193
	call	get_size_operator
3194
	cmp	al,'('
3194
	cmp	al,'('
3195
	jne	invalid_operand
3195
	jne	invalid_operand
3196
	cmp	byte [esi],'.'
3196
	cmp	byte [esi],'.'
3197
	je	invalid_value
3197
	je	invalid_value
3198
	mov	al,[operand_size]
3198
	mov	al,[operand_size]
3199
	cmp	al,2
3199
	cmp	al,2
3200
	je	loop_jump_16bit
3200
	je	loop_jump_16bit
3201
	cmp	al,4
3201
	cmp	al,4
3202
	je	loop_jump_32bit
3202
	je	loop_jump_32bit
3203
	cmp	al,8
3203
	cmp	al,8
3204
	je	loop_jump_64bit
3204
	je	loop_jump_64bit
3205
	or	al,al
3205
	or	al,al
3206
	jnz	invalid_operand_size
3206
	jnz	invalid_operand_size
3207
	cmp	[code_type],16
3207
	cmp	[code_type],16
3208
	je	loop_jump_16bit
3208
	je	loop_jump_16bit
3209
	cmp	[code_type],64
3209
	cmp	[code_type],64
3210
	je	loop_jump_64bit
3210
	je	loop_jump_64bit
3211
      loop_jump_32bit:
3211
      loop_jump_32bit:
3212
	cmp	[code_type],64
3212
	cmp	[code_type],64
3213
	je	invalid_operand_size
3213
	je	invalid_operand_size
3214
	call	get_address_dword_value
3214
	call	get_address_dword_value
3215
	cmp	[code_type],16
3215
	cmp	[code_type],16
3216
	jne	loop_jump_32bit_prefix_ok
3216
	jne	loop_jump_32bit_prefix_ok
3217
	mov	byte [edi],66h
3217
	mov	byte [edi],66h
3218
	inc	edi
3218
	inc	edi
3219
      loop_jump_32bit_prefix_ok:
3219
      loop_jump_32bit_prefix_ok:
3220
	call	loop_counter_size
3220
	call	loop_counter_size
3221
	call	calculate_jump_offset
3221
	call	calculate_jump_offset
3222
	cdq
3222
	cdq
3223
      make_loop_jump:
3223
      make_loop_jump:
3224
	call	check_for_short_jump
3224
	call	check_for_short_jump
3225
	jc	conditional_jump_short
3225
	jc	conditional_jump_short
3226
	scas	word [edi]
3226
	scas	word [edi]
3227
	jmp	jump_out_of_range
3227
	jmp	jump_out_of_range
3228
      loop_counter_size:
3228
      loop_counter_size:
3229
	cmp	[operand_prefix],0
3229
	cmp	[operand_prefix],0
3230
	je	loop_counter_size_ok
3230
	je	loop_counter_size_ok
3231
	push	eax
3231
	push	eax
3232
	mov	al,[operand_prefix]
3232
	mov	al,[operand_prefix]
3233
	stos	byte [edi]
3233
	stos	byte [edi]
3234
	pop	eax
3234
	pop	eax
3235
      loop_counter_size_ok:
3235
      loop_counter_size_ok:
3236
	ret
3236
	ret
3237
      loop_jump_64bit:
3237
      loop_jump_64bit:
3238
	cmp	[code_type],64
3238
	cmp	[code_type],64
3239
	jne	invalid_operand_size
3239
	jne	invalid_operand_size
3240
	call	get_address_qword_value
3240
	call	get_address_qword_value
3241
	call	loop_counter_size
3241
	call	loop_counter_size
3242
	call	calculate_jump_offset
3242
	call	calculate_jump_offset
3243
	mov	ecx,edx
3243
	mov	ecx,edx
3244
	cdq
3244
	cdq
3245
	cmp	edx,ecx
3245
	cmp	edx,ecx
3246
	jne	relative_jump_out_of_range
3246
	jne	relative_jump_out_of_range
3247
	jmp	make_loop_jump
3247
	jmp	make_loop_jump
3248
      loop_jump_16bit:
3248
      loop_jump_16bit:
3249
	call	get_address_word_value
3249
	call	get_address_word_value
3250
	cmp	[code_type],16
3250
	cmp	[code_type],16
3251
	je	loop_jump_16bit_prefix_ok
3251
	je	loop_jump_16bit_prefix_ok
3252
	mov	byte [edi],66h
3252
	mov	byte [edi],66h
3253
	inc	edi
3253
	inc	edi
3254
      loop_jump_16bit_prefix_ok:
3254
      loop_jump_16bit_prefix_ok:
3255
	call	loop_counter_size
3255
	call	loop_counter_size
3256
	call	calculate_jump_offset
3256
	call	calculate_jump_offset
3257
	cwde
3257
	cwde
3258
	cdq
3258
	cdq
3259
	jmp	make_loop_jump
3259
	jmp	make_loop_jump
3260
 
3260
 
3261
movs_instruction:
3261
movs_instruction:
3262
	lods	byte [esi]
3262
	lods	byte [esi]
3263
	call	get_size_operator
3263
	call	get_size_operator
3264
	cmp	al,'['
3264
	cmp	al,'['
3265
	jne	invalid_operand
3265
	jne	invalid_operand
3266
	call	get_address
3266
	call	get_address
3267
	or	eax,eax
3267
	or	eax,eax
3268
	jnz	invalid_address
3268
	jnz	invalid_address
3269
	or	bl,ch
3269
	or	bl,ch
3270
	jnz	invalid_address
3270
	jnz	invalid_address
3271
	cmp	[segment_register],1
3271
	cmp	[segment_register],1
3272
	ja	invalid_address
3272
	ja	invalid_address
3273
	push	ebx
3273
	push	ebx
3274
	lods	byte [esi]
3274
	lods	byte [esi]
3275
	cmp	al,','
3275
	cmp	al,','
3276
	jne	invalid_operand
3276
	jne	invalid_operand
3277
	lods	byte [esi]
3277
	lods	byte [esi]
3278
	call	get_size_operator
3278
	call	get_size_operator
3279
	cmp	al,'['
3279
	cmp	al,'['
3280
	jne	invalid_operand
3280
	jne	invalid_operand
3281
	call	get_address
3281
	call	get_address
3282
	pop	edx
3282
	pop	edx
3283
	or	eax,eax
3283
	or	eax,eax
3284
	jnz	invalid_address
3284
	jnz	invalid_address
3285
	or	bl,ch
3285
	or	bl,ch
3286
	jnz	invalid_address
3286
	jnz	invalid_address
3287
	mov	al,dh
3287
	mov	al,dh
3288
	mov	ah,bh
3288
	mov	ah,bh
3289
	shr	al,4
3289
	shr	al,4
3290
	shr	ah,4
3290
	shr	ah,4
3291
	cmp	al,ah
3291
	cmp	al,ah
3292
	jne	address_sizes_do_not_agree
3292
	jne	address_sizes_do_not_agree
3293
	and	bh,111b
3293
	and	bh,111b
3294
	and	dh,111b
3294
	and	dh,111b
3295
	cmp	bh,6
3295
	cmp	bh,6
3296
	jne	invalid_address
3296
	jne	invalid_address
3297
	cmp	dh,7
3297
	cmp	dh,7
3298
	jne	invalid_address
3298
	jne	invalid_address
3299
	cmp	al,2
3299
	cmp	al,2
3300
	je	movs_address_16bit
3300
	je	movs_address_16bit
3301
	cmp	al,4
3301
	cmp	al,4
3302
	je	movs_address_32bit
3302
	je	movs_address_32bit
3303
	cmp	[code_type],64
3303
	cmp	[code_type],64
3304
	jne	invalid_address_size
3304
	jne	invalid_address_size
3305
	jmp	movs_store
3305
	jmp	movs_store
3306
      movs_address_32bit:
3306
      movs_address_32bit:
3307
	call	address_32bit_prefix
3307
	call	address_32bit_prefix
3308
	jmp	movs_store
3308
	jmp	movs_store
3309
      movs_address_16bit:
3309
      movs_address_16bit:
3310
	cmp	[code_type],64
3310
	cmp	[code_type],64
3311
	je	invalid_address_size
3311
	je	invalid_address_size
3312
	call	address_16bit_prefix
3312
	call	address_16bit_prefix
3313
      movs_store:
3313
      movs_store:
3314
	cmp	[segment_register],4
3314
	xor	ebx,ebx
3315
	je	movs_segment_ok
-
 
3316
	call	store_segment_prefix
3315
	call	store_segment_prefix_if_necessary
3317
      movs_segment_ok:
3316
	mov	al,0A4h
3318
	mov	al,0A4h
-
 
3319
      movs_check_size:
3317
      movs_check_size:
3320
	mov	bl,[operand_size]
3318
	mov	bl,[operand_size]
3321
	cmp	bl,1
3319
	cmp	bl,1
3322
	je	simple_instruction
3320
	je	simple_instruction
3323
	inc	al
3321
	inc	al
3324
	cmp	bl,2
3322
	cmp	bl,2
3325
	je	simple_instruction_16bit
3323
	je	simple_instruction_16bit
3326
	cmp	bl,4
3324
	cmp	bl,4
3327
	je	simple_instruction_32bit
3325
	je	simple_instruction_32bit
3328
	cmp	bl,8
3326
	cmp	bl,8
3329
	je	simple_instruction_64bit
3327
	je	simple_instruction_64bit
3330
	or	bl,bl
3328
	or	bl,bl
3331
	jnz	invalid_operand_size
3329
	jnz	invalid_operand_size
3332
	call	recoverable_unknown_size
3330
	call	recoverable_unknown_size
3333
	jmp	simple_instruction
3331
	jmp	simple_instruction
3334
lods_instruction:
3332
lods_instruction:
3335
	lods	byte [esi]
3333
	lods	byte [esi]
3336
	call	get_size_operator
3334
	call	get_size_operator
3337
	cmp	al,'['
3335
	cmp	al,'['
3338
	jne	invalid_operand
3336
	jne	invalid_operand
3339
	call	get_address
3337
	call	get_address
3340
	or	eax,eax
3338
	or	eax,eax
3341
	jnz	invalid_address
3339
	jnz	invalid_address
3342
	or	bl,ch
3340
	or	bl,ch
3343
	jnz	invalid_address
3341
	jnz	invalid_address
3344
	cmp	bh,26h
3342
	cmp	bh,26h
3345
	je	lods_address_16bit
3343
	je	lods_address_16bit
3346
	cmp	bh,46h
3344
	cmp	bh,46h
3347
	je	lods_address_32bit
3345
	je	lods_address_32bit
3348
	cmp	bh,86h
3346
	cmp	bh,86h
3349
	jne	invalid_address
3347
	jne	invalid_address
3350
	cmp	[code_type],64
3348
	cmp	[code_type],64
3351
	jne	invalid_address_size
3349
	jne	invalid_address_size
3352
	jmp	lods_store
3350
	jmp	lods_store
3353
      lods_address_32bit:
3351
      lods_address_32bit:
3354
	call	address_32bit_prefix
3352
	call	address_32bit_prefix
3355
	jmp	lods_store
3353
	jmp	lods_store
3356
      lods_address_16bit:
3354
      lods_address_16bit:
3357
	cmp	[code_type],64
3355
	cmp	[code_type],64
3358
	je	invalid_address_size
3356
	je	invalid_address_size
3359
	call	address_16bit_prefix
3357
	call	address_16bit_prefix
3360
      lods_store:
3358
      lods_store:
3361
	cmp	[segment_register],4
3359
	xor	ebx,ebx
3362
	je	lods_segment_ok
-
 
3363
	call	store_segment_prefix
3360
	call	store_segment_prefix_if_necessary
3364
      lods_segment_ok:
3361
	mov	al,0ACh
3365
	mov	al,0ACh
-
 
3366
	jmp	movs_check_size
3362
	jmp	movs_check_size
3367
stos_instruction:
3363
stos_instruction:
3368
	mov	[base_code],al
3364
	mov	[base_code],al
3369
	lods	byte [esi]
3365
	lods	byte [esi]
3370
	call	get_size_operator
3366
	call	get_size_operator
3371
	cmp	al,'['
3367
	cmp	al,'['
3372
	jne	invalid_operand
3368
	jne	invalid_operand
3373
	call	get_address
3369
	call	get_address
3374
	or	eax,eax
3370
	or	eax,eax
3375
	jnz	invalid_address
3371
	jnz	invalid_address
3376
	or	bl,ch
3372
	or	bl,ch
3377
	jnz	invalid_address
3373
	jnz	invalid_address
3378
	cmp	bh,27h
3374
	cmp	bh,27h
3379
	je	stos_address_16bit
3375
	je	stos_address_16bit
3380
	cmp	bh,47h
3376
	cmp	bh,47h
3381
	je	stos_address_32bit
3377
	je	stos_address_32bit
3382
	cmp	bh,87h
3378
	cmp	bh,87h
3383
	jne	invalid_address
3379
	jne	invalid_address
3384
	cmp	[code_type],64
3380
	cmp	[code_type],64
3385
	jne	invalid_address_size
3381
	jne	invalid_address_size
3386
	jmp	stos_store
3382
	jmp	stos_store
3387
      stos_address_32bit:
3383
      stos_address_32bit:
3388
	call	address_32bit_prefix
3384
	call	address_32bit_prefix
3389
	jmp	stos_store
3385
	jmp	stos_store
3390
      stos_address_16bit:
3386
      stos_address_16bit:
3391
	cmp	[code_type],64
3387
	cmp	[code_type],64
3392
	je	invalid_address_size
3388
	je	invalid_address_size
3393
	call	address_16bit_prefix
3389
	call	address_16bit_prefix
3394
      stos_store:
3390
      stos_store:
3395
	cmp	[segment_register],1
3391
	cmp	[segment_register],1
3396
	ja	invalid_address
3392
	ja	invalid_address
3397
	mov	al,[base_code]
3393
	mov	al,[base_code]
3398
	jmp	movs_check_size
3394
	jmp	movs_check_size
3399
cmps_instruction:
3395
cmps_instruction:
3400
	lods	byte [esi]
3396
	lods	byte [esi]
3401
	call	get_size_operator
3397
	call	get_size_operator
3402
	cmp	al,'['
3398
	cmp	al,'['
3403
	jne	invalid_operand
3399
	jne	invalid_operand
3404
	call	get_address
3400
	call	get_address
3405
	or	eax,eax
3401
	or	eax,eax
3406
	jnz	invalid_address
3402
	jnz	invalid_address
3407
	or	bl,ch
3403
	or	bl,ch
3408
	jnz	invalid_address
3404
	jnz	invalid_address
3409
	mov	al,[segment_register]
3405
	mov	al,[segment_register]
3410
	push	eax ebx
3406
	push	eax ebx
3411
	lods	byte [esi]
3407
	lods	byte [esi]
3412
	cmp	al,','
3408
	cmp	al,','
3413
	jne	invalid_operand
3409
	jne	invalid_operand
3414
	lods	byte [esi]
3410
	lods	byte [esi]
3415
	call	get_size_operator
3411
	call	get_size_operator
3416
	cmp	al,'['
3412
	cmp	al,'['
3417
	jne	invalid_operand
3413
	jne	invalid_operand
3418
	call	get_address
3414
	call	get_address
3419
	or	eax,eax
3415
	or	eax,eax
3420
	jnz	invalid_address
3416
	jnz	invalid_address
3421
	or	bl,ch
3417
	or	bl,ch
3422
	jnz	invalid_address
3418
	jnz	invalid_address
3423
	pop	edx eax
3419
	pop	edx eax
3424
	cmp	[segment_register],1
3420
	cmp	[segment_register],1
3425
	ja	invalid_address
3421
	ja	invalid_address
3426
	mov	[segment_register],al
3422
	mov	[segment_register],al
3427
	mov	al,dh
3423
	mov	al,dh
3428
	mov	ah,bh
3424
	mov	ah,bh
3429
	shr	al,4
3425
	shr	al,4
3430
	shr	ah,4
3426
	shr	ah,4
3431
	cmp	al,ah
3427
	cmp	al,ah
3432
	jne	address_sizes_do_not_agree
3428
	jne	address_sizes_do_not_agree
3433
	and	bh,111b
3429
	and	bh,111b
3434
	and	dh,111b
3430
	and	dh,111b
3435
	cmp	bh,7
3431
	cmp	bh,7
3436
	jne	invalid_address
3432
	jne	invalid_address
3437
	cmp	dh,6
3433
	cmp	dh,6
3438
	jne	invalid_address
3434
	jne	invalid_address
3439
	cmp	al,2
3435
	cmp	al,2
3440
	je	cmps_address_16bit
3436
	je	cmps_address_16bit
3441
	cmp	al,4
3437
	cmp	al,4
3442
	je	cmps_address_32bit
3438
	je	cmps_address_32bit
3443
	cmp	[code_type],64
3439
	cmp	[code_type],64
3444
	jne	invalid_address_size
3440
	jne	invalid_address_size
3445
	jmp	cmps_store
3441
	jmp	cmps_store
3446
      cmps_address_32bit:
3442
      cmps_address_32bit:
3447
	call	address_32bit_prefix
3443
	call	address_32bit_prefix
3448
	jmp	cmps_store
3444
	jmp	cmps_store
3449
      cmps_address_16bit:
3445
      cmps_address_16bit:
3450
	cmp	[code_type],64
3446
	cmp	[code_type],64
3451
	je	invalid_address_size
3447
	je	invalid_address_size
3452
	call	address_16bit_prefix
3448
	call	address_16bit_prefix
3453
      cmps_store:
3449
      cmps_store:
3454
	cmp	[segment_register],4
3450
	xor	ebx,ebx
3455
	je	cmps_segment_ok
-
 
3456
	call	store_segment_prefix
3451
	call	store_segment_prefix_if_necessary
3457
      cmps_segment_ok:
3452
	mov	al,0A6h
3458
	mov	al,0A6h
-
 
3459
	jmp	movs_check_size
3453
	jmp	movs_check_size
3460
ins_instruction:
3454
ins_instruction:
3461
	lods	byte [esi]
3455
	lods	byte [esi]
3462
	call	get_size_operator
3456
	call	get_size_operator
3463
	cmp	al,'['
3457
	cmp	al,'['
3464
	jne	invalid_operand
3458
	jne	invalid_operand
3465
	call	get_address
3459
	call	get_address
3466
	or	eax,eax
3460
	or	eax,eax
3467
	jnz	invalid_address
3461
	jnz	invalid_address
3468
	or	bl,ch
3462
	or	bl,ch
3469
	jnz	invalid_address
3463
	jnz	invalid_address
3470
	cmp	bh,27h
3464
	cmp	bh,27h
3471
	je	ins_address_16bit
3465
	je	ins_address_16bit
3472
	cmp	bh,47h
3466
	cmp	bh,47h
3473
	je	ins_address_32bit
3467
	je	ins_address_32bit
3474
	cmp	bh,87h
3468
	cmp	bh,87h
3475
	jne	invalid_address
3469
	jne	invalid_address
3476
	cmp	[code_type],64
3470
	cmp	[code_type],64
3477
	jne	invalid_address_size
3471
	jne	invalid_address_size
3478
	jmp	ins_store
3472
	jmp	ins_store
3479
      ins_address_32bit:
3473
      ins_address_32bit:
3480
	call	address_32bit_prefix
3474
	call	address_32bit_prefix
3481
	jmp	ins_store
3475
	jmp	ins_store
3482
      ins_address_16bit:
3476
      ins_address_16bit:
3483
	cmp	[code_type],64
3477
	cmp	[code_type],64
3484
	je	invalid_address_size
3478
	je	invalid_address_size
3485
	call	address_16bit_prefix
3479
	call	address_16bit_prefix
3486
      ins_store:
3480
      ins_store:
3487
	cmp	[segment_register],1
3481
	cmp	[segment_register],1
3488
	ja	invalid_address
3482
	ja	invalid_address
3489
	lods	byte [esi]
3483
	lods	byte [esi]
3490
	cmp	al,','
3484
	cmp	al,','
3491
	jne	invalid_operand
3485
	jne	invalid_operand
3492
	lods	byte [esi]
3486
	lods	byte [esi]
3493
	cmp	al,10h
3487
	cmp	al,10h
3494
	jne	invalid_operand
3488
	jne	invalid_operand
3495
	lods	byte [esi]
3489
	lods	byte [esi]
3496
	cmp	al,22h
3490
	cmp	al,22h
3497
	jne	invalid_operand
3491
	jne	invalid_operand
3498
	mov	al,6Ch
3492
	mov	al,6Ch
3499
      ins_check_size:
3493
      ins_check_size:
3500
	cmp	[operand_size],8
3494
	cmp	[operand_size],8
3501
	jne	movs_check_size
3495
	jne	movs_check_size
3502
	jmp	invalid_operand_size
3496
	jmp	invalid_operand_size
3503
outs_instruction:
3497
outs_instruction:
3504
	lods	byte [esi]
3498
	lods	byte [esi]
3505
	cmp	al,10h
3499
	cmp	al,10h
3506
	jne	invalid_operand
3500
	jne	invalid_operand
3507
	lods	byte [esi]
3501
	lods	byte [esi]
3508
	cmp	al,22h
3502
	cmp	al,22h
3509
	jne	invalid_operand
3503
	jne	invalid_operand
3510
	lods	byte [esi]
3504
	lods	byte [esi]
3511
	cmp	al,','
3505
	cmp	al,','
3512
	jne	invalid_operand
3506
	jne	invalid_operand
3513
	lods	byte [esi]
3507
	lods	byte [esi]
3514
	call	get_size_operator
3508
	call	get_size_operator
3515
	cmp	al,'['
3509
	cmp	al,'['
3516
	jne	invalid_operand
3510
	jne	invalid_operand
3517
	call	get_address
3511
	call	get_address
3518
	or	eax,eax
3512
	or	eax,eax
3519
	jnz	invalid_address
3513
	jnz	invalid_address
3520
	or	bl,ch
3514
	or	bl,ch
3521
	jnz	invalid_address
3515
	jnz	invalid_address
3522
	cmp	bh,26h
3516
	cmp	bh,26h
3523
	je	outs_address_16bit
3517
	je	outs_address_16bit
3524
	cmp	bh,46h
3518
	cmp	bh,46h
3525
	je	outs_address_32bit
3519
	je	outs_address_32bit
3526
	cmp	bh,86h
3520
	cmp	bh,86h
3527
	jne	invalid_address
3521
	jne	invalid_address
3528
	cmp	[code_type],64
3522
	cmp	[code_type],64
3529
	jne	invalid_address_size
3523
	jne	invalid_address_size
3530
	jmp	outs_store
3524
	jmp	outs_store
3531
      outs_address_32bit:
3525
      outs_address_32bit:
3532
	call	address_32bit_prefix
3526
	call	address_32bit_prefix
3533
	jmp	outs_store
3527
	jmp	outs_store
3534
      outs_address_16bit:
3528
      outs_address_16bit:
3535
	cmp	[code_type],64
3529
	cmp	[code_type],64
3536
	je	invalid_address_size
3530
	je	invalid_address_size
3537
	call	address_16bit_prefix
3531
	call	address_16bit_prefix
3538
      outs_store:
3532
      outs_store:
3539
	cmp	[segment_register],4
3533
	xor	ebx,ebx
3540
	je	outs_segment_ok
-
 
3541
	call	store_segment_prefix
3534
	call	store_segment_prefix_if_necessary
3542
      outs_segment_ok:
3535
	mov	al,6Eh
3543
	mov	al,6Eh
-
 
3544
	jmp	ins_check_size
3536
	jmp	ins_check_size
3545
xlat_instruction:
3537
xlat_instruction:
3546
	lods	byte [esi]
3538
	lods	byte [esi]
3547
	call	get_size_operator
3539
	call	get_size_operator
3548
	cmp	al,'['
3540
	cmp	al,'['
3549
	jne	invalid_operand
3541
	jne	invalid_operand
3550
	call	get_address
3542
	call	get_address
3551
	or	eax,eax
3543
	or	eax,eax
3552
	jnz	invalid_address
3544
	jnz	invalid_address
3553
	or	bl,ch
3545
	or	bl,ch
3554
	jnz	invalid_address
3546
	jnz	invalid_address
3555
	cmp	bh,23h
3547
	cmp	bh,23h
3556
	je	xlat_address_16bit
3548
	je	xlat_address_16bit
3557
	cmp	bh,43h
3549
	cmp	bh,43h
3558
	je	xlat_address_32bit
3550
	je	xlat_address_32bit
3559
	cmp	bh,83h
3551
	cmp	bh,83h
3560
	jne	invalid_address
3552
	jne	invalid_address
3561
	cmp	[code_type],64
3553
	cmp	[code_type],64
3562
	jne	invalid_address_size
3554
	jne	invalid_address_size
3563
	jmp	xlat_store
3555
	jmp	xlat_store
3564
      xlat_address_32bit:
3556
      xlat_address_32bit:
3565
	call	address_32bit_prefix
3557
	call	address_32bit_prefix
3566
	jmp	xlat_store
3558
	jmp	xlat_store
3567
      xlat_address_16bit:
3559
      xlat_address_16bit:
3568
	cmp	[code_type],64
3560
	cmp	[code_type],64
3569
	je	invalid_address_size
3561
	je	invalid_address_size
3570
	call	address_16bit_prefix
3562
	call	address_16bit_prefix
3571
      xlat_store:
3563
      xlat_store:
3572
	call	store_segment_prefix_if_necessary
3564
	call	store_segment_prefix_if_necessary
3573
	mov	al,0D7h
3565
	mov	al,0D7h
3574
	cmp	[operand_size],1
3566
	cmp	[operand_size],1
3575
	jbe	simple_instruction
3567
	jbe	simple_instruction
3576
	jmp	invalid_operand_size
3568
	jmp	invalid_operand_size
3577
 
3569
 
3578
pm_word_instruction:
3570
pm_word_instruction:
3579
	mov	ah,al
3571
	mov	ah,al
3580
	shr	ah,4
3572
	shr	ah,4
3581
	and	al,111b
3573
	and	al,111b
3582
	mov	[base_code],0Fh
3574
	mov	[base_code],0Fh
3583
	mov	[extended_code],ah
3575
	mov	[extended_code],ah
3584
	mov	[postbyte_register],al
3576
	mov	[postbyte_register],al
3585
	lods	byte [esi]
3577
	lods	byte [esi]
3586
	call	get_size_operator
3578
	call	get_size_operator
3587
	cmp	al,10h
3579
	cmp	al,10h
3588
	je	pm_reg
3580
	je	pm_reg
3589
      pm_mem:
3581
      pm_mem:
3590
	cmp	al,'['
3582
	cmp	al,'['
3591
	jne	invalid_operand
3583
	jne	invalid_operand
3592
	call	get_address
3584
	call	get_address
3593
	mov	al,[operand_size]
3585
	mov	al,[operand_size]
3594
	cmp	al,2
3586
	cmp	al,2
3595
	je	pm_mem_store
3587
	je	pm_mem_store
3596
	or	al,al
3588
	or	al,al
3597
	jnz	invalid_operand_size
3589
	jnz	invalid_operand_size
3598
      pm_mem_store:
3590
      pm_mem_store:
3599
	jmp	instruction_ready
3591
	jmp	instruction_ready
3600
      pm_reg:
3592
      pm_reg:
3601
	lods	byte [esi]
3593
	lods	byte [esi]
3602
	call	convert_register
3594
	call	convert_register
3603
	mov	bl,al
3595
	mov	bl,al
3604
	cmp	ah,2
3596
	cmp	ah,2
3605
	jne	invalid_operand_size
3597
	jne	invalid_operand_size
3606
	jmp	nomem_instruction_ready
3598
	jmp	nomem_instruction_ready
3607
pm_store_word_instruction:
3599
pm_store_word_instruction:
3608
	mov	ah,al
3600
	mov	ah,al
3609
	shr	ah,4
3601
	shr	ah,4
3610
	and	al,111b
3602
	and	al,111b
3611
	mov	[base_code],0Fh
3603
	mov	[base_code],0Fh
3612
	mov	[extended_code],ah
3604
	mov	[extended_code],ah
3613
	mov	[postbyte_register],al
3605
	mov	[postbyte_register],al
3614
	lods	byte [esi]
3606
	lods	byte [esi]
3615
	call	get_size_operator
3607
	call	get_size_operator
3616
	cmp	al,10h
3608
	cmp	al,10h
3617
	jne	pm_mem
3609
	jne	pm_mem
3618
	lods	byte [esi]
3610
	lods	byte [esi]
3619
	call	convert_register
3611
	call	convert_register
3620
	mov	bl,al
3612
	mov	bl,al
3621
	mov	al,ah
3613
	mov	al,ah
3622
	call	operand_autodetect
3614
	call	operand_autodetect
3623
	jmp	nomem_instruction_ready
3615
	jmp	nomem_instruction_ready
3624
lgdt_instruction:
3616
lgdt_instruction:
3625
	mov	[base_code],0Fh
3617
	mov	[base_code],0Fh
3626
	mov	[extended_code],1
3618
	mov	[extended_code],1
3627
	mov	[postbyte_register],al
3619
	mov	[postbyte_register],al
3628
	lods	byte [esi]
3620
	lods	byte [esi]
3629
	call	get_size_operator
3621
	call	get_size_operator
3630
	cmp	al,'['
3622
	cmp	al,'['
3631
	jne	invalid_operand
3623
	jne	invalid_operand
3632
	call	get_address
3624
	call	get_address
3633
	mov	al,[operand_size]
3625
	mov	al,[operand_size]
3634
	cmp	al,6
3626
	cmp	al,6
3635
	je	lgdt_mem_48bit
3627
	je	lgdt_mem_48bit
3636
	cmp	al,10
3628
	cmp	al,10
3637
	je	lgdt_mem_80bit
3629
	je	lgdt_mem_80bit
3638
	or	al,al
3630
	or	al,al
3639
	jnz	invalid_operand_size
3631
	jnz	invalid_operand_size
3640
	jmp	lgdt_mem_store
3632
	jmp	lgdt_mem_store
3641
      lgdt_mem_80bit:
3633
      lgdt_mem_80bit:
3642
	cmp	[code_type],64
3634
	cmp	[code_type],64
3643
	jne	illegal_instruction
3635
	jne	illegal_instruction
3644
	jmp	lgdt_mem_store
3636
	jmp	lgdt_mem_store
3645
      lgdt_mem_48bit:
3637
      lgdt_mem_48bit:
3646
	cmp	[code_type],64
3638
	cmp	[code_type],64
3647
	je	illegal_instruction
3639
	je	illegal_instruction
3648
	cmp	[postbyte_register],2
3640
	cmp	[postbyte_register],2
3649
	jb	lgdt_mem_store
3641
	jb	lgdt_mem_store
3650
	call	operand_32bit
3642
	call	operand_32bit
3651
      lgdt_mem_store:
3643
      lgdt_mem_store:
3652
	jmp	instruction_ready
3644
	jmp	instruction_ready
3653
lar_instruction:
3645
lar_instruction:
3654
	mov	[extended_code],al
3646
	mov	[extended_code],al
3655
	mov	[base_code],0Fh
3647
	mov	[base_code],0Fh
3656
	lods	byte [esi]
3648
	lods	byte [esi]
3657
	call	get_size_operator
3649
	call	get_size_operator
3658
	cmp	al,10h
3650
	cmp	al,10h
3659
	jne	invalid_operand
3651
	jne	invalid_operand
3660
	lods	byte [esi]
3652
	lods	byte [esi]
3661
	call	convert_register
3653
	call	convert_register
3662
	mov	[postbyte_register],al
3654
	mov	[postbyte_register],al
3663
	lods	byte [esi]
3655
	lods	byte [esi]
3664
	cmp	al,','
3656
	cmp	al,','
3665
	jne	invalid_operand
3657
	jne	invalid_operand
3666
	xor	al,al
3658
	xor	al,al
3667
	xchg	al,[operand_size]
3659
	xchg	al,[operand_size]
3668
	call	operand_autodetect
3660
	call	operand_autodetect
3669
	lods	byte [esi]
3661
	lods	byte [esi]
3670
	call	get_size_operator
3662
	call	get_size_operator
3671
	cmp	al,10h
3663
	cmp	al,10h
3672
	je	lar_reg_reg
3664
	je	lar_reg_reg
3673
	cmp	al,'['
3665
	cmp	al,'['
3674
	jne	invalid_operand
3666
	jne	invalid_operand
3675
	call	get_address
3667
	call	get_address
3676
	mov	al,[operand_size]
3668
	mov	al,[operand_size]
3677
	or	al,al
3669
	or	al,al
3678
	jz	lar_reg_mem
3670
	jz	lar_reg_mem
3679
	cmp	al,2
3671
	cmp	al,2
3680
	jne	invalid_operand_size
3672
	jne	invalid_operand_size
3681
      lar_reg_mem:
3673
      lar_reg_mem:
3682
	jmp	instruction_ready
3674
	jmp	instruction_ready
3683
      lar_reg_reg:
3675
      lar_reg_reg:
3684
	lods	byte [esi]
3676
	lods	byte [esi]
3685
	call	convert_register
3677
	call	convert_register
3686
	cmp	ah,2
3678
	cmp	ah,2
3687
	jne	invalid_operand_size
3679
	jne	invalid_operand_size
3688
	mov	bl,al
3680
	mov	bl,al
3689
	jmp	nomem_instruction_ready
3681
	jmp	nomem_instruction_ready
3690
invlpg_instruction:
3682
invlpg_instruction:
3691
	mov	[base_code],0Fh
3683
	mov	[base_code],0Fh
3692
	mov	[extended_code],1
3684
	mov	[extended_code],1
3693
	mov	[postbyte_register],7
3685
	mov	[postbyte_register],7
3694
	lods	byte [esi]
3686
	lods	byte [esi]
3695
	call	get_size_operator
3687
	call	get_size_operator
3696
	cmp	al,'['
3688
	cmp	al,'['
3697
	jne	invalid_operand
3689
	jne	invalid_operand
3698
	call	get_address
3690
	call	get_address
3699
	jmp	instruction_ready
3691
	jmp	instruction_ready
3700
swapgs_instruction:
3692
swapgs_instruction:
3701
	cmp	[code_type],64
3693
	cmp	[code_type],64
3702
	jne	illegal_instruction
3694
	jne	illegal_instruction
3703
rdtscp_instruction:
3695
rdtscp_instruction:
3704
	mov	[base_code],0Fh
3696
	mov	[base_code],0Fh
3705
	mov	[extended_code],1
3697
	mov	[extended_code],1
3706
	mov	[postbyte_register],7
3698
	mov	[postbyte_register],7
3707
	mov	bl,al
3699
	mov	bl,al
3708
	jmp	nomem_instruction_ready
3700
	jmp	nomem_instruction_ready
3709
 
3701
 
3710
basic_486_instruction:
3702
basic_486_instruction:
3711
	mov	[base_code],0Fh
3703
	mov	[base_code],0Fh
3712
	mov	[extended_code],al
3704
	mov	[extended_code],al
3713
	lods	byte [esi]
3705
	lods	byte [esi]
3714
	call	get_size_operator
3706
	call	get_size_operator
3715
	cmp	al,10h
3707
	cmp	al,10h
3716
	je	basic_486_reg
3708
	je	basic_486_reg
3717
	cmp	al,'['
3709
	cmp	al,'['
3718
	jne	invalid_operand
3710
	jne	invalid_operand
3719
	call	get_address
3711
	call	get_address
3720
	push	edx ebx ecx
3712
	push	edx ebx ecx
3721
	lods	byte [esi]
3713
	lods	byte [esi]
3722
	cmp	al,','
3714
	cmp	al,','
3723
	jne	invalid_operand
3715
	jne	invalid_operand
3724
	lods	byte [esi]
3716
	lods	byte [esi]
3725
	call	get_size_operator
3717
	call	get_size_operator
3726
	cmp	al,10h
3718
	cmp	al,10h
3727
	jne	invalid_operand
3719
	jne	invalid_operand
3728
	lods	byte [esi]
3720
	lods	byte [esi]
3729
	call	convert_register
3721
	call	convert_register
3730
	mov	[postbyte_register],al
3722
	mov	[postbyte_register],al
3731
	pop	ecx ebx edx
3723
	pop	ecx ebx edx
3732
	mov	al,ah
3724
	mov	al,ah
3733
	cmp	al,1
3725
	cmp	al,1
3734
	je	basic_486_mem_reg_8bit
3726
	je	basic_486_mem_reg_8bit
3735
	call	operand_autodetect
3727
	call	operand_autodetect
3736
	inc	[extended_code]
3728
	inc	[extended_code]
3737
      basic_486_mem_reg_8bit:
3729
      basic_486_mem_reg_8bit:
3738
	jmp	instruction_ready
3730
	jmp	instruction_ready
3739
      basic_486_reg:
3731
      basic_486_reg:
3740
	lods	byte [esi]
3732
	lods	byte [esi]
3741
	call	convert_register
3733
	call	convert_register
3742
	mov	[postbyte_register],al
3734
	mov	[postbyte_register],al
3743
	lods	byte [esi]
3735
	lods	byte [esi]
3744
	cmp	al,','
3736
	cmp	al,','
3745
	jne	invalid_operand
3737
	jne	invalid_operand
3746
	lods	byte [esi]
3738
	lods	byte [esi]
3747
	call	get_size_operator
3739
	call	get_size_operator
3748
	cmp	al,10h
3740
	cmp	al,10h
3749
	jne	invalid_operand
3741
	jne	invalid_operand
3750
	lods	byte [esi]
3742
	lods	byte [esi]
3751
	call	convert_register
3743
	call	convert_register
3752
	mov	bl,[postbyte_register]
3744
	mov	bl,[postbyte_register]
3753
	mov	[postbyte_register],al
3745
	mov	[postbyte_register],al
3754
	mov	al,ah
3746
	mov	al,ah
3755
	cmp	al,1
3747
	cmp	al,1
3756
	je	basic_486_reg_reg_8bit
3748
	je	basic_486_reg_reg_8bit
3757
	call	operand_autodetect
3749
	call	operand_autodetect
3758
	inc	[extended_code]
3750
	inc	[extended_code]
3759
      basic_486_reg_reg_8bit:
3751
      basic_486_reg_reg_8bit:
3760
	jmp	nomem_instruction_ready
3752
	jmp	nomem_instruction_ready
3761
bswap_instruction:
3753
bswap_instruction:
3762
	lods	byte [esi]
3754
	lods	byte [esi]
3763
	call	get_size_operator
3755
	call	get_size_operator
3764
	cmp	al,10h
3756
	cmp	al,10h
3765
	jne	invalid_operand
3757
	jne	invalid_operand
3766
	lods	byte [esi]
3758
	lods	byte [esi]
3767
	call	convert_register
3759
	call	convert_register
3768
	test	al,1000b
3760
	test	al,1000b
3769
	jz	bswap_reg_code_ok
3761
	jz	bswap_reg_code_ok
3770
	or	[rex_prefix],41h
3762
	or	[rex_prefix],41h
3771
	and	al,111b
3763
	and	al,111b
3772
      bswap_reg_code_ok:
3764
      bswap_reg_code_ok:
3773
	add	al,0C8h
3765
	add	al,0C8h
3774
	mov	[extended_code],al
3766
	mov	[extended_code],al
3775
	mov	[base_code],0Fh
3767
	mov	[base_code],0Fh
3776
	cmp	ah,8
3768
	cmp	ah,8
3777
	je	bswap_reg64
3769
	je	bswap_reg64
3778
	cmp	ah,4
3770
	cmp	ah,4
3779
	jne	invalid_operand_size
3771
	jne	invalid_operand_size
3780
	call	operand_32bit
3772
	call	operand_32bit
3781
	call	store_instruction_code
3773
	call	store_instruction_code
3782
	jmp	instruction_assembled
3774
	jmp	instruction_assembled
3783
      bswap_reg64:
3775
      bswap_reg64:
3784
	call	operand_64bit
3776
	call	operand_64bit
3785
	call	store_instruction_code
3777
	call	store_instruction_code
3786
	jmp	instruction_assembled
3778
	jmp	instruction_assembled
3787
cmpxchgx_instruction:
3779
cmpxchgx_instruction:
3788
	mov	[base_code],0Fh
3780
	mov	[base_code],0Fh
3789
	mov	[extended_code],0C7h
3781
	mov	[extended_code],0C7h
3790
	mov	[postbyte_register],al
3782
	mov	[postbyte_register],al
3791
	lods	byte [esi]
3783
	lods	byte [esi]
3792
	call	get_size_operator
3784
	call	get_size_operator
3793
	cmp	al,'['
3785
	cmp	al,'['
3794
	jne	invalid_operand
3786
	jne	invalid_operand
3795
	call	get_address
3787
	call	get_address
3796
	mov	ah,1
3788
	mov	ah,1
3797
	xchg	[postbyte_register],ah
3789
	xchg	[postbyte_register],ah
3798
	mov	al,[operand_size]
3790
	mov	al,[operand_size]
3799
	or	al,al
3791
	or	al,al
3800
	jz	cmpxchgx_size_ok
3792
	jz	cmpxchgx_size_ok
3801
	cmp	al,ah
3793
	cmp	al,ah
3802
	jne	invalid_operand_size
3794
	jne	invalid_operand_size
3803
      cmpxchgx_size_ok:
3795
      cmpxchgx_size_ok:
3804
	cmp	ah,16
3796
	cmp	ah,16
3805
	jne	cmpxchgx_store
3797
	jne	cmpxchgx_store
3806
	call	operand_64bit
3798
	call	operand_64bit
3807
      cmpxchgx_store:
3799
      cmpxchgx_store:
3808
	jmp	instruction_ready
3800
	jmp	instruction_ready
3809
nop_instruction:
3801
nop_instruction:
3810
	mov	ah,[esi]
3802
	mov	ah,[esi]
3811
	cmp	ah,10h
3803
	cmp	ah,10h
3812
	je	extended_nop
3804
	je	extended_nop
3813
	cmp	ah,11h
3805
	cmp	ah,11h
3814
	je	extended_nop
3806
	je	extended_nop
3815
	cmp	ah,'['
3807
	cmp	ah,'['
3816
	je	extended_nop
3808
	je	extended_nop
3817
	stos	byte [edi]
3809
	stos	byte [edi]
3818
	jmp	instruction_assembled
3810
	jmp	instruction_assembled
3819
      extended_nop:
3811
      extended_nop:
3820
	mov	[base_code],0Fh
3812
	mov	[base_code],0Fh
3821
	mov	[extended_code],1Fh
3813
	mov	[extended_code],1Fh
3822
	mov	[postbyte_register],0
3814
	mov	[postbyte_register],0
3823
	lods	byte [esi]
3815
	lods	byte [esi]
3824
	call	get_size_operator
3816
	call	get_size_operator
3825
	cmp	al,10h
3817
	cmp	al,10h
3826
	je	extended_nop_reg
3818
	je	extended_nop_reg
3827
	cmp	al,'['
3819
	cmp	al,'['
3828
	jne	invalid_operand
3820
	jne	invalid_operand
3829
	call	get_address
3821
	call	get_address
3830
	mov	al,[operand_size]
3822
	mov	al,[operand_size]
3831
	or	al,al
3823
	or	al,al
3832
	jz	extended_nop_store
3824
	jz	extended_nop_store
3833
	call	operand_autodetect
3825
	call	operand_autodetect
3834
      extended_nop_store:
3826
      extended_nop_store:
3835
	jmp	instruction_ready
3827
	jmp	instruction_ready
3836
      extended_nop_reg:
3828
      extended_nop_reg:
3837
	lods	byte [esi]
3829
	lods	byte [esi]
3838
	call	convert_register
3830
	call	convert_register
3839
	mov	bl,al
3831
	mov	bl,al
3840
	mov	al,ah
3832
	mov	al,ah
3841
	call	operand_autodetect
3833
	call	operand_autodetect
3842
	jmp	nomem_instruction_ready
3834
	jmp	nomem_instruction_ready
3843
 
3835
 
3844
basic_fpu_instruction:
3836
basic_fpu_instruction:
3845
	mov	[postbyte_register],al
3837
	mov	[postbyte_register],al
3846
	mov	[base_code],0D8h
3838
	mov	[base_code],0D8h
3847
	lods	byte [esi]
3839
	lods	byte [esi]
3848
	call	get_size_operator
3840
	call	get_size_operator
3849
	cmp	al,10h
3841
	cmp	al,10h
3850
	je	basic_fpu_streg
3842
	je	basic_fpu_streg
3851
	cmp	al,'['
3843
	cmp	al,'['
3852
	je	basic_fpu_mem
3844
	je	basic_fpu_mem
3853
	dec	esi
3845
	dec	esi
3854
	mov	ah,[postbyte_register]
3846
	mov	ah,[postbyte_register]
3855
	cmp	ah,2
3847
	cmp	ah,2
3856
	jb	invalid_operand
3848
	jb	invalid_operand
3857
	cmp	ah,3
3849
	cmp	ah,3
3858
	ja	invalid_operand
3850
	ja	invalid_operand
3859
	mov	bl,1
3851
	mov	bl,1
3860
	jmp	nomem_instruction_ready
3852
	jmp	nomem_instruction_ready
3861
      basic_fpu_mem:
3853
      basic_fpu_mem:
3862
	call	get_address
3854
	call	get_address
3863
	mov	al,[operand_size]
3855
	mov	al,[operand_size]
3864
	cmp	al,4
3856
	cmp	al,4
3865
	je	basic_fpu_mem_32bit
3857
	je	basic_fpu_mem_32bit
3866
	cmp	al,8
3858
	cmp	al,8
3867
	je	basic_fpu_mem_64bit
3859
	je	basic_fpu_mem_64bit
3868
	or	al,al
3860
	or	al,al
3869
	jnz	invalid_operand_size
3861
	jnz	invalid_operand_size
3870
	call	recoverable_unknown_size
3862
	call	recoverable_unknown_size
3871
      basic_fpu_mem_32bit:
3863
      basic_fpu_mem_32bit:
3872
	jmp	instruction_ready
3864
	jmp	instruction_ready
3873
      basic_fpu_mem_64bit:
3865
      basic_fpu_mem_64bit:
3874
	mov	[base_code],0DCh
3866
	mov	[base_code],0DCh
3875
	jmp	instruction_ready
3867
	jmp	instruction_ready
3876
      basic_fpu_streg:
3868
      basic_fpu_streg:
3877
	lods	byte [esi]
3869
	lods	byte [esi]
3878
	call	convert_fpu_register
3870
	call	convert_fpu_register
3879
	mov	bl,al
3871
	mov	bl,al
3880
	mov	ah,[postbyte_register]
3872
	mov	ah,[postbyte_register]
3881
	cmp	ah,2
3873
	cmp	ah,2
3882
	je	basic_fpu_single_streg
3874
	je	basic_fpu_single_streg
3883
	cmp	ah,3
3875
	cmp	ah,3
3884
	je	basic_fpu_single_streg
3876
	je	basic_fpu_single_streg
3885
	or	al,al
3877
	or	al,al
3886
	jz	basic_fpu_st0
3878
	jz	basic_fpu_st0
3887
	test	ah,110b
3879
	test	ah,110b
3888
	jz	basic_fpu_streg_st0
3880
	jz	basic_fpu_streg_st0
3889
	xor	[postbyte_register],1
3881
	xor	[postbyte_register],1
3890
      basic_fpu_streg_st0:
3882
      basic_fpu_streg_st0:
3891
	lods	byte [esi]
3883
	lods	byte [esi]
3892
	cmp	al,','
3884
	cmp	al,','
3893
	jne	invalid_operand
3885
	jne	invalid_operand
3894
	lods	byte [esi]
3886
	lods	byte [esi]
3895
	call	get_size_operator
3887
	call	get_size_operator
3896
	cmp	al,10h
3888
	cmp	al,10h
3897
	jne	invalid_operand
3889
	jne	invalid_operand
3898
	lods	byte [esi]
3890
	lods	byte [esi]
3899
	call	convert_fpu_register
3891
	call	convert_fpu_register
3900
	or	al,al
3892
	or	al,al
3901
	jnz	invalid_operand
3893
	jnz	invalid_operand
3902
	mov	[base_code],0DCh
3894
	mov	[base_code],0DCh
3903
	jmp	nomem_instruction_ready
3895
	jmp	nomem_instruction_ready
3904
      basic_fpu_st0:
3896
      basic_fpu_st0:
3905
	lods	byte [esi]
3897
	lods	byte [esi]
3906
	cmp	al,','
3898
	cmp	al,','
3907
	jne	invalid_operand
3899
	jne	invalid_operand
3908
	lods	byte [esi]
3900
	lods	byte [esi]
3909
	call	get_size_operator
3901
	call	get_size_operator
3910
	cmp	al,10h
3902
	cmp	al,10h
3911
	jne	invalid_operand
3903
	jne	invalid_operand
3912
	lods	byte [esi]
3904
	lods	byte [esi]
3913
	call	convert_fpu_register
3905
	call	convert_fpu_register
3914
	mov	bl,al
3906
	mov	bl,al
3915
      basic_fpu_single_streg:
3907
      basic_fpu_single_streg:
3916
	mov	[base_code],0D8h
3908
	mov	[base_code],0D8h
3917
	jmp	nomem_instruction_ready
3909
	jmp	nomem_instruction_ready
3918
simple_fpu_instruction:
3910
simple_fpu_instruction:
3919
	mov	ah,al
3911
	mov	ah,al
3920
	or	ah,11000000b
3912
	or	ah,11000000b
3921
	mov	al,0D9h
3913
	mov	al,0D9h
3922
	stos	word [edi]
3914
	stos	word [edi]
3923
	jmp	instruction_assembled
3915
	jmp	instruction_assembled
3924
fi_instruction:
3916
fi_instruction:
3925
	mov	[postbyte_register],al
3917
	mov	[postbyte_register],al
3926
	lods	byte [esi]
3918
	lods	byte [esi]
3927
	call	get_size_operator
3919
	call	get_size_operator
3928
	cmp	al,'['
3920
	cmp	al,'['
3929
	jne	invalid_operand
3921
	jne	invalid_operand
3930
	call	get_address
3922
	call	get_address
3931
	mov	al,[operand_size]
3923
	mov	al,[operand_size]
3932
	cmp	al,2
3924
	cmp	al,2
3933
	je	fi_mem_16bit
3925
	je	fi_mem_16bit
3934
	cmp	al,4
3926
	cmp	al,4
3935
	je	fi_mem_32bit
3927
	je	fi_mem_32bit
3936
	or	al,al
3928
	or	al,al
3937
	jnz	invalid_operand_size
3929
	jnz	invalid_operand_size
3938
	call	recoverable_unknown_size
3930
	call	recoverable_unknown_size
3939
      fi_mem_32bit:
3931
      fi_mem_32bit:
3940
	mov	[base_code],0DAh
3932
	mov	[base_code],0DAh
3941
	jmp	instruction_ready
3933
	jmp	instruction_ready
3942
      fi_mem_16bit:
3934
      fi_mem_16bit:
3943
	mov	[base_code],0DEh
3935
	mov	[base_code],0DEh
3944
	jmp	instruction_ready
3936
	jmp	instruction_ready
3945
fld_instruction:
3937
fld_instruction:
3946
	mov	[postbyte_register],al
3938
	mov	[postbyte_register],al
3947
	lods	byte [esi]
3939
	lods	byte [esi]
3948
	call	get_size_operator
3940
	call	get_size_operator
3949
	cmp	al,10h
3941
	cmp	al,10h
3950
	je	fld_streg
3942
	je	fld_streg
3951
	cmp	al,'['
3943
	cmp	al,'['
3952
	jne	invalid_operand
3944
	jne	invalid_operand
3953
	call	get_address
3945
	call	get_address
3954
	mov	al,[operand_size]
3946
	mov	al,[operand_size]
3955
	cmp	al,4
3947
	cmp	al,4
3956
	je	fld_mem_32bit
3948
	je	fld_mem_32bit
3957
	cmp	al,8
3949
	cmp	al,8
3958
	je	fld_mem_64bit
3950
	je	fld_mem_64bit
3959
	cmp	al,10
3951
	cmp	al,10
3960
	je	fld_mem_80bit
3952
	je	fld_mem_80bit
3961
	or	al,al
3953
	or	al,al
3962
	jnz	invalid_operand_size
3954
	jnz	invalid_operand_size
3963
	call	recoverable_unknown_size
3955
	call	recoverable_unknown_size
3964
      fld_mem_32bit:
3956
      fld_mem_32bit:
3965
	mov	[base_code],0D9h
3957
	mov	[base_code],0D9h
3966
	jmp	instruction_ready
3958
	jmp	instruction_ready
3967
      fld_mem_64bit:
3959
      fld_mem_64bit:
3968
	mov	[base_code],0DDh
3960
	mov	[base_code],0DDh
3969
	jmp	instruction_ready
3961
	jmp	instruction_ready
3970
      fld_mem_80bit:
3962
      fld_mem_80bit:
3971
	mov	al,[postbyte_register]
3963
	mov	al,[postbyte_register]
3972
	cmp	al,0
3964
	cmp	al,0
3973
	je	fld_mem_80bit_store
3965
	je	fld_mem_80bit_store
3974
	dec	[postbyte_register]
3966
	dec	[postbyte_register]
3975
	cmp	al,3
3967
	cmp	al,3
3976
	je	fld_mem_80bit_store
3968
	je	fld_mem_80bit_store
3977
	jmp	invalid_operand_size
3969
	jmp	invalid_operand_size
3978
      fld_mem_80bit_store:
3970
      fld_mem_80bit_store:
3979
	add	[postbyte_register],5
3971
	add	[postbyte_register],5
3980
	mov	[base_code],0DBh
3972
	mov	[base_code],0DBh
3981
	jmp	instruction_ready
3973
	jmp	instruction_ready
3982
      fld_streg:
3974
      fld_streg:
3983
	lods	byte [esi]
3975
	lods	byte [esi]
3984
	call	convert_fpu_register
3976
	call	convert_fpu_register
3985
	mov	bl,al
3977
	mov	bl,al
3986
	cmp	[postbyte_register],2
3978
	cmp	[postbyte_register],2
3987
	jae	fst_streg
3979
	jae	fst_streg
3988
	mov	[base_code],0D9h
3980
	mov	[base_code],0D9h
3989
	jmp	nomem_instruction_ready
3981
	jmp	nomem_instruction_ready
3990
      fst_streg:
3982
      fst_streg:
3991
	mov	[base_code],0DDh
3983
	mov	[base_code],0DDh
3992
	jmp	nomem_instruction_ready
3984
	jmp	nomem_instruction_ready
3993
fild_instruction:
3985
fild_instruction:
3994
	mov	[postbyte_register],al
3986
	mov	[postbyte_register],al
3995
	lods	byte [esi]
3987
	lods	byte [esi]
3996
	call	get_size_operator
3988
	call	get_size_operator
3997
	cmp	al,'['
3989
	cmp	al,'['
3998
	jne	invalid_operand
3990
	jne	invalid_operand
3999
	call	get_address
3991
	call	get_address
4000
	mov	al,[operand_size]
3992
	mov	al,[operand_size]
4001
	cmp	al,2
3993
	cmp	al,2
4002
	je	fild_mem_16bit
3994
	je	fild_mem_16bit
4003
	cmp	al,4
3995
	cmp	al,4
4004
	je	fild_mem_32bit
3996
	je	fild_mem_32bit
4005
	cmp	al,8
3997
	cmp	al,8
4006
	je	fild_mem_64bit
3998
	je	fild_mem_64bit
4007
	or	al,al
3999
	or	al,al
4008
	jnz	invalid_operand_size
4000
	jnz	invalid_operand_size
4009
	call	recoverable_unknown_size
4001
	call	recoverable_unknown_size
4010
      fild_mem_32bit:
4002
      fild_mem_32bit:
4011
	mov	[base_code],0DBh
4003
	mov	[base_code],0DBh
4012
	jmp	instruction_ready
4004
	jmp	instruction_ready
4013
      fild_mem_16bit:
4005
      fild_mem_16bit:
4014
	mov	[base_code],0DFh
4006
	mov	[base_code],0DFh
4015
	jmp	instruction_ready
4007
	jmp	instruction_ready
4016
      fild_mem_64bit:
4008
      fild_mem_64bit:
4017
	mov	al,[postbyte_register]
4009
	mov	al,[postbyte_register]
4018
	cmp	al,1
4010
	cmp	al,1
4019
	je	fisttp_64bit_store
4011
	je	fisttp_64bit_store
4020
	jb	fild_mem_64bit_store
4012
	jb	fild_mem_64bit_store
4021
	dec	[postbyte_register]
4013
	dec	[postbyte_register]
4022
	cmp	al,3
4014
	cmp	al,3
4023
	je	fild_mem_64bit_store
4015
	je	fild_mem_64bit_store
4024
	jmp	invalid_operand_size
4016
	jmp	invalid_operand_size
4025
      fild_mem_64bit_store:
4017
      fild_mem_64bit_store:
4026
	add	[postbyte_register],5
4018
	add	[postbyte_register],5
4027
	mov	[base_code],0DFh
4019
	mov	[base_code],0DFh
4028
	jmp	instruction_ready
4020
	jmp	instruction_ready
4029
      fisttp_64bit_store:
4021
      fisttp_64bit_store:
4030
	mov	[base_code],0DDh
4022
	mov	[base_code],0DDh
4031
	jmp	instruction_ready
4023
	jmp	instruction_ready
4032
fbld_instruction:
4024
fbld_instruction:
4033
	mov	[postbyte_register],al
4025
	mov	[postbyte_register],al
4034
	lods	byte [esi]
4026
	lods	byte [esi]
4035
	call	get_size_operator
4027
	call	get_size_operator
4036
	cmp	al,'['
4028
	cmp	al,'['
4037
	jne	invalid_operand
4029
	jne	invalid_operand
4038
	call	get_address
4030
	call	get_address
4039
	mov	al,[operand_size]
4031
	mov	al,[operand_size]
4040
	or	al,al
4032
	or	al,al
4041
	jz	fbld_mem_80bit
4033
	jz	fbld_mem_80bit
4042
	cmp	al,10
4034
	cmp	al,10
4043
	je	fbld_mem_80bit
4035
	je	fbld_mem_80bit
4044
	jmp	invalid_operand_size
4036
	jmp	invalid_operand_size
4045
      fbld_mem_80bit:
4037
      fbld_mem_80bit:
4046
	mov	[base_code],0DFh
4038
	mov	[base_code],0DFh
4047
	jmp	instruction_ready
4039
	jmp	instruction_ready
4048
faddp_instruction:
4040
faddp_instruction:
4049
	mov	[postbyte_register],al
4041
	mov	[postbyte_register],al
4050
	mov	[base_code],0DEh
4042
	mov	[base_code],0DEh
4051
	mov	edx,esi
4043
	mov	edx,esi
4052
	lods	byte [esi]
4044
	lods	byte [esi]
4053
	call	get_size_operator
4045
	call	get_size_operator
4054
	cmp	al,10h
4046
	cmp	al,10h
4055
	je	faddp_streg
4047
	je	faddp_streg
4056
	mov	esi,edx
4048
	mov	esi,edx
4057
	mov	bl,1
4049
	mov	bl,1
4058
	jmp	nomem_instruction_ready
4050
	jmp	nomem_instruction_ready
4059
      faddp_streg:
4051
      faddp_streg:
4060
	lods	byte [esi]
4052
	lods	byte [esi]
4061
	call	convert_fpu_register
4053
	call	convert_fpu_register
4062
	mov	bl,al
4054
	mov	bl,al
4063
	lods	byte [esi]
4055
	lods	byte [esi]
4064
	cmp	al,','
4056
	cmp	al,','
4065
	jne	invalid_operand
4057
	jne	invalid_operand
4066
	lods	byte [esi]
4058
	lods	byte [esi]
4067
	call	get_size_operator
4059
	call	get_size_operator
4068
	cmp	al,10h
4060
	cmp	al,10h
4069
	jne	invalid_operand
4061
	jne	invalid_operand
4070
	lods	byte [esi]
4062
	lods	byte [esi]
4071
	call	convert_fpu_register
4063
	call	convert_fpu_register
4072
	or	al,al
4064
	or	al,al
4073
	jnz	invalid_operand
4065
	jnz	invalid_operand
4074
	jmp	nomem_instruction_ready
4066
	jmp	nomem_instruction_ready
4075
fcompp_instruction:
4067
fcompp_instruction:
4076
	mov	ax,0D9DEh
4068
	mov	ax,0D9DEh
4077
	stos	word [edi]
4069
	stos	word [edi]
4078
	jmp	instruction_assembled
4070
	jmp	instruction_assembled
4079
fucompp_instruction:
4071
fucompp_instruction:
4080
	mov	ax,0E9DAh
4072
	mov	ax,0E9DAh
4081
	stos	word [edi]
4073
	stos	word [edi]
4082
	jmp	instruction_assembled
4074
	jmp	instruction_assembled
4083
fxch_instruction:
4075
fxch_instruction:
4084
	mov	dx,01D9h
4076
	mov	dx,01D9h
4085
	jmp	fpu_single_operand
4077
	jmp	fpu_single_operand
4086
ffreep_instruction:
4078
ffreep_instruction:
4087
	mov	dx,00DFh
4079
	mov	dx,00DFh
4088
	jmp	fpu_single_operand
4080
	jmp	fpu_single_operand
4089
ffree_instruction:
4081
ffree_instruction:
4090
	mov	dl,0DDh
4082
	mov	dl,0DDh
4091
	mov	dh,al
4083
	mov	dh,al
4092
      fpu_single_operand:
4084
      fpu_single_operand:
4093
	mov	ebx,esi
4085
	mov	ebx,esi
4094
	lods	byte [esi]
4086
	lods	byte [esi]
4095
	call	get_size_operator
4087
	call	get_size_operator
4096
	cmp	al,10h
4088
	cmp	al,10h
4097
	je	fpu_streg
4089
	je	fpu_streg
4098
	or	dh,dh
4090
	or	dh,dh
4099
	jz	invalid_operand
4091
	jz	invalid_operand
4100
	mov	esi,ebx
4092
	mov	esi,ebx
4101
	shl	dh,3
4093
	shl	dh,3
4102
	or	dh,11000001b
4094
	or	dh,11000001b
4103
	mov	ax,dx
4095
	mov	ax,dx
4104
	stos	word [edi]
4096
	stos	word [edi]
4105
	jmp	instruction_assembled
4097
	jmp	instruction_assembled
4106
      fpu_streg:
4098
      fpu_streg:
4107
	lods	byte [esi]
4099
	lods	byte [esi]
4108
	call	convert_fpu_register
4100
	call	convert_fpu_register
4109
	shl	dh,3
4101
	shl	dh,3
4110
	or	dh,al
4102
	or	dh,al
4111
	or	dh,11000000b
4103
	or	dh,11000000b
4112
	mov	ax,dx
4104
	mov	ax,dx
4113
	stos	word [edi]
4105
	stos	word [edi]
4114
	jmp	instruction_assembled
4106
	jmp	instruction_assembled
4115
 
4107
 
4116
fstenv_instruction:
4108
fstenv_instruction:
4117
	mov	byte [edi],9Bh
4109
	mov	byte [edi],9Bh
4118
	inc	edi
4110
	inc	edi
4119
fldenv_instruction:
4111
fldenv_instruction:
4120
	mov	[base_code],0D9h
4112
	mov	[base_code],0D9h
4121
	jmp	fpu_mem
4113
	jmp	fpu_mem
4122
fstenv_instruction_16bit:
4114
fstenv_instruction_16bit:
4123
	mov	byte [edi],9Bh
4115
	mov	byte [edi],9Bh
4124
	inc	edi
4116
	inc	edi
4125
fldenv_instruction_16bit:
4117
fldenv_instruction_16bit:
4126
	call	operand_16bit
4118
	call	operand_16bit
4127
	jmp	fldenv_instruction
4119
	jmp	fldenv_instruction
4128
fstenv_instruction_32bit:
4120
fstenv_instruction_32bit:
4129
	mov	byte [edi],9Bh
4121
	mov	byte [edi],9Bh
4130
	inc	edi
4122
	inc	edi
4131
fldenv_instruction_32bit:
4123
fldenv_instruction_32bit:
4132
	call	operand_32bit
4124
	call	operand_32bit
4133
	jmp	fldenv_instruction
4125
	jmp	fldenv_instruction
4134
fsave_instruction_32bit:
4126
fsave_instruction_32bit:
4135
	mov	byte [edi],9Bh
4127
	mov	byte [edi],9Bh
4136
	inc	edi
4128
	inc	edi
4137
fnsave_instruction_32bit:
4129
fnsave_instruction_32bit:
4138
	call	operand_32bit
4130
	call	operand_32bit
4139
	jmp	fnsave_instruction
4131
	jmp	fnsave_instruction
4140
fsave_instruction_16bit:
4132
fsave_instruction_16bit:
4141
	mov	byte [edi],9Bh
4133
	mov	byte [edi],9Bh
4142
	inc	edi
4134
	inc	edi
4143
fnsave_instruction_16bit:
4135
fnsave_instruction_16bit:
4144
	call	operand_16bit
4136
	call	operand_16bit
4145
	jmp	fnsave_instruction
4137
	jmp	fnsave_instruction
4146
fsave_instruction:
4138
fsave_instruction:
4147
	mov	byte [edi],9Bh
4139
	mov	byte [edi],9Bh
4148
	inc	edi
4140
	inc	edi
4149
fnsave_instruction:
4141
fnsave_instruction:
4150
	mov	[base_code],0DDh
4142
	mov	[base_code],0DDh
4151
      fpu_mem:
4143
      fpu_mem:
4152
	mov	[postbyte_register],al
4144
	mov	[postbyte_register],al
4153
	lods	byte [esi]
4145
	lods	byte [esi]
4154
	call	get_size_operator
4146
	call	get_size_operator
4155
	cmp	al,'['
4147
	cmp	al,'['
4156
	jne	invalid_operand
4148
	jne	invalid_operand
4157
	call	get_address
4149
	call	get_address
4158
	cmp	[operand_size],0
4150
	cmp	[operand_size],0
4159
	jne	invalid_operand_size
4151
	jne	invalid_operand_size
4160
	jmp	instruction_ready
4152
	jmp	instruction_ready
4161
fstcw_instruction:
4153
fstcw_instruction:
4162
	mov	byte [edi],9Bh
4154
	mov	byte [edi],9Bh
4163
	inc	edi
4155
	inc	edi
4164
fldcw_instruction:
4156
fldcw_instruction:
4165
	mov	[postbyte_register],al
4157
	mov	[postbyte_register],al
4166
	mov	[base_code],0D9h
4158
	mov	[base_code],0D9h
4167
	lods	byte [esi]
4159
	lods	byte [esi]
4168
	call	get_size_operator
4160
	call	get_size_operator
4169
	cmp	al,'['
4161
	cmp	al,'['
4170
	jne	invalid_operand
4162
	jne	invalid_operand
4171
	call	get_address
4163
	call	get_address
4172
	mov	al,[operand_size]
4164
	mov	al,[operand_size]
4173
	or	al,al
4165
	or	al,al
4174
	jz	fldcw_mem_16bit
4166
	jz	fldcw_mem_16bit
4175
	cmp	al,2
4167
	cmp	al,2
4176
	je	fldcw_mem_16bit
4168
	je	fldcw_mem_16bit
4177
	jmp	invalid_operand_size
4169
	jmp	invalid_operand_size
4178
      fldcw_mem_16bit:
4170
      fldcw_mem_16bit:
4179
	jmp	instruction_ready
4171
	jmp	instruction_ready
4180
fstsw_instruction:
4172
fstsw_instruction:
4181
	mov	al,9Bh
4173
	mov	al,9Bh
4182
	stos	byte [edi]
4174
	stos	byte [edi]
4183
fnstsw_instruction:
4175
fnstsw_instruction:
4184
	mov	[base_code],0DDh
4176
	mov	[base_code],0DDh
4185
	mov	[postbyte_register],7
4177
	mov	[postbyte_register],7
4186
	lods	byte [esi]
4178
	lods	byte [esi]
4187
	call	get_size_operator
4179
	call	get_size_operator
4188
	cmp	al,10h
4180
	cmp	al,10h
4189
	je	fstsw_reg
4181
	je	fstsw_reg
4190
	cmp	al,'['
4182
	cmp	al,'['
4191
	jne	invalid_operand
4183
	jne	invalid_operand
4192
	call	get_address
4184
	call	get_address
4193
	mov	al,[operand_size]
4185
	mov	al,[operand_size]
4194
	or	al,al
4186
	or	al,al
4195
	jz	fstsw_mem_16bit
4187
	jz	fstsw_mem_16bit
4196
	cmp	al,2
4188
	cmp	al,2
4197
	je	fstsw_mem_16bit
4189
	je	fstsw_mem_16bit
4198
	jmp	invalid_operand_size
4190
	jmp	invalid_operand_size
4199
      fstsw_mem_16bit:
4191
      fstsw_mem_16bit:
4200
	jmp	instruction_ready
4192
	jmp	instruction_ready
4201
      fstsw_reg:
4193
      fstsw_reg:
4202
	lods	byte [esi]
4194
	lods	byte [esi]
4203
	call	convert_register
4195
	call	convert_register
4204
	cmp	ax,0200h
4196
	cmp	ax,0200h
4205
	jne	invalid_operand
4197
	jne	invalid_operand
4206
	mov	ax,0E0DFh
4198
	mov	ax,0E0DFh
4207
	stos	word [edi]
4199
	stos	word [edi]
4208
	jmp	instruction_assembled
4200
	jmp	instruction_assembled
4209
finit_instruction:
4201
finit_instruction:
4210
	mov	byte [edi],9Bh
4202
	mov	byte [edi],9Bh
4211
	inc	edi
4203
	inc	edi
4212
fninit_instruction:
4204
fninit_instruction:
4213
	mov	ah,al
4205
	mov	ah,al
4214
	mov	al,0DBh
4206
	mov	al,0DBh
4215
	stos	word [edi]
4207
	stos	word [edi]
4216
	jmp	instruction_assembled
4208
	jmp	instruction_assembled
4217
fcmov_instruction:
4209
fcmov_instruction:
4218
	mov	dh,0DAh
4210
	mov	dh,0DAh
4219
	jmp	fcomi_streg
4211
	jmp	fcomi_streg
4220
fcomi_instruction:
4212
fcomi_instruction:
4221
	mov	dh,0DBh
4213
	mov	dh,0DBh
4222
	jmp	fcomi_streg
4214
	jmp	fcomi_streg
4223
fcomip_instruction:
4215
fcomip_instruction:
4224
	mov	dh,0DFh
4216
	mov	dh,0DFh
4225
      fcomi_streg:
4217
      fcomi_streg:
4226
	mov	dl,al
4218
	mov	dl,al
4227
	lods	byte [esi]
4219
	lods	byte [esi]
4228
	call	get_size_operator
4220
	call	get_size_operator
4229
	cmp	al,10h
4221
	cmp	al,10h
4230
	jne	invalid_operand
4222
	jne	invalid_operand
4231
	lods	byte [esi]
4223
	lods	byte [esi]
4232
	call	convert_fpu_register
4224
	call	convert_fpu_register
4233
	mov	ah,al
4225
	mov	ah,al
4234
	cmp	byte [esi],','
4226
	cmp	byte [esi],','
4235
	je	fcomi_st0_streg
4227
	je	fcomi_st0_streg
4236
	add	ah,dl
4228
	add	ah,dl
4237
	mov	al,dh
4229
	mov	al,dh
4238
	stos	word [edi]
4230
	stos	word [edi]
4239
	jmp	instruction_assembled
4231
	jmp	instruction_assembled
4240
      fcomi_st0_streg:
4232
      fcomi_st0_streg:
4241
	or	ah,ah
4233
	or	ah,ah
4242
	jnz	invalid_operand
4234
	jnz	invalid_operand
4243
	inc	esi
4235
	inc	esi
4244
	lods	byte [esi]
4236
	lods	byte [esi]
4245
	call	get_size_operator
4237
	call	get_size_operator
4246
	cmp	al,10h
4238
	cmp	al,10h
4247
	jne	invalid_operand
4239
	jne	invalid_operand
4248
	lods	byte [esi]
4240
	lods	byte [esi]
4249
	call	convert_fpu_register
4241
	call	convert_fpu_register
4250
	mov	ah,al
4242
	mov	ah,al
4251
	add	ah,dl
4243
	add	ah,dl
4252
	mov	al,dh
4244
	mov	al,dh
4253
	stos	word [edi]
4245
	stos	word [edi]
4254
	jmp	instruction_assembled
4246
	jmp	instruction_assembled
4255
 
4247
 
4256
basic_mmx_instruction:
4248
basic_mmx_instruction:
4257
	mov	[base_code],0Fh
4249
	mov	[base_code],0Fh
4258
	mov	[extended_code],al
4250
	mov	[extended_code],al
4259
      mmx_instruction:
4251
      mmx_instruction:
4260
	lods	byte [esi]
4252
	lods	byte [esi]
4261
	call	get_size_operator
4253
	call	get_size_operator
4262
	cmp	al,10h
4254
	cmp	al,10h
4263
	jne	invalid_operand
4255
	jne	invalid_operand
4264
	lods	byte [esi]
4256
	lods	byte [esi]
4265
	call	convert_mmx_register
4257
	call	convert_mmx_register
4266
	call	make_mmx_prefix
4258
	call	make_mmx_prefix
4267
	mov	[postbyte_register],al
4259
	mov	[postbyte_register],al
4268
	lods	byte [esi]
4260
	lods	byte [esi]
4269
	cmp	al,','
4261
	cmp	al,','
4270
	jne	invalid_operand
4262
	jne	invalid_operand
4271
	lods	byte [esi]
4263
	lods	byte [esi]
4272
	call	get_size_operator
4264
	call	get_size_operator
4273
	cmp	al,10h
4265
	cmp	al,10h
4274
	je	mmx_mmreg_mmreg
4266
	je	mmx_mmreg_mmreg
4275
	cmp	al,'['
4267
	cmp	al,'['
4276
	jne	invalid_operand
4268
	jne	invalid_operand
4277
      mmx_mmreg_mem:
4269
      mmx_mmreg_mem:
4278
	call	get_address
4270
	call	get_address
4279
	jmp	instruction_ready
4271
	jmp	instruction_ready
4280
      mmx_mmreg_mmreg:
4272
      mmx_mmreg_mmreg:
4281
	lods	byte [esi]
4273
	lods	byte [esi]
4282
	call	convert_mmx_register
4274
	call	convert_mmx_register
4283
	mov	bl,al
4275
	mov	bl,al
4284
	jmp	nomem_instruction_ready
4276
	jmp	nomem_instruction_ready
4285
mmx_bit_shift_instruction:
4277
mmx_bit_shift_instruction:
4286
	mov	[base_code],0Fh
4278
	mov	[base_code],0Fh
4287
	mov	[extended_code],al
4279
	mov	[extended_code],al
4288
	lods	byte [esi]
4280
	lods	byte [esi]
4289
	call	get_size_operator
4281
	call	get_size_operator
4290
	cmp	al,10h
4282
	cmp	al,10h
4291
	jne	invalid_operand
4283
	jne	invalid_operand
4292
	lods	byte [esi]
4284
	lods	byte [esi]
4293
	call	convert_mmx_register
4285
	call	convert_mmx_register
4294
	call	make_mmx_prefix
4286
	call	make_mmx_prefix
4295
	mov	[postbyte_register],al
4287
	mov	[postbyte_register],al
4296
	lods	byte [esi]
4288
	lods	byte [esi]
4297
	cmp	al,','
4289
	cmp	al,','
4298
	jne	invalid_operand
4290
	jne	invalid_operand
4299
	mov	[operand_size],0
4291
	mov	[operand_size],0
4300
	lods	byte [esi]
4292
	lods	byte [esi]
4301
	call	get_size_operator
4293
	call	get_size_operator
4302
	cmp	al,10h
4294
	cmp	al,10h
4303
	je	mmx_mmreg_mmreg
4295
	je	mmx_mmreg_mmreg
4304
	cmp	al,'('
4296
	cmp	al,'('
4305
	je	mmx_ps_mmreg_imm8
4297
	je	mmx_ps_mmreg_imm8
4306
	cmp	al,'['
4298
	cmp	al,'['
4307
	je	mmx_mmreg_mem
4299
	je	mmx_mmreg_mem
4308
	jmp	invalid_operand
4300
	jmp	invalid_operand
4309
      mmx_ps_mmreg_imm8:
4301
      mmx_ps_mmreg_imm8:
4310
	call	get_byte_value
4302
	call	get_byte_value
4311
	mov	byte [value],al
4303
	mov	byte [value],al
4312
	test	[operand_size],not 1
4304
	test	[operand_size],not 1
4313
	jnz	invalid_value
4305
	jnz	invalid_value
4314
	mov	bl,[extended_code]
4306
	mov	bl,[extended_code]
4315
	mov	al,bl
4307
	mov	al,bl
4316
	shr	bl,4
4308
	shr	bl,4
4317
	and	al,1111b
4309
	and	al,1111b
4318
	add	al,70h
4310
	add	al,70h
4319
	mov	[extended_code],al
4311
	mov	[extended_code],al
4320
	sub	bl,0Ch
4312
	sub	bl,0Ch
4321
	shl	bl,1
4313
	shl	bl,1
4322
	xchg	bl,[postbyte_register]
4314
	xchg	bl,[postbyte_register]
4323
	call	store_nomem_instruction
4315
	call	store_nomem_instruction
4324
	mov	al,byte [value]
4316
	mov	al,byte [value]
4325
	stos	byte [edi]
4317
	stos	byte [edi]
4326
	jmp	instruction_assembled
4318
	jmp	instruction_assembled
4327
pmovmskb_instruction:
4319
pmovmskb_instruction:
4328
	mov	[base_code],0Fh
4320
	mov	[base_code],0Fh
4329
	mov	[extended_code],al
4321
	mov	[extended_code],al
4330
	lods	byte [esi]
4322
	lods	byte [esi]
4331
	call	get_size_operator
4323
	call	get_size_operator
4332
	cmp	al,10h
4324
	cmp	al,10h
4333
	jne	invalid_operand
4325
	jne	invalid_operand
4334
	lods	byte [esi]
4326
	lods	byte [esi]
4335
	call	convert_register
4327
	call	convert_register
4336
	cmp	ah,4
4328
	cmp	ah,4
4337
	je	pmovmskb_reg_size_ok
4329
	je	pmovmskb_reg_size_ok
4338
	cmp	[code_type],64
4330
	cmp	[code_type],64
4339
	jne	invalid_operand_size
4331
	jne	invalid_operand_size
4340
	cmp	ah,8
4332
	cmp	ah,8
4341
	jnz	invalid_operand_size
4333
	jnz	invalid_operand_size
4342
      pmovmskb_reg_size_ok:
4334
      pmovmskb_reg_size_ok:
4343
	mov	[postbyte_register],al
4335
	mov	[postbyte_register],al
4344
	mov	[operand_size],0
4336
	mov	[operand_size],0
4345
	lods	byte [esi]
4337
	lods	byte [esi]
4346
	cmp	al,','
4338
	cmp	al,','
4347
	jne	invalid_operand
4339
	jne	invalid_operand
4348
	lods	byte [esi]
4340
	lods	byte [esi]
4349
	call	get_size_operator
4341
	call	get_size_operator
4350
	cmp	al,10h
4342
	cmp	al,10h
4351
	jne	invalid_operand
4343
	jne	invalid_operand
4352
	lods	byte [esi]
4344
	lods	byte [esi]
4353
	call	convert_mmx_register
4345
	call	convert_mmx_register
4354
	mov	bl,al
4346
	mov	bl,al
4355
	call	make_mmx_prefix
4347
	call	make_mmx_prefix
4356
	cmp	[extended_code],0C5h
4348
	cmp	[extended_code],0C5h
4357
	je	mmx_nomem_imm8
4349
	je	mmx_nomem_imm8
4358
	jmp	nomem_instruction_ready
4350
	jmp	nomem_instruction_ready
4359
      mmx_imm8:
4351
      mmx_imm8:
4360
	push	ebx ecx edx
4352
	push	ebx ecx edx
4361
	xor	cl,cl
4353
	xor	cl,cl
4362
	xchg	cl,[operand_size]
4354
	xchg	cl,[operand_size]
4363
	lods	byte [esi]
4355
	lods	byte [esi]
4364
	cmp	al,','
4356
	cmp	al,','
4365
	jne	invalid_operand
4357
	jne	invalid_operand
4366
	lods	byte [esi]
4358
	lods	byte [esi]
4367
	call	get_size_operator
4359
	call	get_size_operator
4368
	test	ah,not 1
4360
	test	ah,not 1
4369
	jnz	invalid_operand_size
4361
	jnz	invalid_operand_size
4370
	mov	[operand_size],cl
4362
	mov	[operand_size],cl
4371
	cmp	al,'('
4363
	cmp	al,'('
4372
	jne	invalid_operand
4364
	jne	invalid_operand
4373
	call	get_byte_value
4365
	call	get_byte_value
4374
	mov	byte [value],al
4366
	mov	byte [value],al
4375
	pop	edx ecx ebx
4367
	pop	edx ecx ebx
4376
	call	store_instruction_with_imm8
4368
	call	store_instruction_with_imm8
4377
	jmp	instruction_assembled
4369
	jmp	instruction_assembled
4378
      mmx_nomem_imm8:
4370
      mmx_nomem_imm8:
4379
	call	store_nomem_instruction
4371
	call	store_nomem_instruction
4380
	call	append_imm8
4372
	call	append_imm8
4381
	jmp	instruction_assembled
4373
	jmp	instruction_assembled
4382
      append_imm8:
4374
      append_imm8:
4383
	mov	[operand_size],0
4375
	mov	[operand_size],0
4384
	lods	byte [esi]
4376
	lods	byte [esi]
4385
	cmp	al,','
4377
	cmp	al,','
4386
	jne	invalid_operand
4378
	jne	invalid_operand
4387
	lods	byte [esi]
4379
	lods	byte [esi]
4388
	call	get_size_operator
4380
	call	get_size_operator
4389
	test	ah,not 1
4381
	test	ah,not 1
4390
	jnz	invalid_operand_size
4382
	jnz	invalid_operand_size
4391
	cmp	al,'('
4383
	cmp	al,'('
4392
	jne	invalid_operand
4384
	jne	invalid_operand
4393
	call	get_byte_value
4385
	call	get_byte_value
4394
	stosb
4386
	stosb
4395
	ret
4387
	ret
4396
pinsrw_instruction:
4388
pinsrw_instruction:
4397
	mov	[extended_code],al
4389
	mov	[extended_code],al
4398
	mov	[base_code],0Fh
4390
	mov	[base_code],0Fh
4399
	lods	byte [esi]
4391
	lods	byte [esi]
4400
	call	get_size_operator
4392
	call	get_size_operator
4401
	cmp	al,10h
4393
	cmp	al,10h
4402
	jne	invalid_operand
4394
	jne	invalid_operand
4403
	lods	byte [esi]
4395
	lods	byte [esi]
4404
	call	convert_mmx_register
4396
	call	convert_mmx_register
4405
	call	make_mmx_prefix
4397
	call	make_mmx_prefix
4406
	mov	[postbyte_register],al
4398
	mov	[postbyte_register],al
4407
	mov	[operand_size],0
4399
	mov	[operand_size],0
4408
	lods	byte [esi]
4400
	lods	byte [esi]
4409
	cmp	al,','
4401
	cmp	al,','
4410
	jne	invalid_operand
4402
	jne	invalid_operand
4411
	lods	byte [esi]
4403
	lods	byte [esi]
4412
	call	get_size_operator
4404
	call	get_size_operator
4413
	cmp	al,10h
4405
	cmp	al,10h
4414
	je	pinsrw_mmreg_reg
4406
	je	pinsrw_mmreg_reg
4415
	cmp	al,'['
4407
	cmp	al,'['
4416
	jne	invalid_operand
4408
	jne	invalid_operand
4417
	call	get_address
4409
	call	get_address
4418
	cmp	[operand_size],0
4410
	cmp	[operand_size],0
4419
	je	mmx_imm8
4411
	je	mmx_imm8
4420
	cmp	[operand_size],2
4412
	cmp	[operand_size],2
4421
	jne	invalid_operand_size
4413
	jne	invalid_operand_size
4422
	jmp	mmx_imm8
4414
	jmp	mmx_imm8
4423
      pinsrw_mmreg_reg:
4415
      pinsrw_mmreg_reg:
4424
	lods	byte [esi]
4416
	lods	byte [esi]
4425
	call	convert_register
4417
	call	convert_register
4426
	cmp	ah,4
4418
	cmp	ah,4
4427
	jne	invalid_operand_size
4419
	jne	invalid_operand_size
4428
	mov	bl,al
4420
	mov	bl,al
4429
	jmp	mmx_nomem_imm8
4421
	jmp	mmx_nomem_imm8
4430
pshufw_instruction:
4422
pshufw_instruction:
4431
	mov	[mmx_size],8
4423
	mov	[mmx_size],8
4432
	mov	[opcode_prefix],al
4424
	mov	[opcode_prefix],al
4433
	jmp	pshuf_instruction
4425
	jmp	pshuf_instruction
4434
pshufd_instruction:
4426
pshufd_instruction:
4435
	mov	[mmx_size],16
4427
	mov	[mmx_size],16
4436
	mov	[opcode_prefix],al
4428
	mov	[opcode_prefix],al
4437
      pshuf_instruction:
4429
      pshuf_instruction:
4438
	mov	[base_code],0Fh
4430
	mov	[base_code],0Fh
4439
	mov	[extended_code],70h
4431
	mov	[extended_code],70h
4440
	lods	byte [esi]
4432
	lods	byte [esi]
4441
	call	get_size_operator
4433
	call	get_size_operator
4442
	cmp	al,10h
4434
	cmp	al,10h
4443
	jne	invalid_operand
4435
	jne	invalid_operand
4444
	lods	byte [esi]
4436
	lods	byte [esi]
4445
	call	convert_mmx_register
4437
	call	convert_mmx_register
4446
	cmp	ah,[mmx_size]
4438
	cmp	ah,[mmx_size]
4447
	jne	invalid_operand_size
4439
	jne	invalid_operand_size
4448
	mov	[postbyte_register],al
4440
	mov	[postbyte_register],al
4449
	lods	byte [esi]
4441
	lods	byte [esi]
4450
	cmp	al,','
4442
	cmp	al,','
4451
	jne	invalid_operand
4443
	jne	invalid_operand
4452
	lods	byte [esi]
4444
	lods	byte [esi]
4453
	call	get_size_operator
4445
	call	get_size_operator
4454
	cmp	al,10h
4446
	cmp	al,10h
4455
	je	pshuf_mmreg_mmreg
4447
	je	pshuf_mmreg_mmreg
4456
	cmp	al,'['
4448
	cmp	al,'['
4457
	jne	invalid_operand
4449
	jne	invalid_operand
4458
	call	get_address
4450
	call	get_address
4459
	jmp	mmx_imm8
4451
	jmp	mmx_imm8
4460
      pshuf_mmreg_mmreg:
4452
      pshuf_mmreg_mmreg:
4461
	lods	byte [esi]
4453
	lods	byte [esi]
4462
	call	convert_mmx_register
4454
	call	convert_mmx_register
4463
	mov	bl,al
4455
	mov	bl,al
4464
	jmp	mmx_nomem_imm8
4456
	jmp	mmx_nomem_imm8
4465
movd_instruction:
4457
movd_instruction:
4466
	mov	[base_code],0Fh
4458
	mov	[base_code],0Fh
4467
	mov	[extended_code],7Eh
4459
	mov	[extended_code],7Eh
4468
	lods	byte [esi]
4460
	lods	byte [esi]
4469
	call	get_size_operator
4461
	call	get_size_operator
4470
	cmp	al,10h
4462
	cmp	al,10h
4471
	je	movd_reg
4463
	je	movd_reg
4472
	cmp	al,'['
4464
	cmp	al,'['
4473
	jne	invalid_operand
4465
	jne	invalid_operand
4474
	call	get_address
4466
	call	get_address
4475
	test	[operand_size],not 4
4467
	test	[operand_size],not 4
4476
	jnz	invalid_operand_size
4468
	jnz	invalid_operand_size
4477
	mov	[operand_size],0
4469
	mov	[operand_size],0
4478
	lods	byte [esi]
4470
	lods	byte [esi]
4479
	cmp	al,','
4471
	cmp	al,','
4480
	jne	invalid_operand
4472
	jne	invalid_operand
4481
	lods	byte [esi]
4473
	lods	byte [esi]
4482
	call	get_size_operator
4474
	call	get_size_operator
4483
	cmp	al,10h
4475
	cmp	al,10h
4484
	jne	invalid_operand
4476
	jne	invalid_operand
4485
	lods	byte [esi]
4477
	lods	byte [esi]
4486
	call	convert_mmx_register
4478
	call	convert_mmx_register
4487
	call	make_mmx_prefix
4479
	call	make_mmx_prefix
4488
	mov	[postbyte_register],al
4480
	mov	[postbyte_register],al
4489
	jmp	instruction_ready
4481
	jmp	instruction_ready
4490
      movd_reg:
4482
      movd_reg:
4491
	lods	byte [esi]
4483
	lods	byte [esi]
4492
	cmp	al,0B0h
4484
	cmp	al,0B0h
4493
	jae	movd_mmreg
4485
	jae	movd_mmreg
4494
	call	convert_register
4486
	call	convert_register
4495
	cmp	ah,4
4487
	cmp	ah,4
4496
	jne	invalid_operand_size
4488
	jne	invalid_operand_size
4497
	mov	[operand_size],0
4489
	mov	[operand_size],0
4498
	mov	bl,al
4490
	mov	bl,al
4499
	lods	byte [esi]
4491
	lods	byte [esi]
4500
	cmp	al,','
4492
	cmp	al,','
4501
	jne	invalid_operand
4493
	jne	invalid_operand
4502
	lods	byte [esi]
4494
	lods	byte [esi]
4503
	call	get_size_operator
4495
	call	get_size_operator
4504
	cmp	al,10h
4496
	cmp	al,10h
4505
	jne	invalid_operand
4497
	jne	invalid_operand
4506
	lods	byte [esi]
4498
	lods	byte [esi]
4507
	call	convert_mmx_register
4499
	call	convert_mmx_register
4508
	mov	[postbyte_register],al
4500
	mov	[postbyte_register],al
4509
	call	make_mmx_prefix
4501
	call	make_mmx_prefix
4510
	jmp	nomem_instruction_ready
4502
	jmp	nomem_instruction_ready
4511
      movd_mmreg:
4503
      movd_mmreg:
4512
	mov	[extended_code],6Eh
4504
	mov	[extended_code],6Eh
4513
	call	convert_mmx_register
4505
	call	convert_mmx_register
4514
	call	make_mmx_prefix
4506
	call	make_mmx_prefix
4515
	mov	[postbyte_register],al
4507
	mov	[postbyte_register],al
4516
	mov	[operand_size],0
4508
	mov	[operand_size],0
4517
	lods	byte [esi]
4509
	lods	byte [esi]
4518
	cmp	al,','
4510
	cmp	al,','
4519
	jne	invalid_operand
4511
	jne	invalid_operand
4520
	lods	byte [esi]
4512
	lods	byte [esi]
4521
	call	get_size_operator
4513
	call	get_size_operator
4522
	cmp	al,10h
4514
	cmp	al,10h
4523
	je	movd_mmreg_reg
4515
	je	movd_mmreg_reg
4524
	cmp	al,'['
4516
	cmp	al,'['
4525
	jne	invalid_operand
4517
	jne	invalid_operand
4526
	call	get_address
4518
	call	get_address
4527
	test	[operand_size],not 4
4519
	test	[operand_size],not 4
4528
	jnz	invalid_operand_size
4520
	jnz	invalid_operand_size
4529
	jmp	instruction_ready
4521
	jmp	instruction_ready
4530
      movd_mmreg_reg:
4522
      movd_mmreg_reg:
4531
	lods	byte [esi]
4523
	lods	byte [esi]
4532
	call	convert_register
4524
	call	convert_register
4533
	cmp	ah,4
4525
	cmp	ah,4
4534
	jne	invalid_operand_size
4526
	jne	invalid_operand_size
4535
	mov	bl,al
4527
	mov	bl,al
4536
	jmp	nomem_instruction_ready
4528
	jmp	nomem_instruction_ready
4537
      make_mmx_prefix:
4529
      make_mmx_prefix:
4538
	cmp	[vex_required],0
4530
	cmp	[vex_required],0
4539
	jne	mmx_prefix_for_vex
4531
	jne	mmx_prefix_for_vex
4540
	cmp	[operand_size],16
4532
	cmp	[operand_size],16
4541
	jne	no_mmx_prefix
4533
	jne	no_mmx_prefix
4542
	mov	[operand_prefix],66h
4534
	mov	[operand_prefix],66h
4543
      no_mmx_prefix:
4535
      no_mmx_prefix:
4544
	ret
4536
	ret
4545
      mmx_prefix_for_vex:
4537
      mmx_prefix_for_vex:
4546
	cmp	[operand_size],16
4538
	cmp	[operand_size],16
4547
	jne	invalid_operand
4539
	jne	invalid_operand
4548
	mov	[opcode_prefix],66h
4540
	mov	[opcode_prefix],66h
4549
	ret
4541
	ret
4550
movq_instruction:
4542
movq_instruction:
4551
	mov	[base_code],0Fh
4543
	mov	[base_code],0Fh
4552
	lods	byte [esi]
4544
	lods	byte [esi]
4553
	call	get_size_operator
4545
	call	get_size_operator
4554
	cmp	al,10h
4546
	cmp	al,10h
4555
	je	movq_reg
4547
	je	movq_reg
4556
	cmp	al,'['
4548
	cmp	al,'['
4557
	jne	invalid_operand
4549
	jne	invalid_operand
4558
	call	get_address
4550
	call	get_address
4559
	test	[operand_size],not 8
4551
	test	[operand_size],not 8
4560
	jnz	invalid_operand_size
4552
	jnz	invalid_operand_size
4561
	mov	[operand_size],0
4553
	mov	[operand_size],0
4562
	lods	byte [esi]
4554
	lods	byte [esi]
4563
	cmp	al,','
4555
	cmp	al,','
4564
	jne	invalid_operand
4556
	jne	invalid_operand
4565
	lods	byte [esi]
4557
	lods	byte [esi]
4566
	cmp	al,10h
4558
	cmp	al,10h
4567
	jne	invalid_operand
4559
	jne	invalid_operand
4568
	lods	byte [esi]
4560
	lods	byte [esi]
4569
	call	convert_mmx_register
4561
	call	convert_mmx_register
4570
	mov	[postbyte_register],al
4562
	mov	[postbyte_register],al
4571
	cmp	ah,16
4563
	cmp	ah,16
4572
	je	movq_mem_xmmreg
4564
	je	movq_mem_xmmreg
4573
	mov	[extended_code],7Fh
4565
	mov	[extended_code],7Fh
4574
	jmp	instruction_ready
4566
	jmp	instruction_ready
4575
     movq_mem_xmmreg:
4567
     movq_mem_xmmreg:
4576
	mov	[extended_code],0D6h
4568
	mov	[extended_code],0D6h
4577
	mov	[opcode_prefix],66h
4569
	mov	[opcode_prefix],66h
4578
	jmp	instruction_ready
4570
	jmp	instruction_ready
4579
     movq_reg:
4571
     movq_reg:
4580
	lods	byte [esi]
4572
	lods	byte [esi]
4581
	cmp	al,0B0h
4573
	cmp	al,0B0h
4582
	jae	movq_mmreg
4574
	jae	movq_mmreg
4583
	call	convert_register
4575
	call	convert_register
4584
	cmp	ah,8
4576
	cmp	ah,8
4585
	jne	invalid_operand_size
4577
	jne	invalid_operand_size
4586
	mov	bl,al
4578
	mov	bl,al
4587
	lods	byte [esi]
4579
	lods	byte [esi]
4588
	cmp	al,','
4580
	cmp	al,','
4589
	jne	invalid_operand
4581
	jne	invalid_operand
4590
	lods	byte [esi]
4582
	lods	byte [esi]
4591
	call	get_size_operator
4583
	call	get_size_operator
4592
	cmp	al,10h
4584
	cmp	al,10h
4593
	jne	invalid_operand
4585
	jne	invalid_operand
4594
	mov	[operand_size],0
4586
	mov	[operand_size],0
4595
	lods	byte [esi]
4587
	lods	byte [esi]
4596
	call	convert_mmx_register
4588
	call	convert_mmx_register
4597
	mov	[postbyte_register],al
4589
	mov	[postbyte_register],al
4598
	call	make_mmx_prefix
4590
	call	make_mmx_prefix
4599
	mov	[extended_code],7Eh
4591
	mov	[extended_code],7Eh
4600
	call	operand_64bit
4592
	call	operand_64bit
4601
	jmp	nomem_instruction_ready
4593
	jmp	nomem_instruction_ready
4602
     movq_mmreg:
4594
     movq_mmreg:
4603
	call	convert_mmx_register
4595
	call	convert_mmx_register
4604
	mov	[postbyte_register],al
4596
	mov	[postbyte_register],al
4605
	mov	[extended_code],6Fh
4597
	mov	[extended_code],6Fh
4606
	mov	[mmx_size],ah
4598
	mov	[mmx_size],ah
4607
	cmp	ah,16
4599
	cmp	ah,16
4608
	jne	movq_mmreg_
4600
	jne	movq_mmreg_
4609
	mov	[extended_code],7Eh
4601
	mov	[extended_code],7Eh
4610
	mov	[opcode_prefix],0F3h
4602
	mov	[opcode_prefix],0F3h
4611
      movq_mmreg_:
4603
      movq_mmreg_:
4612
	lods	byte [esi]
4604
	lods	byte [esi]
4613
	cmp	al,','
4605
	cmp	al,','
4614
	jne	invalid_operand
4606
	jne	invalid_operand
4615
	mov	[operand_size],0
4607
	mov	[operand_size],0
4616
	lods	byte [esi]
4608
	lods	byte [esi]
4617
	call	get_size_operator
4609
	call	get_size_operator
4618
	cmp	al,10h
4610
	cmp	al,10h
4619
	je	movq_mmreg_reg
4611
	je	movq_mmreg_reg
4620
	call	get_address
4612
	call	get_address
4621
	test	[operand_size],not 8
4613
	test	[operand_size],not 8
4622
	jnz	invalid_operand_size
4614
	jnz	invalid_operand_size
4623
	jmp	instruction_ready
4615
	jmp	instruction_ready
4624
      movq_mmreg_reg:
4616
      movq_mmreg_reg:
4625
	lods	byte [esi]
4617
	lods	byte [esi]
4626
	cmp	al,0B0h
4618
	cmp	al,0B0h
4627
	jae	movq_mmreg_mmreg
4619
	jae	movq_mmreg_mmreg
4628
	mov	[operand_size],0
4620
	mov	[operand_size],0
4629
	call	convert_register
4621
	call	convert_register
4630
	cmp	ah,8
4622
	cmp	ah,8
4631
	jne	invalid_operand_size
4623
	jne	invalid_operand_size
4632
	mov	[extended_code],6Eh
4624
	mov	[extended_code],6Eh
4633
	mov	[opcode_prefix],0
4625
	mov	[opcode_prefix],0
4634
	mov	bl,al
4626
	mov	bl,al
4635
	cmp	[mmx_size],16
4627
	cmp	[mmx_size],16
4636
	jne	movq_mmreg_reg_store
4628
	jne	movq_mmreg_reg_store
4637
	mov	[opcode_prefix],66h
4629
	mov	[opcode_prefix],66h
4638
      movq_mmreg_reg_store:
4630
      movq_mmreg_reg_store:
4639
	call	operand_64bit
4631
	call	operand_64bit
4640
	jmp	nomem_instruction_ready
4632
	jmp	nomem_instruction_ready
4641
      movq_mmreg_mmreg:
4633
      movq_mmreg_mmreg:
4642
	call	convert_mmx_register
4634
	call	convert_mmx_register
4643
	cmp	ah,[mmx_size]
4635
	cmp	ah,[mmx_size]
4644
	jne	invalid_operand_size
4636
	jne	invalid_operand_size
4645
	mov	bl,al
4637
	mov	bl,al
4646
	jmp	nomem_instruction_ready
4638
	jmp	nomem_instruction_ready
4647
movdq_instruction:
4639
movdq_instruction:
4648
	mov	[opcode_prefix],al
4640
	mov	[opcode_prefix],al
4649
	mov	[base_code],0Fh
4641
	mov	[base_code],0Fh
4650
	mov	[extended_code],6Fh
4642
	mov	[extended_code],6Fh
4651
	lods	byte [esi]
4643
	lods	byte [esi]
4652
	call	get_size_operator
4644
	call	get_size_operator
4653
	cmp	al,10h
4645
	cmp	al,10h
4654
	je	movdq_mmreg
4646
	je	movdq_mmreg
4655
	cmp	al,'['
4647
	cmp	al,'['
4656
	jne	invalid_operand
4648
	jne	invalid_operand
4657
	call	get_address
4649
	call	get_address
4658
	lods	byte [esi]
4650
	lods	byte [esi]
4659
	cmp	al,','
4651
	cmp	al,','
4660
	jne	invalid_operand
4652
	jne	invalid_operand
4661
	lods	byte [esi]
4653
	lods	byte [esi]
4662
	call	get_size_operator
4654
	call	get_size_operator
4663
	cmp	al,10h
4655
	cmp	al,10h
4664
	jne	invalid_operand
4656
	jne	invalid_operand
4665
	lods	byte [esi]
4657
	lods	byte [esi]
4666
	call	convert_xmm_register
4658
	call	convert_xmm_register
4667
	mov	[postbyte_register],al
4659
	mov	[postbyte_register],al
4668
	mov	[extended_code],7Fh
4660
	mov	[extended_code],7Fh
4669
	jmp	instruction_ready
4661
	jmp	instruction_ready
4670
      movdq_mmreg:
4662
      movdq_mmreg:
4671
	lods	byte [esi]
4663
	lods	byte [esi]
4672
	call	convert_xmm_register
4664
	call	convert_xmm_register
4673
	mov	[postbyte_register],al
4665
	mov	[postbyte_register],al
4674
	lods	byte [esi]
4666
	lods	byte [esi]
4675
	cmp	al,','
4667
	cmp	al,','
4676
	jne	invalid_operand
4668
	jne	invalid_operand
4677
	lods	byte [esi]
4669
	lods	byte [esi]
4678
	call	get_size_operator
4670
	call	get_size_operator
4679
	cmp	al,10h
4671
	cmp	al,10h
4680
	je	movdq_mmreg_mmreg
4672
	je	movdq_mmreg_mmreg
4681
	cmp	al,'['
4673
	cmp	al,'['
4682
	jne	invalid_operand
4674
	jne	invalid_operand
4683
	call	get_address
4675
	call	get_address
4684
	jmp	instruction_ready
4676
	jmp	instruction_ready
4685
      movdq_mmreg_mmreg:
4677
      movdq_mmreg_mmreg:
4686
	lods	byte [esi]
4678
	lods	byte [esi]
4687
	call	convert_xmm_register
4679
	call	convert_xmm_register
4688
	mov	bl,al
4680
	mov	bl,al
4689
	jmp	nomem_instruction_ready
4681
	jmp	nomem_instruction_ready
4690
lddqu_instruction:
4682
lddqu_instruction:
4691
	lods	byte [esi]
4683
	lods	byte [esi]
4692
	call	get_size_operator
4684
	call	get_size_operator
4693
	cmp	al,10h
4685
	cmp	al,10h
4694
	jne	invalid_operand
4686
	jne	invalid_operand
4695
	lods	byte [esi]
4687
	lods	byte [esi]
4696
	call	convert_xmm_register
4688
	call	convert_xmm_register
4697
	push	eax
4689
	push	eax
4698
	lods	byte [esi]
4690
	lods	byte [esi]
4699
	cmp	al,','
4691
	cmp	al,','
4700
	jne	invalid_operand
4692
	jne	invalid_operand
4701
	lods	byte [esi]
4693
	lods	byte [esi]
4702
	call	get_size_operator
4694
	call	get_size_operator
4703
	cmp	al,'['
4695
	cmp	al,'['
4704
	jne	invalid_operand
4696
	jne	invalid_operand
4705
	call	get_address
4697
	call	get_address
4706
	pop	eax
4698
	pop	eax
4707
	mov	[postbyte_register],al
4699
	mov	[postbyte_register],al
4708
	mov	[opcode_prefix],0F2h
4700
	mov	[opcode_prefix],0F2h
4709
	mov	[base_code],0Fh
4701
	mov	[base_code],0Fh
4710
	mov	[extended_code],0F0h
4702
	mov	[extended_code],0F0h
4711
	jmp	instruction_ready
4703
	jmp	instruction_ready
4712
 
4704
 
4713
movdq2q_instruction:
4705
movdq2q_instruction:
4714
	mov	[opcode_prefix],0F2h
4706
	mov	[opcode_prefix],0F2h
4715
	mov	[mmx_size],8
4707
	mov	[mmx_size],8
4716
	jmp	movq2dq_
4708
	jmp	movq2dq_
4717
movq2dq_instruction:
4709
movq2dq_instruction:
4718
	mov	[opcode_prefix],0F3h
4710
	mov	[opcode_prefix],0F3h
4719
	mov	[mmx_size],16
4711
	mov	[mmx_size],16
4720
      movq2dq_:
4712
      movq2dq_:
4721
	lods	byte [esi]
4713
	lods	byte [esi]
4722
	call	get_size_operator
4714
	call	get_size_operator
4723
	cmp	al,10h
4715
	cmp	al,10h
4724
	jne	invalid_operand
4716
	jne	invalid_operand
4725
	lods	byte [esi]
4717
	lods	byte [esi]
4726
	call	convert_mmx_register
4718
	call	convert_mmx_register
4727
	cmp	ah,[mmx_size]
4719
	cmp	ah,[mmx_size]
4728
	jne	invalid_operand_size
4720
	jne	invalid_operand_size
4729
	mov	[postbyte_register],al
4721
	mov	[postbyte_register],al
4730
	mov	[operand_size],0
4722
	mov	[operand_size],0
4731
	lods	byte [esi]
4723
	lods	byte [esi]
4732
	cmp	al,','
4724
	cmp	al,','
4733
	jne	invalid_operand
4725
	jne	invalid_operand
4734
	lods	byte [esi]
4726
	lods	byte [esi]
4735
	call	get_size_operator
4727
	call	get_size_operator
4736
	cmp	al,10h
4728
	cmp	al,10h
4737
	jne	invalid_operand
4729
	jne	invalid_operand
4738
	lods	byte [esi]
4730
	lods	byte [esi]
4739
	call	convert_mmx_register
4731
	call	convert_mmx_register
4740
	xor	[mmx_size],8+16
4732
	xor	[mmx_size],8+16
4741
	cmp	ah,[mmx_size]
4733
	cmp	ah,[mmx_size]
4742
	jne	invalid_operand_size
4734
	jne	invalid_operand_size
4743
	mov	bl,al
4735
	mov	bl,al
4744
	mov	[base_code],0Fh
4736
	mov	[base_code],0Fh
4745
	mov	[extended_code],0D6h
4737
	mov	[extended_code],0D6h
4746
	jmp	nomem_instruction_ready
4738
	jmp	nomem_instruction_ready
4747
 
4739
 
4748
sse_ps_instruction_imm8:
4740
sse_ps_instruction_imm8:
4749
	mov	[immediate_size],1
4741
	mov	[immediate_size],1
4750
sse_ps_instruction:
4742
sse_ps_instruction:
4751
	mov	[mmx_size],16
4743
	mov	[mmx_size],16
4752
	jmp	sse_instruction
4744
	jmp	sse_instruction
4753
sse_pd_instruction_imm8:
4745
sse_pd_instruction_imm8:
4754
	mov	[immediate_size],1
4746
	mov	[immediate_size],1
4755
sse_pd_instruction:
4747
sse_pd_instruction:
4756
	mov	[mmx_size],16
4748
	mov	[mmx_size],16
4757
	mov	[opcode_prefix],66h
4749
	mov	[opcode_prefix],66h
4758
	jmp	sse_instruction
4750
	jmp	sse_instruction
4759
sse_ss_instruction:
4751
sse_ss_instruction:
4760
	mov	[mmx_size],4
4752
	mov	[mmx_size],4
4761
	mov	[opcode_prefix],0F3h
4753
	mov	[opcode_prefix],0F3h
4762
	jmp	sse_instruction
4754
	jmp	sse_instruction
4763
sse_sd_instruction:
4755
sse_sd_instruction:
4764
	mov	[mmx_size],8
4756
	mov	[mmx_size],8
4765
	mov	[opcode_prefix],0F2h
4757
	mov	[opcode_prefix],0F2h
4766
	jmp	sse_instruction
4758
	jmp	sse_instruction
4767
cmp_pd_instruction:
4759
cmp_pd_instruction:
4768
	mov	[opcode_prefix],66h
4760
	mov	[opcode_prefix],66h
4769
cmp_ps_instruction:
4761
cmp_ps_instruction:
4770
	mov	[mmx_size],16
4762
	mov	[mmx_size],16
4771
	mov	byte [value],al
4763
	mov	byte [value],al
4772
	mov	al,0C2h
4764
	mov	al,0C2h
4773
	jmp	sse_instruction
4765
	jmp	sse_instruction
4774
cmp_ss_instruction:
4766
cmp_ss_instruction:
4775
	mov	[mmx_size],4
4767
	mov	[mmx_size],4
4776
	mov	[opcode_prefix],0F3h
4768
	mov	[opcode_prefix],0F3h
4777
	jmp	cmp_sx_instruction
4769
	jmp	cmp_sx_instruction
4778
cmpsd_instruction:
4770
cmpsd_instruction:
4779
	mov	al,0A7h
4771
	mov	al,0A7h
4780
	mov	ah,[esi]
4772
	mov	ah,[esi]
4781
	or	ah,ah
4773
	or	ah,ah
4782
	jz	simple_instruction_32bit
4774
	jz	simple_instruction_32bit
4783
	cmp	ah,0Fh
4775
	cmp	ah,0Fh
4784
	je	simple_instruction_32bit
4776
	je	simple_instruction_32bit
4785
	mov	al,-1
4777
	mov	al,-1
4786
cmp_sd_instruction:
4778
cmp_sd_instruction:
4787
	mov	[mmx_size],8
4779
	mov	[mmx_size],8
4788
	mov	[opcode_prefix],0F2h
4780
	mov	[opcode_prefix],0F2h
4789
      cmp_sx_instruction:
4781
      cmp_sx_instruction:
4790
	mov	byte [value],al
4782
	mov	byte [value],al
4791
	mov	al,0C2h
4783
	mov	al,0C2h
4792
	jmp	sse_instruction
4784
	jmp	sse_instruction
4793
comiss_instruction:
4785
comiss_instruction:
4794
	mov	[mmx_size],4
4786
	mov	[mmx_size],4
4795
	jmp	sse_instruction
4787
	jmp	sse_instruction
4796
comisd_instruction:
4788
comisd_instruction:
4797
	mov	[mmx_size],8
4789
	mov	[mmx_size],8
4798
	mov	[opcode_prefix],66h
4790
	mov	[opcode_prefix],66h
4799
	jmp	sse_instruction
4791
	jmp	sse_instruction
4800
cvtdq2pd_instruction:
4792
cvtdq2pd_instruction:
4801
	mov	[opcode_prefix],0F3h
4793
	mov	[opcode_prefix],0F3h
4802
cvtps2pd_instruction:
4794
cvtps2pd_instruction:
4803
	mov	[mmx_size],8
4795
	mov	[mmx_size],8
4804
	jmp	sse_instruction
4796
	jmp	sse_instruction
4805
cvtpd2dq_instruction:
4797
cvtpd2dq_instruction:
4806
	mov	[mmx_size],16
4798
	mov	[mmx_size],16
4807
	mov	[opcode_prefix],0F2h
4799
	mov	[opcode_prefix],0F2h
4808
	jmp	sse_instruction
4800
	jmp	sse_instruction
4809
movshdup_instruction:
4801
movshdup_instruction:
4810
	mov	[mmx_size],16
4802
	mov	[mmx_size],16
4811
	mov	[opcode_prefix],0F3h
4803
	mov	[opcode_prefix],0F3h
4812
sse_instruction:
4804
sse_instruction:
4813
	mov	[base_code],0Fh
4805
	mov	[base_code],0Fh
4814
	mov	[extended_code],al
4806
	mov	[extended_code],al
4815
	lods	byte [esi]
4807
	lods	byte [esi]
4816
	call	get_size_operator
4808
	call	get_size_operator
4817
	cmp	al,10h
4809
	cmp	al,10h
4818
	jne	invalid_operand
4810
	jne	invalid_operand
4819
      sse_xmmreg:
4811
      sse_xmmreg:
4820
	lods	byte [esi]
4812
	lods	byte [esi]
4821
	call	convert_xmm_register
4813
	call	convert_xmm_register
4822
      sse_reg:
4814
      sse_reg:
4823
	mov	[postbyte_register],al
4815
	mov	[postbyte_register],al
4824
	mov	[operand_size],0
4816
	mov	[operand_size],0
4825
	lods	byte [esi]
4817
	lods	byte [esi]
4826
	cmp	al,','
4818
	cmp	al,','
4827
	jne	invalid_operand
4819
	jne	invalid_operand
4828
	lods	byte [esi]
4820
	lods	byte [esi]
4829
	call	get_size_operator
4821
	call	get_size_operator
4830
	cmp	al,10h
4822
	cmp	al,10h
4831
	je	sse_xmmreg_xmmreg
4823
	je	sse_xmmreg_xmmreg
4832
      sse_reg_mem:
4824
      sse_reg_mem:
4833
	cmp	al,'['
4825
	cmp	al,'['
4834
	jne	invalid_operand
4826
	jne	invalid_operand
4835
	call	get_address
4827
	call	get_address
4836
	cmp	[operand_size],0
4828
	cmp	[operand_size],0
4837
	je	sse_mem_size_ok
4829
	je	sse_mem_size_ok
4838
	mov	al,[mmx_size]
4830
	mov	al,[mmx_size]
4839
	cmp	[operand_size],al
4831
	cmp	[operand_size],al
4840
	jne	invalid_operand_size
4832
	jne	invalid_operand_size
4841
      sse_mem_size_ok:
4833
      sse_mem_size_ok:
4842
	mov	al,[extended_code]
4834
	mov	al,[extended_code]
4843
	mov	ah,[supplemental_code]
4835
	mov	ah,[supplemental_code]
4844
	cmp	al,0C2h
4836
	cmp	al,0C2h
4845
	je	sse_cmp_mem_ok
4837
	je	sse_cmp_mem_ok
4846
	cmp	ax,443Ah
4838
	cmp	ax,443Ah
4847
	je	sse_cmp_mem_ok
4839
	je	sse_cmp_mem_ok
4848
	cmp	[immediate_size],1
4840
	cmp	[immediate_size],1
4849
	je	mmx_imm8
4841
	je	mmx_imm8
4850
	cmp	[immediate_size],-1
4842
	cmp	[immediate_size],-1
4851
	jne	sse_ok
4843
	jne	sse_ok
4852
	call	take_additional_xmm0
4844
	call	take_additional_xmm0
4853
	mov	[immediate_size],0
4845
	mov	[immediate_size],0
4854
      sse_ok:
4846
      sse_ok:
4855
	jmp	instruction_ready
4847
	jmp	instruction_ready
4856
      sse_cmp_mem_ok:
4848
      sse_cmp_mem_ok:
4857
	cmp	byte [value],-1
4849
	cmp	byte [value],-1
4858
	je	mmx_imm8
4850
	je	mmx_imm8
4859
	call	store_instruction_with_imm8
4851
	call	store_instruction_with_imm8
4860
	jmp	instruction_assembled
4852
	jmp	instruction_assembled
4861
      sse_xmmreg_xmmreg:
4853
      sse_xmmreg_xmmreg:
4862
	cmp	[operand_prefix],66h
4854
	cmp	[operand_prefix],66h
4863
	jne	sse_xmmreg_xmmreg_ok
4855
	jne	sse_xmmreg_xmmreg_ok
4864
	cmp	[extended_code],12h
4856
	cmp	[extended_code],12h
4865
	je	invalid_operand
4857
	je	invalid_operand
4866
	cmp	[extended_code],16h
4858
	cmp	[extended_code],16h
4867
	je	invalid_operand
4859
	je	invalid_operand
4868
      sse_xmmreg_xmmreg_ok:
4860
      sse_xmmreg_xmmreg_ok:
4869
	lods	byte [esi]
4861
	lods	byte [esi]
4870
	call	convert_xmm_register
4862
	call	convert_xmm_register
4871
	mov	bl,al
4863
	mov	bl,al
4872
	mov	al,[extended_code]
4864
	mov	al,[extended_code]
4873
	mov	ah,[supplemental_code]
4865
	mov	ah,[supplemental_code]
4874
	cmp	al,0C2h
4866
	cmp	al,0C2h
4875
	je	sse_cmp_nomem_ok
4867
	je	sse_cmp_nomem_ok
4876
	cmp	ax,443Ah
4868
	cmp	ax,443Ah
4877
	je	sse_cmp_nomem_ok
4869
	je	sse_cmp_nomem_ok
4878
	cmp	[immediate_size],1
4870
	cmp	[immediate_size],1
4879
	je	mmx_nomem_imm8
4871
	je	mmx_nomem_imm8
4880
	cmp	[immediate_size],-1
4872
	cmp	[immediate_size],-1
4881
	jne	sse_nomem_ok
4873
	jne	sse_nomem_ok
4882
	call	take_additional_xmm0
4874
	call	take_additional_xmm0
4883
	mov	[immediate_size],0
4875
	mov	[immediate_size],0
4884
      sse_nomem_ok:
4876
      sse_nomem_ok:
4885
	jmp	nomem_instruction_ready
4877
	jmp	nomem_instruction_ready
4886
      sse_cmp_nomem_ok:
4878
      sse_cmp_nomem_ok:
4887
	cmp	byte [value],-1
4879
	cmp	byte [value],-1
4888
	je	mmx_nomem_imm8
4880
	je	mmx_nomem_imm8
4889
	call	store_nomem_instruction
4881
	call	store_nomem_instruction
4890
	mov	al,byte [value]
4882
	mov	al,byte [value]
4891
	stosb
4883
	stosb
4892
	jmp	instruction_assembled
4884
	jmp	instruction_assembled
4893
      take_additional_xmm0:
4885
      take_additional_xmm0:
4894
	cmp	byte [esi],','
4886
	cmp	byte [esi],','
4895
	jne	additional_xmm0_ok
4887
	jne	additional_xmm0_ok
4896
	inc	esi
4888
	inc	esi
4897
	lods	byte [esi]
4889
	lods	byte [esi]
4898
	cmp	al,10h
4890
	cmp	al,10h
4899
	jne	invalid_operand
4891
	jne	invalid_operand
4900
	lods	byte [esi]
4892
	lods	byte [esi]
4901
	call	convert_xmm_register
4893
	call	convert_xmm_register
4902
	test	al,al
4894
	test	al,al
4903
	jnz	invalid_operand
4895
	jnz	invalid_operand
4904
      additional_xmm0_ok:
4896
      additional_xmm0_ok:
4905
	ret
4897
	ret
4906
 
4898
 
4907
pslldq_instruction:
4899
pslldq_instruction:
4908
	mov	[postbyte_register],al
4900
	mov	[postbyte_register],al
4909
	mov	[opcode_prefix],66h
4901
	mov	[opcode_prefix],66h
4910
	mov	[base_code],0Fh
4902
	mov	[base_code],0Fh
4911
	mov	[extended_code],73h
4903
	mov	[extended_code],73h
4912
	lods	byte [esi]
4904
	lods	byte [esi]
4913
	call	get_size_operator
4905
	call	get_size_operator
4914
	cmp	al,10h
4906
	cmp	al,10h
4915
	jne	invalid_operand
4907
	jne	invalid_operand
4916
	lods	byte [esi]
4908
	lods	byte [esi]
4917
	call	convert_xmm_register
4909
	call	convert_xmm_register
4918
	mov	bl,al
4910
	mov	bl,al
4919
	jmp	mmx_nomem_imm8
4911
	jmp	mmx_nomem_imm8
4920
movpd_instruction:
4912
movpd_instruction:
4921
	mov	[opcode_prefix],66h
4913
	mov	[opcode_prefix],66h
4922
movps_instruction:
4914
movps_instruction:
4923
	mov	[base_code],0Fh
4915
	mov	[base_code],0Fh
4924
	mov	[extended_code],al
4916
	mov	[extended_code],al
4925
	mov	[mmx_size],16
4917
	mov	[mmx_size],16
4926
	jmp	sse_mov_instruction
4918
	jmp	sse_mov_instruction
4927
movss_instruction:
4919
movss_instruction:
4928
	mov	[mmx_size],4
4920
	mov	[mmx_size],4
4929
	mov	[opcode_prefix],0F3h
4921
	mov	[opcode_prefix],0F3h
4930
	jmp	sse_movs
4922
	jmp	sse_movs
4931
movsd_instruction:
4923
movsd_instruction:
4932
	mov	al,0A5h
4924
	mov	al,0A5h
4933
	mov	ah,[esi]
4925
	mov	ah,[esi]
4934
	or	ah,ah
4926
	or	ah,ah
4935
	jz	simple_instruction_32bit
4927
	jz	simple_instruction_32bit
4936
	cmp	ah,0Fh
4928
	cmp	ah,0Fh
4937
	je	simple_instruction_32bit
4929
	je	simple_instruction_32bit
4938
	mov	[mmx_size],8
4930
	mov	[mmx_size],8
4939
	mov	[opcode_prefix],0F2h
4931
	mov	[opcode_prefix],0F2h
4940
      sse_movs:
4932
      sse_movs:
4941
	mov	[base_code],0Fh
4933
	mov	[base_code],0Fh
4942
	mov	[extended_code],10h
4934
	mov	[extended_code],10h
4943
	jmp	sse_mov_instruction
4935
	jmp	sse_mov_instruction
4944
sse_mov_instruction:
4936
sse_mov_instruction:
4945
	lods	byte [esi]
4937
	lods	byte [esi]
4946
	call	get_size_operator
4938
	call	get_size_operator
4947
	cmp	al,10h
4939
	cmp	al,10h
4948
	je	sse_xmmreg
4940
	je	sse_xmmreg
4949
      sse_mem:
4941
      sse_mem:
4950
	cmp	al,'['
4942
	cmp	al,'['
4951
	jne	invalid_operand
4943
	jne	invalid_operand
4952
	inc	[extended_code]
4944
	inc	[extended_code]
4953
	call	get_address
4945
	call	get_address
4954
	cmp	[operand_size],0
4946
	cmp	[operand_size],0
4955
	je	sse_mem_xmmreg
4947
	je	sse_mem_xmmreg
4956
	mov	al,[mmx_size]
4948
	mov	al,[mmx_size]
4957
	cmp	[operand_size],al
4949
	cmp	[operand_size],al
4958
	jne	invalid_operand_size
4950
	jne	invalid_operand_size
4959
	mov	[operand_size],0
4951
	mov	[operand_size],0
4960
      sse_mem_xmmreg:
4952
      sse_mem_xmmreg:
4961
	lods	byte [esi]
4953
	lods	byte [esi]
4962
	cmp	al,','
4954
	cmp	al,','
4963
	jne	invalid_operand
4955
	jne	invalid_operand
4964
	lods	byte [esi]
4956
	lods	byte [esi]
4965
	call	get_size_operator
4957
	call	get_size_operator
4966
	cmp	al,10h
4958
	cmp	al,10h
4967
	jne	invalid_operand
4959
	jne	invalid_operand
4968
	lods	byte [esi]
4960
	lods	byte [esi]
4969
	call	convert_xmm_register
4961
	call	convert_xmm_register
4970
	mov	[postbyte_register],al
4962
	mov	[postbyte_register],al
4971
	jmp	instruction_ready
4963
	jmp	instruction_ready
4972
movlpd_instruction:
4964
movlpd_instruction:
4973
	mov	[opcode_prefix],66h
4965
	mov	[opcode_prefix],66h
4974
movlps_instruction:
4966
movlps_instruction:
4975
	mov	[base_code],0Fh
4967
	mov	[base_code],0Fh
4976
	mov	[extended_code],al
4968
	mov	[extended_code],al
4977
	mov	[mmx_size],8
4969
	mov	[mmx_size],8
4978
	lods	byte [esi]
4970
	lods	byte [esi]
4979
	call	get_size_operator
4971
	call	get_size_operator
4980
	cmp	al,10h
4972
	cmp	al,10h
4981
	jne	sse_mem
4973
	jne	sse_mem
4982
	lods	byte [esi]
4974
	lods	byte [esi]
4983
	call	convert_xmm_register
4975
	call	convert_xmm_register
4984
	mov	[postbyte_register],al
4976
	mov	[postbyte_register],al
4985
	mov	[operand_size],0
4977
	mov	[operand_size],0
4986
	lods	byte [esi]
4978
	lods	byte [esi]
4987
	cmp	al,','
4979
	cmp	al,','
4988
	jne	invalid_operand
4980
	jne	invalid_operand
4989
	lods	byte [esi]
4981
	lods	byte [esi]
4990
	call	get_size_operator
4982
	call	get_size_operator
4991
	jmp	sse_reg_mem
4983
	jmp	sse_reg_mem
4992
movhlps_instruction:
4984
movhlps_instruction:
4993
	mov	[base_code],0Fh
4985
	mov	[base_code],0Fh
4994
	mov	[extended_code],al
4986
	mov	[extended_code],al
4995
	mov	[mmx_size],0
4987
	mov	[mmx_size],0
4996
	lods	byte [esi]
4988
	lods	byte [esi]
4997
	call	get_size_operator
4989
	call	get_size_operator
4998
	cmp	al,10h
4990
	cmp	al,10h
4999
	jne	invalid_operand
4991
	jne	invalid_operand
5000
	lods	byte [esi]
4992
	lods	byte [esi]
5001
	call	convert_xmm_register
4993
	call	convert_xmm_register
5002
	mov	[postbyte_register],al
4994
	mov	[postbyte_register],al
5003
	lods	byte [esi]
4995
	lods	byte [esi]
5004
	cmp	al,','
4996
	cmp	al,','
5005
	jne	invalid_operand
4997
	jne	invalid_operand
5006
	lods	byte [esi]
4998
	lods	byte [esi]
5007
	call	get_size_operator
4999
	call	get_size_operator
5008
	cmp	al,10h
5000
	cmp	al,10h
5009
	je	sse_xmmreg_xmmreg_ok
5001
	je	sse_xmmreg_xmmreg_ok
5010
	jmp	invalid_operand
5002
	jmp	invalid_operand
5011
maskmovq_instruction:
5003
maskmovq_instruction:
5012
	mov	cl,8
5004
	mov	cl,8
5013
	jmp	maskmov_instruction
5005
	jmp	maskmov_instruction
5014
maskmovdqu_instruction:
5006
maskmovdqu_instruction:
5015
	mov	cl,16
5007
	mov	cl,16
5016
	mov	[opcode_prefix],66h
5008
	mov	[opcode_prefix],66h
5017
      maskmov_instruction:
5009
      maskmov_instruction:
5018
	mov	[base_code],0Fh
5010
	mov	[base_code],0Fh
5019
	mov	[extended_code],0F7h
5011
	mov	[extended_code],0F7h
5020
	lods	byte [esi]
5012
	lods	byte [esi]
5021
	call	get_size_operator
5013
	call	get_size_operator
5022
	cmp	al,10h
5014
	cmp	al,10h
5023
	jne	invalid_operand
5015
	jne	invalid_operand
5024
	lods	byte [esi]
5016
	lods	byte [esi]
5025
	call	convert_mmx_register
5017
	call	convert_mmx_register
5026
	cmp	ah,cl
5018
	cmp	ah,cl
5027
	jne	invalid_operand_size
5019
	jne	invalid_operand_size
5028
	mov	[postbyte_register],al
5020
	mov	[postbyte_register],al
5029
	lods	byte [esi]
5021
	lods	byte [esi]
5030
	cmp	al,','
5022
	cmp	al,','
5031
	jne	invalid_operand
5023
	jne	invalid_operand
5032
	lods	byte [esi]
5024
	lods	byte [esi]
5033
	call	get_size_operator
5025
	call	get_size_operator
5034
	cmp	al,10h
5026
	cmp	al,10h
5035
	jne	invalid_operand
5027
	jne	invalid_operand
5036
	lods	byte [esi]
5028
	lods	byte [esi]
5037
	call	convert_mmx_register
5029
	call	convert_mmx_register
5038
	mov	bl,al
5030
	mov	bl,al
5039
	jmp	nomem_instruction_ready
5031
	jmp	nomem_instruction_ready
5040
movmskpd_instruction:
5032
movmskpd_instruction:
5041
	mov	[opcode_prefix],66h
5033
	mov	[opcode_prefix],66h
5042
movmskps_instruction:
5034
movmskps_instruction:
5043
	mov	[base_code],0Fh
5035
	mov	[base_code],0Fh
5044
	mov	[extended_code],50h
5036
	mov	[extended_code],50h
5045
	lods	byte [esi]
5037
	lods	byte [esi]
5046
	call	get_size_operator
5038
	call	get_size_operator
5047
	cmp	al,10h
5039
	cmp	al,10h
5048
	jne	invalid_operand
5040
	jne	invalid_operand
5049
	lods	byte [esi]
5041
	lods	byte [esi]
5050
	call	convert_register
5042
	call	convert_register
5051
	mov	[postbyte_register],al
5043
	mov	[postbyte_register],al
5052
	cmp	ah,4
5044
	cmp	ah,4
5053
	je	movmskps_reg_ok
5045
	je	movmskps_reg_ok
5054
	cmp	ah,8
5046
	cmp	ah,8
5055
	jne	invalid_operand_size
5047
	jne	invalid_operand_size
5056
	cmp	[code_type],64
5048
	cmp	[code_type],64
5057
	jne	invalid_operand
5049
	jne	invalid_operand
5058
      movmskps_reg_ok:
5050
      movmskps_reg_ok:
5059
	mov	[operand_size],0
5051
	mov	[operand_size],0
5060
	lods	byte [esi]
5052
	lods	byte [esi]
5061
	cmp	al,','
5053
	cmp	al,','
5062
	jne	invalid_operand
5054
	jne	invalid_operand
5063
	lods	byte [esi]
5055
	lods	byte [esi]
5064
	call	get_size_operator
5056
	call	get_size_operator
5065
	cmp	al,10h
5057
	cmp	al,10h
5066
	je	sse_xmmreg_xmmreg_ok
5058
	je	sse_xmmreg_xmmreg_ok
5067
	jmp	invalid_operand
5059
	jmp	invalid_operand
5068
 
5060
 
5069
cvtpi2pd_instruction:
5061
cvtpi2pd_instruction:
5070
	mov	[opcode_prefix],66h
5062
	mov	[opcode_prefix],66h
5071
cvtpi2ps_instruction:
5063
cvtpi2ps_instruction:
5072
	mov	[base_code],0Fh
5064
	mov	[base_code],0Fh
5073
	mov	[extended_code],al
5065
	mov	[extended_code],al
5074
	lods	byte [esi]
5066
	lods	byte [esi]
5075
	call	get_size_operator
5067
	call	get_size_operator
5076
	cmp	al,10h
5068
	cmp	al,10h
5077
	jne	invalid_operand
5069
	jne	invalid_operand
5078
	lods	byte [esi]
5070
	lods	byte [esi]
5079
	call	convert_xmm_register
5071
	call	convert_xmm_register
5080
	mov	[postbyte_register],al
5072
	mov	[postbyte_register],al
5081
	mov	[operand_size],0
5073
	mov	[operand_size],0
5082
	lods	byte [esi]
5074
	lods	byte [esi]
5083
	cmp	al,','
5075
	cmp	al,','
5084
	jne	invalid_operand
5076
	jne	invalid_operand
5085
	lods	byte [esi]
5077
	lods	byte [esi]
5086
	call	get_size_operator
5078
	call	get_size_operator
5087
	cmp	al,10h
5079
	cmp	al,10h
5088
	je	cvtpi_xmmreg_xmmreg
5080
	je	cvtpi_xmmreg_xmmreg
5089
	cmp	al,'['
5081
	cmp	al,'['
5090
	jne	invalid_operand
5082
	jne	invalid_operand
5091
	call	get_address
5083
	call	get_address
5092
	cmp	[operand_size],0
5084
	cmp	[operand_size],0
5093
	je	cvtpi_size_ok
5085
	je	cvtpi_size_ok
5094
	cmp	[operand_size],8
5086
	cmp	[operand_size],8
5095
	jne	invalid_operand_size
5087
	jne	invalid_operand_size
5096
      cvtpi_size_ok:
5088
      cvtpi_size_ok:
5097
	jmp	instruction_ready
5089
	jmp	instruction_ready
5098
      cvtpi_xmmreg_xmmreg:
5090
      cvtpi_xmmreg_xmmreg:
5099
	lods	byte [esi]
5091
	lods	byte [esi]
5100
	call	convert_mmx_register
5092
	call	convert_mmx_register
5101
	cmp	ah,8
5093
	cmp	ah,8
5102
	jne	invalid_operand_size
5094
	jne	invalid_operand_size
5103
	mov	bl,al
5095
	mov	bl,al
5104
	jmp	nomem_instruction_ready
5096
	jmp	nomem_instruction_ready
5105
cvtsi2ss_instruction:
5097
cvtsi2ss_instruction:
5106
	mov	[opcode_prefix],0F3h
5098
	mov	[opcode_prefix],0F3h
5107
	jmp	cvtsi_instruction
5099
	jmp	cvtsi_instruction
5108
cvtsi2sd_instruction:
5100
cvtsi2sd_instruction:
5109
	mov	[opcode_prefix],0F2h
5101
	mov	[opcode_prefix],0F2h
5110
      cvtsi_instruction:
5102
      cvtsi_instruction:
5111
	mov	[base_code],0Fh
5103
	mov	[base_code],0Fh
5112
	mov	[extended_code],al
5104
	mov	[extended_code],al
5113
	lods	byte [esi]
5105
	lods	byte [esi]
5114
	call	get_size_operator
5106
	call	get_size_operator
5115
	cmp	al,10h
5107
	cmp	al,10h
5116
	jne	invalid_operand
5108
	jne	invalid_operand
5117
	lods	byte [esi]
5109
	lods	byte [esi]
5118
	call	convert_xmm_register
5110
	call	convert_xmm_register
5119
	mov	[postbyte_register],al
5111
	mov	[postbyte_register],al
5120
      cvtsi_xmmreg:
5112
      cvtsi_xmmreg:
5121
	mov	[operand_size],0
5113
	mov	[operand_size],0
5122
	lods	byte [esi]
5114
	lods	byte [esi]
5123
	cmp	al,','
5115
	cmp	al,','
5124
	jne	invalid_operand
5116
	jne	invalid_operand
5125
	lods	byte [esi]
5117
	lods	byte [esi]
5126
	call	get_size_operator
5118
	call	get_size_operator
5127
	cmp	al,10h
5119
	cmp	al,10h
5128
	je	cvtsi_xmmreg_reg
5120
	je	cvtsi_xmmreg_reg
5129
	cmp	al,'['
5121
	cmp	al,'['
5130
	jne	invalid_operand
5122
	jne	invalid_operand
5131
	call	get_address
5123
	call	get_address
5132
	cmp	[operand_size],0
5124
	cmp	[operand_size],0
5133
	je	cvtsi_size_ok
5125
	je	cvtsi_size_ok
5134
	cmp	[operand_size],4
5126
	cmp	[operand_size],4
5135
	je	cvtsi_size_ok
5127
	je	cvtsi_size_ok
5136
	cmp	[operand_size],8
5128
	cmp	[operand_size],8
5137
	jne	invalid_operand_size
5129
	jne	invalid_operand_size
5138
	call	operand_64bit
5130
	call	operand_64bit
5139
      cvtsi_size_ok:
5131
      cvtsi_size_ok:
5140
	jmp	instruction_ready
5132
	jmp	instruction_ready
5141
      cvtsi_xmmreg_reg:
5133
      cvtsi_xmmreg_reg:
5142
	lods	byte [esi]
5134
	lods	byte [esi]
5143
	call	convert_register
5135
	call	convert_register
5144
	cmp	ah,4
5136
	cmp	ah,4
5145
	je	cvtsi_xmmreg_reg_store
5137
	je	cvtsi_xmmreg_reg_store
5146
	cmp	ah,8
5138
	cmp	ah,8
5147
	jne	invalid_operand_size
5139
	jne	invalid_operand_size
5148
	call	operand_64bit
5140
	call	operand_64bit
5149
      cvtsi_xmmreg_reg_store:
5141
      cvtsi_xmmreg_reg_store:
5150
	mov	bl,al
5142
	mov	bl,al
5151
	jmp	nomem_instruction_ready
5143
	jmp	nomem_instruction_ready
5152
cvtps2pi_instruction:
5144
cvtps2pi_instruction:
5153
	mov	[mmx_size],8
5145
	mov	[mmx_size],8
5154
	jmp	cvtpd_instruction
5146
	jmp	cvtpd_instruction
5155
cvtpd2pi_instruction:
5147
cvtpd2pi_instruction:
5156
	mov	[opcode_prefix],66h
5148
	mov	[opcode_prefix],66h
5157
	mov	[mmx_size],16
5149
	mov	[mmx_size],16
5158
      cvtpd_instruction:
5150
      cvtpd_instruction:
5159
	mov	[base_code],0Fh
5151
	mov	[base_code],0Fh
5160
	mov	[extended_code],al
5152
	mov	[extended_code],al
5161
	lods	byte [esi]
5153
	lods	byte [esi]
5162
	call	get_size_operator
5154
	call	get_size_operator
5163
	cmp	al,10h
5155
	cmp	al,10h
5164
	jne	invalid_operand
5156
	jne	invalid_operand
5165
	lods	byte [esi]
5157
	lods	byte [esi]
5166
	call	convert_mmx_register
5158
	call	convert_mmx_register
5167
	cmp	ah,8
5159
	cmp	ah,8
5168
	jne	invalid_operand_size
5160
	jne	invalid_operand_size
5169
	mov	[operand_size],0
5161
	mov	[operand_size],0
5170
	jmp	sse_reg
5162
	jmp	sse_reg
5171
cvtss2si_instruction:
5163
cvtss2si_instruction:
5172
	mov	[opcode_prefix],0F3h
5164
	mov	[opcode_prefix],0F3h
5173
	mov	[mmx_size],4
5165
	mov	[mmx_size],4
5174
	jmp	cvt2si_instruction
5166
	jmp	cvt2si_instruction
5175
cvtsd2si_instruction:
5167
cvtsd2si_instruction:
5176
	mov	[opcode_prefix],0F2h
5168
	mov	[opcode_prefix],0F2h
5177
	mov	[mmx_size],8
5169
	mov	[mmx_size],8
5178
      cvt2si_instruction:
5170
      cvt2si_instruction:
5179
	mov	[extended_code],al
5171
	mov	[extended_code],al
5180
	mov	[base_code],0Fh
5172
	mov	[base_code],0Fh
5181
	lods	byte [esi]
5173
	lods	byte [esi]
5182
	call	get_size_operator
5174
	call	get_size_operator
5183
	cmp	al,10h
5175
	cmp	al,10h
5184
	jne	invalid_operand
5176
	jne	invalid_operand
5185
	lods	byte [esi]
5177
	lods	byte [esi]
5186
	call	convert_register
5178
	call	convert_register
5187
	mov	[operand_size],0
5179
	mov	[operand_size],0
5188
	cmp	ah,4
5180
	cmp	ah,4
5189
	je	sse_reg
5181
	je	sse_reg
5190
	cmp	ah,8
5182
	cmp	ah,8
5191
	jne	invalid_operand_size
5183
	jne	invalid_operand_size
5192
	call	operand_64bit
5184
	call	operand_64bit
5193
	jmp	sse_reg
5185
	jmp	sse_reg
5194
 
5186
 
5195
ssse3_instruction:
5187
ssse3_instruction:
5196
	mov	[base_code],0Fh
5188
	mov	[base_code],0Fh
5197
	mov	[extended_code],38h
5189
	mov	[extended_code],38h
5198
	mov	[supplemental_code],al
5190
	mov	[supplemental_code],al
5199
	jmp	mmx_instruction
5191
	jmp	mmx_instruction
5200
palignr_instruction:
5192
palignr_instruction:
5201
	mov	[base_code],0Fh
5193
	mov	[base_code],0Fh
5202
	mov	[extended_code],3Ah
5194
	mov	[extended_code],3Ah
5203
	mov	[supplemental_code],0Fh
5195
	mov	[supplemental_code],0Fh
5204
	lods	byte [esi]
5196
	lods	byte [esi]
5205
	call	get_size_operator
5197
	call	get_size_operator
5206
	cmp	al,10h
5198
	cmp	al,10h
5207
	jne	invalid_operand
5199
	jne	invalid_operand
5208
	lods	byte [esi]
5200
	lods	byte [esi]
5209
	call	convert_mmx_register
5201
	call	convert_mmx_register
5210
	call	make_mmx_prefix
5202
	call	make_mmx_prefix
5211
	mov	[postbyte_register],al
5203
	mov	[postbyte_register],al
5212
	lods	byte [esi]
5204
	lods	byte [esi]
5213
	cmp	al,','
5205
	cmp	al,','
5214
	jne	invalid_operand
5206
	jne	invalid_operand
5215
	lods	byte [esi]
5207
	lods	byte [esi]
5216
	call	get_size_operator
5208
	call	get_size_operator
5217
	cmp	al,10h
5209
	cmp	al,10h
5218
	je	palignr_mmreg_mmreg
5210
	je	palignr_mmreg_mmreg
5219
	cmp	al,'['
5211
	cmp	al,'['
5220
	jne	invalid_operand
5212
	jne	invalid_operand
5221
	call	get_address
5213
	call	get_address
5222
	jmp	mmx_imm8
5214
	jmp	mmx_imm8
5223
      palignr_mmreg_mmreg:
5215
      palignr_mmreg_mmreg:
5224
	lods	byte [esi]
5216
	lods	byte [esi]
5225
	call	convert_mmx_register
5217
	call	convert_mmx_register
5226
	mov	bl,al
5218
	mov	bl,al
5227
	jmp	mmx_nomem_imm8
5219
	jmp	mmx_nomem_imm8
5228
amd3dnow_instruction:
5220
amd3dnow_instruction:
5229
	mov	[base_code],0Fh
5221
	mov	[base_code],0Fh
5230
	mov	[extended_code],0Fh
5222
	mov	[extended_code],0Fh
5231
	mov	byte [value],al
5223
	mov	byte [value],al
5232
	lods	byte [esi]
5224
	lods	byte [esi]
5233
	call	get_size_operator
5225
	call	get_size_operator
5234
	cmp	al,10h
5226
	cmp	al,10h
5235
	jne	invalid_operand
5227
	jne	invalid_operand
5236
	lods	byte [esi]
5228
	lods	byte [esi]
5237
	call	convert_mmx_register
5229
	call	convert_mmx_register
5238
	cmp	ah,8
5230
	cmp	ah,8
5239
	jne	invalid_operand_size
5231
	jne	invalid_operand_size
5240
	mov	[postbyte_register],al
5232
	mov	[postbyte_register],al
5241
	lods	byte [esi]
5233
	lods	byte [esi]
5242
	cmp	al,','
5234
	cmp	al,','
5243
	jne	invalid_operand
5235
	jne	invalid_operand
5244
	lods	byte [esi]
5236
	lods	byte [esi]
5245
	call	get_size_operator
5237
	call	get_size_operator
5246
	cmp	al,10h
5238
	cmp	al,10h
5247
	je	amd3dnow_mmreg_mmreg
5239
	je	amd3dnow_mmreg_mmreg
5248
	cmp	al,'['
5240
	cmp	al,'['
5249
	jne	invalid_operand
5241
	jne	invalid_operand
5250
	call	get_address
5242
	call	get_address
5251
	call	store_instruction_with_imm8
5243
	call	store_instruction_with_imm8
5252
	jmp	instruction_assembled
5244
	jmp	instruction_assembled
5253
      amd3dnow_mmreg_mmreg:
5245
      amd3dnow_mmreg_mmreg:
5254
	lods	byte [esi]
5246
	lods	byte [esi]
5255
	call	convert_mmx_register
5247
	call	convert_mmx_register
5256
	cmp	ah,8
5248
	cmp	ah,8
5257
	jne	invalid_operand_size
5249
	jne	invalid_operand_size
5258
	mov	bl,al
5250
	mov	bl,al
5259
	call	store_nomem_instruction
5251
	call	store_nomem_instruction
5260
	mov	al,byte [value]
5252
	mov	al,byte [value]
5261
	stos	byte [edi]
5253
	stos	byte [edi]
5262
	jmp	instruction_assembled
5254
	jmp	instruction_assembled
5263
 
5255
 
5264
sse4_instruction_38_xmm0:
5256
sse4_instruction_38_xmm0:
5265
	mov	[immediate_size],-1
5257
	mov	[immediate_size],-1
5266
sse4_instruction_38:
5258
sse4_instruction_38:
5267
	mov	[mmx_size],16
5259
	mov	[mmx_size],16
5268
	mov	[opcode_prefix],66h
5260
	mov	[opcode_prefix],66h
5269
	mov	[supplemental_code],al
5261
	mov	[supplemental_code],al
5270
	mov	al,38h
5262
	mov	al,38h
5271
	jmp	sse_instruction
5263
	jmp	sse_instruction
5272
sse4_ss_instruction_3a_imm8:
5264
sse4_ss_instruction_3a_imm8:
5273
	mov	[immediate_size],1
5265
	mov	[immediate_size],1
5274
	mov	[mmx_size],4
5266
	mov	[mmx_size],4
5275
	jmp	sse4_instruction_3a_setup
5267
	jmp	sse4_instruction_3a_setup
5276
sse4_sd_instruction_3a_imm8:
5268
sse4_sd_instruction_3a_imm8:
5277
	mov	[immediate_size],1
5269
	mov	[immediate_size],1
5278
	mov	[mmx_size],8
5270
	mov	[mmx_size],8
5279
	jmp	sse4_instruction_3a_setup
5271
	jmp	sse4_instruction_3a_setup
5280
sse4_instruction_3a_imm8:
5272
sse4_instruction_3a_imm8:
5281
	mov	[immediate_size],1
5273
	mov	[immediate_size],1
5282
	mov	[mmx_size],16
5274
	mov	[mmx_size],16
5283
      sse4_instruction_3a_setup:
5275
      sse4_instruction_3a_setup:
5284
	mov	[opcode_prefix],66h
5276
	mov	[opcode_prefix],66h
5285
	mov	[supplemental_code],al
5277
	mov	[supplemental_code],al
5286
	mov	al,3Ah
5278
	mov	al,3Ah
5287
	jmp	sse_instruction
5279
	jmp	sse_instruction
5288
pclmulqdq_instruction:
5280
pclmulqdq_instruction:
5289
	mov	byte [value],al
5281
	mov	byte [value],al
5290
	mov	[mmx_size],16
5282
	mov	[mmx_size],16
5291
	mov	al,44h
5283
	mov	al,44h
5292
	jmp	sse4_instruction_3a_setup
5284
	jmp	sse4_instruction_3a_setup
5293
extractps_instruction:
5285
extractps_instruction:
5294
	mov	[opcode_prefix],66h
5286
	mov	[opcode_prefix],66h
5295
	mov	[base_code],0Fh
5287
	mov	[base_code],0Fh
5296
	mov	[extended_code],3Ah
5288
	mov	[extended_code],3Ah
5297
	mov	[supplemental_code],17h
5289
	mov	[supplemental_code],17h
5298
	lods	byte [esi]
5290
	lods	byte [esi]
5299
	call	get_size_operator
5291
	call	get_size_operator
5300
	cmp	al,10h
5292
	cmp	al,10h
5301
	je	extractps_reg
5293
	je	extractps_reg
5302
	cmp	al,'['
5294
	cmp	al,'['
5303
	jne	invalid_operand
5295
	jne	invalid_operand
5304
	call	get_address
5296
	call	get_address
5305
	cmp	[operand_size],4
5297
	cmp	[operand_size],4
5306
	je	extractps_size_ok
5298
	je	extractps_size_ok
5307
	cmp	[operand_size],0
5299
	cmp	[operand_size],0
5308
	jne	invalid_operand_size
5300
	jne	invalid_operand_size
5309
      extractps_size_ok:
5301
      extractps_size_ok:
5310
	push	edx ebx ecx
5302
	push	edx ebx ecx
5311
	mov	[operand_size],0
5303
	mov	[operand_size],0
5312
	lods	byte [esi]
5304
	lods	byte [esi]
5313
	cmp	al,','
5305
	cmp	al,','
5314
	jne	invalid_operand
5306
	jne	invalid_operand
5315
	lods	byte [esi]
5307
	lods	byte [esi]
5316
	call	get_size_operator
5308
	call	get_size_operator
5317
	cmp	al,10h
5309
	cmp	al,10h
5318
	jne	invalid_operand
5310
	jne	invalid_operand
5319
	lods	byte [esi]
5311
	lods	byte [esi]
5320
	call	convert_xmm_register
5312
	call	convert_xmm_register
5321
	mov	[postbyte_register],al
5313
	mov	[postbyte_register],al
5322
	pop	ecx ebx edx
5314
	pop	ecx ebx edx
5323
	jmp	mmx_imm8
5315
	jmp	mmx_imm8
5324
      extractps_reg:
5316
      extractps_reg:
5325
	lods	byte [esi]
5317
	lods	byte [esi]
5326
	call	convert_register
5318
	call	convert_register
5327
	push	eax
5319
	push	eax
5328
	mov	[operand_size],0
5320
	mov	[operand_size],0
5329
	lods	byte [esi]
5321
	lods	byte [esi]
5330
	cmp	al,','
5322
	cmp	al,','
5331
	jne	invalid_operand
5323
	jne	invalid_operand
5332
	lods	byte [esi]
5324
	lods	byte [esi]
5333
	call	get_size_operator
5325
	call	get_size_operator
5334
	cmp	al,10h
5326
	cmp	al,10h
5335
	jne	invalid_operand
5327
	jne	invalid_operand
5336
	lods	byte [esi]
5328
	lods	byte [esi]
5337
	call	convert_xmm_register
5329
	call	convert_xmm_register
5338
	mov	[postbyte_register],al
5330
	mov	[postbyte_register],al
5339
	pop	ebx
5331
	pop	ebx
5340
	mov	al,bh
5332
	mov	al,bh
5341
	cmp	al,4
5333
	cmp	al,4
5342
	je	mmx_nomem_imm8
5334
	je	mmx_nomem_imm8
5343
	cmp	al,8
5335
	cmp	al,8
5344
	jne	invalid_operand_size
5336
	jne	invalid_operand_size
5345
	call	operand_64bit
5337
	call	operand_64bit
5346
	jmp	mmx_nomem_imm8
5338
	jmp	mmx_nomem_imm8
5347
insertps_instruction:
5339
insertps_instruction:
5348
	lods	byte [esi]
5340
	lods	byte [esi]
5349
	call	get_size_operator
5341
	call	get_size_operator
5350
	cmp	al,10h
5342
	cmp	al,10h
5351
	jne	invalid_operand
5343
	jne	invalid_operand
5352
	lods	byte [esi]
5344
	lods	byte [esi]
5353
	call	convert_xmm_register
5345
	call	convert_xmm_register
5354
	mov	[postbyte_register],al
5346
	mov	[postbyte_register],al
5355
      insertps_xmmreg:
5347
      insertps_xmmreg:
5356
	mov	[opcode_prefix],66h
5348
	mov	[opcode_prefix],66h
5357
	mov	[base_code],0Fh
5349
	mov	[base_code],0Fh
5358
	mov	[extended_code],3Ah
5350
	mov	[extended_code],3Ah
5359
	mov	[supplemental_code],21h
5351
	mov	[supplemental_code],21h
5360
	mov	[operand_size],0
5352
	mov	[operand_size],0
5361
	lods	byte [esi]
5353
	lods	byte [esi]
5362
	cmp	al,','
5354
	cmp	al,','
5363
	jne	invalid_operand
5355
	jne	invalid_operand
5364
	lods	byte [esi]
5356
	lods	byte [esi]
5365
	call	get_size_operator
5357
	call	get_size_operator
5366
	cmp	al,10h
5358
	cmp	al,10h
5367
	je	insertps_xmmreg_reg
5359
	je	insertps_xmmreg_reg
5368
	cmp	al,'['
5360
	cmp	al,'['
5369
	jne	invalid_operand
5361
	jne	invalid_operand
5370
	call	get_address
5362
	call	get_address
5371
	cmp	[operand_size],4
5363
	cmp	[operand_size],4
5372
	je	insertps_size_ok
5364
	je	insertps_size_ok
5373
	cmp	[operand_size],0
5365
	cmp	[operand_size],0
5374
	jne	invalid_operand_size
5366
	jne	invalid_operand_size
5375
      insertps_size_ok:
5367
      insertps_size_ok:
5376
	jmp	mmx_imm8
5368
	jmp	mmx_imm8
5377
      insertps_xmmreg_reg:
5369
      insertps_xmmreg_reg:
5378
	lods	byte [esi]
5370
	lods	byte [esi]
5379
	call	convert_mmx_register
5371
	call	convert_mmx_register
5380
	mov	bl,al
5372
	mov	bl,al
5381
	jmp	mmx_nomem_imm8
5373
	jmp	mmx_nomem_imm8
5382
pextrq_instruction:
5374
pextrq_instruction:
5383
	mov	[mmx_size],8
5375
	mov	[mmx_size],8
5384
	jmp	pextr_instruction
5376
	jmp	pextr_instruction
5385
pextrd_instruction:
5377
pextrd_instruction:
5386
	mov	[mmx_size],4
5378
	mov	[mmx_size],4
5387
	jmp	pextr_instruction
5379
	jmp	pextr_instruction
5388
pextrw_instruction:
5380
pextrw_instruction:
5389
	mov	[mmx_size],2
5381
	mov	[mmx_size],2
5390
	jmp	pextr_instruction
5382
	jmp	pextr_instruction
5391
pextrb_instruction:
5383
pextrb_instruction:
5392
	mov	[mmx_size],1
5384
	mov	[mmx_size],1
5393
      pextr_instruction:
5385
      pextr_instruction:
5394
	mov	[opcode_prefix],66h
5386
	mov	[opcode_prefix],66h
5395
	mov	[base_code],0Fh
5387
	mov	[base_code],0Fh
5396
	mov	[extended_code],3Ah
5388
	mov	[extended_code],3Ah
5397
	mov	[supplemental_code],al
5389
	mov	[supplemental_code],al
5398
	lods	byte [esi]
5390
	lods	byte [esi]
5399
	call	get_size_operator
5391
	call	get_size_operator
5400
	cmp	al,10h
5392
	cmp	al,10h
5401
	je	pextr_reg
5393
	je	pextr_reg
5402
	cmp	al,'['
5394
	cmp	al,'['
5403
	jne	invalid_operand
5395
	jne	invalid_operand
5404
	call	get_address
5396
	call	get_address
5405
	mov	al,[mmx_size]
5397
	mov	al,[mmx_size]
5406
	cmp	al,[operand_size]
5398
	cmp	al,[operand_size]
5407
	je	pextr_size_ok
5399
	je	pextr_size_ok
5408
	cmp	[operand_size],0
5400
	cmp	[operand_size],0
5409
	jne	invalid_operand_size
5401
	jne	invalid_operand_size
5410
      pextr_size_ok:
5402
      pextr_size_ok:
5411
	cmp	al,8
5403
	cmp	al,8
5412
	jne	pextr_prefix_ok
5404
	jne	pextr_prefix_ok
5413
	call	operand_64bit
5405
	call	operand_64bit
5414
      pextr_prefix_ok:
5406
      pextr_prefix_ok:
5415
	push	edx ebx ecx
5407
	push	edx ebx ecx
5416
	mov	[operand_size],0
5408
	mov	[operand_size],0
5417
	lods	byte [esi]
5409
	lods	byte [esi]
5418
	cmp	al,','
5410
	cmp	al,','
5419
	jne	invalid_operand
5411
	jne	invalid_operand
5420
	lods	byte [esi]
5412
	lods	byte [esi]
5421
	call	get_size_operator
5413
	call	get_size_operator
5422
	cmp	al,10h
5414
	cmp	al,10h
5423
	jne	invalid_operand
5415
	jne	invalid_operand
5424
	lods	byte [esi]
5416
	lods	byte [esi]
5425
	call	convert_xmm_register
5417
	call	convert_xmm_register
5426
	mov	[postbyte_register],al
5418
	mov	[postbyte_register],al
5427
	pop	ecx ebx edx
5419
	pop	ecx ebx edx
5428
	jmp	mmx_imm8
5420
	jmp	mmx_imm8
5429
      pextr_reg:
5421
      pextr_reg:
5430
	lods	byte [esi]
5422
	lods	byte [esi]
5431
	call	convert_register
5423
	call	convert_register
5432
	cmp	[mmx_size],4
5424
	cmp	[mmx_size],4
5433
	ja	pextrq_reg
5425
	ja	pextrq_reg
5434
	cmp	ah,4
5426
	cmp	ah,4
5435
	je	pextr_reg_size_ok
5427
	je	pextr_reg_size_ok
5436
	cmp	[code_type],64
5428
	cmp	[code_type],64
5437
	jne	pextr_invalid_size
5429
	jne	pextr_invalid_size
5438
	cmp	ah,8
5430
	cmp	ah,8
5439
	je	pextr_reg_size_ok
5431
	je	pextr_reg_size_ok
5440
      pextr_invalid_size:
5432
      pextr_invalid_size:
5441
	jmp	invalid_operand_size
5433
	jmp	invalid_operand_size
5442
      pextrq_reg:
5434
      pextrq_reg:
5443
	cmp	ah,8
5435
	cmp	ah,8
5444
	jne	pextr_invalid_size
5436
	jne	pextr_invalid_size
5445
	call	operand_64bit
5437
	call	operand_64bit
5446
      pextr_reg_size_ok:
5438
      pextr_reg_size_ok:
5447
	mov	[operand_size],0
5439
	mov	[operand_size],0
5448
	push	eax
5440
	push	eax
5449
	lods	byte [esi]
5441
	lods	byte [esi]
5450
	cmp	al,','
5442
	cmp	al,','
5451
	jne	invalid_operand
5443
	jne	invalid_operand
5452
	lods	byte [esi]
5444
	lods	byte [esi]
5453
	call	get_size_operator
5445
	call	get_size_operator
5454
	cmp	al,10h
5446
	cmp	al,10h
5455
	jne	invalid_operand
5447
	jne	invalid_operand
5456
	lods	byte [esi]
5448
	lods	byte [esi]
5457
	call	convert_mmx_register
5449
	call	convert_mmx_register
5458
	mov	ebx,eax
5450
	mov	ebx,eax
5459
	pop	eax
5451
	pop	eax
5460
	mov	[postbyte_register],al
5452
	mov	[postbyte_register],al
5461
	mov	al,ah
5453
	mov	al,ah
5462
	cmp	[mmx_size],2
5454
	cmp	[mmx_size],2
5463
	jne	pextr_reg_store
5455
	jne	pextr_reg_store
5464
	mov	[opcode_prefix],0
5456
	mov	[opcode_prefix],0
5465
	mov	[extended_code],0C5h
5457
	mov	[extended_code],0C5h
5466
	call	make_mmx_prefix
5458
	call	make_mmx_prefix
5467
	jmp	mmx_nomem_imm8
5459
	jmp	mmx_nomem_imm8
5468
      pextr_reg_store:
5460
      pextr_reg_store:
5469
	cmp	bh,16
5461
	cmp	bh,16
5470
	jne	invalid_operand_size
5462
	jne	invalid_operand_size
5471
	xchg	bl,[postbyte_register]
5463
	xchg	bl,[postbyte_register]
5472
	call	operand_autodetect
5464
	call	operand_autodetect
5473
	jmp	mmx_nomem_imm8
5465
	jmp	mmx_nomem_imm8
5474
pinsrb_instruction:
5466
pinsrb_instruction:
5475
	mov	[mmx_size],1
5467
	mov	[mmx_size],1
5476
	jmp	pinsr_instruction
5468
	jmp	pinsr_instruction
5477
pinsrd_instruction:
5469
pinsrd_instruction:
5478
	mov	[mmx_size],4
5470
	mov	[mmx_size],4
5479
	jmp	pinsr_instruction
5471
	jmp	pinsr_instruction
5480
pinsrq_instruction:
5472
pinsrq_instruction:
5481
	mov	[mmx_size],8
5473
	mov	[mmx_size],8
5482
	call	operand_64bit
5474
	call	operand_64bit
5483
      pinsr_instruction:
5475
      pinsr_instruction:
5484
	mov	[opcode_prefix],66h
5476
	mov	[opcode_prefix],66h
5485
	mov	[base_code],0Fh
5477
	mov	[base_code],0Fh
5486
	mov	[extended_code],3Ah
5478
	mov	[extended_code],3Ah
5487
	mov	[supplemental_code],al
5479
	mov	[supplemental_code],al
5488
	lods	byte [esi]
5480
	lods	byte [esi]
5489
	call	get_size_operator
5481
	call	get_size_operator
5490
	cmp	al,10h
5482
	cmp	al,10h
5491
	jne	invalid_operand
5483
	jne	invalid_operand
5492
	lods	byte [esi]
5484
	lods	byte [esi]
5493
	call	convert_xmm_register
5485
	call	convert_xmm_register
5494
	mov	[postbyte_register],al
5486
	mov	[postbyte_register],al
5495
      pinsr_xmmreg:
5487
      pinsr_xmmreg:
5496
	mov	[operand_size],0
5488
	mov	[operand_size],0
5497
	lods	byte [esi]
5489
	lods	byte [esi]
5498
	cmp	al,','
5490
	cmp	al,','
5499
	jne	invalid_operand
5491
	jne	invalid_operand
5500
	lods	byte [esi]
5492
	lods	byte [esi]
5501
	call	get_size_operator
5493
	call	get_size_operator
5502
	cmp	al,10h
5494
	cmp	al,10h
5503
	je	pinsr_xmmreg_reg
5495
	je	pinsr_xmmreg_reg
5504
	cmp	al,'['
5496
	cmp	al,'['
5505
	jne	invalid_operand
5497
	jne	invalid_operand
5506
	call	get_address
5498
	call	get_address
5507
	cmp	[operand_size],0
5499
	cmp	[operand_size],0
5508
	je	mmx_imm8
5500
	je	mmx_imm8
5509
	mov	al,[mmx_size]
5501
	mov	al,[mmx_size]
5510
	cmp	al,[operand_size]
5502
	cmp	al,[operand_size]
5511
	je	mmx_imm8
5503
	je	mmx_imm8
5512
	jmp	invalid_operand_size
5504
	jmp	invalid_operand_size
5513
      pinsr_xmmreg_reg:
5505
      pinsr_xmmreg_reg:
5514
	lods	byte [esi]
5506
	lods	byte [esi]
5515
	call	convert_register
5507
	call	convert_register
5516
	mov	bl,al
5508
	mov	bl,al
5517
	cmp	[mmx_size],8
5509
	cmp	[mmx_size],8
5518
	je	pinsrq_xmmreg_reg
5510
	je	pinsrq_xmmreg_reg
5519
	cmp	ah,4
5511
	cmp	ah,4
5520
	je	mmx_nomem_imm8
5512
	je	mmx_nomem_imm8
5521
	jmp	invalid_operand_size
5513
	jmp	invalid_operand_size
5522
      pinsrq_xmmreg_reg:
5514
      pinsrq_xmmreg_reg:
5523
	cmp	ah,8
5515
	cmp	ah,8
5524
	je	mmx_nomem_imm8
5516
	je	mmx_nomem_imm8
5525
	jmp	invalid_operand_size
5517
	jmp	invalid_operand_size
5526
pmovsxbw_instruction:
5518
pmovsxbw_instruction:
5527
	mov	[mmx_size],8
5519
	mov	[mmx_size],8
5528
	jmp	pmovsx_instruction
5520
	jmp	pmovsx_instruction
5529
pmovsxbd_instruction:
5521
pmovsxbd_instruction:
5530
	mov	[mmx_size],4
5522
	mov	[mmx_size],4
5531
	jmp	pmovsx_instruction
5523
	jmp	pmovsx_instruction
5532
pmovsxbq_instruction:
5524
pmovsxbq_instruction:
5533
	mov	[mmx_size],2
5525
	mov	[mmx_size],2
5534
	jmp	pmovsx_instruction
5526
	jmp	pmovsx_instruction
5535
pmovsxwd_instruction:
5527
pmovsxwd_instruction:
5536
	mov	[mmx_size],8
5528
	mov	[mmx_size],8
5537
	jmp	pmovsx_instruction
5529
	jmp	pmovsx_instruction
5538
pmovsxwq_instruction:
5530
pmovsxwq_instruction:
5539
	mov	[mmx_size],4
5531
	mov	[mmx_size],4
5540
	jmp	pmovsx_instruction
5532
	jmp	pmovsx_instruction
5541
pmovsxdq_instruction:
5533
pmovsxdq_instruction:
5542
	mov	[mmx_size],8
5534
	mov	[mmx_size],8
5543
      pmovsx_instruction:
5535
      pmovsx_instruction:
5544
	mov	[opcode_prefix],66h
5536
	mov	[opcode_prefix],66h
5545
	mov	[base_code],0Fh
5537
	mov	[base_code],0Fh
5546
	mov	[extended_code],38h
5538
	mov	[extended_code],38h
5547
	mov	[supplemental_code],al
5539
	mov	[supplemental_code],al
5548
	lods	byte [esi]
5540
	lods	byte [esi]
5549
	call	get_size_operator
5541
	call	get_size_operator
5550
	cmp	al,10h
5542
	cmp	al,10h
5551
	jne	invalid_operand
5543
	jne	invalid_operand
5552
	lods	byte [esi]
5544
	lods	byte [esi]
5553
	call	convert_xmm_register
5545
	call	convert_xmm_register
5554
	mov	[postbyte_register],al
5546
	mov	[postbyte_register],al
5555
	lods	byte [esi]
5547
	lods	byte [esi]
5556
	cmp	al,','
5548
	cmp	al,','
5557
	jne	invalid_operand
5549
	jne	invalid_operand
5558
	mov	[operand_size],0
5550
	mov	[operand_size],0
5559
	lods	byte [esi]
5551
	lods	byte [esi]
5560
	call	get_size_operator
5552
	call	get_size_operator
5561
	cmp	al,10h
5553
	cmp	al,10h
5562
	je	pmovsx_xmmreg_reg
5554
	je	pmovsx_xmmreg_reg
5563
	cmp	al,'['
5555
	cmp	al,'['
5564
	jne	invalid_operand
5556
	jne	invalid_operand
5565
	call	get_address
5557
	call	get_address
5566
	cmp	[operand_size],0
5558
	cmp	[operand_size],0
5567
	je	instruction_ready
5559
	je	instruction_ready
5568
	mov	al,[mmx_size]
5560
	mov	al,[mmx_size]
5569
	cmp	al,[operand_size]
5561
	cmp	al,[operand_size]
5570
	jne	invalid_operand_size
5562
	jne	invalid_operand_size
5571
	jmp	instruction_ready
5563
	jmp	instruction_ready
5572
      pmovsx_xmmreg_reg:
5564
      pmovsx_xmmreg_reg:
5573
	lods	byte [esi]
5565
	lods	byte [esi]
5574
	call	convert_xmm_register
5566
	call	convert_xmm_register
5575
	mov	bl,al
5567
	mov	bl,al
5576
	jmp	nomem_instruction_ready
5568
	jmp	nomem_instruction_ready
5577
 
5569
 
5578
fxsave_instruction_64bit:
5570
fxsave_instruction_64bit:
5579
	call	operand_64bit
5571
	call	operand_64bit
5580
fxsave_instruction:
5572
fxsave_instruction:
5581
	mov	[extended_code],0AEh
5573
	mov	[extended_code],0AEh
5582
	mov	[base_code],0Fh
5574
	mov	[base_code],0Fh
5583
	mov	[postbyte_register],al
5575
	mov	[postbyte_register],al
5584
	lods	byte [esi]
5576
	lods	byte [esi]
5585
	call	get_size_operator
5577
	call	get_size_operator
5586
	cmp	al,'['
5578
	cmp	al,'['
5587
	jne	invalid_operand
5579
	jne	invalid_operand
5588
	call	get_address
5580
	call	get_address
5589
	mov	ah,[operand_size]
5581
	mov	ah,[operand_size]
5590
	or	ah,ah
5582
	or	ah,ah
5591
	jz	fxsave_size_ok
5583
	jz	fxsave_size_ok
5592
	mov	al,[postbyte_register]
5584
	mov	al,[postbyte_register]
5593
	cmp	al,111b
5585
	cmp	al,111b
5594
	je	clflush_size_check
5586
	je	clflush_size_check
5595
	cmp	al,10b
5587
	cmp	al,10b
5596
	jb	invalid_operand_size
5588
	jb	invalid_operand_size
5597
	cmp	al,11b
5589
	cmp	al,11b
5598
	ja	invalid_operand_size
5590
	ja	invalid_operand_size
5599
	cmp	ah,4
5591
	cmp	ah,4
5600
	jne	invalid_operand_size
5592
	jne	invalid_operand_size
5601
	jmp	fxsave_size_ok
5593
	jmp	fxsave_size_ok
5602
      clflush_size_check:
5594
      clflush_size_check:
5603
	cmp	ah,1
5595
	cmp	ah,1
5604
	jne	invalid_operand_size
5596
	jne	invalid_operand_size
5605
      fxsave_size_ok:
5597
      fxsave_size_ok:
5606
	jmp	instruction_ready
5598
	jmp	instruction_ready
5607
prefetch_instruction:
5599
prefetch_instruction:
5608
	mov	[extended_code],18h
5600
	mov	[extended_code],18h
5609
      prefetch_mem_8bit:
5601
      prefetch_mem_8bit:
5610
	mov	[base_code],0Fh
5602
	mov	[base_code],0Fh
5611
	mov	[postbyte_register],al
5603
	mov	[postbyte_register],al
5612
	lods	byte [esi]
5604
	lods	byte [esi]
5613
	call	get_size_operator
5605
	call	get_size_operator
5614
	cmp	al,'['
5606
	cmp	al,'['
5615
	jne	invalid_operand
5607
	jne	invalid_operand
5616
	or	ah,ah
5608
	or	ah,ah
5617
	jz	prefetch_size_ok
5609
	jz	prefetch_size_ok
5618
	cmp	ah,1
5610
	cmp	ah,1
5619
	jne	invalid_operand_size
5611
	jne	invalid_operand_size
5620
      prefetch_size_ok:
5612
      prefetch_size_ok:
5621
	call	get_address
5613
	call	get_address
5622
	jmp	instruction_ready
5614
	jmp	instruction_ready
5623
amd_prefetch_instruction:
5615
amd_prefetch_instruction:
5624
	mov	[extended_code],0Dh
5616
	mov	[extended_code],0Dh
5625
	jmp	prefetch_mem_8bit
5617
	jmp	prefetch_mem_8bit
5626
fence_instruction:
5618
fence_instruction:
5627
	mov	bl,al
5619
	mov	bl,al
5628
	mov	ax,0AE0Fh
5620
	mov	ax,0AE0Fh
5629
	stos	word [edi]
5621
	stos	word [edi]
5630
	mov	al,bl
5622
	mov	al,bl
5631
	stos	byte [edi]
5623
	stos	byte [edi]
5632
	jmp	instruction_assembled
5624
	jmp	instruction_assembled
5633
pause_instruction:
5625
pause_instruction:
5634
	mov	ax,90F3h
5626
	mov	ax,90F3h
5635
	stos	word [edi]
5627
	stos	word [edi]
5636
	jmp	instruction_assembled
5628
	jmp	instruction_assembled
5637
movntq_instruction:
5629
movntq_instruction:
5638
	mov	[mmx_size],8
5630
	mov	[mmx_size],8
5639
	jmp	movnt_instruction
5631
	jmp	movnt_instruction
5640
movntpd_instruction:
5632
movntpd_instruction:
5641
	mov	[opcode_prefix],66h
5633
	mov	[opcode_prefix],66h
5642
movntps_instruction:
5634
movntps_instruction:
5643
	mov	[mmx_size],16
5635
	mov	[mmx_size],16
5644
      movnt_instruction:
5636
      movnt_instruction:
5645
	mov	[extended_code],al
5637
	mov	[extended_code],al
5646
	mov	[base_code],0Fh
5638
	mov	[base_code],0Fh
5647
	lods	byte [esi]
5639
	lods	byte [esi]
5648
	call	get_size_operator
5640
	call	get_size_operator
5649
	cmp	al,'['
5641
	cmp	al,'['
5650
	jne	invalid_operand
5642
	jne	invalid_operand
5651
	call	get_address
5643
	call	get_address
5652
	lods	byte [esi]
5644
	lods	byte [esi]
5653
	cmp	al,','
5645
	cmp	al,','
5654
	jne	invalid_operand
5646
	jne	invalid_operand
5655
	lods	byte [esi]
5647
	lods	byte [esi]
5656
	call	get_size_operator
5648
	call	get_size_operator
5657
	cmp	al,10h
5649
	cmp	al,10h
5658
	jne	invalid_operand
5650
	jne	invalid_operand
5659
	lods	byte [esi]
5651
	lods	byte [esi]
5660
	call	convert_mmx_register
5652
	call	convert_mmx_register
5661
	cmp	ah,[mmx_size]
5653
	cmp	ah,[mmx_size]
5662
	jne	invalid_operand_size
5654
	jne	invalid_operand_size
5663
	mov	[postbyte_register],al
5655
	mov	[postbyte_register],al
5664
	jmp	instruction_ready
5656
	jmp	instruction_ready
5665
 
5657
 
5666
movntsd_instruction:
5658
movntsd_instruction:
5667
	mov	[opcode_prefix],0F2h
5659
	mov	[opcode_prefix],0F2h
5668
	mov	[mmx_size],8
5660
	mov	[mmx_size],8
5669
	jmp	movnts_instruction
5661
	jmp	movnts_instruction
5670
movntss_instruction:
5662
movntss_instruction:
5671
	mov	[opcode_prefix],0F3h
5663
	mov	[opcode_prefix],0F3h
5672
	mov	[mmx_size],4
5664
	mov	[mmx_size],4
5673
      movnts_instruction:
5665
      movnts_instruction:
5674
	mov	[extended_code],al
5666
	mov	[extended_code],al
5675
	mov	[base_code],0Fh
5667
	mov	[base_code],0Fh
5676
	lods	byte [esi]
5668
	lods	byte [esi]
5677
	call	get_size_operator
5669
	call	get_size_operator
5678
	cmp	al,'['
5670
	cmp	al,'['
5679
	jne	invalid_operand
5671
	jne	invalid_operand
5680
	call	get_address
5672
	call	get_address
5681
	mov	al,[operand_size]
5673
	mov	al,[operand_size]
5682
	cmp	al,[mmx_size]
5674
	cmp	al,[mmx_size]
5683
	je	movnts_size_ok
5675
	je	movnts_size_ok
5684
	test	al,al
5676
	test	al,al
5685
	jnz	invalid_operand_size
5677
	jnz	invalid_operand_size
5686
      movnts_size_ok:
5678
      movnts_size_ok:
5687
	lods	byte [esi]
5679
	lods	byte [esi]
5688
	cmp	al,','
5680
	cmp	al,','
5689
	jne	invalid_operand
5681
	jne	invalid_operand
5690
	mov	[operand_size],0
5682
	mov	[operand_size],0
5691
	lods	byte [esi]
5683
	lods	byte [esi]
5692
	call	get_size_operator
5684
	call	get_size_operator
5693
	cmp	al,10h
5685
	cmp	al,10h
5694
	jne	invalid_operand
5686
	jne	invalid_operand
5695
	lods	byte [esi]
5687
	lods	byte [esi]
5696
	call	convert_xmm_register
5688
	call	convert_xmm_register
5697
	mov	[postbyte_register],al
5689
	mov	[postbyte_register],al
5698
	jmp	instruction_ready
5690
	jmp	instruction_ready
5699
 
5691
 
5700
movnti_instruction:
5692
movnti_instruction:
5701
	mov	[base_code],0Fh
5693
	mov	[base_code],0Fh
5702
	mov	[extended_code],al
5694
	mov	[extended_code],al
5703
	lods	byte [esi]
5695
	lods	byte [esi]
5704
	call	get_size_operator
5696
	call	get_size_operator
5705
	cmp	al,'['
5697
	cmp	al,'['
5706
	jne	invalid_operand
5698
	jne	invalid_operand
5707
	call	get_address
5699
	call	get_address
5708
	lods	byte [esi]
5700
	lods	byte [esi]
5709
	cmp	al,','
5701
	cmp	al,','
5710
	jne	invalid_operand
5702
	jne	invalid_operand
5711
	lods	byte [esi]
5703
	lods	byte [esi]
5712
	call	get_size_operator
5704
	call	get_size_operator
5713
	cmp	al,10h
5705
	cmp	al,10h
5714
	jne	invalid_operand
5706
	jne	invalid_operand
5715
	lods	byte [esi]
5707
	lods	byte [esi]
5716
	call	convert_register
5708
	call	convert_register
5717
	cmp	ah,4
5709
	cmp	ah,4
5718
	je	movnti_store
5710
	je	movnti_store
5719
	cmp	ah,8
5711
	cmp	ah,8
5720
	jne	invalid_operand_size
5712
	jne	invalid_operand_size
5721
	call	operand_64bit
5713
	call	operand_64bit
5722
      movnti_store:
5714
      movnti_store:
5723
	mov	[postbyte_register],al
5715
	mov	[postbyte_register],al
5724
	jmp	instruction_ready
5716
	jmp	instruction_ready
5725
monitor_instruction:
5717
monitor_instruction:
5726
	mov	[postbyte_register],al
5718
	mov	[postbyte_register],al
5727
	cmp	byte [esi],0
5719
	cmp	byte [esi],0
5728
	je	monitor_instruction_store
5720
	je	monitor_instruction_store
5729
	cmp	byte [esi],0Fh
5721
	cmp	byte [esi],0Fh
5730
	je	monitor_instruction_store
5722
	je	monitor_instruction_store
5731
	lods	byte [esi]
5723
	lods	byte [esi]
5732
	call	get_size_operator
5724
	call	get_size_operator
5733
	cmp	al,10h
5725
	cmp	al,10h
5734
	jne	invalid_operand
5726
	jne	invalid_operand
5735
	lods	byte [esi]
5727
	lods	byte [esi]
5736
	call	convert_register
5728
	call	convert_register
5737
	cmp	ax,0400h
5729
	cmp	ax,0400h
5738
	jne	invalid_operand
5730
	jne	invalid_operand
5739
	lods	byte [esi]
5731
	lods	byte [esi]
5740
	cmp	al,','
5732
	cmp	al,','
5741
	jne	invalid_operand
5733
	jne	invalid_operand
5742
	lods	byte [esi]
5734
	lods	byte [esi]
5743
	call	get_size_operator
5735
	call	get_size_operator
5744
	cmp	al,10h
5736
	cmp	al,10h
5745
	jne	invalid_operand
5737
	jne	invalid_operand
5746
	lods	byte [esi]
5738
	lods	byte [esi]
5747
	call	convert_register
5739
	call	convert_register
5748
	cmp	ax,0401h
5740
	cmp	ax,0401h
5749
	jne	invalid_operand
5741
	jne	invalid_operand
5750
	cmp	[postbyte_register],0C8h
5742
	cmp	[postbyte_register],0C8h
5751
	jne	monitor_instruction_store
5743
	jne	monitor_instruction_store
5752
	lods	byte [esi]
5744
	lods	byte [esi]
5753
	cmp	al,','
5745
	cmp	al,','
5754
	jne	invalid_operand
5746
	jne	invalid_operand
5755
	lods	byte [esi]
5747
	lods	byte [esi]
5756
	call	get_size_operator
5748
	call	get_size_operator
5757
	cmp	al,10h
5749
	cmp	al,10h
5758
	jne	invalid_operand
5750
	jne	invalid_operand
5759
	lods	byte [esi]
5751
	lods	byte [esi]
5760
	call	convert_register
5752
	call	convert_register
5761
	cmp	ax,0402h
5753
	cmp	ax,0402h
5762
	jne	invalid_operand
5754
	jne	invalid_operand
5763
      monitor_instruction_store:
5755
      monitor_instruction_store:
5764
	mov	ax,010Fh
5756
	mov	ax,010Fh
5765
	stos	word [edi]
5757
	stos	word [edi]
5766
	mov	al,[postbyte_register]
5758
	mov	al,[postbyte_register]
5767
	stos	byte [edi]
5759
	stos	byte [edi]
5768
	jmp	instruction_assembled
5760
	jmp	instruction_assembled
5769
movntdqa_instruction:
5761
movntdqa_instruction:
5770
	mov	[opcode_prefix],66h
5762
	mov	[opcode_prefix],66h
5771
	mov	[base_code],0Fh
5763
	mov	[base_code],0Fh
5772
	mov	[extended_code],38h
5764
	mov	[extended_code],38h
5773
	mov	[supplemental_code],al
5765
	mov	[supplemental_code],al
5774
	lods	byte [esi]
5766
	lods	byte [esi]
5775
	call	get_size_operator
5767
	call	get_size_operator
5776
	cmp	al,10h
5768
	cmp	al,10h
5777
	jne	invalid_operand
5769
	jne	invalid_operand
5778
	lods	byte [esi]
5770
	lods	byte [esi]
5779
	call	convert_xmm_register
5771
	call	convert_xmm_register
5780
	mov	[postbyte_register],al
5772
	mov	[postbyte_register],al
5781
	lods	byte [esi]
5773
	lods	byte [esi]
5782
	cmp	al,','
5774
	cmp	al,','
5783
	jne	invalid_operand
5775
	jne	invalid_operand
5784
	lods	byte [esi]
5776
	lods	byte [esi]
5785
	call	get_size_operator
5777
	call	get_size_operator
5786
	cmp	al,'['
5778
	cmp	al,'['
5787
	jne	invalid_operand
5779
	jne	invalid_operand
5788
	call	get_address
5780
	call	get_address
5789
	jmp	instruction_ready
5781
	jmp	instruction_ready
5790
 
5782
 
5791
extrq_instruction:
5783
extrq_instruction:
5792
	mov	[opcode_prefix],66h
5784
	mov	[opcode_prefix],66h
5793
	mov	[base_code],0Fh
5785
	mov	[base_code],0Fh
5794
	mov	[extended_code],78h
5786
	mov	[extended_code],78h
5795
	lods	byte [esi]
5787
	lods	byte [esi]
5796
	call	get_size_operator
5788
	call	get_size_operator
5797
	cmp	al,10h
5789
	cmp	al,10h
5798
	jne	invalid_operand
5790
	jne	invalid_operand
5799
	lods	byte [esi]
5791
	lods	byte [esi]
5800
	call	convert_xmm_register
5792
	call	convert_xmm_register
5801
	mov	[postbyte_register],al
5793
	mov	[postbyte_register],al
5802
	mov	[operand_size],0
5794
	mov	[operand_size],0
5803
	lods	byte [esi]
5795
	lods	byte [esi]
5804
	cmp	al,','
5796
	cmp	al,','
5805
	jne	invalid_operand
5797
	jne	invalid_operand
5806
	lods	byte [esi]
5798
	lods	byte [esi]
5807
	call	get_size_operator
5799
	call	get_size_operator
5808
	cmp	al,10h
5800
	cmp	al,10h
5809
	je	extrq_xmmreg_xmmreg
5801
	je	extrq_xmmreg_xmmreg
5810
	test	ah,not 1
5802
	test	ah,not 1
5811
	jnz	invalid_operand_size
5803
	jnz	invalid_operand_size
5812
	cmp	al,'('
5804
	cmp	al,'('
5813
	jne	invalid_operand
5805
	jne	invalid_operand
5814
	xor	bl,bl
5806
	xor	bl,bl
5815
	xchg	bl,[postbyte_register]
5807
	xchg	bl,[postbyte_register]
5816
	call	store_nomem_instruction
5808
	call	store_nomem_instruction
5817
	call	get_byte_value
5809
	call	get_byte_value
5818
	stosb
5810
	stosb
5819
	call	append_imm8
5811
	call	append_imm8
5820
	jmp	instruction_assembled
5812
	jmp	instruction_assembled
5821
      extrq_xmmreg_xmmreg:
5813
      extrq_xmmreg_xmmreg:
5822
	inc	[extended_code]
5814
	inc	[extended_code]
5823
	lods	byte [esi]
5815
	lods	byte [esi]
5824
	call	convert_xmm_register
5816
	call	convert_xmm_register
5825
	mov	bl,al
5817
	mov	bl,al
5826
	jmp	nomem_instruction_ready
5818
	jmp	nomem_instruction_ready
5827
insertq_instruction:
5819
insertq_instruction:
5828
	mov	[opcode_prefix],0F2h
5820
	mov	[opcode_prefix],0F2h
5829
	mov	[base_code],0Fh
5821
	mov	[base_code],0Fh
5830
	mov	[extended_code],78h
5822
	mov	[extended_code],78h
5831
	lods	byte [esi]
5823
	lods	byte [esi]
5832
	call	get_size_operator
5824
	call	get_size_operator
5833
	cmp	al,10h
5825
	cmp	al,10h
5834
	jne	invalid_operand
5826
	jne	invalid_operand
5835
	lods	byte [esi]
5827
	lods	byte [esi]
5836
	call	convert_xmm_register
5828
	call	convert_xmm_register
5837
	mov	[postbyte_register],al
5829
	mov	[postbyte_register],al
5838
	mov	[operand_size],0
5830
	mov	[operand_size],0
5839
	lods	byte [esi]
5831
	lods	byte [esi]
5840
	cmp	al,','
5832
	cmp	al,','
5841
	jne	invalid_operand
5833
	jne	invalid_operand
5842
	lods	byte [esi]
5834
	lods	byte [esi]
5843
	call	get_size_operator
5835
	call	get_size_operator
5844
	cmp	al,10h
5836
	cmp	al,10h
5845
	jne	invalid_operand
5837
	jne	invalid_operand
5846
	lods	byte [esi]
5838
	lods	byte [esi]
5847
	call	convert_xmm_register
5839
	call	convert_xmm_register
5848
	mov	bl,al
5840
	mov	bl,al
5849
	cmp	byte [esi],','
5841
	cmp	byte [esi],','
5850
	je	insertq_with_imm
5842
	je	insertq_with_imm
5851
	inc	[extended_code]
5843
	inc	[extended_code]
5852
	jmp	nomem_instruction_ready
5844
	jmp	nomem_instruction_ready
5853
      insertq_with_imm:
5845
      insertq_with_imm:
5854
	call	store_nomem_instruction
5846
	call	store_nomem_instruction
5855
	call	append_imm8
5847
	call	append_imm8
5856
	call	append_imm8
5848
	call	append_imm8
5857
	jmp	instruction_assembled
5849
	jmp	instruction_assembled
5858
 
5850
 
5859
crc32_instruction:
5851
crc32_instruction:
5860
	mov	[opcode_prefix],0F2h
5852
	mov	[opcode_prefix],0F2h
5861
	mov	[base_code],0Fh
5853
	mov	[base_code],0Fh
5862
	mov	[extended_code],38h
5854
	mov	[extended_code],38h
5863
	mov	[supplemental_code],0F0h
5855
	mov	[supplemental_code],0F0h
5864
	lods	byte [esi]
5856
	lods	byte [esi]
5865
	call	get_size_operator
5857
	call	get_size_operator
5866
	cmp	al,10h
5858
	cmp	al,10h
5867
	jne	invalid_operand
5859
	jne	invalid_operand
5868
	lods	byte [esi]
5860
	lods	byte [esi]
5869
	call	convert_register
5861
	call	convert_register
5870
	mov	[postbyte_register],al
5862
	mov	[postbyte_register],al
5871
	cmp	ah,8
5863
	cmp	ah,8
5872
	je	crc32_reg64
5864
	je	crc32_reg64
5873
	cmp	ah,4
5865
	cmp	ah,4
5874
	jne	invalid_operand
5866
	jne	invalid_operand
5875
	lods	byte [esi]
5867
	lods	byte [esi]
5876
	cmp	al,','
5868
	cmp	al,','
5877
	jne	invalid_operand
5869
	jne	invalid_operand
5878
	mov	[operand_size],0
5870
	mov	[operand_size],0
5879
	lods	byte [esi]
5871
	lods	byte [esi]
5880
	call	get_size_operator
5872
	call	get_size_operator
5881
	cmp	al,10h
5873
	cmp	al,10h
5882
	je	crc32_reg32_reg
5874
	je	crc32_reg32_reg
5883
	cmp	al,'['
5875
	cmp	al,'['
5884
	jne	invalid_operand
5876
	jne	invalid_operand
5885
	call	get_address
5877
	call	get_address
5886
	mov	al,[operand_size]
5878
	mov	al,[operand_size]
5887
	test	al,al
5879
	test	al,al
5888
	jz	crc32_unknown_size
5880
	jz	crc32_unknown_size
5889
	cmp	al,1
5881
	cmp	al,1
5890
	je	crc32_reg32_mem_store
5882
	je	crc32_reg32_mem_store
5891
	cmp	al,4
5883
	cmp	al,4
5892
	ja	invalid_operand_size
5884
	ja	invalid_operand_size
5893
	inc	[supplemental_code]
5885
	inc	[supplemental_code]
5894
	call	operand_autodetect
5886
	call	operand_autodetect
5895
      crc32_reg32_mem_store:
5887
      crc32_reg32_mem_store:
5896
	jmp	instruction_ready
5888
	jmp	instruction_ready
5897
      crc32_unknown_size:
5889
      crc32_unknown_size:
5898
	call	recoverable_unknown_size
5890
	call	recoverable_unknown_size
5899
	jmp	crc32_reg32_mem_store
5891
	jmp	crc32_reg32_mem_store
5900
      crc32_reg32_reg:
5892
      crc32_reg32_reg:
5901
	lods	byte [esi]
5893
	lods	byte [esi]
5902
	call	convert_register
5894
	call	convert_register
5903
	mov	bl,al
5895
	mov	bl,al
5904
	mov	al,ah
5896
	mov	al,ah
5905
	cmp	al,1
5897
	cmp	al,1
5906
	je	crc32_reg32_reg_store
5898
	je	crc32_reg32_reg_store
5907
	cmp	al,4
5899
	cmp	al,4
5908
	ja	invalid_operand_size
5900
	ja	invalid_operand_size
5909
	inc	[supplemental_code]
5901
	inc	[supplemental_code]
5910
	call	operand_autodetect
5902
	call	operand_autodetect
5911
      crc32_reg32_reg_store:
5903
      crc32_reg32_reg_store:
5912
	jmp	nomem_instruction_ready
5904
	jmp	nomem_instruction_ready
5913
      crc32_reg64:
5905
      crc32_reg64:
5914
	lods	byte [esi]
5906
	lods	byte [esi]
5915
	cmp	al,','
5907
	cmp	al,','
5916
	jne	invalid_operand
5908
	jne	invalid_operand
5917
	mov	[operand_size],0
5909
	mov	[operand_size],0
5918
	call	operand_64bit
5910
	call	operand_64bit
5919
	lods	byte [esi]
5911
	lods	byte [esi]
5920
	call	get_size_operator
5912
	call	get_size_operator
5921
	cmp	al,10h
5913
	cmp	al,10h
5922
	je	crc32_reg64_reg
5914
	je	crc32_reg64_reg
5923
	cmp	al,'['
5915
	cmp	al,'['
5924
	jne	invalid_operand
5916
	jne	invalid_operand
5925
	call	get_address
5917
	call	get_address
5926
	mov	ah,[operand_size]
5918
	mov	ah,[operand_size]
5927
	mov	al,8
5919
	mov	al,8
5928
	test	ah,ah
5920
	test	ah,ah
5929
	jz	crc32_unknown_size
5921
	jz	crc32_unknown_size
5930
	cmp	ah,1
5922
	cmp	ah,1
5931
	je	crc32_reg32_mem_store
5923
	je	crc32_reg32_mem_store
5932
	cmp	ah,al
5924
	cmp	ah,al
5933
	jne	invalid_operand_size
5925
	jne	invalid_operand_size
5934
	inc	[supplemental_code]
5926
	inc	[supplemental_code]
5935
	jmp	crc32_reg32_mem_store
5927
	jmp	crc32_reg32_mem_store
5936
      crc32_reg64_reg:
5928
      crc32_reg64_reg:
5937
	lods	byte [esi]
5929
	lods	byte [esi]
5938
	call	convert_register
5930
	call	convert_register
5939
	mov	bl,al
5931
	mov	bl,al
5940
	mov	al,8
5932
	mov	al,8
5941
	cmp	ah,1
5933
	cmp	ah,1
5942
	je	crc32_reg32_reg_store
5934
	je	crc32_reg32_reg_store
5943
	cmp	ah,al
5935
	cmp	ah,al
5944
	jne	invalid_operand_size
5936
	jne	invalid_operand_size
5945
	inc	[supplemental_code]
5937
	inc	[supplemental_code]
5946
	jmp	crc32_reg32_reg_store
5938
	jmp	crc32_reg32_reg_store
5947
popcnt_instruction:
5939
popcnt_instruction:
5948
	mov	[opcode_prefix],0F3h
5940
	mov	[opcode_prefix],0F3h
5949
	jmp	bs_instruction
5941
	jmp	bs_instruction
5950
movbe_instruction:
5942
movbe_instruction:
5951
	mov	[supplemental_code],al
5943
	mov	[supplemental_code],al
5952
	mov	[extended_code],38h
5944
	mov	[extended_code],38h
5953
	mov	[base_code],0Fh
5945
	mov	[base_code],0Fh
5954
	lods	byte [esi]
5946
	lods	byte [esi]
5955
	call	get_size_operator
5947
	call	get_size_operator
5956
	cmp	al,'['
5948
	cmp	al,'['
5957
	je	movbe_mem
5949
	je	movbe_mem
5958
	cmp	al,10h
5950
	cmp	al,10h
5959
	jne	invalid_operand
5951
	jne	invalid_operand
5960
	lods	byte [esi]
5952
	lods	byte [esi]
5961
	call	convert_register
5953
	call	convert_register
5962
	mov	[postbyte_register],al
5954
	mov	[postbyte_register],al
5963
	lods	byte [esi]
5955
	lods	byte [esi]
5964
	cmp	al,','
5956
	cmp	al,','
5965
	jne	invalid_operand
5957
	jne	invalid_operand
5966
	lods	byte [esi]
5958
	lods	byte [esi]
5967
	call	get_size_operator
5959
	call	get_size_operator
5968
	cmp	al,'['
5960
	cmp	al,'['
5969
	jne	invalid_argument
5961
	jne	invalid_argument
5970
	call	get_address
5962
	call	get_address
5971
	mov	al,[operand_size]
5963
	mov	al,[operand_size]
5972
	call	operand_autodetect
5964
	call	operand_autodetect
5973
	jmp	instruction_ready
5965
	jmp	instruction_ready
5974
      movbe_mem:
5966
      movbe_mem:
5975
	inc	[supplemental_code]
5967
	inc	[supplemental_code]
5976
	call	get_address
5968
	call	get_address
5977
	push	edx ebx ecx
5969
	push	edx ebx ecx
5978
	lods	byte [esi]
5970
	lods	byte [esi]
5979
	cmp	al,','
5971
	cmp	al,','
5980
	jne	invalid_operand
5972
	jne	invalid_operand
5981
	lods	byte [esi]
5973
	lods	byte [esi]
5982
	call	get_size_operator
5974
	call	get_size_operator
5983
	cmp	al,10h
5975
	cmp	al,10h
5984
	jne	invalid_operand
5976
	jne	invalid_operand
5985
	lods	byte [esi]
5977
	lods	byte [esi]
5986
	call	convert_register
5978
	call	convert_register
5987
	mov	[postbyte_register],al
5979
	mov	[postbyte_register],al
5988
	pop	ecx ebx edx
5980
	pop	ecx ebx edx
5989
	mov	al,[operand_size]
5981
	mov	al,[operand_size]
5990
	call	operand_autodetect
5982
	call	operand_autodetect
5991
	jmp	instruction_ready
5983
	jmp	instruction_ready
5992
 
5984
 
5993
simple_vmx_instruction:
5985
simple_vmx_instruction:
5994
	mov	ah,al
5986
	mov	ah,al
5995
	mov	al,0Fh
5987
	mov	al,0Fh
5996
	stos	byte [edi]
5988
	stos	byte [edi]
5997
	mov	al,1
5989
	mov	al,1
5998
	stos	word [edi]
5990
	stos	word [edi]
5999
	jmp	instruction_assembled
5991
	jmp	instruction_assembled
6000
vmclear_instruction:
5992
vmclear_instruction:
6001
	mov	[opcode_prefix],66h
5993
	mov	[opcode_prefix],66h
6002
	jmp	vmx_instruction
5994
	jmp	vmx_instruction
6003
vmxon_instruction:
5995
vmxon_instruction:
6004
	mov	[opcode_prefix],0F3h
5996
	mov	[opcode_prefix],0F3h
6005
vmx_instruction:
5997
vmx_instruction:
6006
	mov	[postbyte_register],al
5998
	mov	[postbyte_register],al
6007
	mov	[extended_code],0C7h
5999
	mov	[extended_code],0C7h
6008
	lods	byte [esi]
6000
	lods	byte [esi]
6009
	call	get_size_operator
6001
	call	get_size_operator
6010
	cmp	al,'['
6002
	cmp	al,'['
6011
	jne	invalid_operand
6003
	jne	invalid_operand
6012
	call	get_address
6004
	call	get_address
6013
	mov	al,[operand_size]
6005
	mov	al,[operand_size]
6014
	or	al,al
6006
	or	al,al
6015
	jz	vmx_size_ok
6007
	jz	vmx_size_ok
6016
	cmp	al,8
6008
	cmp	al,8
6017
	jne	invalid_operand_size
6009
	jne	invalid_operand_size
6018
      vmx_size_ok:
6010
      vmx_size_ok:
6019
	mov	[base_code],0Fh
6011
	mov	[base_code],0Fh
6020
	jmp	instruction_ready
6012
	jmp	instruction_ready
6021
vmread_instruction:
6013
vmread_instruction:
6022
	mov	[extended_code],78h
6014
	mov	[extended_code],78h
6023
	lods	byte [esi]
6015
	lods	byte [esi]
6024
	call	get_size_operator
6016
	call	get_size_operator
6025
	cmp	al,10h
6017
	cmp	al,10h
6026
	je	vmread_nomem
6018
	je	vmread_nomem
6027
	cmp	al,'['
6019
	cmp	al,'['
6028
	jne	invalid_operand
6020
	jne	invalid_operand
6029
	call	get_address
6021
	call	get_address
6030
	lods	byte [esi]
6022
	lods	byte [esi]
6031
	cmp	al,','
6023
	cmp	al,','
6032
	jne	invalid_operand
6024
	jne	invalid_operand
6033
	lods	byte [esi]
6025
	lods	byte [esi]
6034
	call	get_size_operator
6026
	call	get_size_operator
6035
	cmp	al,10h
6027
	cmp	al,10h
6036
	jne	invalid_operand
6028
	jne	invalid_operand
6037
	lods	byte [esi]
6029
	lods	byte [esi]
6038
	call	convert_register
6030
	call	convert_register
6039
	mov	[postbyte_register],al
6031
	mov	[postbyte_register],al
6040
	call	vmread_check_size
6032
	call	vmread_check_size
6041
	jmp	vmx_size_ok
6033
	jmp	vmx_size_ok
6042
      vmread_nomem:
6034
      vmread_nomem:
6043
	lods	byte [esi]
6035
	lods	byte [esi]
6044
	call	convert_register
6036
	call	convert_register
6045
	push	eax
6037
	push	eax
6046
	call	vmread_check_size
6038
	call	vmread_check_size
6047
	lods	byte [esi]
6039
	lods	byte [esi]
6048
	cmp	al,','
6040
	cmp	al,','
6049
	jne	invalid_operand
6041
	jne	invalid_operand
6050
	lods	byte [esi]
6042
	lods	byte [esi]
6051
	call	get_size_operator
6043
	call	get_size_operator
6052
	cmp	al,10h
6044
	cmp	al,10h
6053
	jne	invalid_operand
6045
	jne	invalid_operand
6054
	lods	byte [esi]
6046
	lods	byte [esi]
6055
	call	convert_register
6047
	call	convert_register
6056
	mov	[postbyte_register],al
6048
	mov	[postbyte_register],al
6057
	call	vmread_check_size
6049
	call	vmread_check_size
6058
	pop	ebx
6050
	pop	ebx
6059
	mov	[base_code],0Fh
6051
	mov	[base_code],0Fh
6060
	jmp	nomem_instruction_ready
6052
	jmp	nomem_instruction_ready
6061
      vmread_check_size:
6053
      vmread_check_size:
6062
	cmp	[code_type],64
6054
	cmp	[code_type],64
6063
	je	vmread_long
6055
	je	vmread_long
6064
	cmp	[operand_size],4
6056
	cmp	[operand_size],4
6065
	jne	invalid_operand_size
6057
	jne	invalid_operand_size
6066
	ret
6058
	ret
6067
      vmread_long:
6059
      vmread_long:
6068
	cmp	[operand_size],8
6060
	cmp	[operand_size],8
6069
	jne	invalid_operand_size
6061
	jne	invalid_operand_size
6070
	ret
6062
	ret
6071
vmwrite_instruction:
6063
vmwrite_instruction:
6072
	mov	[extended_code],79h
6064
	mov	[extended_code],79h
6073
	lods	byte [esi]
6065
	lods	byte [esi]
6074
	call	get_size_operator
6066
	call	get_size_operator
6075
	cmp	al,10h
6067
	cmp	al,10h
6076
	jne	invalid_operand
6068
	jne	invalid_operand
6077
	lods	byte [esi]
6069
	lods	byte [esi]
6078
	call	convert_register
6070
	call	convert_register
6079
	mov	[postbyte_register],al
6071
	mov	[postbyte_register],al
6080
	lods	byte [esi]
6072
	lods	byte [esi]
6081
	cmp	al,','
6073
	cmp	al,','
6082
	jne	invalid_operand
6074
	jne	invalid_operand
6083
	lods	byte [esi]
6075
	lods	byte [esi]
6084
	call	get_size_operator
6076
	call	get_size_operator
6085
	cmp	al,10h
6077
	cmp	al,10h
6086
	je	vmwrite_nomem
6078
	je	vmwrite_nomem
6087
	cmp	al,'['
6079
	cmp	al,'['
6088
	jne	invalid_operand
6080
	jne	invalid_operand
6089
	call	get_address
6081
	call	get_address
6090
	call	vmread_check_size
6082
	call	vmread_check_size
6091
	jmp	vmx_size_ok
6083
	jmp	vmx_size_ok
6092
      vmwrite_nomem:
6084
      vmwrite_nomem:
6093
	lods	byte [esi]
6085
	lods	byte [esi]
6094
	call	convert_register
6086
	call	convert_register
6095
	mov	bl,al
6087
	mov	bl,al
6096
	mov	[base_code],0Fh
6088
	mov	[base_code],0Fh
6097
	jmp	nomem_instruction_ready
6089
	jmp	nomem_instruction_ready
6098
vmx_inv_instruction:
6090
vmx_inv_instruction:
6099
	mov	[opcode_prefix],66h
6091
	mov	[opcode_prefix],66h
6100
	mov	[extended_code],38h
6092
	mov	[extended_code],38h
6101
	mov	[supplemental_code],al
6093
	mov	[supplemental_code],al
6102
	lods	byte [esi]
6094
	lods	byte [esi]
6103
	call	get_size_operator
6095
	call	get_size_operator
6104
	cmp	al,10h
6096
	cmp	al,10h
6105
	jne	invalid_operand
6097
	jne	invalid_operand
6106
	lods	byte [esi]
6098
	lods	byte [esi]
6107
	call	convert_register
6099
	call	convert_register
6108
	mov	[postbyte_register],al
6100
	mov	[postbyte_register],al
6109
	call	vmread_check_size
6101
	call	vmread_check_size
6110
	mov	[operand_size],0
6102
	mov	[operand_size],0
6111
	lods	byte [esi]
6103
	lods	byte [esi]
6112
	cmp	al,','
6104
	cmp	al,','
6113
	jne	invalid_operand
6105
	jne	invalid_operand
6114
	lods	byte [esi]
6106
	lods	byte [esi]
6115
	call	get_size_operator
6107
	call	get_size_operator
6116
	cmp	al,'['
6108
	cmp	al,'['
6117
	jne	invalid_operand
6109
	jne	invalid_operand
6118
	call	get_address
6110
	call	get_address
6119
	mov	al,[operand_size]
6111
	mov	al,[operand_size]
6120
	or	al,al
6112
	or	al,al
6121
	jz	vmx_size_ok
6113
	jz	vmx_size_ok
6122
	cmp	al,16
6114
	cmp	al,16
6123
	jne	invalid_operand_size
6115
	jne	invalid_operand_size
6124
	jmp	vmx_size_ok
6116
	jmp	vmx_size_ok
6125
simple_svm_instruction:
6117
simple_svm_instruction:
6126
	push	eax
6118
	push	eax
6127
	mov	[base_code],0Fh
6119
	mov	[base_code],0Fh
6128
	mov	[extended_code],1
6120
	mov	[extended_code],1
6129
	lods	byte [esi]
6121
	lods	byte [esi]
6130
	call	get_size_operator
6122
	call	get_size_operator
6131
	cmp	al,10h
6123
	cmp	al,10h
6132
	jne	invalid_operand
6124
	jne	invalid_operand
6133
	lods	byte [esi]
6125
	lods	byte [esi]
6134
	call	convert_register
6126
	call	convert_register
6135
	or	al,al
6127
	or	al,al
6136
	jnz	invalid_operand
6128
	jnz	invalid_operand
6137
      simple_svm_detect_size:
6129
      simple_svm_detect_size:
6138
	cmp	ah,2
6130
	cmp	ah,2
6139
	je	simple_svm_16bit
6131
	je	simple_svm_16bit
6140
	cmp	ah,4
6132
	cmp	ah,4
6141
	je	simple_svm_32bit
6133
	je	simple_svm_32bit
6142
	cmp	[code_type],64
6134
	cmp	[code_type],64
6143
	jne	invalid_operand_size
6135
	jne	invalid_operand_size
6144
	jmp	simple_svm_store
6136
	jmp	simple_svm_store
6145
      simple_svm_16bit:
6137
      simple_svm_16bit:
6146
	cmp	[code_type],16
6138
	cmp	[code_type],16
6147
	je	simple_svm_store
6139
	je	simple_svm_store
6148
	cmp	[code_type],64
6140
	cmp	[code_type],64
6149
	je	invalid_operand_size
6141
	je	invalid_operand_size
6150
	jmp	prefixed_svm_store
6142
	jmp	prefixed_svm_store
6151
      simple_svm_32bit:
6143
      simple_svm_32bit:
6152
	cmp	[code_type],32
6144
	cmp	[code_type],32
6153
	je	simple_svm_store
6145
	je	simple_svm_store
6154
      prefixed_svm_store:
6146
      prefixed_svm_store:
6155
	mov	al,67h
6147
	mov	al,67h
6156
	stos	byte [edi]
6148
	stos	byte [edi]
6157
      simple_svm_store:
6149
      simple_svm_store:
6158
	call	store_instruction_code
6150
	call	store_instruction_code
6159
	pop	eax
6151
	pop	eax
6160
	stos	byte [edi]
6152
	stos	byte [edi]
6161
	jmp	instruction_assembled
6153
	jmp	instruction_assembled
6162
skinit_instruction:
6154
skinit_instruction:
6163
	lods	byte [esi]
6155
	lods	byte [esi]
6164
	call	get_size_operator
6156
	call	get_size_operator
6165
	cmp	al,10h
6157
	cmp	al,10h
6166
	jne	invalid_operand
6158
	jne	invalid_operand
6167
	lods	byte [esi]
6159
	lods	byte [esi]
6168
	call	convert_register
6160
	call	convert_register
6169
	cmp	ax,0400h
6161
	cmp	ax,0400h
6170
	jne	invalid_operand
6162
	jne	invalid_operand
6171
	mov	al,0DEh
6163
	mov	al,0DEh
6172
	jmp	simple_vmx_instruction
6164
	jmp	simple_vmx_instruction
6173
invlpga_instruction:
6165
invlpga_instruction:
6174
	push	eax
6166
	push	eax
6175
	mov	[base_code],0Fh
6167
	mov	[base_code],0Fh
6176
	mov	[extended_code],1
6168
	mov	[extended_code],1
6177
	lods	byte [esi]
6169
	lods	byte [esi]
6178
	call	get_size_operator
6170
	call	get_size_operator
6179
	cmp	al,10h
6171
	cmp	al,10h
6180
	jne	invalid_operand
6172
	jne	invalid_operand
6181
	lods	byte [esi]
6173
	lods	byte [esi]
6182
	call	convert_register
6174
	call	convert_register
6183
	or	al,al
6175
	or	al,al
6184
	jnz	invalid_operand
6176
	jnz	invalid_operand
6185
	mov	bl,ah
6177
	mov	bl,ah
6186
	mov	[operand_size],0
6178
	mov	[operand_size],0
6187
	lods	byte [esi]
6179
	lods	byte [esi]
6188
	cmp	al,','
6180
	cmp	al,','
6189
	jne	invalid_operand
6181
	jne	invalid_operand
6190
	lods	byte [esi]
6182
	lods	byte [esi]
6191
	call	get_size_operator
6183
	call	get_size_operator
6192
	cmp	al,10h
6184
	cmp	al,10h
6193
	jne	invalid_operand
6185
	jne	invalid_operand
6194
	lods	byte [esi]
6186
	lods	byte [esi]
6195
	call	convert_register
6187
	call	convert_register
6196
	cmp	ax,0401h
6188
	cmp	ax,0401h
6197
	jne	invalid_operand
6189
	jne	invalid_operand
6198
	mov	ah,bl
6190
	mov	ah,bl
6199
	jmp	simple_svm_detect_size
6191
	jmp	simple_svm_detect_size
6200
 
6192
 
6201
rdrand_instruction:
6193
rdrand_instruction:
6202
	mov	[base_code],0Fh
6194
	mov	[base_code],0Fh
6203
	mov	[extended_code],0C7h
6195
	mov	[extended_code],0C7h
6204
	mov	[postbyte_register],al
6196
	mov	[postbyte_register],al
6205
	lods	byte [esi]
6197
	lods	byte [esi]
6206
	call	get_size_operator
6198
	call	get_size_operator
6207
	cmp	al,10h
6199
	cmp	al,10h
6208
	jne	invalid_operand
6200
	jne	invalid_operand
6209
	lods	byte [esi]
6201
	lods	byte [esi]
6210
	call	convert_register
6202
	call	convert_register
6211
	mov	bl,al
6203
	mov	bl,al
6212
	mov	al,ah
6204
	mov	al,ah
6213
	call	operand_autodetect
6205
	call	operand_autodetect
6214
	jmp	nomem_instruction_ready
6206
	jmp	nomem_instruction_ready
6215
rdfsbase_instruction:
6207
rdfsbase_instruction:
6216
	cmp	[code_type],64
6208
	cmp	[code_type],64
6217
	jne	illegal_instruction
6209
	jne	illegal_instruction
6218
	mov	[opcode_prefix],0F3h
6210
	mov	[opcode_prefix],0F3h
6219
	mov	[base_code],0Fh
6211
	mov	[base_code],0Fh
6220
	mov	[extended_code],0AEh
6212
	mov	[extended_code],0AEh
6221
	mov	[postbyte_register],al
6213
	mov	[postbyte_register],al
6222
	lods	byte [esi]
6214
	lods	byte [esi]
6223
	call	get_size_operator
6215
	call	get_size_operator
6224
	cmp	al,10h
6216
	cmp	al,10h
6225
	jne	invalid_operand
6217
	jne	invalid_operand
6226
	lods	byte [esi]
6218
	lods	byte [esi]
6227
	call	convert_register
6219
	call	convert_register
6228
	mov	bl,al
6220
	mov	bl,al
6229
	mov	al,ah
6221
	mov	al,ah
6230
	cmp	ah,2
6222
	cmp	ah,2
6231
	je	invalid_operand_size
6223
	je	invalid_operand_size
6232
	call	operand_autodetect
6224
	call	operand_autodetect
6233
	jmp	nomem_instruction_ready
6225
	jmp	nomem_instruction_ready
6234
 
6226
 
6235
xabort_instruction:
6227
xabort_instruction:
6236
	lods	byte [esi]
6228
	lods	byte [esi]
6237
	call	get_size_operator
6229
	call	get_size_operator
6238
	cmp	ah,1
6230
	cmp	ah,1
6239
	ja	invalid_operand_size
6231
	ja	invalid_operand_size
6240
	cmp	al,'('
6232
	cmp	al,'('
6241
	jne	invalid_operand
6233
	jne	invalid_operand
6242
	call	get_byte_value
6234
	call	get_byte_value
6243
	mov	dl,al
6235
	mov	dl,al
6244
	mov	ax,0F8C6h
6236
	mov	ax,0F8C6h
6245
	stos	word [edi]
6237
	stos	word [edi]
6246
	mov	al,dl
6238
	mov	al,dl
6247
	stos	byte [edi]
6239
	stos	byte [edi]
6248
	jmp	instruction_assembled
6240
	jmp	instruction_assembled
6249
xbegin_instruction:
6241
xbegin_instruction:
6250
	lods	byte [esi]
6242
	lods	byte [esi]
6251
	cmp	al,'('
6243
	cmp	al,'('
6252
	jne	invalid_operand
6244
	jne	invalid_operand
6253
	mov	al,[code_type]
6245
	mov	al,[code_type]
6254
	cmp	al,64
6246
	cmp	al,64
6255
	je	xbegin_64bit
6247
	je	xbegin_64bit
6256
	cmp	al,32
6248
	cmp	al,32
6257
	je	xbegin_32bit
6249
	je	xbegin_32bit
6258
      xbegin_16bit:
6250
      xbegin_16bit:
6259
	call	get_address_word_value
6251
	call	get_address_word_value
6260
	add	edi,4
6252
	add	edi,4
6261
	call	calculate_relative_offset
6253
	call	calculate_relative_offset
6262
	sub	edi,4
6254
	sub	edi,4
6263
	shl	eax,16
6255
	shl	eax,16
6264
	mov	ax,0F8C7h
6256
	mov	ax,0F8C7h
6265
	stos	dword [edi]
6257
	stos	dword [edi]
6266
	jmp	instruction_assembled
6258
	jmp	instruction_assembled
6267
      xbegin_32bit:
6259
      xbegin_32bit:
6268
	call	get_address_dword_value
6260
	call	get_address_dword_value
6269
	jmp	xbegin_address_ok
6261
	jmp	xbegin_address_ok
6270
      xbegin_64bit:
6262
      xbegin_64bit:
6271
	call	get_address_qword_value
6263
	call	get_address_qword_value
6272
      xbegin_address_ok:
6264
      xbegin_address_ok:
6273
	add	edi,5
6265
	add	edi,5
6274
	call	calculate_relative_offset
6266
	call	calculate_relative_offset
6275
	sub	edi,5
6267
	sub	edi,5
6276
	mov	edx,eax
6268
	mov	edx,eax
6277
	cwde
6269
	cwde
6278
	cmp	eax,edx
6270
	cmp	eax,edx
6279
	jne	xbegin_rel32
6271
	jne	xbegin_rel32
6280
	mov	al,66h
6272
	mov	al,66h
6281
	stos	byte [edi]
6273
	stos	byte [edi]
6282
	mov	eax,edx
6274
	mov	eax,edx
6283
	shl	eax,16
6275
	shl	eax,16
6284
	mov	ax,0F8C7h
6276
	mov	ax,0F8C7h
6285
	stos	dword [edi]
6277
	stos	dword [edi]
6286
	jmp	instruction_assembled
6278
	jmp	instruction_assembled
6287
      xbegin_rel32:
6279
      xbegin_rel32:
6288
	sub	edx,1
6280
	sub	edx,1
6289
	jno	xbegin_rel32_ok
6281
	jno	xbegin_rel32_ok
6290
	cmp	[code_type],64
6282
	cmp	[code_type],64
6291
	je	relative_jump_out_of_range
6283
	je	relative_jump_out_of_range
6292
      xbegin_rel32_ok:
6284
      xbegin_rel32_ok:
6293
	mov	ax,0F8C7h
6285
	mov	ax,0F8C7h
6294
	stos	word [edi]
6286
	stos	word [edi]
6295
	mov	eax,edx
6287
	mov	eax,edx
6296
	stos	dword [edi]
6288
	stos	dword [edi]
6297
	jmp	instruction_assembled
6289
	jmp	instruction_assembled
6298
 
6290
 
6299
convert_register:
6291
convert_register:
6300
	mov	ah,al
6292
	mov	ah,al
6301
	shr	ah,4
6293
	shr	ah,4
6302
	and	al,0Fh
6294
	and	al,0Fh
6303
	cmp	ah,8
6295
	cmp	ah,8
6304
	je	match_register_size
6296
	je	match_register_size
6305
	cmp	ah,4
6297
	cmp	ah,4
6306
	ja	invalid_operand
6298
	ja	invalid_operand
6307
	cmp	ah,1
6299
	cmp	ah,1
6308
	ja	match_register_size
6300
	ja	match_register_size
6309
	cmp	al,4
6301
	cmp	al,4
6310
	jb	match_register_size
6302
	jb	match_register_size
6311
	or	ah,ah
6303
	or	ah,ah
6312
	jz	high_byte_register
6304
	jz	high_byte_register
6313
	or	[rex_prefix],40h
6305
	or	[rex_prefix],40h
6314
      match_register_size:
6306
      match_register_size:
6315
	cmp	ah,[operand_size]
6307
	cmp	ah,[operand_size]
6316
	je	register_size_ok
6308
	je	register_size_ok
6317
	cmp	[operand_size],0
6309
	cmp	[operand_size],0
6318
	jne	operand_sizes_do_not_match
6310
	jne	operand_sizes_do_not_match
6319
	mov	[operand_size],ah
6311
	mov	[operand_size],ah
6320
      register_size_ok:
6312
      register_size_ok:
6321
	ret
6313
	ret
6322
      high_byte_register:
6314
      high_byte_register:
6323
	mov	ah,1
6315
	mov	ah,1
6324
	or	[rex_prefix],80h
6316
	or	[rex_prefix],80h
6325
	jmp	match_register_size
6317
	jmp	match_register_size
6326
convert_fpu_register:
6318
convert_fpu_register:
6327
	mov	ah,al
6319
	mov	ah,al
6328
	shr	ah,4
6320
	shr	ah,4
6329
	and	al,111b
6321
	and	al,111b
6330
	cmp	ah,10
6322
	cmp	ah,10
6331
	jne	invalid_operand
6323
	jne	invalid_operand
6332
	jmp	match_register_size
6324
	jmp	match_register_size
6333
convert_mmx_register:
6325
convert_mmx_register:
6334
	mov	ah,al
6326
	mov	ah,al
6335
	shr	ah,4
6327
	shr	ah,4
6336
	cmp	ah,0Ch
6328
	cmp	ah,0Ch
6337
	je	xmm_register
6329
	je	xmm_register
6338
	ja	invalid_operand
6330
	ja	invalid_operand
6339
	and	al,111b
6331
	and	al,111b
6340
	cmp	ah,0Bh
6332
	cmp	ah,0Bh
6341
	jne	invalid_operand
6333
	jne	invalid_operand
6342
	mov	ah,8
6334
	mov	ah,8
6343
	cmp	[vex_required],0
6335
	cmp	[vex_required],0
6344
	jne	invalid_operand
6336
	jne	invalid_operand
6345
	jmp	match_register_size
6337
	jmp	match_register_size
6346
      xmm_register:
6338
      xmm_register:
6347
	and	al,0Fh
6339
	and	al,0Fh
6348
	mov	ah,16
6340
	mov	ah,16
6349
	cmp	al,8
6341
	cmp	al,8
6350
	jb	match_register_size
6342
	jb	match_register_size
6351
	cmp	[code_type],64
6343
	cmp	[code_type],64
6352
	jne	invalid_operand
6344
	jne	invalid_operand
6353
	jmp	match_register_size
6345
	jmp	match_register_size
6354
convert_xmm_register:
6346
convert_xmm_register:
6355
	mov	ah,al
6347
	mov	ah,al
6356
	shr	ah,4
6348
	shr	ah,4
6357
	cmp	ah,0Ch
6349
	cmp	ah,0Ch
6358
	je	xmm_register
6350
	je	xmm_register
6359
	jmp	invalid_operand
6351
	jmp	invalid_operand
6360
get_size_operator:
6352
get_size_operator:
6361
	xor	ah,ah
6353
	xor	ah,ah
6362
	cmp	al,11h
6354
	cmp	al,11h
6363
	jne	no_size_operator
6355
	jne	no_size_operator
6364
	mov	[size_declared],1
6356
	mov	[size_declared],1
6365
	lods	word [esi]
6357
	lods	word [esi]
6366
	xchg	al,ah
6358
	xchg	al,ah
6367
	mov	[size_override],1
6359
	mov	[size_override],1
6368
	cmp	ah,[operand_size]
6360
	cmp	ah,[operand_size]
6369
	je	size_operator_ok
6361
	je	size_operator_ok
6370
	cmp	[operand_size],0
6362
	cmp	[operand_size],0
6371
	jne	operand_sizes_do_not_match
6363
	jne	operand_sizes_do_not_match
6372
	mov	[operand_size],ah
6364
	mov	[operand_size],ah
6373
      size_operator_ok:
6365
      size_operator_ok:
6374
	ret
6366
	ret
6375
      no_size_operator:
6367
      no_size_operator:
6376
	mov	[size_declared],0
6368
	mov	[size_declared],0
6377
	cmp	al,'['
6369
	cmp	al,'['
6378
	jne	size_operator_ok
6370
	jne	size_operator_ok
6379
	mov	[size_override],0
6371
	mov	[size_override],0
6380
	ret
6372
	ret
6381
get_jump_operator:
6373
get_jump_operator:
6382
	mov	[jump_type],0
6374
	mov	[jump_type],0
6383
	cmp	al,12h
6375
	cmp	al,12h
6384
	jne	jump_operator_ok
6376
	jne	jump_operator_ok
6385
	lods	word [esi]
6377
	lods	word [esi]
6386
	mov	[jump_type],al
6378
	mov	[jump_type],al
6387
	mov	al,ah
6379
	mov	al,ah
6388
      jump_operator_ok:
6380
      jump_operator_ok:
6389
	ret
6381
	ret
6390
get_address:
6382
get_address:
6391
	mov	[segment_register],0
6383
	mov	[segment_register],0
6392
	mov	[address_size],0
6384
	mov	[address_size],0
6393
	mov	al,[code_type]
6385
	mov	al,[code_type]
6394
	shr	al,3
6386
	shr	al,3
6395
	mov	[value_size],al
6387
	mov	[value_size],al
6396
	mov	al,[esi]
6388
	mov	al,[esi]
6397
	and	al,11110000b
6389
	and	al,11110000b
6398
	cmp	al,60h
6390
	cmp	al,60h
6399
	jne	get_size_prefix
6391
	jne	get_size_prefix
6400
	lods	byte [esi]
6392
	lods	byte [esi]
6401
	sub	al,60h
6393
	sub	al,60h
6402
	mov	[segment_register],al
6394
	mov	[segment_register],al
6403
	mov	al,[esi]
6395
	mov	al,[esi]
6404
	and	al,11110000b
6396
	and	al,11110000b
6405
      get_size_prefix:
6397
      get_size_prefix:
6406
	cmp	al,70h
6398
	cmp	al,70h
6407
	jne	address_size_prefix_ok
6399
	jne	address_size_prefix_ok
6408
	lods	byte [esi]
6400
	lods	byte [esi]
6409
	sub	al,70h
6401
	sub	al,70h
6410
	cmp	al,2
6402
	cmp	al,2
6411
	jb	invalid_address_size
6403
	jb	invalid_address_size
6412
	cmp	al,8
6404
	cmp	al,8
6413
	ja	invalid_address_size
6405
	ja	invalid_address_size
6414
	mov	[address_size],al
6406
	mov	[address_size],al
6415
	mov	[value_size],al
6407
	mov	[value_size],al
6416
      address_size_prefix_ok:
6408
      address_size_prefix_ok:
6417
	call	calculate_address
6409
	call	calculate_address
6418
	cmp	byte [esi-1],']'
6410
	cmp	byte [esi-1],']'
6419
	jne	invalid_address
6411
	jne	invalid_address
6420
	mov	[address_high],edx
6412
	mov	[address_high],edx
6421
	mov	edx,eax
6413
	mov	edx,eax
6422
	cmp	[code_type],64
6414
	cmp	[code_type],64
6423
	jne	address_ok
6415
	jne	address_ok
6424
	or	bx,bx
6416
	or	bx,bx
6425
	jnz	address_ok
6417
	jnz	address_ok
6426
	test	ch,0Fh
6418
	test	ch,0Fh
6427
	jnz	address_ok
6419
	jnz	address_ok
6428
      calculate_relative_address:
6420
      calculate_relative_address:
6429
	mov	edx,[address_symbol]
6421
	mov	edx,[address_symbol]
6430
	mov	[symbol_identifier],edx
6422
	mov	[symbol_identifier],edx
6431
	mov	edx,[address_high]
6423
	mov	edx,[address_high]
6432
	call	calculate_relative_offset
6424
	call	calculate_relative_offset
6433
	mov	[address_high],edx
6425
	mov	[address_high],edx
6434
	cdq
6426
	cdq
6435
	cmp	edx,[address_high]
6427
	cmp	edx,[address_high]
6436
	je	address_high_ok
6428
	je	address_high_ok
6437
	call	recoverable_overflow
6429
	call	recoverable_overflow
6438
      address_high_ok:
6430
      address_high_ok:
6439
	mov	edx,eax
6431
	mov	edx,eax
6440
	ror	ecx,16
6432
	ror	ecx,16
6441
	mov	cl,[value_type]
6433
	mov	cl,[value_type]
6442
	rol	ecx,16
6434
	rol	ecx,16
6443
	mov	bx,0FF00h
6435
	mov	bx,0FF00h
6444
      address_ok:
6436
      address_ok:
6445
	ret
6437
	ret
6446
operand_16bit:
6438
operand_16bit:
6447
	cmp	[code_type],16
6439
	cmp	[code_type],16
6448
	je	size_prefix_ok
6440
	je	size_prefix_ok
6449
	mov	[operand_prefix],66h
6441
	mov	[operand_prefix],66h
6450
	ret
6442
	ret
6451
operand_32bit:
6443
operand_32bit:
6452
	cmp	[code_type],16
6444
	cmp	[code_type],16
6453
	jne	size_prefix_ok
6445
	jne	size_prefix_ok
6454
	mov	[operand_prefix],66h
6446
	mov	[operand_prefix],66h
6455
      size_prefix_ok:
6447
      size_prefix_ok:
6456
	ret
6448
	ret
6457
operand_64bit:
6449
operand_64bit:
6458
	cmp	[code_type],64
6450
	cmp	[code_type],64
6459
	jne	illegal_instruction
6451
	jne	illegal_instruction
6460
	or	[rex_prefix],48h
6452
	or	[rex_prefix],48h
6461
	ret
6453
	ret
6462
operand_autodetect:
6454
operand_autodetect:
6463
	cmp	al,2
6455
	cmp	al,2
6464
	je	operand_16bit
6456
	je	operand_16bit
6465
	cmp	al,4
6457
	cmp	al,4
6466
	je	operand_32bit
6458
	je	operand_32bit
6467
	cmp	al,8
6459
	cmp	al,8
6468
	je	operand_64bit
6460
	je	operand_64bit
6469
	jmp	invalid_operand_size
6461
	jmp	invalid_operand_size
6470
store_segment_prefix_if_necessary:
6462
store_segment_prefix_if_necessary:
6471
	mov	al,[segment_register]
6463
	mov	al,[segment_register]
6472
	or	al,al
6464
	or	al,al
6473
	jz	segment_prefix_ok
6465
	jz	segment_prefix_ok
6474
	cmp	al,4
6466
	cmp	al,4
6475
	ja	segment_prefix_386
6467
	ja	segment_prefix_386
6476
	cmp	[code_type],64
6468
	cmp	[code_type],64
6477
	je	segment_prefix_ok
6469
	je	segment_prefix_ok
6478
	cmp	al,3
6470
	cmp	al,3
6479
	je	ss_prefix
6471
	je	ss_prefix
6480
	jb	segment_prefix_86
6472
	jb	segment_prefix_86
6481
	cmp	bl,25h
6473
	cmp	bl,25h
6482
	je	segment_prefix_86
6474
	je	segment_prefix_86
6483
	cmp	bh,25h
6475
	cmp	bh,25h
6484
	je	segment_prefix_86
6476
	je	segment_prefix_86
6485
	cmp	bh,45h
6477
	cmp	bh,45h
6486
	je	segment_prefix_86
6478
	je	segment_prefix_86
6487
	cmp	bh,44h
6479
	cmp	bh,44h
6488
	je	segment_prefix_86
6480
	je	segment_prefix_86
6489
	ret
6481
	ret
6490
      ss_prefix:
6482
      ss_prefix:
6491
	cmp	bl,25h
6483
	cmp	bl,25h
6492
	je	segment_prefix_ok
6484
	je	segment_prefix_ok
6493
	cmp	bh,25h
6485
	cmp	bh,25h
6494
	je	segment_prefix_ok
6486
	je	segment_prefix_ok
6495
	cmp	bh,45h
6487
	cmp	bh,45h
6496
	je	segment_prefix_ok
6488
	je	segment_prefix_ok
6497
	cmp	bh,44h
6489
	cmp	bh,44h
6498
	je	segment_prefix_ok
6490
	je	segment_prefix_ok
6499
	jmp	segment_prefix_86
6491
	jmp	segment_prefix_86
6500
store_segment_prefix:
6492
store_segment_prefix:
6501
	mov	al,[segment_register]
6493
	mov	al,[segment_register]
6502
	or	al,al
6494
	or	al,al
6503
	jz	segment_prefix_ok
6495
	jz	segment_prefix_ok
6504
	cmp	al,5
6496
	cmp	al,5
6505
	jae	segment_prefix_386
6497
	jae	segment_prefix_386
6506
      segment_prefix_86:
6498
      segment_prefix_86:
6507
	dec	al
6499
	dec	al
6508
	shl	al,3
6500
	shl	al,3
6509
	add	al,26h
6501
	add	al,26h
6510
	stos	byte [edi]
6502
	stos	byte [edi]
6511
	jmp	segment_prefix_ok
6503
	jmp	segment_prefix_ok
6512
      segment_prefix_386:
6504
      segment_prefix_386:
6513
	add	al,64h-5
6505
	add	al,64h-5
6514
	stos	byte [edi]
6506
	stos	byte [edi]
6515
      segment_prefix_ok:
6507
      segment_prefix_ok:
6516
	ret
6508
	ret
6517
store_instruction_code:
6509
store_instruction_code:
6518
	cmp	[vex_required],0
6510
	cmp	[vex_required],0
6519
	jne	store_vex_instruction_code
6511
	jne	store_vex_instruction_code
6520
	mov	al,[operand_prefix]
6512
	mov	al,[operand_prefix]
6521
	or	al,al
6513
	or	al,al
6522
	jz	operand_prefix_ok
6514
	jz	operand_prefix_ok
6523
	stos	byte [edi]
6515
	stos	byte [edi]
6524
      operand_prefix_ok:
6516
      operand_prefix_ok:
6525
	mov	al,[opcode_prefix]
6517
	mov	al,[opcode_prefix]
6526
	or	al,al
6518
	or	al,al
6527
	jz	opcode_prefix_ok
6519
	jz	opcode_prefix_ok
6528
	stos	byte [edi]
6520
	stos	byte [edi]
6529
      opcode_prefix_ok:
6521
      opcode_prefix_ok:
6530
	mov	al,[rex_prefix]
6522
	mov	al,[rex_prefix]
6531
	test	al,40h
6523
	test	al,40h
6532
	jz	rex_prefix_ok
6524
	jz	rex_prefix_ok
6533
	cmp	[code_type],64
6525
	cmp	[code_type],64
6534
	jne	invalid_operand
6526
	jne	invalid_operand
6535
	test	al,0B0h
6527
	test	al,0B0h
6536
	jnz	disallowed_combination_of_registers
6528
	jnz	disallowed_combination_of_registers
6537
	stos	byte [edi]
6529
	stos	byte [edi]
6538
      rex_prefix_ok:
6530
      rex_prefix_ok:
6539
	mov	al,[base_code]
6531
	mov	al,[base_code]
6540
	stos	byte [edi]
6532
	stos	byte [edi]
6541
	cmp	al,0Fh
6533
	cmp	al,0Fh
6542
	jne	instruction_code_ok
6534
	jne	instruction_code_ok
6543
      store_extended_code:
6535
      store_extended_code:
6544
	mov	al,[extended_code]
6536
	mov	al,[extended_code]
6545
	stos	byte [edi]
6537
	stos	byte [edi]
6546
	cmp	al,38h
6538
	cmp	al,38h
6547
	je	store_supplemental_code
6539
	je	store_supplemental_code
6548
	cmp	al,3Ah
6540
	cmp	al,3Ah
6549
	je	store_supplemental_code
6541
	je	store_supplemental_code
6550
      instruction_code_ok:
6542
      instruction_code_ok:
6551
	ret
6543
	ret
6552
      store_supplemental_code:
6544
      store_supplemental_code:
6553
	mov	al,[supplemental_code]
6545
	mov	al,[supplemental_code]
6554
	stos	byte [edi]
6546
	stos	byte [edi]
6555
	ret
6547
	ret
6556
store_nomem_instruction:
6548
store_nomem_instruction:
6557
	test	[postbyte_register],1000b
6549
	test	[postbyte_register],1000b
6558
	jz	nomem_reg_code_ok
6550
	jz	nomem_reg_code_ok
6559
	or	[rex_prefix],44h
6551
	or	[rex_prefix],44h
6560
	and	[postbyte_register],111b
6552
	and	[postbyte_register],111b
6561
      nomem_reg_code_ok:
6553
      nomem_reg_code_ok:
6562
	test	bl,1000b
6554
	test	bl,1000b
6563
	jz	nomem_rm_code_ok
6555
	jz	nomem_rm_code_ok
6564
	or	[rex_prefix],41h
6556
	or	[rex_prefix],41h
6565
	and	bl,111b
6557
	and	bl,111b
6566
      nomem_rm_code_ok:
6558
      nomem_rm_code_ok:
6567
	call	store_instruction_code
6559
	call	store_instruction_code
6568
	mov	al,[postbyte_register]
6560
	mov	al,[postbyte_register]
6569
	shl	al,3
6561
	shl	al,3
6570
	or	al,bl
6562
	or	al,bl
6571
	or	al,11000000b
6563
	or	al,11000000b
6572
	stos	byte [edi]
6564
	stos	byte [edi]
6573
	ret
6565
	ret
6574
store_instruction:
6566
store_instruction:
6575
	mov	[current_offset],edi
6567
	mov	[current_offset],edi
6576
	test	[postbyte_register],1000b
6568
	test	[postbyte_register],1000b
6577
	jz	reg_code_ok
6569
	jz	reg_code_ok
6578
	or	[rex_prefix],44h
6570
	or	[rex_prefix],44h
6579
	and	[postbyte_register],111b
6571
	and	[postbyte_register],111b
6580
      reg_code_ok:
6572
      reg_code_ok:
6581
	cmp	[code_type],64
6573
	cmp	[code_type],64
6582
	jne	address_value_ok
6574
	jne	address_value_ok
6583
	xor	eax,eax
6575
	xor	eax,eax
6584
	bt	edx,31
6576
	bt	edx,31
6585
	sbb	eax,[address_high]
6577
	sbb	eax,[address_high]
6586
	jz	address_value_ok
6578
	jz	address_value_ok
6587
	cmp	[address_high],0
6579
	cmp	[address_high],0
6588
	jne	address_value_out_of_range
6580
	jne	address_value_out_of_range
6589
	test	ch,44h
6581
	test	ch,44h
6590
	jnz	address_value_ok
6582
	jnz	address_value_ok
6591
	test	bx,8080h
6583
	test	bx,8080h
6592
	jz	address_value_ok
6584
	jz	address_value_ok
6593
      address_value_out_of_range:
6585
      address_value_out_of_range:
6594
	call	recoverable_overflow
6586
	call	recoverable_overflow
6595
      address_value_ok:
6587
      address_value_ok:
6596
	call	store_segment_prefix_if_necessary
6588
	call	store_segment_prefix_if_necessary
6597
	test	[vex_required],4
6589
	test	[vex_required],4
6598
	jnz	address_vsib
6590
	jnz	address_vsib
6599
	or	bx,bx
6591
	or	bx,bx
6600
	jz	address_immediate
6592
	jz	address_immediate
6601
	cmp	bx,0F800h
6593
	cmp	bx,0F800h
6602
	je	address_rip_based
6594
	je	address_rip_based
6603
	cmp	bx,0F400h
6595
	cmp	bx,0F400h
6604
	je	address_eip_based
6596
	je	address_eip_based
6605
	cmp	bx,0FF00h
6597
	cmp	bx,0FF00h
6606
	je	address_relative
6598
	je	address_relative
6607
	mov	al,bl
6599
	mov	al,bl
6608
	or	al,bh
6600
	or	al,bh
6609
	and	al,11110000b
6601
	and	al,11110000b
6610
	cmp	al,80h
6602
	cmp	al,80h
6611
	je	postbyte_64bit
6603
	je	postbyte_64bit
6612
	cmp	al,40h
6604
	cmp	al,40h
6613
	je	postbyte_32bit
6605
	je	postbyte_32bit
6614
	cmp	al,20h
6606
	cmp	al,20h
6615
	jne	invalid_address
6607
	jne	invalid_address
6616
	cmp	[code_type],64
6608
	cmp	[code_type],64
6617
	je	invalid_address_size
6609
	je	invalid_address_size
6618
	call	address_16bit_prefix
6610
	call	address_16bit_prefix
6619
	call	store_instruction_code
6611
	call	store_instruction_code
6620
	cmp	bl,bh
6612
	cmp	bl,bh
6621
	jbe	determine_16bit_address
6613
	jbe	determine_16bit_address
6622
	xchg	bl,bh
6614
	xchg	bl,bh
6623
      determine_16bit_address:
6615
      determine_16bit_address:
6624
	cmp	bx,2600h
6616
	cmp	bx,2600h
6625
	je	address_si
6617
	je	address_si
6626
	cmp	bx,2700h
6618
	cmp	bx,2700h
6627
	je	address_di
6619
	je	address_di
6628
	cmp	bx,2300h
6620
	cmp	bx,2300h
6629
	je	address_bx
6621
	je	address_bx
6630
	cmp	bx,2500h
6622
	cmp	bx,2500h
6631
	je	address_bp
6623
	je	address_bp
6632
	cmp	bx,2625h
6624
	cmp	bx,2625h
6633
	je	address_bp_si
6625
	je	address_bp_si
6634
	cmp	bx,2725h
6626
	cmp	bx,2725h
6635
	je	address_bp_di
6627
	je	address_bp_di
6636
	cmp	bx,2723h
6628
	cmp	bx,2723h
6637
	je	address_bx_di
6629
	je	address_bx_di
6638
	cmp	bx,2623h
6630
	cmp	bx,2623h
6639
	jne	invalid_address
6631
	jne	invalid_address
6640
      address_bx_si:
6632
      address_bx_si:
6641
	xor	al,al
6633
	xor	al,al
6642
	jmp	postbyte_16bit
6634
	jmp	postbyte_16bit
6643
      address_bx_di:
6635
      address_bx_di:
6644
	mov	al,1
6636
	mov	al,1
6645
	jmp	postbyte_16bit
6637
	jmp	postbyte_16bit
6646
      address_bp_si:
6638
      address_bp_si:
6647
	mov	al,10b
6639
	mov	al,10b
6648
	jmp	postbyte_16bit
6640
	jmp	postbyte_16bit
6649
      address_bp_di:
6641
      address_bp_di:
6650
	mov	al,11b
6642
	mov	al,11b
6651
	jmp	postbyte_16bit
6643
	jmp	postbyte_16bit
6652
      address_si:
6644
      address_si:
6653
	mov	al,100b
6645
	mov	al,100b
6654
	jmp	postbyte_16bit
6646
	jmp	postbyte_16bit
6655
      address_di:
6647
      address_di:
6656
	mov	al,101b
6648
	mov	al,101b
6657
	jmp	postbyte_16bit
6649
	jmp	postbyte_16bit
6658
      address_bx:
6650
      address_bx:
6659
	mov	al,111b
6651
	mov	al,111b
6660
	jmp	postbyte_16bit
6652
	jmp	postbyte_16bit
6661
      address_bp:
6653
      address_bp:
6662
	mov	al,110b
6654
	mov	al,110b
6663
      postbyte_16bit:
6655
      postbyte_16bit:
6664
	test	ch,22h
6656
	test	ch,22h
6665
	jnz	address_16bit_value
6657
	jnz	address_16bit_value
6666
	or	ch,ch
6658
	or	ch,ch
6667
	jnz	address_sizes_do_not_agree
6659
	jnz	address_sizes_do_not_agree
6668
	cmp	edx,10000h
6660
	cmp	edx,10000h
6669
	jge	value_out_of_range
6661
	jge	value_out_of_range
6670
	cmp	edx,-8000h
6662
	cmp	edx,-8000h
6671
	jl	value_out_of_range
6663
	jl	value_out_of_range
6672
	or	dx,dx
6664
	or	dx,dx
6673
	jz	address
6665
	jz	address
6674
	cmp	dx,80h
6666
	cmp	dx,80h
6675
	jb	address_8bit_value
6667
	jb	address_8bit_value
6676
	cmp	dx,-80h
6668
	cmp	dx,-80h
6677
	jae	address_8bit_value
6669
	jae	address_8bit_value
6678
      address_16bit_value:
6670
      address_16bit_value:
6679
	or	al,10000000b
6671
	or	al,10000000b
6680
	mov	cl,[postbyte_register]
6672
	mov	cl,[postbyte_register]
6681
	shl	cl,3
6673
	shl	cl,3
6682
	or	al,cl
6674
	or	al,cl
6683
	stos	byte [edi]
6675
	stos	byte [edi]
6684
	mov	eax,edx
6676
	mov	eax,edx
6685
	stos	word [edi]
6677
	stos	word [edi]
6686
	ret
6678
	ret
6687
      address_8bit_value:
6679
      address_8bit_value:
6688
	or	al,01000000b
6680
	or	al,01000000b
6689
	mov	cl,[postbyte_register]
6681
	mov	cl,[postbyte_register]
6690
	shl	cl,3
6682
	shl	cl,3
6691
	or	al,cl
6683
	or	al,cl
6692
	stos	byte [edi]
6684
	stos	byte [edi]
6693
	mov	al,dl
6685
	mov	al,dl
6694
	stos	byte [edi]
6686
	stos	byte [edi]
6695
	cmp	dx,80h
6687
	cmp	dx,80h
6696
	jge	value_out_of_range
6688
	jge	value_out_of_range
6697
	cmp	dx,-80h
6689
	cmp	dx,-80h
6698
	jl	value_out_of_range
6690
	jl	value_out_of_range
6699
	ret
6691
	ret
6700
      address:
6692
      address:
6701
	cmp	al,110b
6693
	cmp	al,110b
6702
	je	address_8bit_value
6694
	je	address_8bit_value
6703
	mov	cl,[postbyte_register]
6695
	mov	cl,[postbyte_register]
6704
	shl	cl,3
6696
	shl	cl,3
6705
	or	al,cl
6697
	or	al,cl
6706
	stos	byte [edi]
6698
	stos	byte [edi]
6707
	ret
6699
	ret
6708
      address_vsib:
6700
      address_vsib:
6709
	mov	al,bl
6701
	mov	al,bl
6710
	shr	al,4
6702
	shr	al,4
6711
	cmp	al,0Ch
6703
	cmp	al,0Ch
6712
	je	vector_index_ok
6704
	je	vector_index_ok
6713
	cmp	al,0Dh
6705
	cmp	al,0Dh
6714
	jne	invalid_address
6706
	jne	invalid_address
6715
      vector_index_ok:
6707
      vector_index_ok:
6716
	mov	al,bh
6708
	mov	al,bh
6717
	shr	al,4
6709
	shr	al,4
6718
	cmp	al,4
6710
	cmp	al,4
6719
	je	postbyte_32bit
6711
	je	postbyte_32bit
6720
	cmp	[code_type],64
6712
	cmp	[code_type],64
6721
	je	address_prefix_ok
6713
	je	address_prefix_ok
6722
	test	al,al
6714
	test	al,al
6723
	jnz	invalid_address
6715
	jnz	invalid_address
6724
      postbyte_32bit:
6716
      postbyte_32bit:
6725
	call	address_32bit_prefix
6717
	call	address_32bit_prefix
6726
	jmp	address_prefix_ok
6718
	jmp	address_prefix_ok
6727
      postbyte_64bit:
6719
      postbyte_64bit:
6728
	cmp	[code_type],64
6720
	cmp	[code_type],64
6729
	jne	invalid_address_size
6721
	jne	invalid_address_size
6730
      address_prefix_ok:
6722
      address_prefix_ok:
6731
	cmp	bl,44h
6723
	cmp	bl,44h
6732
	je	invalid_address
6724
	je	invalid_address
6733
	cmp	bl,84h
6725
	cmp	bl,84h
6734
	je	invalid_address
6726
	je	invalid_address
6735
	test	bh,1000b
6727
	test	bh,1000b
6736
	jz	base_code_ok
6728
	jz	base_code_ok
6737
	or	[rex_prefix],41h
6729
	or	[rex_prefix],41h
6738
      base_code_ok:
6730
      base_code_ok:
6739
	test	bl,1000b
6731
	test	bl,1000b
6740
	jz	index_code_ok
6732
	jz	index_code_ok
6741
	or	[rex_prefix],42h
6733
	or	[rex_prefix],42h
6742
      index_code_ok:
6734
      index_code_ok:
6743
	call	store_instruction_code
6735
	call	store_instruction_code
6744
	or	cl,cl
6736
	or	cl,cl
6745
	jz	only_base_register
6737
	jz	only_base_register
6746
      base_and_index:
6738
      base_and_index:
6747
	mov	al,100b
6739
	mov	al,100b
6748
	xor	ah,ah
6740
	xor	ah,ah
6749
	cmp	cl,1
6741
	cmp	cl,1
6750
	je	scale_ok
6742
	je	scale_ok
6751
	cmp	cl,2
6743
	cmp	cl,2
6752
	je	scale_1
6744
	je	scale_1
6753
	cmp	cl,4
6745
	cmp	cl,4
6754
	je	scale_2
6746
	je	scale_2
6755
	or	ah,11000000b
6747
	or	ah,11000000b
6756
	jmp	scale_ok
6748
	jmp	scale_ok
6757
      scale_2:
6749
      scale_2:
6758
	or	ah,10000000b
6750
	or	ah,10000000b
6759
	jmp	scale_ok
6751
	jmp	scale_ok
6760
      scale_1:
6752
      scale_1:
6761
	or	ah,01000000b
6753
	or	ah,01000000b
6762
      scale_ok:
6754
      scale_ok:
6763
	or	bh,bh
6755
	or	bh,bh
6764
	jz	only_index_register
6756
	jz	only_index_register
6765
	and	bl,111b
6757
	and	bl,111b
6766
	shl	bl,3
6758
	shl	bl,3
6767
	or	ah,bl
6759
	or	ah,bl
6768
	and	bh,111b
6760
	and	bh,111b
6769
	or	ah,bh
6761
	or	ah,bh
6770
      sib_ready:
6762
      sib_ready:
6771
	test	ch,44h
6763
	test	ch,44h
6772
	jnz	sib_address_32bit_value
6764
	jnz	sib_address_32bit_value
6773
	test	ch,88h
6765
	test	ch,88h
6774
	jnz	sib_address_32bit_value
6766
	jnz	sib_address_32bit_value
6775
	or	ch,ch
6767
	or	ch,ch
6776
	jnz	address_sizes_do_not_agree
6768
	jnz	address_sizes_do_not_agree
6777
	cmp	bh,5
6769
	cmp	bh,5
6778
	je	address_value
6770
	je	address_value
6779
	or	edx,edx
6771
	or	edx,edx
6780
	jz	sib_address
6772
	jz	sib_address
6781
      address_value:
6773
      address_value:
6782
	cmp	edx,80h
6774
	cmp	edx,80h
6783
	jb	sib_address_8bit_value
6775
	jb	sib_address_8bit_value
6784
	cmp	edx,-80h
6776
	cmp	edx,-80h
6785
	jae	sib_address_8bit_value
6777
	jae	sib_address_8bit_value
6786
      sib_address_32bit_value:
6778
      sib_address_32bit_value:
6787
	or	al,10000000b
6779
	or	al,10000000b
6788
	mov	cl,[postbyte_register]
6780
	mov	cl,[postbyte_register]
6789
	shl	cl,3
6781
	shl	cl,3
6790
	or	al,cl
6782
	or	al,cl
6791
	stos	word [edi]
6783
	stos	word [edi]
6792
	jmp	store_address_32bit_value
6784
	jmp	store_address_32bit_value
6793
      sib_address_8bit_value:
6785
      sib_address_8bit_value:
6794
	or	al,01000000b
6786
	or	al,01000000b
6795
	mov	cl,[postbyte_register]
6787
	mov	cl,[postbyte_register]
6796
	shl	cl,3
6788
	shl	cl,3
6797
	or	al,cl
6789
	or	al,cl
6798
	stos	word [edi]
6790
	stos	word [edi]
6799
	mov	al,dl
6791
	mov	al,dl
6800
	stos	byte [edi]
6792
	stos	byte [edi]
6801
	cmp	edx,80h
6793
	cmp	edx,80h
6802
	jge	value_out_of_range
6794
	jge	value_out_of_range
6803
	cmp	edx,-80h
6795
	cmp	edx,-80h
6804
	jl	value_out_of_range
6796
	jl	value_out_of_range
6805
	ret
6797
	ret
6806
      sib_address:
6798
      sib_address:
6807
	mov	cl,[postbyte_register]
6799
	mov	cl,[postbyte_register]
6808
	shl	cl,3
6800
	shl	cl,3
6809
	or	al,cl
6801
	or	al,cl
6810
	stos	word [edi]
6802
	stos	word [edi]
6811
	ret
6803
	ret
6812
      only_index_register:
6804
      only_index_register:
6813
	or	ah,101b
6805
	or	ah,101b
6814
	and	bl,111b
6806
	and	bl,111b
6815
	shl	bl,3
6807
	shl	bl,3
6816
	or	ah,bl
6808
	or	ah,bl
6817
	mov	cl,[postbyte_register]
6809
	mov	cl,[postbyte_register]
6818
	shl	cl,3
6810
	shl	cl,3
6819
	or	al,cl
6811
	or	al,cl
6820
	stos	word [edi]
6812
	stos	word [edi]
6821
	test	ch,44h
6813
	test	ch,44h
6822
	jnz	store_address_32bit_value
6814
	jnz	store_address_32bit_value
6823
	test	ch,88h
6815
	test	ch,88h
6824
	jnz	store_address_32bit_value
6816
	jnz	store_address_32bit_value
6825
	or	ch,ch
6817
	or	ch,ch
6826
	jnz	invalid_address_size
6818
	jnz	invalid_address_size
6827
	jmp	store_address_32bit_value
6819
	jmp	store_address_32bit_value
6828
      zero_index_register:
6820
      zero_index_register:
6829
	mov	bl,4
6821
	mov	bl,4
6830
	mov	cl,1
6822
	mov	cl,1
6831
	jmp	base_and_index
6823
	jmp	base_and_index
6832
      only_base_register:
6824
      only_base_register:
6833
	mov	al,bh
6825
	mov	al,bh
6834
	and	al,111b
6826
	and	al,111b
6835
	cmp	al,4
6827
	cmp	al,4
6836
	je	zero_index_register
6828
	je	zero_index_register
6837
	test	ch,44h
6829
	test	ch,44h
6838
	jnz	simple_address_32bit_value
6830
	jnz	simple_address_32bit_value
6839
	test	ch,88h
6831
	test	ch,88h
6840
	jnz	simple_address_32bit_value
6832
	jnz	simple_address_32bit_value
6841
	or	ch,ch
6833
	or	ch,ch
6842
	jnz	address_sizes_do_not_agree
6834
	jnz	address_sizes_do_not_agree
6843
	or	edx,edx
6835
	or	edx,edx
6844
	jz	simple_address
6836
	jz	simple_address
6845
	cmp	edx,80h
6837
	cmp	edx,80h
6846
	jb	simple_address_8bit_value
6838
	jb	simple_address_8bit_value
6847
	cmp	edx,-80h
6839
	cmp	edx,-80h
6848
	jae	simple_address_8bit_value
6840
	jae	simple_address_8bit_value
6849
      simple_address_32bit_value:
6841
      simple_address_32bit_value:
6850
	or	al,10000000b
6842
	or	al,10000000b
6851
	mov	cl,[postbyte_register]
6843
	mov	cl,[postbyte_register]
6852
	shl	cl,3
6844
	shl	cl,3
6853
	or	al,cl
6845
	or	al,cl
6854
	stos	byte [edi]
6846
	stos	byte [edi]
6855
	jmp	store_address_32bit_value
6847
	jmp	store_address_32bit_value
6856
      simple_address_8bit_value:
6848
      simple_address_8bit_value:
6857
	or	al,01000000b
6849
	or	al,01000000b
6858
	mov	cl,[postbyte_register]
6850
	mov	cl,[postbyte_register]
6859
	shl	cl,3
6851
	shl	cl,3
6860
	or	al,cl
6852
	or	al,cl
6861
	stos	byte [edi]
6853
	stos	byte [edi]
6862
	mov	al,dl
6854
	mov	al,dl
6863
	stos	byte [edi]
6855
	stos	byte [edi]
6864
	cmp	edx,80h
6856
	cmp	edx,80h
6865
	jge	value_out_of_range
6857
	jge	value_out_of_range
6866
	cmp	edx,-80h
6858
	cmp	edx,-80h
6867
	jl	value_out_of_range
6859
	jl	value_out_of_range
6868
	ret
6860
	ret
6869
      simple_address:
6861
      simple_address:
6870
	cmp	al,5
6862
	cmp	al,5
6871
	je	simple_address_8bit_value
6863
	je	simple_address_8bit_value
6872
	mov	cl,[postbyte_register]
6864
	mov	cl,[postbyte_register]
6873
	shl	cl,3
6865
	shl	cl,3
6874
	or	al,cl
6866
	or	al,cl
6875
	stos	byte [edi]
6867
	stos	byte [edi]
6876
	ret
6868
	ret
6877
      address_immediate:
6869
      address_immediate:
6878
	cmp	[code_type],64
6870
	cmp	[code_type],64
6879
	je	address_immediate_sib
6871
	je	address_immediate_sib
6880
	test	ch,44h
6872
	test	ch,44h
6881
	jnz	address_immediate_32bit
6873
	jnz	address_immediate_32bit
6882
	test	ch,22h
6874
	test	ch,88h
-
 
6875
	jnz	address_immediate_32bit
-
 
6876
	test	ch,22h
6883
	jnz	address_immediate_16bit
6877
	jnz	address_immediate_16bit
6884
	or	ch,ch
6878
	or	ch,ch
6885
	jnz	invalid_address_size
6879
	jnz	invalid_address_size
6886
	cmp	[code_type],16
6880
	cmp	[code_type],16
6887
	je	addressing_16bit
6881
	je	addressing_16bit
6888
      address_immediate_32bit:
6882
      address_immediate_32bit:
6889
	call	address_32bit_prefix
6883
	call	address_32bit_prefix
6890
	call	store_instruction_code
6884
	call	store_instruction_code
6891
      store_immediate_address:
6885
      store_immediate_address:
6892
	mov	al,101b
6886
	mov	al,101b
6893
	mov	cl,[postbyte_register]
6887
	mov	cl,[postbyte_register]
6894
	shl	cl,3
6888
	shl	cl,3
6895
	or	al,cl
6889
	or	al,cl
6896
	stos	byte [edi]
6890
	stos	byte [edi]
6897
      store_address_32bit_value:
6891
      store_address_32bit_value:
6898
	test	ch,0F0h
6892
	test	ch,0F0h
6899
	jz	address_32bit_relocation_ok
6893
	jz	address_32bit_relocation_ok
6900
	mov	eax,ecx
6894
	mov	eax,ecx
6901
	shr	eax,16
6895
	shr	eax,16
6902
	cmp	al,4
6896
	cmp	al,4
6903
	jne	address_32bit_relocation
6897
	jne	address_32bit_relocation
6904
	mov	al,2
6898
	mov	al,2
6905
      address_32bit_relocation:
6899
      address_32bit_relocation:
6906
	xchg	[value_type],al
6900
	xchg	[value_type],al
6907
	mov	ebx,[address_symbol]
6901
	mov	ebx,[address_symbol]
6908
	xchg	ebx,[symbol_identifier]
6902
	xchg	ebx,[symbol_identifier]
6909
	call	mark_relocation
6903
	call	mark_relocation
6910
	mov	[value_type],al
6904
	mov	[value_type],al
6911
	mov	[symbol_identifier],ebx
6905
	mov	[symbol_identifier],ebx
6912
      address_32bit_relocation_ok:
6906
      address_32bit_relocation_ok:
6913
	mov	eax,edx
6907
	mov	eax,edx
6914
	stos	dword [edi]
6908
	stos	dword [edi]
6915
	ret
6909
	ret
6916
      store_address_64bit_value:
6910
      store_address_64bit_value:
6917
	test	ch,0F0h
6911
	test	ch,0F0h
6918
	jz	address_64bit_relocation_ok
6912
	jz	address_64bit_relocation_ok
6919
	mov	eax,ecx
6913
	mov	eax,ecx
6920
	shr	eax,16
6914
	shr	eax,16
6921
	xchg	[value_type],al
6915
	xchg	[value_type],al
6922
	mov	ebx,[address_symbol]
6916
	mov	ebx,[address_symbol]
6923
	xchg	ebx,[symbol_identifier]
6917
	xchg	ebx,[symbol_identifier]
6924
	call	mark_relocation
6918
	call	mark_relocation
6925
	mov	[value_type],al
6919
	mov	[value_type],al
6926
	mov	[symbol_identifier],ebx
6920
	mov	[symbol_identifier],ebx
6927
      address_64bit_relocation_ok:
6921
      address_64bit_relocation_ok:
6928
	mov	eax,edx
6922
	mov	eax,edx
6929
	stos	dword [edi]
6923
	stos	dword [edi]
6930
	mov	eax,[address_high]
6924
	mov	eax,[address_high]
6931
	stos	dword [edi]
6925
	stos	dword [edi]
6932
	ret
6926
	ret
6933
      address_immediate_sib:
6927
      address_immediate_sib:
6934
	test	ch,44h
6928
	test	ch,44h
6935
	jnz	address_immediate_sib_32bit
6929
	jnz	address_immediate_sib_32bit
6936
	test	ch,not 88h
6930
	test	ch,not 88h
6937
	jnz	invalid_address_size
6931
	jnz	invalid_address_size
6938
      address_immediate_sib_store:
6932
      address_immediate_sib_store:
6939
	call	store_instruction_code
6933
	call	store_instruction_code
6940
	mov	al,100b
6934
	mov	al,100b
6941
	mov	ah,100101b
6935
	mov	ah,100101b
6942
	mov	cl,[postbyte_register]
6936
	mov	cl,[postbyte_register]
6943
	shl	cl,3
6937
	shl	cl,3
6944
	or	al,cl
6938
	or	al,cl
6945
	stos	word [edi]
6939
	stos	word [edi]
6946
	jmp	store_address_32bit_value
6940
	jmp	store_address_32bit_value
6947
      address_immediate_sib_32bit:
6941
      address_immediate_sib_32bit:
6948
	test	ecx,0FF0000h
6942
	test	ecx,0FF0000h
6949
	jnz	address_immediate_sib_nosignextend
6943
	jnz	address_immediate_sib_nosignextend
6950
	test	edx,80000000h
6944
	test	edx,80000000h
6951
	jz	address_immediate_sib_store
6945
	jz	address_immediate_sib_store
6952
      address_immediate_sib_nosignextend:
6946
      address_immediate_sib_nosignextend:
6953
	call	address_32bit_prefix
6947
	call	address_32bit_prefix
6954
	jmp	address_immediate_sib_store
6948
	jmp	address_immediate_sib_store
6955
      address_eip_based:
6949
      address_eip_based:
6956
	mov	al,67h
6950
	mov	al,67h
6957
	stos	byte [edi]
6951
	stos	byte [edi]
6958
      address_rip_based:
6952
      address_rip_based:
6959
	cmp	[code_type],64
6953
	cmp	[code_type],64
6960
	jne	invalid_address
6954
	jne	invalid_address
6961
	call	store_instruction_code
6955
	call	store_instruction_code
6962
	jmp	store_immediate_address
6956
	jmp	store_immediate_address
6963
      address_relative:
6957
      address_relative:
6964
	call	store_instruction_code
6958
	call	store_instruction_code
6965
	movzx	eax,[immediate_size]
6959
	movzx	eax,[immediate_size]
6966
	add	eax,edi
6960
	add	eax,edi
6967
	sub	eax,[current_offset]
6961
	sub	eax,[current_offset]
6968
	add	eax,5
6962
	add	eax,5
6969
	sub	edx,eax
6963
	sub	edx,eax
6970
	jo	value_out_of_range
6964
	jo	value_out_of_range
6971
	mov	al,101b
6965
	mov	al,101b
6972
	mov	cl,[postbyte_register]
6966
	mov	cl,[postbyte_register]
6973
	shl	cl,3
6967
	shl	cl,3
6974
	or	al,cl
6968
	or	al,cl
6975
	stos	byte [edi]
6969
	stos	byte [edi]
6976
	shr	ecx,16
6970
	shr	ecx,16
6977
	xchg	[value_type],cl
6971
	xchg	[value_type],cl
6978
	mov	ebx,[address_symbol]
6972
	mov	ebx,[address_symbol]
6979
	xchg	ebx,[symbol_identifier]
6973
	xchg	ebx,[symbol_identifier]
6980
	mov	eax,edx
6974
	mov	eax,edx
6981
	call	mark_relocation
6975
	call	mark_relocation
6982
	mov	[value_type],cl
6976
	mov	[value_type],cl
6983
	mov	[symbol_identifier],ebx
6977
	mov	[symbol_identifier],ebx
6984
	stos	dword [edi]
6978
	stos	dword [edi]
6985
	ret
6979
	ret
6986
      addressing_16bit:
6980
      addressing_16bit:
6987
	cmp	edx,10000h
6981
	cmp	edx,10000h
6988
	jge	address_immediate_32bit
6982
	jge	address_immediate_32bit
6989
	cmp	edx,-8000h
6983
	cmp	edx,-8000h
6990
	jl	address_immediate_32bit
6984
	jl	address_immediate_32bit
6991
	movzx	edx,dx
6985
	movzx	edx,dx
6992
      address_immediate_16bit:
6986
      address_immediate_16bit:
6993
	call	address_16bit_prefix
6987
	call	address_16bit_prefix
6994
	call	store_instruction_code
6988
	call	store_instruction_code
6995
	mov	al,110b
6989
	mov	al,110b
6996
	mov	cl,[postbyte_register]
6990
	mov	cl,[postbyte_register]
6997
	shl	cl,3
6991
	shl	cl,3
6998
	or	al,cl
6992
	or	al,cl
6999
	stos	byte [edi]
6993
	stos	byte [edi]
7000
	mov	eax,edx
6994
	mov	eax,edx
7001
	stos	word [edi]
6995
	stos	word [edi]
7002
	cmp	edx,10000h
6996
	cmp	edx,10000h
7003
	jge	value_out_of_range
6997
	jge	value_out_of_range
7004
	cmp	edx,-8000h
6998
	cmp	edx,-8000h
7005
	jl	value_out_of_range
6999
	jl	value_out_of_range
7006
	ret
7000
	ret
7007
      address_16bit_prefix:
7001
      address_16bit_prefix:
7008
	cmp	[code_type],16
7002
	cmp	[code_type],16
7009
	je	instruction_prefix_ok
7003
	je	instruction_prefix_ok
7010
	mov	al,67h
7004
	mov	al,67h
7011
	stos	byte [edi]
7005
	stos	byte [edi]
7012
	ret
7006
	ret
7013
      address_32bit_prefix:
7007
      address_32bit_prefix:
7014
	cmp	[code_type],32
7008
	cmp	[code_type],32
7015
	je	instruction_prefix_ok
7009
	je	instruction_prefix_ok
7016
	mov	al,67h
7010
	mov	al,67h
7017
	stos	byte [edi]
7011
	stos	byte [edi]
7018
      instruction_prefix_ok:
7012
      instruction_prefix_ok:
7019
	ret
7013
	ret
7020
store_instruction_with_imm8:
7014
store_instruction_with_imm8:
7021
	mov	[immediate_size],1
7015
	mov	[immediate_size],1
7022
	call	store_instruction
7016
	call	store_instruction
7023
	mov	al,byte [value]
7017
	mov	al,byte [value]
7024
	stos	byte [edi]
7018
	stos	byte [edi]
7025
	ret
7019
	ret
7026
store_instruction_with_imm16:
7020
store_instruction_with_imm16:
7027
	mov	[immediate_size],2
7021
	mov	[immediate_size],2
7028
	call	store_instruction
7022
	call	store_instruction
7029
	mov	ax,word [value]
7023
	mov	ax,word [value]
7030
	call	mark_relocation
7024
	call	mark_relocation
7031
	stos	word [edi]
7025
	stos	word [edi]
7032
	ret
7026
	ret
7033
store_instruction_with_imm32:
7027
store_instruction_with_imm32:
7034
	mov	[immediate_size],4
7028
	mov	[immediate_size],4
7035
	call	store_instruction
7029
	call	store_instruction
7036
	mov	eax,dword [value]
7030
	mov	eax,dword [value]
7037
	call	mark_relocation
7031
	call	mark_relocation
7038
	stos	dword [edi]
7032
	stos	dword [edi]
7039
	ret
7033
	ret