Subversion Repositories Kolibri OS

Rev

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

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