Subversion Repositories Kolibri OS

Rev

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

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