Subversion Repositories Kolibri OS

Rev

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

Rev 340 Rev 370
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
	cmp	al,4
1404
	jc	invalid_operand
-
 
1405
	cmp	al,4
1405
	jae	push_sreg_386
1406
	jae	push_sreg_386
1406
	shl	al,3
1407
	shl	al,3
1407
	add	al,6
1408
	add	al,6
1408
	mov	[base_code],al
1409
	mov	[base_code],al
1409
	cmp	[code_type],64
1410
	cmp	[code_type],64
1410
	je	illegal_instruction
1411
	je	illegal_instruction
1411
	jmp	push_reg_store
1412
	jmp	push_reg_store
1412
      push_sreg_386:
1413
      push_sreg_386:
1413
	sub	al,4
1414
	sub	al,4
1414
	shl	al,3
1415
	shl	al,3
1415
	add	al,0A0h
1416
	add	al,0A0h
1416
	mov	[extended_code],al
1417
	mov	[extended_code],al
1417
	mov	[base_code],0Fh
1418
	mov	[base_code],0Fh
1418
	jmp	push_reg_store
1419
	jmp	push_reg_store
1419
      push_imm:
1420
      push_imm:
1420
	mov	al,[operand_size]
1421
	mov	al,[operand_size]
1421
	mov	ah,[push_size]
1422
	mov	ah,[push_size]
1422
	or	al,al
1423
	or	al,al
1423
	je	push_imm_size_ok
1424
	je	push_imm_size_ok
1424
	or	ah,ah
1425
	or	ah,ah
1425
	je	push_imm_size_ok
1426
	je	push_imm_size_ok
1426
	cmp	al,ah
1427
	cmp	al,ah
1427
	jne	invalid_operand_size
1428
	jne	invalid_operand_size
1428
      push_imm_size_ok:
1429
      push_imm_size_ok:
1429
	cmp	al,2
1430
	cmp	al,2
1430
	je	push_imm_16bit
1431
	je	push_imm_16bit
1431
	cmp	al,4
1432
	cmp	al,4
1432
	je	push_imm_32bit
1433
	je	push_imm_32bit
1433
	cmp	al,8
1434
	cmp	al,8
1434
	je	push_imm_64bit
1435
	je	push_imm_64bit
1435
	cmp	ah,2
1436
	cmp	ah,2
1436
	je	push_imm_optimized_16bit
1437
	je	push_imm_optimized_16bit
1437
	cmp	ah,4
1438
	cmp	ah,4
1438
	je	push_imm_optimized_32bit
1439
	je	push_imm_optimized_32bit
1439
	cmp	ah,8
1440
	cmp	ah,8
1440
	je	push_imm_optimized_64bit
1441
	je	push_imm_optimized_64bit
1441
	or	al,al
1442
	or	al,al
1442
	jnz	invalid_operand_size
1443
	jnz	invalid_operand_size
1443
	cmp	[code_type],16
1444
	cmp	[code_type],16
1444
	je	push_imm_optimized_16bit
1445
	je	push_imm_optimized_16bit
1445
	cmp	[code_type],32
1446
	cmp	[code_type],32
1446
	je	push_imm_optimized_32bit
1447
	je	push_imm_optimized_32bit
1447
      push_imm_optimized_64bit:
1448
      push_imm_optimized_64bit:
1448
	cmp	[code_type],64
1449
	cmp	[code_type],64
1449
	jne	illegal_instruction
1450
	jne	illegal_instruction
1450
	call	get_simm32
1451
	call	get_simm32
1451
	mov	edx,eax
1452
	mov	edx,eax
1452
	cmp	[value_type],0
1453
	cmp	[value_type],0
1453
	jne	push_imm_32bit_store
1454
	jne	push_imm_32bit_store
1454
	cmp	eax,-80h
1455
	cmp	eax,-80h
1455
	jl	push_imm_32bit_store
1456
	jl	push_imm_32bit_store
1456
	cmp	eax,80h
1457
	cmp	eax,80h
1457
	jge	push_imm_32bit_store
1458
	jge	push_imm_32bit_store
1458
	jmp	push_imm_8bit
1459
	jmp	push_imm_8bit
1459
      push_imm_optimized_32bit:
1460
      push_imm_optimized_32bit:
1460
	cmp	[code_type],64
1461
	cmp	[code_type],64
1461
	je	illegal_instruction
1462
	je	illegal_instruction
1462
	call	get_dword_value
1463
	call	get_dword_value
1463
	mov	edx,eax
1464
	mov	edx,eax
1464
	call	operand_32bit
1465
	call	operand_32bit
1465
	cmp	[value_type],0
1466
	cmp	[value_type],0
1466
	jne	push_imm_32bit_store
1467
	jne	push_imm_32bit_store
1467
	cmp	eax,-80h
1468
	cmp	eax,-80h
1468
	jl	push_imm_32bit_store
1469
	jl	push_imm_32bit_store
1469
	cmp	eax,80h
1470
	cmp	eax,80h
1470
	jge	push_imm_32bit_store
1471
	jge	push_imm_32bit_store
1471
	jmp	push_imm_8bit
1472
	jmp	push_imm_8bit
1472
      push_imm_optimized_16bit:
1473
      push_imm_optimized_16bit:
1473
	call	get_word_value
1474
	call	get_word_value
1474
	mov	dx,ax
1475
	mov	dx,ax
1475
	call	operand_16bit
1476
	call	operand_16bit
1476
	cmp	[value_type],0
1477
	cmp	[value_type],0
1477
	jne	push_imm_16bit_store
1478
	jne	push_imm_16bit_store
1478
	cmp	ax,-80h
1479
	cmp	ax,-80h
1479
	jl	push_imm_16bit_store
1480
	jl	push_imm_16bit_store
1480
	cmp	ax,80h
1481
	cmp	ax,80h
1481
	jge	push_imm_16bit_store
1482
	jge	push_imm_16bit_store
1482
      push_imm_8bit:
1483
      push_imm_8bit:
1483
	mov	ah,al
1484
	mov	ah,al
1484
	mov	[base_code],6Ah
1485
	mov	[base_code],6Ah
1485
	call	store_instruction_code
1486
	call	store_instruction_code
1486
	mov	al,ah
1487
	mov	al,ah
1487
	stos	byte [edi]
1488
	stos	byte [edi]
1488
	jmp	push_done
1489
	jmp	push_done
1489
      push_imm_16bit:
1490
      push_imm_16bit:
1490
	call	get_word_value
1491
	call	get_word_value
1491
	mov	dx,ax
1492
	mov	dx,ax
1492
	call	operand_16bit
1493
	call	operand_16bit
1493
      push_imm_16bit_store:
1494
      push_imm_16bit_store:
1494
	mov	[base_code],68h
1495
	mov	[base_code],68h
1495
	call	store_instruction_code
1496
	call	store_instruction_code
1496
	mov	ax,dx
1497
	mov	ax,dx
1497
	call	mark_relocation
1498
	call	mark_relocation
1498
	stos	word [edi]
1499
	stos	word [edi]
1499
	jmp	push_done
1500
	jmp	push_done
1500
      push_imm_64bit:
1501
      push_imm_64bit:
1501
	cmp	[code_type],64
1502
	cmp	[code_type],64
1502
	jne	illegal_instruction
1503
	jne	illegal_instruction
1503
	call	get_simm32
1504
	call	get_simm32
1504
	mov	edx,eax
1505
	mov	edx,eax
1505
	jmp	push_imm_32bit_store
1506
	jmp	push_imm_32bit_store
1506
      push_imm_32bit:
1507
      push_imm_32bit:
1507
	cmp	[code_type],64
1508
	cmp	[code_type],64
1508
	je	illegal_instruction
1509
	je	illegal_instruction
1509
	call	get_dword_value
1510
	call	get_dword_value
1510
	mov	edx,eax
1511
	mov	edx,eax
1511
	call	operand_32bit
1512
	call	operand_32bit
1512
      push_imm_32bit_store:
1513
      push_imm_32bit_store:
1513
	mov	[base_code],68h
1514
	mov	[base_code],68h
1514
	call	store_instruction_code
1515
	call	store_instruction_code
1515
	mov	eax,edx
1516
	mov	eax,edx
1516
	call	mark_relocation
1517
	call	mark_relocation
1517
	stos	dword [edi]
1518
	stos	dword [edi]
1518
      push_done:
1519
      push_done:
1519
	lods	byte [esi]
1520
	lods	byte [esi]
1520
	dec	esi
1521
	dec	esi
1521
	cmp	al,0Fh
1522
	cmp	al,0Fh
1522
	je	instruction_assembled
1523
	je	instruction_assembled
1523
	or	al,al
1524
	or	al,al
1524
	jz	instruction_assembled
1525
	jz	instruction_assembled
1525
	mov	[operand_size],0
1526
	mov	[operand_size],0
1526
	mov	[size_override],0
1527
	mov	[size_override],0
1527
	mov	[operand_prefix],0
1528
	mov	[operand_prefix],0
1528
	mov	[rex_prefix],0
1529
	mov	[rex_prefix],0
1529
	jmp	push_next
1530
	jmp	push_next
1530
pop_instruction:
1531
pop_instruction:
1531
	mov	[push_size],al
1532
	mov	[push_size],al
1532
      pop_next:
1533
      pop_next:
1533
	lods	byte [esi]
1534
	lods	byte [esi]
1534
	call	get_size_operator
1535
	call	get_size_operator
1535
	cmp	al,10h
1536
	cmp	al,10h
1536
	je	pop_reg
1537
	je	pop_reg
1537
	cmp	al,'['
1538
	cmp	al,'['
1538
	jne	invalid_operand
1539
	jne	invalid_operand
1539
      pop_mem:
1540
      pop_mem:
1540
	call	get_address
1541
	call	get_address
1541
	mov	al,[operand_size]
1542
	mov	al,[operand_size]
1542
	mov	ah,[push_size]
1543
	mov	ah,[push_size]
1543
	cmp	al,2
1544
	cmp	al,2
1544
	je	pop_mem_16bit
1545
	je	pop_mem_16bit
1545
	cmp	al,4
1546
	cmp	al,4
1546
	je	pop_mem_32bit
1547
	je	pop_mem_32bit
1547
	cmp	al,8
1548
	cmp	al,8
1548
	je	pop_mem_64bit
1549
	je	pop_mem_64bit
1549
	or	al,al
1550
	or	al,al
1550
	jnz	invalid_operand_size
1551
	jnz	invalid_operand_size
1551
	cmp	ah,2
1552
	cmp	ah,2
1552
	je	pop_mem_16bit
1553
	je	pop_mem_16bit
1553
	cmp	ah,4
1554
	cmp	ah,4
1554
	je	pop_mem_32bit
1555
	je	pop_mem_32bit
1555
	cmp	ah,8
1556
	cmp	ah,8
1556
	je	pop_mem_64bit
1557
	je	pop_mem_64bit
1557
	cmp	[error_line],0
1558
	cmp	[error_line],0
1558
	jne	pop_mem_store
1559
	jne	pop_mem_store
1559
	mov	eax,[current_line]
1560
	mov	eax,[current_line]
1560
	mov	[error_line],eax
1561
	mov	[error_line],eax
1561
	mov	[error],operand_size_not_specified
1562
	mov	[error],operand_size_not_specified
1562
	jmp	pop_mem_store
1563
	jmp	pop_mem_store
1563
      pop_mem_16bit:
1564
      pop_mem_16bit:
1564
	test	ah,not 2
1565
	test	ah,not 2
1565
	jnz	invalid_operand_size
1566
	jnz	invalid_operand_size
1566
	call	operand_16bit
1567
	call	operand_16bit
1567
	jmp	pop_mem_store
1568
	jmp	pop_mem_store
1568
      pop_mem_32bit:
1569
      pop_mem_32bit:
1569
	test	ah,not 4
1570
	test	ah,not 4
1570
	jnz	invalid_operand_size
1571
	jnz	invalid_operand_size
1571
	cmp	[code_type],64
1572
	cmp	[code_type],64
1572
	je	illegal_instruction
1573
	je	illegal_instruction
1573
	call	operand_32bit
1574
	call	operand_32bit
1574
	jmp	pop_mem_store
1575
	jmp	pop_mem_store
1575
      pop_mem_64bit:
1576
      pop_mem_64bit:
1576
	test	ah,not 8
1577
	test	ah,not 8
1577
	jnz	invalid_operand_size
1578
	jnz	invalid_operand_size
1578
	cmp	[code_type],64
1579
	cmp	[code_type],64
1579
	jne	illegal_instruction
1580
	jne	illegal_instruction
1580
      pop_mem_store:
1581
      pop_mem_store:
1581
	mov	[base_code],08Fh
1582
	mov	[base_code],08Fh
1582
	mov	[postbyte_register],0
1583
	mov	[postbyte_register],0
1583
	call	store_instruction
1584
	call	store_instruction
1584
	jmp	pop_done
1585
	jmp	pop_done
1585
      pop_reg:
1586
      pop_reg:
1586
	lods	byte [esi]
1587
	lods	byte [esi]
1587
	mov	ah,al
1588
	mov	ah,al
1588
	sub	ah,10h
1589
	sub	ah,10h
1589
	and	ah,al
1590
	and	ah,al
1590
	test	ah,0F0h
1591
	test	ah,0F0h
1591
	jnz	pop_sreg
1592
	jnz	pop_sreg
1592
	call	convert_register
1593
	call	convert_register
1593
	test	al,1000b
1594
	test	al,1000b
1594
	jz	pop_reg_ok
1595
	jz	pop_reg_ok
1595
	or	[rex_prefix],41h
1596
	or	[rex_prefix],41h
1596
	and	al,111b
1597
	and	al,111b
1597
      pop_reg_ok:
1598
      pop_reg_ok:
1598
	add	al,58h
1599
	add	al,58h
1599
	mov	[base_code],al
1600
	mov	[base_code],al
1600
	mov	al,ah
1601
	mov	al,ah
1601
	mov	ah,[push_size]
1602
	mov	ah,[push_size]
1602
	cmp	al,2
1603
	cmp	al,2
1603
	je	pop_reg_16bit
1604
	je	pop_reg_16bit
1604
	cmp	al,4
1605
	cmp	al,4
1605
	je	pop_reg_32bit
1606
	je	pop_reg_32bit
1606
	cmp	al,8
1607
	cmp	al,8
1607
	je	pop_reg_64bit
1608
	je	pop_reg_64bit
1608
	jmp	invalid_operand_size
1609
	jmp	invalid_operand_size
1609
      pop_reg_64bit:
1610
      pop_reg_64bit:
1610
	test	ah,not 8
1611
	test	ah,not 8
1611
	jnz	invalid_operand_size
1612
	jnz	invalid_operand_size
1612
	cmp	[code_type],64
1613
	cmp	[code_type],64
1613
	jne	illegal_instruction
1614
	jne	illegal_instruction
1614
	jmp	pop_reg_store
1615
	jmp	pop_reg_store
1615
      pop_reg_32bit:
1616
      pop_reg_32bit:
1616
	test	ah,not 4
1617
	test	ah,not 4
1617
	jnz	invalid_operand_size
1618
	jnz	invalid_operand_size
1618
	cmp	[code_type],64
1619
	cmp	[code_type],64
1619
	je	illegal_instruction
1620
	je	illegal_instruction
1620
	call	operand_32bit
1621
	call	operand_32bit
1621
	jmp	pop_reg_store
1622
	jmp	pop_reg_store
1622
      pop_reg_16bit:
1623
      pop_reg_16bit:
1623
	test	ah,not 2
1624
	test	ah,not 2
1624
	jnz	invalid_operand_size
1625
	jnz	invalid_operand_size
1625
	call	operand_16bit
1626
	call	operand_16bit
1626
      pop_reg_store:
1627
      pop_reg_store:
1627
	call	store_instruction_code
1628
	call	store_instruction_code
1628
      pop_done:
1629
      pop_done:
1629
	lods	byte [esi]
1630
	lods	byte [esi]
1630
	dec	esi
1631
	dec	esi
1631
	cmp	al,0Fh
1632
	cmp	al,0Fh
1632
	je	instruction_assembled
1633
	je	instruction_assembled
1633
	or	al,al
1634
	or	al,al
1634
	jz	instruction_assembled
1635
	jz	instruction_assembled
1635
	mov	[operand_size],0
1636
	mov	[operand_size],0
1636
	mov	[size_override],0
1637
	mov	[size_override],0
1637
	mov	[operand_prefix],0
1638
	mov	[operand_prefix],0
1638
	mov	[rex_prefix],0
1639
	mov	[rex_prefix],0
1639
	jmp	pop_next
1640
	jmp	pop_next
1640
      pop_sreg:
1641
      pop_sreg:
1641
	mov	dl,[operand_size]
1642
	mov	dl,[operand_size]
1642
	mov	dh,[push_size]
1643
	mov	dh,[push_size]
1643
	cmp	al,62h
1644
	cmp	al,62h
1644
	je	pop_cs
1645
	je	pop_cs
1645
	mov	bl,al
1646
	mov	bl,al
1646
	cmp	dl,2
1647
	cmp	dl,2
1647
	je	pop_sreg16
1648
	je	pop_sreg16
1648
	cmp	dl,4
1649
	cmp	dl,4
1649
	je	pop_sreg32
1650
	je	pop_sreg32
1650
	cmp	dl,8
1651
	cmp	dl,8
1651
	je	pop_sreg64
1652
	je	pop_sreg64
1652
	or	dl,dl
1653
	or	dl,dl
1653
	jnz	invalid_operand_size
1654
	jnz	invalid_operand_size
1654
	cmp	dh,2
1655
	cmp	dh,2
1655
	je	pop_sreg16
1656
	je	pop_sreg16
1656
	cmp	dh,4
1657
	cmp	dh,4
1657
	je	pop_sreg32
1658
	je	pop_sreg32
1658
	cmp	dh,8
1659
	cmp	dh,8
1659
	je	pop_sreg64
1660
	je	pop_sreg64
1660
	jmp	pop_sreg_store
1661
	jmp	pop_sreg_store
1661
      pop_sreg16:
1662
      pop_sreg16:
1662
	test	dh,not 2
1663
	test	dh,not 2
1663
	jnz	invalid_operand_size
1664
	jnz	invalid_operand_size
1664
	call	operand_16bit
1665
	call	operand_16bit
1665
	jmp	pop_sreg_store
1666
	jmp	pop_sreg_store
1666
      pop_sreg32:
1667
      pop_sreg32:
1667
	test	dh,not 4
1668
	test	dh,not 4
1668
	jnz	invalid_operand_size
1669
	jnz	invalid_operand_size
1669
	cmp	[code_type],64
1670
	cmp	[code_type],64
1670
	je	illegal_instruction
1671
	je	illegal_instruction
1671
	call	operand_32bit
1672
	call	operand_32bit
1672
	jmp	pop_sreg_store
1673
	jmp	pop_sreg_store
1673
      pop_sreg64:
1674
      pop_sreg64:
1674
	test	dh,not 8
1675
	test	dh,not 8
1675
	jnz	invalid_operand_size
1676
	jnz	invalid_operand_size
1676
	cmp	[code_type],64
1677
	cmp	[code_type],64
1677
	jne	illegal_instruction
1678
	jne	illegal_instruction
1678
      pop_sreg_store:
1679
      pop_sreg_store:
1679
	mov	al,bl
1680
	mov	al,bl
1680
	cmp	al,70h
1681
	cmp	al,70h
1681
	jae	invalid_operand
1682
	jae	invalid_operand
1682
	sub	al,61h
1683
	sub	al,61h
1683
	cmp	al,4
1684
	jc	invalid_operand
-
 
1685
	cmp	al,4
1684
	jae	pop_sreg_386
1686
	jae	pop_sreg_386
1685
	shl	al,3
1687
	shl	al,3
1686
	add	al,7
1688
	add	al,7
1687
	mov	[base_code],al
1689
	mov	[base_code],al
1688
	cmp	[code_type],64
1690
	cmp	[code_type],64
1689
	je	illegal_instruction
1691
	je	illegal_instruction
1690
	jmp	pop_reg_store
1692
	jmp	pop_reg_store
1691
      pop_cs:
1693
      pop_cs:
1692
	cmp	[code_type],16
1694
	cmp	[code_type],16
1693
	jne	illegal_instruction
1695
	jne	illegal_instruction
1694
	cmp	dl,2
1696
	cmp	dl,2
1695
	je	pop_cs_store
1697
	je	pop_cs_store
1696
	or	dl,dl
1698
	or	dl,dl
1697
	jnz	invalid_operand_size
1699
	jnz	invalid_operand_size
1698
	cmp	dh,2
1700
	cmp	dh,2
1699
	je	pop_cs_store
1701
	je	pop_cs_store
1700
	or	dh,dh
1702
	or	dh,dh
1701
	jnz	illegal_instruction
1703
	jnz	illegal_instruction
1702
      pop_cs_store:
1704
      pop_cs_store:
1703
	test	dh,not 2
1705
	test	dh,not 2
1704
	jnz	invalid_operand_size
1706
	jnz	invalid_operand_size
1705
	mov	al,0Fh
1707
	mov	al,0Fh
1706
	stos	byte [edi]
1708
	stos	byte [edi]
1707
	jmp	pop_done
1709
	jmp	pop_done
1708
      pop_sreg_386:
1710
      pop_sreg_386:
1709
	sub	al,4
1711
	sub	al,4
1710
	shl	al,3
1712
	shl	al,3
1711
	add	al,0A1h
1713
	add	al,0A1h
1712
	mov	[extended_code],al
1714
	mov	[extended_code],al
1713
	mov	[base_code],0Fh
1715
	mov	[base_code],0Fh
1714
	jmp	pop_reg_store
1716
	jmp	pop_reg_store
1715
inc_instruction:
1717
inc_instruction:
1716
	mov	[base_code],al
1718
	mov	[base_code],al
1717
	lods	byte [esi]
1719
	lods	byte [esi]
1718
	call	get_size_operator
1720
	call	get_size_operator
1719
	cmp	al,10h
1721
	cmp	al,10h
1720
	je	inc_reg
1722
	je	inc_reg
1721
	cmp	al,'['
1723
	cmp	al,'['
1722
	je	inc_mem
1724
	je	inc_mem
1723
	jne	invalid_operand
1725
	jne	invalid_operand
1724
      inc_mem:
1726
      inc_mem:
1725
	call	get_address
1727
	call	get_address
1726
	mov	al,[operand_size]
1728
	mov	al,[operand_size]
1727
	cmp	al,1
1729
	cmp	al,1
1728
	je	inc_mem_8bit
1730
	je	inc_mem_8bit
1729
	jb	inc_mem_nosize
1731
	jb	inc_mem_nosize
1730
	call	operand_autodetect
1732
	call	operand_autodetect
1731
	mov	al,0FFh
1733
	mov	al,0FFh
1732
	xchg	al,[base_code]
1734
	xchg	al,[base_code]
1733
	mov	[postbyte_register],al
1735
	mov	[postbyte_register],al
1734
	call	store_instruction
1736
	call	store_instruction
1735
	jmp	instruction_assembled
1737
	jmp	instruction_assembled
1736
      inc_mem_nosize:
1738
      inc_mem_nosize:
1737
	cmp	[error_line],0
1739
	cmp	[error_line],0
1738
	jne	inc_mem_8bit
1740
	jne	inc_mem_8bit
1739
	mov	eax,[current_line]
1741
	mov	eax,[current_line]
1740
	mov	[error_line],eax
1742
	mov	[error_line],eax
1741
	mov	[error],operand_size_not_specified
1743
	mov	[error],operand_size_not_specified
1742
      inc_mem_8bit:
1744
      inc_mem_8bit:
1743
	mov	al,0FEh
1745
	mov	al,0FEh
1744
	xchg	al,[base_code]
1746
	xchg	al,[base_code]
1745
	mov	[postbyte_register],al
1747
	mov	[postbyte_register],al
1746
	call	store_instruction
1748
	call	store_instruction
1747
	jmp	instruction_assembled
1749
	jmp	instruction_assembled
1748
      inc_reg:
1750
      inc_reg:
1749
	lods	byte [esi]
1751
	lods	byte [esi]
1750
	call	convert_register
1752
	call	convert_register
1751
	mov	bl,al
1753
	mov	bl,al
1752
	mov	al,0FEh
1754
	mov	al,0FEh
1753
	xchg	al,[base_code]
1755
	xchg	al,[base_code]
1754
	mov	[postbyte_register],al
1756
	mov	[postbyte_register],al
1755
	mov	al,ah
1757
	mov	al,ah
1756
	cmp	al,1
1758
	cmp	al,1
1757
	je	inc_reg_8bit
1759
	je	inc_reg_8bit
1758
	call	operand_autodetect
1760
	call	operand_autodetect
1759
	cmp	[code_type],64
1761
	cmp	[code_type],64
1760
	je	inc_reg_long_form
1762
	je	inc_reg_long_form
1761
	mov	al,[postbyte_register]
1763
	mov	al,[postbyte_register]
1762
	shl	al,3
1764
	shl	al,3
1763
	add	al,bl
1765
	add	al,bl
1764
	add	al,40h
1766
	add	al,40h
1765
	mov	[base_code],al
1767
	mov	[base_code],al
1766
	call	store_instruction_code
1768
	call	store_instruction_code
1767
	jmp	instruction_assembled
1769
	jmp	instruction_assembled
1768
      inc_reg_long_form:
1770
      inc_reg_long_form:
1769
	inc	[base_code]
1771
	inc	[base_code]
1770
      inc_reg_8bit:
1772
      inc_reg_8bit:
1771
	call	store_nomem_instruction
1773
	call	store_nomem_instruction
1772
	jmp	instruction_assembled
1774
	jmp	instruction_assembled
1773
set_instruction:
1775
set_instruction:
1774
	mov	[base_code],0Fh
1776
	mov	[base_code],0Fh
1775
	mov	[extended_code],al
1777
	mov	[extended_code],al
1776
	lods	byte [esi]
1778
	lods	byte [esi]
1777
	call	get_size_operator
1779
	call	get_size_operator
1778
	cmp	al,10h
1780
	cmp	al,10h
1779
	je	set_reg
1781
	je	set_reg
1780
	cmp	al,'['
1782
	cmp	al,'['
1781
	jne	invalid_operand
1783
	jne	invalid_operand
1782
      set_mem:
1784
      set_mem:
1783
	call	get_address
1785
	call	get_address
1784
	cmp	[operand_size],1
1786
	cmp	[operand_size],1
1785
	ja	invalid_operand_size
1787
	ja	invalid_operand_size
1786
	mov	[postbyte_register],0
1788
	mov	[postbyte_register],0
1787
	call	store_instruction
1789
	call	store_instruction
1788
	jmp	instruction_assembled
1790
	jmp	instruction_assembled
1789
      set_reg:
1791
      set_reg:
1790
	lods	byte [esi]
1792
	lods	byte [esi]
1791
	call	convert_register
1793
	call	convert_register
1792
	cmp	ah,1
1794
	cmp	ah,1
1793
	jne	invalid_operand_size
1795
	jne	invalid_operand_size
1794
	mov	bl,al
1796
	mov	bl,al
1795
	mov	[postbyte_register],0
1797
	mov	[postbyte_register],0
1796
	call	store_nomem_instruction
1798
	call	store_nomem_instruction
1797
	jmp	instruction_assembled
1799
	jmp	instruction_assembled
1798
arpl_instruction:
1800
arpl_instruction:
1799
	cmp	[code_type],64
1801
	cmp	[code_type],64
1800
	je	illegal_instruction
1802
	je	illegal_instruction
1801
	mov	[base_code],63h
1803
	mov	[base_code],63h
1802
	lods	byte [esi]
1804
	lods	byte [esi]
1803
	call	get_size_operator
1805
	call	get_size_operator
1804
	cmp	al,10h
1806
	cmp	al,10h
1805
	je	arpl_reg
1807
	je	arpl_reg
1806
	cmp	al,'['
1808
	cmp	al,'['
1807
	jne	invalid_operand
1809
	jne	invalid_operand
1808
	call	get_address
1810
	call	get_address
1809
	lods	byte [esi]
1811
	lods	byte [esi]
1810
	cmp	al,','
1812
	cmp	al,','
1811
	jne	invalid_operand
1813
	jne	invalid_operand
1812
	lods	byte [esi]
1814
	lods	byte [esi]
1813
	cmp	al,10h
1815
	cmp	al,10h
1814
	jne	invalid_operand
1816
	jne	invalid_operand
1815
	lods	byte [esi]
1817
	lods	byte [esi]
1816
	call	convert_register
1818
	call	convert_register
1817
	mov	[postbyte_register],al
1819
	mov	[postbyte_register],al
1818
	cmp	ah,2
1820
	cmp	ah,2
1819
	jne	invalid_operand_size
1821
	jne	invalid_operand_size
1820
	call	store_instruction
1822
	call	store_instruction
1821
	jmp	instruction_assembled
1823
	jmp	instruction_assembled
1822
      arpl_reg:
1824
      arpl_reg:
1823
	lods	byte [esi]
1825
	lods	byte [esi]
1824
	call	convert_register
1826
	call	convert_register
1825
	cmp	ah,2
1827
	cmp	ah,2
1826
	jne	invalid_operand_size
1828
	jne	invalid_operand_size
1827
	mov	bl,al
1829
	mov	bl,al
1828
	lods	byte [esi]
1830
	lods	byte [esi]
1829
	cmp	al,','
1831
	cmp	al,','
1830
	jne	invalid_operand
1832
	jne	invalid_operand
1831
	lods	byte [esi]
1833
	lods	byte [esi]
1832
	cmp	al,10h
1834
	cmp	al,10h
1833
	jne	invalid_operand
1835
	jne	invalid_operand
1834
	lods	byte [esi]
1836
	lods	byte [esi]
1835
	call	convert_register
1837
	call	convert_register
1836
	cmp	ah,2
1838
	cmp	ah,2
1837
	jne	invalid_operand_size
1839
	jne	invalid_operand_size
1838
	mov	[postbyte_register],al
1840
	mov	[postbyte_register],al
1839
	call	store_nomem_instruction
1841
	call	store_nomem_instruction
1840
	jmp	instruction_assembled
1842
	jmp	instruction_assembled
1841
bound_instruction:
1843
bound_instruction:
1842
	cmp	[code_type],64
1844
	cmp	[code_type],64
1843
	je	illegal_instruction
1845
	je	illegal_instruction
1844
	lods	byte [esi]
1846
	lods	byte [esi]
1845
	call	get_size_operator
1847
	call	get_size_operator
1846
	cmp	al,10h
1848
	cmp	al,10h
1847
	jne	invalid_operand
1849
	jne	invalid_operand
1848
	lods	byte [esi]
1850
	lods	byte [esi]
1849
	call	convert_register
1851
	call	convert_register
1850
	mov	[postbyte_register],al
1852
	mov	[postbyte_register],al
1851
	lods	byte [esi]
1853
	lods	byte [esi]
1852
	cmp	al,','
1854
	cmp	al,','
1853
	jne	invalid_operand
1855
	jne	invalid_operand
1854
	lods	byte [esi]
1856
	lods	byte [esi]
1855
	call	get_size_operator
1857
	call	get_size_operator
1856
	cmp	al,'['
1858
	cmp	al,'['
1857
	jne	invalid_operand
1859
	jne	invalid_operand
1858
	call	get_address
1860
	call	get_address
1859
	mov	al,[operand_size]
1861
	mov	al,[operand_size]
1860
	cmp	al,2
1862
	cmp	al,2
1861
	je	bound_16bit
1863
	je	bound_16bit
1862
	cmp	al,4
1864
	cmp	al,4
1863
	je	bound_32bit
1865
	je	bound_32bit
1864
	jmp	invalid_operand_size
1866
	jmp	invalid_operand_size
1865
      bound_32bit:
1867
      bound_32bit:
1866
	call	operand_32bit
1868
	call	operand_32bit
1867
	mov	[base_code],62h
1869
	mov	[base_code],62h
1868
	call	store_instruction
1870
	call	store_instruction
1869
	jmp	instruction_assembled
1871
	jmp	instruction_assembled
1870
      bound_16bit:
1872
      bound_16bit:
1871
	call	operand_16bit
1873
	call	operand_16bit
1872
	mov	[base_code],62h
1874
	mov	[base_code],62h
1873
	call	store_instruction
1875
	call	store_instruction
1874
	jmp	instruction_assembled
1876
	jmp	instruction_assembled
1875
enter_instruction:
1877
enter_instruction:
1876
	lods	byte [esi]
1878
	lods	byte [esi]
1877
	call	get_size_operator
1879
	call	get_size_operator
1878
	cmp	ah,2
1880
	cmp	ah,2
1879
	je	enter_imm16_size_ok
1881
	je	enter_imm16_size_ok
1880
	or	ah,ah
1882
	or	ah,ah
1881
	jnz	invalid_operand_size
1883
	jnz	invalid_operand_size
1882
      enter_imm16_size_ok:
1884
      enter_imm16_size_ok:
1883
	cmp	al,'('
1885
	cmp	al,'('
1884
	jne	invalid_operand
1886
	jne	invalid_operand
1885
	call	get_word_value
1887
	call	get_word_value
1886
	cmp	[next_pass_needed],0
1888
	cmp	[next_pass_needed],0
1887
	jne	enter_imm16_ok
1889
	jne	enter_imm16_ok
1888
	cmp	[value_type],0
1890
	cmp	[value_type],0
1889
	jne	invalid_use_of_symbol
1891
	jne	invalid_use_of_symbol
1890
      enter_imm16_ok:
1892
      enter_imm16_ok:
1891
	push	eax
1893
	push	eax
1892
	mov	[operand_size],0
1894
	mov	[operand_size],0
1893
	lods	byte [esi]
1895
	lods	byte [esi]
1894
	cmp	al,','
1896
	cmp	al,','
1895
	jne	invalid_operand
1897
	jne	invalid_operand
1896
	lods	byte [esi]
1898
	lods	byte [esi]
1897
	call	get_size_operator
1899
	call	get_size_operator
1898
	cmp	ah,1
1900
	cmp	ah,1
1899
	je	enter_imm8_size_ok
1901
	je	enter_imm8_size_ok
1900
	or	ah,ah
1902
	or	ah,ah
1901
	jnz	invalid_operand_size
1903
	jnz	invalid_operand_size
1902
      enter_imm8_size_ok:
1904
      enter_imm8_size_ok:
1903
	cmp	al,'('
1905
	cmp	al,'('
1904
	jne	invalid_operand
1906
	jne	invalid_operand
1905
	call	get_byte_value
1907
	call	get_byte_value
1906
	mov	dl,al
1908
	mov	dl,al
1907
	pop	ebx
1909
	pop	ebx
1908
	mov	al,0C8h
1910
	mov	al,0C8h
1909
	stos	byte [edi]
1911
	stos	byte [edi]
1910
	mov	ax,bx
1912
	mov	ax,bx
1911
	stos	word [edi]
1913
	stos	word [edi]
1912
	mov	al,dl
1914
	mov	al,dl
1913
	stos	byte [edi]
1915
	stos	byte [edi]
1914
	jmp	instruction_assembled
1916
	jmp	instruction_assembled
1915
ret_instruction_only64:
1917
ret_instruction_only64:
1916
	cmp	[code_type],64
1918
	cmp	[code_type],64
1917
	jne	illegal_instruction
1919
	jne	illegal_instruction
1918
	jmp	ret_instruction
1920
	jmp	ret_instruction
1919
ret_instruction_32bit_except64:
1921
ret_instruction_32bit_except64:
1920
	cmp	[code_type],64
1922
	cmp	[code_type],64
1921
	je	illegal_instruction
1923
	je	illegal_instruction
1922
ret_instruction_32bit:
1924
ret_instruction_32bit:
1923
	call	operand_32bit
1925
	call	operand_32bit
1924
	jmp	ret_instruction
1926
	jmp	ret_instruction
1925
ret_instruction_16bit:
1927
ret_instruction_16bit:
1926
	call	operand_16bit
1928
	call	operand_16bit
1927
	jmp	ret_instruction
1929
	jmp	ret_instruction
1928
retf_instruction:
1930
retf_instruction:
1929
	cmp	[code_type],64
1931
	cmp	[code_type],64
1930
	jne	ret_instruction
1932
	jne	ret_instruction
1931
ret_instruction_64bit:
1933
ret_instruction_64bit:
1932
	call	operand_64bit
1934
	call	operand_64bit
1933
ret_instruction:
1935
ret_instruction:
1934
	mov	[base_code],al
1936
	mov	[base_code],al
1935
	lods	byte [esi]
1937
	lods	byte [esi]
1936
	dec	esi
1938
	dec	esi
1937
	or	al,al
1939
	or	al,al
1938
	jz	simple_ret
1940
	jz	simple_ret
1939
	cmp	al,0Fh
1941
	cmp	al,0Fh
1940
	je	simple_ret
1942
	je	simple_ret
1941
	lods	byte [esi]
1943
	lods	byte [esi]
1942
	call	get_size_operator
1944
	call	get_size_operator
1943
	or	ah,ah
1945
	or	ah,ah
1944
	jz	ret_imm
1946
	jz	ret_imm
1945
	cmp	ah,2
1947
	cmp	ah,2
1946
	je	ret_imm
1948
	je	ret_imm
1947
	jmp	invalid_operand_size
1949
	jmp	invalid_operand_size
1948
      ret_imm:
1950
      ret_imm:
1949
	cmp	al,'('
1951
	cmp	al,'('
1950
	jne	invalid_operand
1952
	jne	invalid_operand
1951
	call	get_word_value
1953
	call	get_word_value
1952
	cmp	[next_pass_needed],0
1954
	cmp	[next_pass_needed],0
1953
	jne	ret_imm_ok
1955
	jne	ret_imm_ok
1954
	cmp	[value_type],0
1956
	cmp	[value_type],0
1955
	jne	invalid_use_of_symbol
1957
	jne	invalid_use_of_symbol
1956
      ret_imm_ok:
1958
      ret_imm_ok:
1957
	cmp	[size_declared],0
1959
	cmp	[size_declared],0
1958
	jne	ret_imm_store
1960
	jne	ret_imm_store
1959
	or	ax,ax
1961
	or	ax,ax
1960
	jz	simple_ret
1962
	jz	simple_ret
1961
      ret_imm_store:
1963
      ret_imm_store:
1962
	mov	dx,ax
1964
	mov	dx,ax
1963
	call	store_instruction_code
1965
	call	store_instruction_code
1964
	mov	ax,dx
1966
	mov	ax,dx
1965
	stos	word [edi]
1967
	stos	word [edi]
1966
	jmp	instruction_assembled
1968
	jmp	instruction_assembled
1967
      simple_ret:
1969
      simple_ret:
1968
	inc	[base_code]
1970
	inc	[base_code]
1969
	call	store_instruction_code
1971
	call	store_instruction_code
1970
	jmp	instruction_assembled
1972
	jmp	instruction_assembled
1971
lea_instruction:
1973
lea_instruction:
1972
	mov	[base_code],8Dh
1974
	mov	[base_code],8Dh
1973
	lods	byte [esi]
1975
	lods	byte [esi]
1974
	call	get_size_operator
1976
	call	get_size_operator
1975
	cmp	al,10h
1977
	cmp	al,10h
1976
	jne	invalid_operand
1978
	jne	invalid_operand
1977
	lods	byte [esi]
1979
	lods	byte [esi]
1978
	call	convert_register
1980
	call	convert_register
1979
	mov	[postbyte_register],al
1981
	mov	[postbyte_register],al
1980
	lods	byte [esi]
1982
	lods	byte [esi]
1981
	cmp	al,','
1983
	cmp	al,','
1982
	jne	invalid_operand
1984
	jne	invalid_operand
1983
	xor	al,al
1985
	xor	al,al
1984
	xchg	al,[operand_size]
1986
	xchg	al,[operand_size]
1985
	push	eax
1987
	push	eax
1986
	lods	byte [esi]
1988
	lods	byte [esi]
1987
	call	get_size_operator
1989
	call	get_size_operator
1988
	cmp	al,'['
1990
	cmp	al,'['
1989
	jne	invalid_operand
1991
	jne	invalid_operand
1990
	mov	[size_override],-1
1992
	mov	[size_override],-1
1991
	call	get_address
1993
	call	get_address
1992
	pop	eax
1994
	pop	eax
1993
	mov	[operand_size],al
1995
	mov	[operand_size],al
1994
	call	operand_autodetect
1996
	call	operand_autodetect
1995
	call	store_instruction
1997
	call	store_instruction
1996
	jmp	instruction_assembled
1998
	jmp	instruction_assembled
1997
ls_instruction:
1999
ls_instruction:
1998
	or	al,al
2000
	or	al,al
1999
	jz	les_instruction
2001
	jz	les_instruction
2000
	cmp	al,3
2002
	cmp	al,3
2001
	jz	lds_instruction
2003
	jz	lds_instruction
2002
	add	al,0B0h
2004
	add	al,0B0h
2003
	mov	[extended_code],al
2005
	mov	[extended_code],al
2004
	mov	[base_code],0Fh
2006
	mov	[base_code],0Fh
2005
	jmp	ls_code_ok
2007
	jmp	ls_code_ok
2006
      les_instruction:
2008
      les_instruction:
2007
	mov	[base_code],0C4h
2009
	mov	[base_code],0C4h
2008
	jmp	ls_short_code
2010
	jmp	ls_short_code
2009
      lds_instruction:
2011
      lds_instruction:
2010
	mov	[base_code],0C5h
2012
	mov	[base_code],0C5h
2011
      ls_short_code:
2013
      ls_short_code:
2012
	cmp	[code_type],64
2014
	cmp	[code_type],64
2013
	je	illegal_instruction
2015
	je	illegal_instruction
2014
      ls_code_ok:
2016
      ls_code_ok:
2015
	lods	byte [esi]
2017
	lods	byte [esi]
2016
	call	get_size_operator
2018
	call	get_size_operator
2017
	cmp	al,10h
2019
	cmp	al,10h
2018
	jne	invalid_operand
2020
	jne	invalid_operand
2019
	lods	byte [esi]
2021
	lods	byte [esi]
2020
	call	convert_register
2022
	call	convert_register
2021
	mov	[postbyte_register],al
2023
	mov	[postbyte_register],al
2022
	lods	byte [esi]
2024
	lods	byte [esi]
2023
	cmp	al,','
2025
	cmp	al,','
2024
	jne	invalid_operand
2026
	jne	invalid_operand
2025
	add	[operand_size],2
2027
	add	[operand_size],2
2026
	lods	byte [esi]
2028
	lods	byte [esi]
2027
	call	get_size_operator
2029
	call	get_size_operator
2028
	cmp	al,'['
2030
	cmp	al,'['
2029
	jne	invalid_operand
2031
	jne	invalid_operand
2030
	call	get_address
2032
	call	get_address
2031
	mov	al,[operand_size]
2033
	mov	al,[operand_size]
2032
	cmp	al,4
2034
	cmp	al,4
2033
	je	ls_16bit
2035
	je	ls_16bit
2034
	cmp	al,6
2036
	cmp	al,6
2035
	je	ls_32bit
2037
	je	ls_32bit
2036
	cmp	al,10
2038
	cmp	al,10
2037
	je	ls_64bit
2039
	je	ls_64bit
2038
	jmp	invalid_operand_size
2040
	jmp	invalid_operand_size
2039
      ls_16bit:
2041
      ls_16bit:
2040
	call	operand_16bit
2042
	call	operand_16bit
2041
	call	store_instruction
2043
	call	store_instruction
2042
	jmp	instruction_assembled
2044
	jmp	instruction_assembled
2043
      ls_32bit:
2045
      ls_32bit:
2044
	call	operand_32bit
2046
	call	operand_32bit
2045
	call	store_instruction
2047
	call	store_instruction
2046
	jmp	instruction_assembled
2048
	jmp	instruction_assembled
2047
      ls_64bit:
2049
      ls_64bit:
2048
	call	operand_64bit
2050
	call	operand_64bit
2049
	call	store_instruction
2051
	call	store_instruction
2050
	jmp	instruction_assembled
2052
	jmp	instruction_assembled
2051
sh_instruction:
2053
sh_instruction:
2052
	mov	[postbyte_register],al
2054
	mov	[postbyte_register],al
2053
	lods	byte [esi]
2055
	lods	byte [esi]
2054
	call	get_size_operator
2056
	call	get_size_operator
2055
	cmp	al,10h
2057
	cmp	al,10h
2056
	je	sh_reg
2058
	je	sh_reg
2057
	cmp	al,'['
2059
	cmp	al,'['
2058
	jne	invalid_operand
2060
	jne	invalid_operand
2059
      sh_mem:
2061
      sh_mem:
2060
	call	get_address
2062
	call	get_address
2061
	push	edx ebx ecx
2063
	push	edx ebx ecx
2062
	mov	al,[operand_size]
2064
	mov	al,[operand_size]
2063
	push	eax
2065
	push	eax
2064
	mov	[operand_size],0
2066
	mov	[operand_size],0
2065
	lods	byte [esi]
2067
	lods	byte [esi]
2066
	cmp	al,','
2068
	cmp	al,','
2067
	jne	invalid_operand
2069
	jne	invalid_operand
2068
	lods	byte [esi]
2070
	lods	byte [esi]
2069
	call	get_size_operator
2071
	call	get_size_operator
2070
	cmp	al,'('
2072
	cmp	al,'('
2071
	je	sh_mem_imm
2073
	je	sh_mem_imm
2072
	cmp	al,10h
2074
	cmp	al,10h
2073
	jne	invalid_operand
2075
	jne	invalid_operand
2074
      sh_mem_reg:
2076
      sh_mem_reg:
2075
	lods	byte [esi]
2077
	lods	byte [esi]
2076
	cmp	al,11h
2078
	cmp	al,11h
2077
	jne	invalid_operand
2079
	jne	invalid_operand
2078
	pop	eax ecx ebx edx
2080
	pop	eax ecx ebx edx
2079
	cmp	al,1
2081
	cmp	al,1
2080
	je	sh_mem_cl_8bit
2082
	je	sh_mem_cl_8bit
2081
	jb	sh_mem_cl_nosize
2083
	jb	sh_mem_cl_nosize
2082
	call	operand_autodetect
2084
	call	operand_autodetect
2083
	mov	[base_code],0D3h
2085
	mov	[base_code],0D3h
2084
	call	store_instruction
2086
	call	store_instruction
2085
	jmp	instruction_assembled
2087
	jmp	instruction_assembled
2086
      sh_mem_cl_nosize:
2088
      sh_mem_cl_nosize:
2087
	cmp	[error_line],0
2089
	cmp	[error_line],0
2088
	jne	sh_mem_cl_8bit
2090
	jne	sh_mem_cl_8bit
2089
	mov	eax,[current_line]
2091
	mov	eax,[current_line]
2090
	mov	[error_line],eax
2092
	mov	[error_line],eax
2091
	mov	[error],operand_size_not_specified
2093
	mov	[error],operand_size_not_specified
2092
      sh_mem_cl_8bit:
2094
      sh_mem_cl_8bit:
2093
	mov	[base_code],0D2h
2095
	mov	[base_code],0D2h
2094
	call	store_instruction
2096
	call	store_instruction
2095
	jmp	instruction_assembled
2097
	jmp	instruction_assembled
2096
      sh_mem_imm:
2098
      sh_mem_imm:
2097
	mov	al,[operand_size]
2099
	mov	al,[operand_size]
2098
	or	al,al
2100
	or	al,al
2099
	jz	sh_mem_imm_size_ok
2101
	jz	sh_mem_imm_size_ok
2100
	cmp	al,1
2102
	cmp	al,1
2101
	jne	invalid_operand_size
2103
	jne	invalid_operand_size
2102
      sh_mem_imm_size_ok:
2104
      sh_mem_imm_size_ok:
2103
	call	get_byte_value
2105
	call	get_byte_value
2104
	mov	byte [value],al
2106
	mov	byte [value],al
2105
	pop	eax ecx ebx edx
2107
	pop	eax ecx ebx edx
2106
	cmp	al,1
2108
	cmp	al,1
2107
	je	sh_mem_imm_8bit
2109
	je	sh_mem_imm_8bit
2108
	jb	sh_mem_imm_nosize
2110
	jb	sh_mem_imm_nosize
2109
	call	operand_autodetect
2111
	call	operand_autodetect
2110
	cmp	byte [value],1
2112
	cmp	byte [value],1
2111
	je	sh_mem_1
2113
	je	sh_mem_1
2112
	mov	[base_code],0C1h
2114
	mov	[base_code],0C1h
2113
	call	store_instruction_with_imm8
2115
	call	store_instruction_with_imm8
2114
	jmp	instruction_assembled
2116
	jmp	instruction_assembled
2115
      sh_mem_1:
2117
      sh_mem_1:
2116
	mov	[base_code],0D1h
2118
	mov	[base_code],0D1h
2117
	call	store_instruction
2119
	call	store_instruction
2118
	jmp	instruction_assembled
2120
	jmp	instruction_assembled
2119
      sh_mem_imm_nosize:
2121
      sh_mem_imm_nosize:
2120
	cmp	[error_line],0
2122
	cmp	[error_line],0
2121
	jne	sh_mem_imm_8bit
2123
	jne	sh_mem_imm_8bit
2122
	mov	eax,[current_line]
2124
	mov	eax,[current_line]
2123
	mov	[error_line],eax
2125
	mov	[error_line],eax
2124
	mov	[error],operand_size_not_specified
2126
	mov	[error],operand_size_not_specified
2125
      sh_mem_imm_8bit:
2127
      sh_mem_imm_8bit:
2126
	cmp	byte [value],1
2128
	cmp	byte [value],1
2127
	je	sh_mem_1_8bit
2129
	je	sh_mem_1_8bit
2128
	mov	[base_code],0C0h
2130
	mov	[base_code],0C0h
2129
	call	store_instruction_with_imm8
2131
	call	store_instruction_with_imm8
2130
	jmp	instruction_assembled
2132
	jmp	instruction_assembled
2131
      sh_mem_1_8bit:
2133
      sh_mem_1_8bit:
2132
	mov	[base_code],0D0h
2134
	mov	[base_code],0D0h
2133
	call	store_instruction
2135
	call	store_instruction
2134
	jmp	instruction_assembled
2136
	jmp	instruction_assembled
2135
      sh_reg:
2137
      sh_reg:
2136
	lods	byte [esi]
2138
	lods	byte [esi]
2137
	call	convert_register
2139
	call	convert_register
2138
	mov	bx,ax
2140
	mov	bx,ax
2139
	mov	[operand_size],0
2141
	mov	[operand_size],0
2140
	lods	byte [esi]
2142
	lods	byte [esi]
2141
	cmp	al,','
2143
	cmp	al,','
2142
	jne	invalid_operand
2144
	jne	invalid_operand
2143
	lods	byte [esi]
2145
	lods	byte [esi]
2144
	call	get_size_operator
2146
	call	get_size_operator
2145
	cmp	al,'('
2147
	cmp	al,'('
2146
	je	sh_reg_imm
2148
	je	sh_reg_imm
2147
	cmp	al,10h
2149
	cmp	al,10h
2148
	jne	invalid_operand
2150
	jne	invalid_operand
2149
      sh_reg_reg:
2151
      sh_reg_reg:
2150
	lods	byte [esi]
2152
	lods	byte [esi]
2151
	cmp	al,11h
2153
	cmp	al,11h
2152
	jne	invalid_operand
2154
	jne	invalid_operand
2153
	mov	al,bh
2155
	mov	al,bh
2154
	cmp	al,1
2156
	cmp	al,1
2155
	je	sh_reg_cl_8bit
2157
	je	sh_reg_cl_8bit
2156
	call	operand_autodetect
2158
	call	operand_autodetect
2157
	mov	[base_code],0D3h
2159
	mov	[base_code],0D3h
2158
	call	store_nomem_instruction
2160
	call	store_nomem_instruction
2159
	jmp	instruction_assembled
2161
	jmp	instruction_assembled
2160
      sh_reg_cl_8bit:
2162
      sh_reg_cl_8bit:
2161
	mov	[base_code],0D2h
2163
	mov	[base_code],0D2h
2162
	call	store_nomem_instruction
2164
	call	store_nomem_instruction
2163
	jmp	instruction_assembled
2165
	jmp	instruction_assembled
2164
      sh_reg_imm:
2166
      sh_reg_imm:
2165
	mov	al,[operand_size]
2167
	mov	al,[operand_size]
2166
	or	al,al
2168
	or	al,al
2167
	jz	sh_reg_imm_size_ok
2169
	jz	sh_reg_imm_size_ok
2168
	cmp	al,1
2170
	cmp	al,1
2169
	jne	invalid_operand_size
2171
	jne	invalid_operand_size
2170
      sh_reg_imm_size_ok:
2172
      sh_reg_imm_size_ok:
2171
	push	ebx
2173
	push	ebx
2172
	call	get_byte_value
2174
	call	get_byte_value
2173
	mov	dl,al
2175
	mov	dl,al
2174
	pop	ebx
2176
	pop	ebx
2175
	mov	al,bh
2177
	mov	al,bh
2176
	cmp	al,1
2178
	cmp	al,1
2177
	je	sh_reg_imm_8bit
2179
	je	sh_reg_imm_8bit
2178
	call	operand_autodetect
2180
	call	operand_autodetect
2179
	cmp	dl,1
2181
	cmp	dl,1
2180
	je	sh_reg_1
2182
	je	sh_reg_1
2181
	mov	[base_code],0C1h
2183
	mov	[base_code],0C1h
2182
	call	store_nomem_instruction
2184
	call	store_nomem_instruction
2183
	mov	al,dl
2185
	mov	al,dl
2184
	stos	byte [edi]
2186
	stos	byte [edi]
2185
	jmp	instruction_assembled
2187
	jmp	instruction_assembled
2186
      sh_reg_1:
2188
      sh_reg_1:
2187
	mov	[base_code],0D1h
2189
	mov	[base_code],0D1h
2188
	call	store_nomem_instruction
2190
	call	store_nomem_instruction
2189
	jmp	instruction_assembled
2191
	jmp	instruction_assembled
2190
      sh_reg_imm_8bit:
2192
      sh_reg_imm_8bit:
2191
	cmp	dl,1
2193
	cmp	dl,1
2192
	je	sh_reg_1_8bit
2194
	je	sh_reg_1_8bit
2193
	mov	[base_code],0C0h
2195
	mov	[base_code],0C0h
2194
	call	store_nomem_instruction
2196
	call	store_nomem_instruction
2195
	mov	al,dl
2197
	mov	al,dl
2196
	stos	byte [edi]
2198
	stos	byte [edi]
2197
	jmp	instruction_assembled
2199
	jmp	instruction_assembled
2198
      sh_reg_1_8bit:
2200
      sh_reg_1_8bit:
2199
	mov	[base_code],0D0h
2201
	mov	[base_code],0D0h
2200
	call	store_nomem_instruction
2202
	call	store_nomem_instruction
2201
	jmp	instruction_assembled
2203
	jmp	instruction_assembled
2202
shd_instruction:
2204
shd_instruction:
2203
	mov	[base_code],0Fh
2205
	mov	[base_code],0Fh
2204
	mov	[extended_code],al
2206
	mov	[extended_code],al
2205
	lods	byte [esi]
2207
	lods	byte [esi]
2206
	call	get_size_operator
2208
	call	get_size_operator
2207
	cmp	al,10h
2209
	cmp	al,10h
2208
	je	shd_reg
2210
	je	shd_reg
2209
	cmp	al,'['
2211
	cmp	al,'['
2210
	jne	invalid_operand
2212
	jne	invalid_operand
2211
      shd_mem:
2213
      shd_mem:
2212
	call	get_address
2214
	call	get_address
2213
	push	edx ebx ecx
2215
	push	edx ebx ecx
2214
	lods	byte [esi]
2216
	lods	byte [esi]
2215
	cmp	al,','
2217
	cmp	al,','
2216
	jne	invalid_operand
2218
	jne	invalid_operand
2217
	lods	byte [esi]
2219
	lods	byte [esi]
2218
	call	get_size_operator
2220
	call	get_size_operator
2219
	cmp	al,10h
2221
	cmp	al,10h
2220
	jne	invalid_operand
2222
	jne	invalid_operand
2221
	lods	byte [esi]
2223
	lods	byte [esi]
2222
	call	convert_register
2224
	call	convert_register
2223
	mov	[postbyte_register],al
2225
	mov	[postbyte_register],al
2224
	lods	byte [esi]
2226
	lods	byte [esi]
2225
	cmp	al,','
2227
	cmp	al,','
2226
	jne	invalid_operand
2228
	jne	invalid_operand
2227
	mov	al,ah
2229
	mov	al,ah
2228
	mov	[operand_size],0
2230
	mov	[operand_size],0
2229
	push	eax
2231
	push	eax
2230
	lods	byte [esi]
2232
	lods	byte [esi]
2231
	call	get_size_operator
2233
	call	get_size_operator
2232
	cmp	al,'('
2234
	cmp	al,'('
2233
	je	shd_mem_reg_imm
2235
	je	shd_mem_reg_imm
2234
	cmp	al,10h
2236
	cmp	al,10h
2235
	jne	invalid_operand
2237
	jne	invalid_operand
2236
	lods	byte [esi]
2238
	lods	byte [esi]
2237
	cmp	al,11h
2239
	cmp	al,11h
2238
	jne	invalid_operand
2240
	jne	invalid_operand
2239
	pop	eax ecx ebx edx
2241
	pop	eax ecx ebx edx
2240
	call	operand_autodetect
2242
	call	operand_autodetect
2241
	inc	[extended_code]
2243
	inc	[extended_code]
2242
	call	store_instruction
2244
	call	store_instruction
2243
	jmp	instruction_assembled
2245
	jmp	instruction_assembled
2244
      shd_mem_reg_imm:
2246
      shd_mem_reg_imm:
2245
	mov	al,[operand_size]
2247
	mov	al,[operand_size]
2246
	or	al,al
2248
	or	al,al
2247
	jz	shd_mem_reg_imm_size_ok
2249
	jz	shd_mem_reg_imm_size_ok
2248
	cmp	al,1
2250
	cmp	al,1
2249
	jne	invalid_operand_size
2251
	jne	invalid_operand_size
2250
      shd_mem_reg_imm_size_ok:
2252
      shd_mem_reg_imm_size_ok:
2251
	call	get_byte_value
2253
	call	get_byte_value
2252
	mov	byte [value],al
2254
	mov	byte [value],al
2253
	pop	eax ecx ebx edx
2255
	pop	eax ecx ebx edx
2254
	call	operand_autodetect
2256
	call	operand_autodetect
2255
	call	store_instruction_with_imm8
2257
	call	store_instruction_with_imm8
2256
	jmp	instruction_assembled
2258
	jmp	instruction_assembled
2257
      shd_reg:
2259
      shd_reg:
2258
	lods	byte [esi]
2260
	lods	byte [esi]
2259
	call	convert_register
2261
	call	convert_register
2260
	mov	[postbyte_register],al
2262
	mov	[postbyte_register],al
2261
	lods	byte [esi]
2263
	lods	byte [esi]
2262
	cmp	al,','
2264
	cmp	al,','
2263
	jne	invalid_operand
2265
	jne	invalid_operand
2264
	lods	byte [esi]
2266
	lods	byte [esi]
2265
	call	get_size_operator
2267
	call	get_size_operator
2266
	cmp	al,10h
2268
	cmp	al,10h
2267
	jne	invalid_operand
2269
	jne	invalid_operand
2268
	lods	byte [esi]
2270
	lods	byte [esi]
2269
	call	convert_register
2271
	call	convert_register
2270
	mov	bl,[postbyte_register]
2272
	mov	bl,[postbyte_register]
2271
	mov	[postbyte_register],al
2273
	mov	[postbyte_register],al
2272
	mov	al,ah
2274
	mov	al,ah
2273
	push	eax ebx
2275
	push	eax ebx
2274
	lods	byte [esi]
2276
	lods	byte [esi]
2275
	cmp	al,','
2277
	cmp	al,','
2276
	jne	invalid_operand
2278
	jne	invalid_operand
2277
	mov	[operand_size],0
2279
	mov	[operand_size],0
2278
	lods	byte [esi]
2280
	lods	byte [esi]
2279
	call	get_size_operator
2281
	call	get_size_operator
2280
	cmp	al,'('
2282
	cmp	al,'('
2281
	je	shd_reg_reg_imm
2283
	je	shd_reg_reg_imm
2282
	cmp	al,10h
2284
	cmp	al,10h
2283
	jne	invalid_operand
2285
	jne	invalid_operand
2284
	lods	byte [esi]
2286
	lods	byte [esi]
2285
	cmp	al,11h
2287
	cmp	al,11h
2286
	jne	invalid_operand
2288
	jne	invalid_operand
2287
	pop	ebx eax
2289
	pop	ebx eax
2288
	call	operand_autodetect
2290
	call	operand_autodetect
2289
	inc	[extended_code]
2291
	inc	[extended_code]
2290
	call	store_nomem_instruction
2292
	call	store_nomem_instruction
2291
	jmp	instruction_assembled
2293
	jmp	instruction_assembled
2292
      shd_reg_reg_imm:
2294
      shd_reg_reg_imm:
2293
	mov	al,[operand_size]
2295
	mov	al,[operand_size]
2294
	or	al,al
2296
	or	al,al
2295
	jz	shd_reg_reg_imm_size_ok
2297
	jz	shd_reg_reg_imm_size_ok
2296
	cmp	al,1
2298
	cmp	al,1
2297
	jne	invalid_operand_size
2299
	jne	invalid_operand_size
2298
      shd_reg_reg_imm_size_ok:
2300
      shd_reg_reg_imm_size_ok:
2299
	call	get_byte_value
2301
	call	get_byte_value
2300
	mov	dl,al
2302
	mov	dl,al
2301
	pop	ebx eax
2303
	pop	ebx eax
2302
	call	operand_autodetect
2304
	call	operand_autodetect
2303
	call	store_nomem_instruction
2305
	call	store_nomem_instruction
2304
	mov	al,dl
2306
	mov	al,dl
2305
	stos	byte [edi]
2307
	stos	byte [edi]
2306
	jmp	instruction_assembled
2308
	jmp	instruction_assembled
2307
movx_instruction:
2309
movx_instruction:
2308
	mov	[base_code],0Fh
2310
	mov	[base_code],0Fh
2309
	mov	[extended_code],al
2311
	mov	[extended_code],al
2310
	lods	byte [esi]
2312
	lods	byte [esi]
2311
	call	get_size_operator
2313
	call	get_size_operator
2312
	cmp	al,10h
2314
	cmp	al,10h
2313
	jne	invalid_operand
2315
	jne	invalid_operand
2314
	lods	byte [esi]
2316
	lods	byte [esi]
2315
	call	convert_register
2317
	call	convert_register
2316
	mov	[postbyte_register],al
2318
	mov	[postbyte_register],al
2317
	mov	al,ah
2319
	mov	al,ah
2318
	push	eax
2320
	push	eax
2319
	lods	byte [esi]
2321
	lods	byte [esi]
2320
	cmp	al,','
2322
	cmp	al,','
2321
	jne	invalid_operand
2323
	jne	invalid_operand
2322
	mov	[operand_size],0
2324
	mov	[operand_size],0
2323
	lods	byte [esi]
2325
	lods	byte [esi]
2324
	call	get_size_operator
2326
	call	get_size_operator
2325
	cmp	al,10h
2327
	cmp	al,10h
2326
	je	movx_reg
2328
	je	movx_reg
2327
	cmp	al,'['
2329
	cmp	al,'['
2328
	jne	invalid_operand
2330
	jne	invalid_operand
2329
	call	get_address
2331
	call	get_address
2330
	pop	eax
2332
	pop	eax
2331
	mov	ah,[operand_size]
2333
	mov	ah,[operand_size]
2332
	or	ah,ah
2334
	or	ah,ah
2333
	jz	movx_unknown_size
2335
	jz	movx_unknown_size
2334
	cmp	ah,al
2336
	cmp	ah,al
2335
	jae	invalid_operand_size
2337
	jae	invalid_operand_size
2336
	cmp	ah,1
2338
	cmp	ah,1
2337
	je	movx_mem_8bit
2339
	je	movx_mem_8bit
2338
	cmp	ah,2
2340
	cmp	ah,2
2339
	jne	invalid_operand_size
2341
	jne	invalid_operand_size
2340
      movx_mem_16bit:
2342
      movx_mem_16bit:
2341
	inc	[extended_code]
2343
	inc	[extended_code]
2342
	call	operand_autodetect
2344
	call	operand_autodetect
2343
	call	store_instruction
2345
	call	store_instruction
2344
	jmp	instruction_assembled
2346
	jmp	instruction_assembled
2345
      movx_unknown_size:
2347
      movx_unknown_size:
2346
	cmp	[error_line],0
2348
	cmp	[error_line],0
2347
	jne	movx_mem_8bit
2349
	jne	movx_mem_8bit
2348
	mov	eax,[current_line]
2350
	mov	eax,[current_line]
2349
	mov	[error_line],eax
2351
	mov	[error_line],eax
2350
	mov	[error],operand_size_not_specified
2352
	mov	[error],operand_size_not_specified
2351
      movx_mem_8bit:
2353
      movx_mem_8bit:
2352
	call	operand_autodetect
2354
	call	operand_autodetect
2353
	call	store_instruction
2355
	call	store_instruction
2354
	jmp	instruction_assembled
2356
	jmp	instruction_assembled
2355
      movx_reg:
2357
      movx_reg:
2356
	lods	byte [esi]
2358
	lods	byte [esi]
2357
	call	convert_register
2359
	call	convert_register
2358
	pop	ebx
2360
	pop	ebx
2359
	xchg	bl,al
2361
	xchg	bl,al
2360
	cmp	ah,al
2362
	cmp	ah,al
2361
	jae	invalid_operand_size
2363
	jae	invalid_operand_size
2362
	cmp	ah,1
2364
	cmp	ah,1
2363
	je	movx_reg_8bit
2365
	je	movx_reg_8bit
2364
	cmp	ah,2
2366
	cmp	ah,2
2365
	je	movx_reg_16bit
2367
	je	movx_reg_16bit
2366
	jmp	invalid_operand_size
2368
	jmp	invalid_operand_size
2367
      movx_reg_8bit:
2369
      movx_reg_8bit:
2368
	call	operand_autodetect
2370
	call	operand_autodetect
2369
	call	store_nomem_instruction
2371
	call	store_nomem_instruction
2370
	jmp	instruction_assembled
2372
	jmp	instruction_assembled
2371
      movx_reg_16bit:
2373
      movx_reg_16bit:
2372
	call	operand_autodetect
2374
	call	operand_autodetect
2373
	inc	[extended_code]
2375
	inc	[extended_code]
2374
	call	store_nomem_instruction
2376
	call	store_nomem_instruction
2375
	jmp	instruction_assembled
2377
	jmp	instruction_assembled
2376
movsxd_instruction:
2378
movsxd_instruction:
2377
	mov	[base_code],al
2379
	mov	[base_code],al
2378
	lods	byte [esi]
2380
	lods	byte [esi]
2379
	call	get_size_operator
2381
	call	get_size_operator
2380
	cmp	al,10h
2382
	cmp	al,10h
2381
	jne	invalid_operand
2383
	jne	invalid_operand
2382
	lods	byte [esi]
2384
	lods	byte [esi]
2383
	call	convert_register
2385
	call	convert_register
2384
	mov	[postbyte_register],al
2386
	mov	[postbyte_register],al
2385
	cmp	ah,8
2387
	cmp	ah,8
2386
	jne	invalid_operand_size
2388
	jne	invalid_operand_size
2387
	lods	byte [esi]
2389
	lods	byte [esi]
2388
	cmp	al,','
2390
	cmp	al,','
2389
	jne	invalid_operand
2391
	jne	invalid_operand
2390
	mov	[operand_size],0
2392
	mov	[operand_size],0
2391
	lods	byte [esi]
2393
	lods	byte [esi]
2392
	call	get_size_operator
2394
	call	get_size_operator
2393
	cmp	al,10h
2395
	cmp	al,10h
2394
	je	movsxd_reg
2396
	je	movsxd_reg
2395
	cmp	al,'['
2397
	cmp	al,'['
2396
	jne	invalid_operand
2398
	jne	invalid_operand
2397
	call	get_address
2399
	call	get_address
2398
	cmp	[operand_size],4
2400
	cmp	[operand_size],4
2399
	je	movsxd_mem_store
2401
	je	movsxd_mem_store
2400
	cmp	[operand_size],0
2402
	cmp	[operand_size],0
2401
	jne	invalid_operand_size
2403
	jne	invalid_operand_size
2402
      movsxd_mem_store:
2404
      movsxd_mem_store:
2403
	call	operand_64bit
2405
	call	operand_64bit
2404
	call	store_instruction
2406
	call	store_instruction
2405
	jmp	instruction_assembled
2407
	jmp	instruction_assembled
2406
      movsxd_reg:
2408
      movsxd_reg:
2407
	lods	byte [esi]
2409
	lods	byte [esi]
2408
	call	convert_register
2410
	call	convert_register
2409
	cmp	ah,4
2411
	cmp	ah,4
2410
	jne	invalid_operand_size
2412
	jne	invalid_operand_size
2411
	mov	bl,al
2413
	mov	bl,al
2412
	call	operand_64bit
2414
	call	operand_64bit
2413
	call	store_nomem_instruction
2415
	call	store_nomem_instruction
2414
	jmp	instruction_assembled
2416
	jmp	instruction_assembled
2415
bt_instruction:
2417
bt_instruction:
2416
	mov	[postbyte_register],al
2418
	mov	[postbyte_register],al
2417
	shl	al,3
2419
	shl	al,3
2418
	add	al,83h
2420
	add	al,83h
2419
	mov	[extended_code],al
2421
	mov	[extended_code],al
2420
	mov	[base_code],0Fh
2422
	mov	[base_code],0Fh
2421
	lods	byte [esi]
2423
	lods	byte [esi]
2422
	call	get_size_operator
2424
	call	get_size_operator
2423
	cmp	al,10h
2425
	cmp	al,10h
2424
	je	bt_reg
2426
	je	bt_reg
2425
	cmp	al,'['
2427
	cmp	al,'['
2426
	jne	invalid_operand
2428
	jne	invalid_operand
2427
	call	get_address
2429
	call	get_address
2428
	push	eax ebx ecx
2430
	push	eax ebx ecx
2429
	lods	byte [esi]
2431
	lods	byte [esi]
2430
	cmp	al,','
2432
	cmp	al,','
2431
	jne	invalid_operand
2433
	jne	invalid_operand
2432
	cmp	byte [esi],'('
2434
	cmp	byte [esi],'('
2433
	je	bt_mem_imm
2435
	je	bt_mem_imm
2434
	cmp	byte [esi],11h
2436
	cmp	byte [esi],11h
2435
	jne	bt_mem_reg
2437
	jne	bt_mem_reg
2436
	cmp	byte [esi+2],'('
2438
	cmp	byte [esi+2],'('
2437
	je	bt_mem_imm
2439
	je	bt_mem_imm
2438
      bt_mem_reg:
2440
      bt_mem_reg:
2439
	lods	byte [esi]
2441
	lods	byte [esi]
2440
	call	get_size_operator
2442
	call	get_size_operator
2441
	cmp	al,10h
2443
	cmp	al,10h
2442
	jne	invalid_operand
2444
	jne	invalid_operand
2443
	lods	byte [esi]
2445
	lods	byte [esi]
2444
	call	convert_register
2446
	call	convert_register
2445
	mov	[postbyte_register],al
2447
	mov	[postbyte_register],al
2446
	pop	ecx ebx edx
2448
	pop	ecx ebx edx
2447
	mov	al,ah
2449
	mov	al,ah
2448
	call	operand_autodetect
2450
	call	operand_autodetect
2449
	call	store_instruction
2451
	call	store_instruction
2450
	jmp	instruction_assembled
2452
	jmp	instruction_assembled
2451
      bt_mem_imm:
2453
      bt_mem_imm:
2452
	xor	al,al
2454
	xor	al,al
2453
	xchg	al,[operand_size]
2455
	xchg	al,[operand_size]
2454
	push	eax
2456
	push	eax
2455
	lods	byte [esi]
2457
	lods	byte [esi]
2456
	call	get_size_operator
2458
	call	get_size_operator
2457
	cmp	al,'('
2459
	cmp	al,'('
2458
	jne	invalid_operand
2460
	jne	invalid_operand
2459
	mov	al,[operand_size]
2461
	mov	al,[operand_size]
2460
	or	al,al
2462
	or	al,al
2461
	jz	bt_mem_imm_size_ok
2463
	jz	bt_mem_imm_size_ok
2462
	cmp	al,1
2464
	cmp	al,1
2463
	jne	invalid_operand_size
2465
	jne	invalid_operand_size
2464
      bt_mem_imm_size_ok:
2466
      bt_mem_imm_size_ok:
2465
	call	get_byte_value
2467
	call	get_byte_value
2466
	mov	byte [value],al
2468
	mov	byte [value],al
2467
	pop	eax
2469
	pop	eax
2468
	or	al,al
2470
	or	al,al
2469
	jz	bt_mem_imm_nosize
2471
	jz	bt_mem_imm_nosize
2470
	call	operand_autodetect
2472
	call	operand_autodetect
2471
      bt_mem_imm_store:
2473
      bt_mem_imm_store:
2472
	pop	ecx ebx edx
2474
	pop	ecx ebx edx
2473
	mov	[extended_code],0BAh
2475
	mov	[extended_code],0BAh
2474
	call	store_instruction_with_imm8
2476
	call	store_instruction_with_imm8
2475
	jmp	instruction_assembled
2477
	jmp	instruction_assembled
2476
      bt_mem_imm_nosize:
2478
      bt_mem_imm_nosize:
2477
	cmp	[error_line],0
2479
	cmp	[error_line],0
2478
	jne	bt_mem_imm_store
2480
	jne	bt_mem_imm_store
2479
	mov	eax,[current_line]
2481
	mov	eax,[current_line]
2480
	mov	[error_line],eax
2482
	mov	[error_line],eax
2481
	mov	[error],operand_size_not_specified
2483
	mov	[error],operand_size_not_specified
2482
	jmp	bt_mem_imm_store
2484
	jmp	bt_mem_imm_store
2483
      bt_reg:
2485
      bt_reg:
2484
	lods	byte [esi]
2486
	lods	byte [esi]
2485
	call	convert_register
2487
	call	convert_register
2486
	mov	bl,al
2488
	mov	bl,al
2487
	lods	byte [esi]
2489
	lods	byte [esi]
2488
	cmp	al,','
2490
	cmp	al,','
2489
	jne	invalid_operand
2491
	jne	invalid_operand
2490
	cmp	byte [esi],'('
2492
	cmp	byte [esi],'('
2491
	je	bt_reg_imm
2493
	je	bt_reg_imm
2492
	cmp	byte [esi],11h
2494
	cmp	byte [esi],11h
2493
	jne	bt_reg_reg
2495
	jne	bt_reg_reg
2494
	cmp	byte [esi+2],'('
2496
	cmp	byte [esi+2],'('
2495
	je	bt_reg_imm
2497
	je	bt_reg_imm
2496
      bt_reg_reg:
2498
      bt_reg_reg:
2497
	lods	byte [esi]
2499
	lods	byte [esi]
2498
	call	get_size_operator
2500
	call	get_size_operator
2499
	cmp	al,10h
2501
	cmp	al,10h
2500
	jne	invalid_operand
2502
	jne	invalid_operand
2501
	lods	byte [esi]
2503
	lods	byte [esi]
2502
	call	convert_register
2504
	call	convert_register
2503
	mov	[postbyte_register],al
2505
	mov	[postbyte_register],al
2504
	mov	al,ah
2506
	mov	al,ah
2505
	call	operand_autodetect
2507
	call	operand_autodetect
2506
	call	store_nomem_instruction
2508
	call	store_nomem_instruction
2507
	jmp	instruction_assembled
2509
	jmp	instruction_assembled
2508
      bt_reg_imm:
2510
      bt_reg_imm:
2509
	xor	al,al
2511
	xor	al,al
2510
	xchg	al,[operand_size]
2512
	xchg	al,[operand_size]
2511
	push	eax ebx
2513
	push	eax ebx
2512
	lods	byte [esi]
2514
	lods	byte [esi]
2513
	call	get_size_operator
2515
	call	get_size_operator
2514
	cmp	al,'('
2516
	cmp	al,'('
2515
	jne	invalid_operand
2517
	jne	invalid_operand
2516
	mov	al,[operand_size]
2518
	mov	al,[operand_size]
2517
	or	al,al
2519
	or	al,al
2518
	jz	bt_reg_imm_size_ok
2520
	jz	bt_reg_imm_size_ok
2519
	cmp	al,1
2521
	cmp	al,1
2520
	jne	invalid_operand_size
2522
	jne	invalid_operand_size
2521
      bt_reg_imm_size_ok:
2523
      bt_reg_imm_size_ok:
2522
	call	get_byte_value
2524
	call	get_byte_value
2523
	mov	byte [value],al
2525
	mov	byte [value],al
2524
	pop	ebx eax
2526
	pop	ebx eax
2525
	call	operand_autodetect
2527
	call	operand_autodetect
2526
      bt_reg_imm_store:
2528
      bt_reg_imm_store:
2527
	mov	[extended_code],0BAh
2529
	mov	[extended_code],0BAh
2528
	call	store_nomem_instruction
2530
	call	store_nomem_instruction
2529
	mov	al,byte [value]
2531
	mov	al,byte [value]
2530
	stos	byte [edi]
2532
	stos	byte [edi]
2531
	jmp	instruction_assembled
2533
	jmp	instruction_assembled
2532
bs_instruction:
2534
bs_instruction:
2533
	mov	[extended_code],al
2535
	mov	[extended_code],al
2534
	mov	[base_code],0Fh
2536
	mov	[base_code],0Fh
2535
	lods	byte [esi]
2537
	lods	byte [esi]
2536
	call	get_size_operator
2538
	call	get_size_operator
2537
	cmp	al,10h
2539
	cmp	al,10h
2538
	jne	invalid_operand
2540
	jne	invalid_operand
2539
	lods	byte [esi]
2541
	lods	byte [esi]
2540
	call	convert_register
2542
	call	convert_register
2541
	mov	[postbyte_register],al
2543
	mov	[postbyte_register],al
2542
	lods	byte [esi]
2544
	lods	byte [esi]
2543
	cmp	al,','
2545
	cmp	al,','
2544
	jne	invalid_operand
2546
	jne	invalid_operand
2545
	lods	byte [esi]
2547
	lods	byte [esi]
2546
	call	get_size_operator
2548
	call	get_size_operator
2547
	cmp	al,10h
2549
	cmp	al,10h
2548
	je	bs_reg_reg
2550
	je	bs_reg_reg
2549
	cmp	al,'['
2551
	cmp	al,'['
2550
	jne	invalid_argument
2552
	jne	invalid_argument
2551
	call	get_address
2553
	call	get_address
2552
	mov	al,[operand_size]
2554
	mov	al,[operand_size]
2553
	call	operand_autodetect
2555
	call	operand_autodetect
2554
	call	store_instruction
2556
	call	store_instruction
2555
	jmp	instruction_assembled
2557
	jmp	instruction_assembled
2556
      bs_reg_reg:
2558
      bs_reg_reg:
2557
	lods	byte [esi]
2559
	lods	byte [esi]
2558
	call	convert_register
2560
	call	convert_register
2559
	mov	bl,al
2561
	mov	bl,al
2560
	mov	al,ah
2562
	mov	al,ah
2561
	call	operand_autodetect
2563
	call	operand_autodetect
2562
	call	store_nomem_instruction
2564
	call	store_nomem_instruction
2563
	jmp	instruction_assembled
2565
	jmp	instruction_assembled
2564
imul_instruction:
2566
imul_instruction:
2565
	mov	[base_code],0F6h
2567
	mov	[base_code],0F6h
2566
	mov	[postbyte_register],5
2568
	mov	[postbyte_register],5
2567
	lods	byte [esi]
2569
	lods	byte [esi]
2568
	call	get_size_operator
2570
	call	get_size_operator
2569
	cmp	al,10h
2571
	cmp	al,10h
2570
	je	imul_reg
2572
	je	imul_reg
2571
	cmp	al,'['
2573
	cmp	al,'['
2572
	jne	invalid_operand
2574
	jne	invalid_operand
2573
      imul_mem:
2575
      imul_mem:
2574
	call	get_address
2576
	call	get_address
2575
	mov	al,[operand_size]
2577
	mov	al,[operand_size]
2576
	cmp	al,1
2578
	cmp	al,1
2577
	je	imul_mem_8bit
2579
	je	imul_mem_8bit
2578
	jb	imul_mem_nosize
2580
	jb	imul_mem_nosize
2579
	call	operand_autodetect
2581
	call	operand_autodetect
2580
	inc	[base_code]
2582
	inc	[base_code]
2581
	call	store_instruction
2583
	call	store_instruction
2582
	jmp	instruction_assembled
2584
	jmp	instruction_assembled
2583
      imul_mem_nosize:
2585
      imul_mem_nosize:
2584
	cmp	[error_line],0
2586
	cmp	[error_line],0
2585
	jne	imul_mem_8bit
2587
	jne	imul_mem_8bit
2586
	mov	eax,[current_line]
2588
	mov	eax,[current_line]
2587
	mov	[error_line],eax
2589
	mov	[error_line],eax
2588
	mov	[error],operand_size_not_specified
2590
	mov	[error],operand_size_not_specified
2589
      imul_mem_8bit:
2591
      imul_mem_8bit:
2590
	call	store_instruction
2592
	call	store_instruction
2591
	jmp	instruction_assembled
2593
	jmp	instruction_assembled
2592
      imul_reg:
2594
      imul_reg:
2593
	lods	byte [esi]
2595
	lods	byte [esi]
2594
	call	convert_register
2596
	call	convert_register
2595
	cmp	byte [esi],','
2597
	cmp	byte [esi],','
2596
	je	imul_reg_
2598
	je	imul_reg_
2597
	mov	bl,al
2599
	mov	bl,al
2598
	mov	al,ah
2600
	mov	al,ah
2599
	cmp	al,1
2601
	cmp	al,1
2600
	je	imul_reg_8bit
2602
	je	imul_reg_8bit
2601
	call	operand_autodetect
2603
	call	operand_autodetect
2602
	inc	[base_code]
2604
	inc	[base_code]
2603
	call	store_nomem_instruction
2605
	call	store_nomem_instruction
2604
	jmp	instruction_assembled
2606
	jmp	instruction_assembled
2605
      imul_reg_8bit:
2607
      imul_reg_8bit:
2606
	call	store_nomem_instruction
2608
	call	store_nomem_instruction
2607
	jmp	instruction_assembled
2609
	jmp	instruction_assembled
2608
      imul_reg_:
2610
      imul_reg_:
2609
	mov	[postbyte_register],al
2611
	mov	[postbyte_register],al
2610
	inc	esi
2612
	inc	esi
2611
	cmp	byte [esi],'('
2613
	cmp	byte [esi],'('
2612
	je	imul_reg_imm
2614
	je	imul_reg_imm
2613
	cmp	byte [esi],11h
2615
	cmp	byte [esi],11h
2614
	jne	imul_reg_noimm
2616
	jne	imul_reg_noimm
2615
	cmp	byte [esi+2],'('
2617
	cmp	byte [esi+2],'('
2616
	je	imul_reg_imm
2618
	je	imul_reg_imm
2617
      imul_reg_noimm:
2619
      imul_reg_noimm:
2618
	lods	byte [esi]
2620
	lods	byte [esi]
2619
	call	get_size_operator
2621
	call	get_size_operator
2620
	cmp	al,10h
2622
	cmp	al,10h
2621
	je	imul_reg_reg
2623
	je	imul_reg_reg
2622
	cmp	al,'['
2624
	cmp	al,'['
2623
	jne	invalid_operand
2625
	jne	invalid_operand
2624
      imul_reg_mem:
2626
      imul_reg_mem:
2625
	call	get_address
2627
	call	get_address
2626
	push	edx ebx ecx
2628
	push	edx ebx ecx
2627
	cmp	byte [esi],','
2629
	cmp	byte [esi],','
2628
	je	imul_reg_mem_imm
2630
	je	imul_reg_mem_imm
2629
	mov	al,[operand_size]
2631
	mov	al,[operand_size]
2630
	call	operand_autodetect
2632
	call	operand_autodetect
2631
	pop	ecx ebx edx
2633
	pop	ecx ebx edx
2632
	mov	[base_code],0Fh
2634
	mov	[base_code],0Fh
2633
	mov	[extended_code],0AFh
2635
	mov	[extended_code],0AFh
2634
	call	store_instruction
2636
	call	store_instruction
2635
	jmp	instruction_assembled
2637
	jmp	instruction_assembled
2636
      imul_reg_mem_imm:
2638
      imul_reg_mem_imm:
2637
	inc	esi
2639
	inc	esi
2638
	lods	byte [esi]
2640
	lods	byte [esi]
2639
	call	get_size_operator
2641
	call	get_size_operator
2640
	cmp	al,'('
2642
	cmp	al,'('
2641
	jne	invalid_operand
2643
	jne	invalid_operand
2642
	mov	al,[operand_size]
2644
	mov	al,[operand_size]
2643
	cmp	al,2
2645
	cmp	al,2
2644
	je	imul_reg_mem_imm_16bit
2646
	je	imul_reg_mem_imm_16bit
2645
	cmp	al,4
2647
	cmp	al,4
2646
	je	imul_reg_mem_imm_32bit
2648
	je	imul_reg_mem_imm_32bit
2647
	cmp	al,8
2649
	cmp	al,8
2648
	je	imul_reg_mem_imm_64bit
2650
	je	imul_reg_mem_imm_64bit
2649
	jmp	invalid_operand_size
2651
	jmp	invalid_operand_size
2650
      imul_reg_mem_imm_16bit:
2652
      imul_reg_mem_imm_16bit:
2651
	call	operand_16bit
2653
	call	operand_16bit
2652
	call	get_word_value
2654
	call	get_word_value
2653
	mov	word [value],ax
2655
	mov	word [value],ax
2654
	cmp	[value_type],0
2656
	cmp	[value_type],0
2655
	jne	imul_reg_mem_imm_16bit_store
2657
	jne	imul_reg_mem_imm_16bit_store
2656
	cmp	[size_declared],0
2658
	cmp	[size_declared],0
2657
	jne	imul_reg_mem_imm_16bit_store
2659
	jne	imul_reg_mem_imm_16bit_store
2658
	cmp	ax,-80h
2660
	cmp	ax,-80h
2659
	jl	imul_reg_mem_imm_16bit_store
2661
	jl	imul_reg_mem_imm_16bit_store
2660
	cmp	ax,80h
2662
	cmp	ax,80h
2661
	jl	imul_reg_mem_imm_8bit_store
2663
	jl	imul_reg_mem_imm_8bit_store
2662
      imul_reg_mem_imm_16bit_store:
2664
      imul_reg_mem_imm_16bit_store:
2663
	pop	ecx ebx edx
2665
	pop	ecx ebx edx
2664
	mov	[base_code],69h
2666
	mov	[base_code],69h
2665
	call	store_instruction_with_imm16
2667
	call	store_instruction_with_imm16
2666
	jmp	instruction_assembled
2668
	jmp	instruction_assembled
2667
      imul_reg_mem_imm_32bit:
2669
      imul_reg_mem_imm_32bit:
2668
	call	operand_32bit
2670
	call	operand_32bit
2669
	call	get_dword_value
2671
	call	get_dword_value
2670
      imul_reg_mem_imm_32bit_ok:
2672
      imul_reg_mem_imm_32bit_ok:
2671
	mov	dword [value],eax
2673
	mov	dword [value],eax
2672
	cmp	[value_type],0
2674
	cmp	[value_type],0
2673
	jne	imul_reg_mem_imm_32bit_store
2675
	jne	imul_reg_mem_imm_32bit_store
2674
	cmp	[size_declared],0
2676
	cmp	[size_declared],0
2675
	jne	imul_reg_mem_imm_32bit_store
2677
	jne	imul_reg_mem_imm_32bit_store
2676
	cmp	eax,-80h
2678
	cmp	eax,-80h
2677
	jl	imul_reg_mem_imm_32bit_store
2679
	jl	imul_reg_mem_imm_32bit_store
2678
	cmp	eax,80h
2680
	cmp	eax,80h
2679
	jl	imul_reg_mem_imm_8bit_store
2681
	jl	imul_reg_mem_imm_8bit_store
2680
      imul_reg_mem_imm_32bit_store:
2682
      imul_reg_mem_imm_32bit_store:
2681
	pop	ecx ebx edx
2683
	pop	ecx ebx edx
2682
	mov	[base_code],69h
2684
	mov	[base_code],69h
2683
	call	store_instruction_with_imm32
2685
	call	store_instruction_with_imm32
2684
	jmp	instruction_assembled
2686
	jmp	instruction_assembled
2685
      imul_reg_mem_imm_64bit:
2687
      imul_reg_mem_imm_64bit:
2686
	cmp	[size_declared],0
2688
	cmp	[size_declared],0
2687
	jne	long_immediate_not_encodable
2689
	jne	long_immediate_not_encodable
2688
	call	operand_64bit
2690
	call	operand_64bit
2689
	call	get_simm32
2691
	call	get_simm32
2690
	cmp	[value_type],4
2692
	cmp	[value_type],4
2691
	jae	long_immediate_not_encodable
2693
	jae	long_immediate_not_encodable
2692
	jmp	imul_reg_mem_imm_32bit_ok
2694
	jmp	imul_reg_mem_imm_32bit_ok
2693
      imul_reg_mem_imm_8bit_store:
2695
      imul_reg_mem_imm_8bit_store:
2694
	pop	ecx ebx edx
2696
	pop	ecx ebx edx
2695
	mov	[base_code],6Bh
2697
	mov	[base_code],6Bh
2696
	call	store_instruction_with_imm8
2698
	call	store_instruction_with_imm8
2697
	jmp	instruction_assembled
2699
	jmp	instruction_assembled
2698
      imul_reg_imm:
2700
      imul_reg_imm:
2699
	mov	bl,[postbyte_register]
2701
	mov	bl,[postbyte_register]
2700
	dec	esi
2702
	dec	esi
2701
	jmp	imul_reg_reg_imm
2703
	jmp	imul_reg_reg_imm
2702
      imul_reg_reg:
2704
      imul_reg_reg:
2703
	lods	byte [esi]
2705
	lods	byte [esi]
2704
	call	convert_register
2706
	call	convert_register
2705
	mov	bl,al
2707
	mov	bl,al
2706
	cmp	byte [esi],','
2708
	cmp	byte [esi],','
2707
	je	imul_reg_reg_imm
2709
	je	imul_reg_reg_imm
2708
	mov	al,ah
2710
	mov	al,ah
2709
	call	operand_autodetect
2711
	call	operand_autodetect
2710
	mov	[base_code],0Fh
2712
	mov	[base_code],0Fh
2711
	mov	[extended_code],0AFh
2713
	mov	[extended_code],0AFh
2712
	call	store_nomem_instruction
2714
	call	store_nomem_instruction
2713
	jmp	instruction_assembled
2715
	jmp	instruction_assembled
2714
      imul_reg_reg_imm:
2716
      imul_reg_reg_imm:
2715
	inc	esi
2717
	inc	esi
2716
	lods	byte [esi]
2718
	lods	byte [esi]
2717
	call	get_size_operator
2719
	call	get_size_operator
2718
	cmp	al,'('
2720
	cmp	al,'('
2719
	jne	invalid_operand
2721
	jne	invalid_operand
2720
	mov	al,[operand_size]
2722
	mov	al,[operand_size]
2721
	cmp	al,2
2723
	cmp	al,2
2722
	je	imul_reg_reg_imm_16bit
2724
	je	imul_reg_reg_imm_16bit
2723
	cmp	al,4
2725
	cmp	al,4
2724
	je	imul_reg_reg_imm_32bit
2726
	je	imul_reg_reg_imm_32bit
2725
	cmp	al,8
2727
	cmp	al,8
2726
	je	imul_reg_reg_imm_64bit
2728
	je	imul_reg_reg_imm_64bit
2727
	jmp	invalid_operand_size
2729
	jmp	invalid_operand_size
2728
      imul_reg_reg_imm_16bit:
2730
      imul_reg_reg_imm_16bit:
2729
	call	operand_16bit
2731
	call	operand_16bit
2730
	push	ebx
2732
	push	ebx
2731
	call	get_word_value
2733
	call	get_word_value
2732
	pop	ebx
2734
	pop	ebx
2733
	mov	dx,ax
2735
	mov	dx,ax
2734
	cmp	[value_type],0
2736
	cmp	[value_type],0
2735
	jne	imul_reg_reg_imm_16bit_store
2737
	jne	imul_reg_reg_imm_16bit_store
2736
	cmp	[size_declared],0
2738
	cmp	[size_declared],0
2737
	jne	imul_reg_reg_imm_16bit_store
2739
	jne	imul_reg_reg_imm_16bit_store
2738
	cmp	ax,-80h
2740
	cmp	ax,-80h
2739
	jl	imul_reg_reg_imm_16bit_store
2741
	jl	imul_reg_reg_imm_16bit_store
2740
	cmp	ax,80h
2742
	cmp	ax,80h
2741
	jl	imul_reg_reg_imm_8bit_store
2743
	jl	imul_reg_reg_imm_8bit_store
2742
      imul_reg_reg_imm_16bit_store:
2744
      imul_reg_reg_imm_16bit_store:
2743
	mov	[base_code],69h
2745
	mov	[base_code],69h
2744
	call	store_nomem_instruction
2746
	call	store_nomem_instruction
2745
	mov	ax,dx
2747
	mov	ax,dx
2746
	call	mark_relocation
2748
	call	mark_relocation
2747
	stos	word [edi]
2749
	stos	word [edi]
2748
	jmp	instruction_assembled
2750
	jmp	instruction_assembled
2749
      imul_reg_reg_imm_32bit:
2751
      imul_reg_reg_imm_32bit:
2750
	call	operand_32bit
2752
	call	operand_32bit
2751
	push	ebx
2753
	push	ebx
2752
	call	get_dword_value
2754
	call	get_dword_value
2753
      imul_reg_reg_imm_32bit_ok:
2755
      imul_reg_reg_imm_32bit_ok:
2754
	pop	ebx
2756
	pop	ebx
2755
	mov	edx,eax
2757
	mov	edx,eax
2756
	cmp	[value_type],0
2758
	cmp	[value_type],0
2757
	jne	imul_reg_reg_imm_32bit_store
2759
	jne	imul_reg_reg_imm_32bit_store
2758
	cmp	[size_declared],0
2760
	cmp	[size_declared],0
2759
	jne	imul_reg_reg_imm_32bit_store
2761
	jne	imul_reg_reg_imm_32bit_store
2760
	cmp	eax,-80h
2762
	cmp	eax,-80h
2761
	jl	imul_reg_reg_imm_32bit_store
2763
	jl	imul_reg_reg_imm_32bit_store
2762
	cmp	eax,80h
2764
	cmp	eax,80h
2763
	jl	imul_reg_reg_imm_8bit_store
2765
	jl	imul_reg_reg_imm_8bit_store
2764
      imul_reg_reg_imm_32bit_store:
2766
      imul_reg_reg_imm_32bit_store:
2765
	mov	[base_code],69h
2767
	mov	[base_code],69h
2766
	call	store_nomem_instruction
2768
	call	store_nomem_instruction
2767
	mov	eax,edx
2769
	mov	eax,edx
2768
	call	mark_relocation
2770
	call	mark_relocation
2769
	stos	dword [edi]
2771
	stos	dword [edi]
2770
	jmp	instruction_assembled
2772
	jmp	instruction_assembled
2771
      imul_reg_reg_imm_64bit:
2773
      imul_reg_reg_imm_64bit:
2772
	cmp	[size_declared],0
2774
	cmp	[size_declared],0
2773
	jne	long_immediate_not_encodable
2775
	jne	long_immediate_not_encodable
2774
	call	operand_64bit
2776
	call	operand_64bit
2775
	push	ebx
2777
	push	ebx
2776
	call	get_simm32
2778
	call	get_simm32
2777
	cmp	[value_type],4
2779
	cmp	[value_type],4
2778
	jae	long_immediate_not_encodable
2780
	jae	long_immediate_not_encodable
2779
	jmp	imul_reg_reg_imm_32bit_ok
2781
	jmp	imul_reg_reg_imm_32bit_ok
2780
      imul_reg_reg_imm_8bit_store:
2782
      imul_reg_reg_imm_8bit_store:
2781
	mov	[base_code],6Bh
2783
	mov	[base_code],6Bh
2782
	call	store_nomem_instruction
2784
	call	store_nomem_instruction
2783
	mov	al,dl
2785
	mov	al,dl
2784
	stos	byte [edi]
2786
	stos	byte [edi]
2785
	jmp	instruction_assembled
2787
	jmp	instruction_assembled
2786
in_instruction:
2788
in_instruction:
2787
	lods	byte [esi]
2789
	lods	byte [esi]
2788
	call	get_size_operator
2790
	call	get_size_operator
2789
	cmp	al,10h
2791
	cmp	al,10h
2790
	jne	invalid_operand
2792
	jne	invalid_operand
2791
	lods	byte [esi]
2793
	lods	byte [esi]
2792
	call	convert_register
2794
	call	convert_register
2793
	or	al,al
2795
	or	al,al
2794
	jnz	invalid_operand
2796
	jnz	invalid_operand
2795
	lods	byte [esi]
2797
	lods	byte [esi]
2796
	cmp	al,','
2798
	cmp	al,','
2797
	jne	invalid_operand
2799
	jne	invalid_operand
2798
	mov	al,ah
2800
	mov	al,ah
2799
	push	eax
2801
	push	eax
2800
	mov	[operand_size],0
2802
	mov	[operand_size],0
2801
	lods	byte [esi]
2803
	lods	byte [esi]
2802
	call	get_size_operator
2804
	call	get_size_operator
2803
	cmp	al,'('
2805
	cmp	al,'('
2804
	je	in_imm
2806
	je	in_imm
2805
	cmp	al,10h
2807
	cmp	al,10h
2806
	je	in_reg
2808
	je	in_reg
2807
	jmp	invalid_operand
2809
	jmp	invalid_operand
2808
      in_reg:
2810
      in_reg:
2809
	lods	byte [esi]
2811
	lods	byte [esi]
2810
	cmp	al,22h
2812
	cmp	al,22h
2811
	jne	invalid_operand
2813
	jne	invalid_operand
2812
	pop	eax
2814
	pop	eax
2813
	cmp	al,1
2815
	cmp	al,1
2814
	je	in_al_dx
2816
	je	in_al_dx
2815
	cmp	al,2
2817
	cmp	al,2
2816
	je	in_ax_dx
2818
	je	in_ax_dx
2817
	cmp	al,4
2819
	cmp	al,4
2818
	je	in_eax_dx
2820
	je	in_eax_dx
2819
	jmp	invalid_operand_size
2821
	jmp	invalid_operand_size
2820
      in_al_dx:
2822
      in_al_dx:
2821
	mov	al,0ECh
2823
	mov	al,0ECh
2822
	stos	byte [edi]
2824
	stos	byte [edi]
2823
	jmp	instruction_assembled
2825
	jmp	instruction_assembled
2824
      in_ax_dx:
2826
      in_ax_dx:
2825
	call	operand_16bit
2827
	call	operand_16bit
2826
	mov	[base_code],0EDh
2828
	mov	[base_code],0EDh
2827
	call	store_instruction_code
2829
	call	store_instruction_code
2828
	jmp	instruction_assembled
2830
	jmp	instruction_assembled
2829
      in_eax_dx:
2831
      in_eax_dx:
2830
	call	operand_32bit
2832
	call	operand_32bit
2831
	mov	[base_code],0EDh
2833
	mov	[base_code],0EDh
2832
	call	store_instruction_code
2834
	call	store_instruction_code
2833
	jmp	instruction_assembled
2835
	jmp	instruction_assembled
2834
      in_imm:
2836
      in_imm:
2835
	mov	al,[operand_size]
2837
	mov	al,[operand_size]
2836
	or	al,al
2838
	or	al,al
2837
	jz	in_imm_size_ok
2839
	jz	in_imm_size_ok
2838
	cmp	al,1
2840
	cmp	al,1
2839
	jne	invalid_operand_size
2841
	jne	invalid_operand_size
2840
      in_imm_size_ok:
2842
      in_imm_size_ok:
2841
	call	get_byte_value
2843
	call	get_byte_value
2842
	mov	dl,al
2844
	mov	dl,al
2843
	pop	eax
2845
	pop	eax
2844
	cmp	al,1
2846
	cmp	al,1
2845
	je	in_al_imm
2847
	je	in_al_imm
2846
	cmp	al,2
2848
	cmp	al,2
2847
	je	in_ax_imm
2849
	je	in_ax_imm
2848
	cmp	al,4
2850
	cmp	al,4
2849
	je	in_eax_imm
2851
	je	in_eax_imm
2850
	jmp	invalid_operand_size
2852
	jmp	invalid_operand_size
2851
      in_al_imm:
2853
      in_al_imm:
2852
	mov	al,0E4h
2854
	mov	al,0E4h
2853
	stos	byte [edi]
2855
	stos	byte [edi]
2854
	mov	al,dl
2856
	mov	al,dl
2855
	stos	byte [edi]
2857
	stos	byte [edi]
2856
	jmp	instruction_assembled
2858
	jmp	instruction_assembled
2857
      in_ax_imm:
2859
      in_ax_imm:
2858
	call	operand_16bit
2860
	call	operand_16bit
2859
	mov	[base_code],0E5h
2861
	mov	[base_code],0E5h
2860
	call	store_instruction_code
2862
	call	store_instruction_code
2861
	mov	al,dl
2863
	mov	al,dl
2862
	stos	byte [edi]
2864
	stos	byte [edi]
2863
	jmp	instruction_assembled
2865
	jmp	instruction_assembled
2864
      in_eax_imm:
2866
      in_eax_imm:
2865
	call	operand_32bit
2867
	call	operand_32bit
2866
	mov	[base_code],0E5h
2868
	mov	[base_code],0E5h
2867
	call	store_instruction_code
2869
	call	store_instruction_code
2868
	mov	al,dl
2870
	mov	al,dl
2869
	stos	byte [edi]
2871
	stos	byte [edi]
2870
	jmp	instruction_assembled
2872
	jmp	instruction_assembled
2871
out_instruction:
2873
out_instruction:
2872
	lods	byte [esi]
2874
	lods	byte [esi]
2873
	call	get_size_operator
2875
	call	get_size_operator
2874
	cmp	al,'('
2876
	cmp	al,'('
2875
	je	out_imm
2877
	je	out_imm
2876
	cmp	al,10h
2878
	cmp	al,10h
2877
	jne	invalid_operand
2879
	jne	invalid_operand
2878
	lods	byte [esi]
2880
	lods	byte [esi]
2879
	cmp	al,22h
2881
	cmp	al,22h
2880
	jne	invalid_operand
2882
	jne	invalid_operand
2881
	lods	byte [esi]
2883
	lods	byte [esi]
2882
	cmp	al,','
2884
	cmp	al,','
2883
	jne	invalid_operand
2885
	jne	invalid_operand
2884
	mov	[operand_size],0
2886
	mov	[operand_size],0
2885
	lods	byte [esi]
2887
	lods	byte [esi]
2886
	call	get_size_operator
2888
	call	get_size_operator
2887
	cmp	al,10h
2889
	cmp	al,10h
2888
	jne	invalid_operand
2890
	jne	invalid_operand
2889
	lods	byte [esi]
2891
	lods	byte [esi]
2890
	call	convert_register
2892
	call	convert_register
2891
	or	al,al
2893
	or	al,al
2892
	jnz	invalid_operand
2894
	jnz	invalid_operand
2893
	mov	al,ah
2895
	mov	al,ah
2894
	cmp	al,1
2896
	cmp	al,1
2895
	je	out_dx_al
2897
	je	out_dx_al
2896
	cmp	al,2
2898
	cmp	al,2
2897
	je	out_dx_ax
2899
	je	out_dx_ax
2898
	cmp	al,4
2900
	cmp	al,4
2899
	je	out_dx_eax
2901
	je	out_dx_eax
2900
	jmp	invalid_operand_size
2902
	jmp	invalid_operand_size
2901
      out_dx_al:
2903
      out_dx_al:
2902
	mov	al,0EEh
2904
	mov	al,0EEh
2903
	stos	byte [edi]
2905
	stos	byte [edi]
2904
	jmp	instruction_assembled
2906
	jmp	instruction_assembled
2905
      out_dx_ax:
2907
      out_dx_ax:
2906
	call	operand_16bit
2908
	call	operand_16bit
2907
	mov	[base_code],0EFh
2909
	mov	[base_code],0EFh
2908
	call	store_instruction_code
2910
	call	store_instruction_code
2909
	jmp	instruction_assembled
2911
	jmp	instruction_assembled
2910
      out_dx_eax:
2912
      out_dx_eax:
2911
	call	operand_32bit
2913
	call	operand_32bit
2912
	mov	[base_code],0EFh
2914
	mov	[base_code],0EFh
2913
	call	store_instruction_code
2915
	call	store_instruction_code
2914
	jmp	instruction_assembled
2916
	jmp	instruction_assembled
2915
      out_imm:
2917
      out_imm:
2916
	mov	al,[operand_size]
2918
	mov	al,[operand_size]
2917
	or	al,al
2919
	or	al,al
2918
	jz	out_imm_size_ok
2920
	jz	out_imm_size_ok
2919
	cmp	al,1
2921
	cmp	al,1
2920
	jne	invalid_operand_size
2922
	jne	invalid_operand_size
2921
      out_imm_size_ok:
2923
      out_imm_size_ok:
2922
	call	get_byte_value
2924
	call	get_byte_value
2923
	mov	dl,al
2925
	mov	dl,al
2924
	lods	byte [esi]
2926
	lods	byte [esi]
2925
	cmp	al,','
2927
	cmp	al,','
2926
	jne	invalid_operand
2928
	jne	invalid_operand
2927
	mov	[operand_size],0
2929
	mov	[operand_size],0
2928
	lods	byte [esi]
2930
	lods	byte [esi]
2929
	call	get_size_operator
2931
	call	get_size_operator
2930
	cmp	al,10h
2932
	cmp	al,10h
2931
	jne	invalid_operand
2933
	jne	invalid_operand
2932
	lods	byte [esi]
2934
	lods	byte [esi]
2933
	call	convert_register
2935
	call	convert_register
2934
	or	al,al
2936
	or	al,al
2935
	jnz	invalid_operand
2937
	jnz	invalid_operand
2936
	mov	al,ah
2938
	mov	al,ah
2937
	cmp	al,1
2939
	cmp	al,1
2938
	je	out_imm_al
2940
	je	out_imm_al
2939
	cmp	al,2
2941
	cmp	al,2
2940
	je	out_imm_ax
2942
	je	out_imm_ax
2941
	cmp	al,4
2943
	cmp	al,4
2942
	je	out_imm_eax
2944
	je	out_imm_eax
2943
	jmp	invalid_operand_size
2945
	jmp	invalid_operand_size
2944
      out_imm_al:
2946
      out_imm_al:
2945
	mov	al,0E6h
2947
	mov	al,0E6h
2946
	stos	byte [edi]
2948
	stos	byte [edi]
2947
	mov	al,dl
2949
	mov	al,dl
2948
	stos	byte [edi]
2950
	stos	byte [edi]
2949
	jmp	instruction_assembled
2951
	jmp	instruction_assembled
2950
      out_imm_ax:
2952
      out_imm_ax:
2951
	call	operand_16bit
2953
	call	operand_16bit
2952
	mov	[base_code],0E7h
2954
	mov	[base_code],0E7h
2953
	call	store_instruction_code
2955
	call	store_instruction_code
2954
	mov	al,dl
2956
	mov	al,dl
2955
	stos	byte [edi]
2957
	stos	byte [edi]
2956
	jmp	instruction_assembled
2958
	jmp	instruction_assembled
2957
      out_imm_eax:
2959
      out_imm_eax:
2958
	call	operand_32bit
2960
	call	operand_32bit
2959
	mov	[base_code],0E7h
2961
	mov	[base_code],0E7h
2960
	call	store_instruction_code
2962
	call	store_instruction_code
2961
	mov	al,dl
2963
	mov	al,dl
2962
	stos	byte [edi]
2964
	stos	byte [edi]
2963
	jmp	instruction_assembled
2965
	jmp	instruction_assembled
2964
 
2966
 
2965
call_instruction:
2967
call_instruction:
2966
	mov	[postbyte_register],10b
2968
	mov	[postbyte_register],10b
2967
	mov	[base_code],0E8h
2969
	mov	[base_code],0E8h
2968
	mov	[extended_code],9Ah
2970
	mov	[extended_code],9Ah
2969
	jmp	process_jmp
2971
	jmp	process_jmp
2970
jmp_instruction:
2972
jmp_instruction:
2971
	mov	[postbyte_register],100b
2973
	mov	[postbyte_register],100b
2972
	mov	[base_code],0E9h
2974
	mov	[base_code],0E9h
2973
	mov	[extended_code],0EAh
2975
	mov	[extended_code],0EAh
2974
      process_jmp:
2976
      process_jmp:
2975
	lods	byte [esi]
2977
	lods	byte [esi]
2976
	call	get_jump_operator
2978
	call	get_jump_operator
2977
	call	get_size_operator
2979
	call	get_size_operator
2978
	cmp	al,'('
2980
	cmp	al,'('
2979
	je	jmp_imm
2981
	je	jmp_imm
2980
	mov	[base_code],0FFh
2982
	mov	[base_code],0FFh
2981
	cmp	al,10h
2983
	cmp	al,10h
2982
	je	jmp_reg
2984
	je	jmp_reg
2983
	cmp	al,'['
2985
	cmp	al,'['
2984
	jne	invalid_operand
2986
	jne	invalid_operand
2985
      jmp_mem:
2987
      jmp_mem:
2986
	cmp	[jump_type],1
2988
	cmp	[jump_type],1
2987
	je	illegal_instruction
2989
	je	illegal_instruction
2988
	call	get_address
2990
	call	get_address
2989
	mov	edx,eax
2991
	mov	edx,eax
2990
	mov	al,[operand_size]
2992
	mov	al,[operand_size]
2991
	or	al,al
2993
	or	al,al
2992
	jz	jmp_mem_size_not_specified
2994
	jz	jmp_mem_size_not_specified
2993
	cmp	al,2
2995
	cmp	al,2
2994
	je	jmp_mem_16bit
2996
	je	jmp_mem_16bit
2995
	cmp	al,4
2997
	cmp	al,4
2996
	je	jmp_mem_32bit
2998
	je	jmp_mem_32bit
2997
	cmp	al,6
2999
	cmp	al,6
2998
	je	jmp_mem_48bit
3000
	je	jmp_mem_48bit
2999
	cmp	al,8
3001
	cmp	al,8
3000
	je	jmp_mem_64bit
3002
	je	jmp_mem_64bit
3001
	cmp	al,10
3003
	cmp	al,10
3002
	je	jmp_mem_80bit
3004
	je	jmp_mem_80bit
3003
	jmp	invalid_operand_size
3005
	jmp	invalid_operand_size
3004
      jmp_mem_size_not_specified:
3006
      jmp_mem_size_not_specified:
3005
	cmp	[jump_type],3
3007
	cmp	[jump_type],3
3006
	je	jmp_mem_far
3008
	je	jmp_mem_far
3007
	cmp	[jump_type],2
3009
	cmp	[jump_type],2
3008
	je	jmp_mem_near
3010
	je	jmp_mem_near
3009
	cmp	[error_line],0
3011
	cmp	[error_line],0
3010
	jne	jmp_mem_near
3012
	jne	jmp_mem_near
3011
	mov	eax,[current_line]
3013
	mov	eax,[current_line]
3012
	mov	[error_line],eax
3014
	mov	[error_line],eax
3013
	mov	[error],operand_size_not_specified
3015
	mov	[error],operand_size_not_specified
3014
      jmp_mem_near:
3016
      jmp_mem_near:
3015
	cmp	[code_type],16
3017
	cmp	[code_type],16
3016
	je	jmp_mem_16bit
3018
	je	jmp_mem_16bit
3017
	cmp	[code_type],32
3019
	cmp	[code_type],32
3018
	je	jmp_mem_near_32bit
3020
	je	jmp_mem_near_32bit
3019
      jmp_mem_64bit:
3021
      jmp_mem_64bit:
3020
	cmp	[jump_type],3
3022
	cmp	[jump_type],3
3021
	je	invalid_operand_size
3023
	je	invalid_operand_size
3022
	cmp	[code_type],64
3024
	cmp	[code_type],64
3023
	jne	illegal_instruction
3025
	jne	illegal_instruction
3024
	call	store_instruction
3026
	call	store_instruction
3025
	jmp	instruction_assembled
3027
	jmp	instruction_assembled
3026
      jmp_mem_far:
3028
      jmp_mem_far:
3027
	cmp	[code_type],16
3029
	cmp	[code_type],16
3028
	je	jmp_mem_far_32bit
3030
	je	jmp_mem_far_32bit
3029
      jmp_mem_48bit:
3031
      jmp_mem_48bit:
3030
	call	operand_32bit
3032
	call	operand_32bit
3031
      jmp_mem_far_store:
3033
      jmp_mem_far_store:
3032
	cmp	[jump_type],2
3034
	cmp	[jump_type],2
3033
	je	invalid_operand_size
3035
	je	invalid_operand_size
3034
	inc	[postbyte_register]
3036
	inc	[postbyte_register]
3035
	call	store_instruction
3037
	call	store_instruction
3036
	jmp	instruction_assembled
3038
	jmp	instruction_assembled
3037
      jmp_mem_80bit:
3039
      jmp_mem_80bit:
3038
	call	operand_64bit
3040
	call	operand_64bit
3039
	jmp	jmp_mem_far_store
3041
	jmp	jmp_mem_far_store
3040
      jmp_mem_far_32bit:
3042
      jmp_mem_far_32bit:
3041
	call	operand_16bit
3043
	call	operand_16bit
3042
	jmp	jmp_mem_far_store
3044
	jmp	jmp_mem_far_store
3043
      jmp_mem_32bit:
3045
      jmp_mem_32bit:
3044
	cmp	[jump_type],3
3046
	cmp	[jump_type],3
3045
	je	jmp_mem_far_32bit
3047
	je	jmp_mem_far_32bit
3046
	cmp	[jump_type],2
3048
	cmp	[jump_type],2
3047
	je	jmp_mem_near_32bit
3049
	je	jmp_mem_near_32bit
3048
	cmp	[code_type],16
3050
	cmp	[code_type],16
3049
	je	jmp_mem_far_32bit
3051
	je	jmp_mem_far_32bit
3050
      jmp_mem_near_32bit:
3052
      jmp_mem_near_32bit:
3051
	cmp	[code_type],64
3053
	cmp	[code_type],64
3052
	je	illegal_instruction
3054
	je	illegal_instruction
3053
	call	operand_32bit
3055
	call	operand_32bit
3054
	call	store_instruction
3056
	call	store_instruction
3055
	jmp	instruction_assembled
3057
	jmp	instruction_assembled
3056
      jmp_mem_16bit:
3058
      jmp_mem_16bit:
3057
	cmp	[jump_type],3
3059
	cmp	[jump_type],3
3058
	je	invalid_operand_size
3060
	je	invalid_operand_size
3059
	call	operand_16bit
3061
	call	operand_16bit
3060
	call	store_instruction
3062
	call	store_instruction
3061
	jmp	instruction_assembled
3063
	jmp	instruction_assembled
3062
      jmp_reg:
3064
      jmp_reg:
3063
	test	[jump_type],1
3065
	test	[jump_type],1
3064
	jnz	invalid_operand
3066
	jnz	invalid_operand
3065
	lods	byte [esi]
3067
	lods	byte [esi]
3066
	call	convert_register
3068
	call	convert_register
3067
	mov	bl,al
3069
	mov	bl,al
3068
	mov	al,ah
3070
	mov	al,ah
3069
	cmp	al,2
3071
	cmp	al,2
3070
	je	jmp_reg_16bit
3072
	je	jmp_reg_16bit
3071
	cmp	al,4
3073
	cmp	al,4
3072
	je	jmp_reg_32bit
3074
	je	jmp_reg_32bit
3073
	cmp	al,8
3075
	cmp	al,8
3074
	jne	invalid_operand_size
3076
	jne	invalid_operand_size
3075
      jmp_reg_64bit:
3077
      jmp_reg_64bit:
3076
	cmp	[code_type],64
3078
	cmp	[code_type],64
3077
	jne	illegal_instruction
3079
	jne	illegal_instruction
3078
	call	store_nomem_instruction
3080
	call	store_nomem_instruction
3079
	jmp	instruction_assembled
3081
	jmp	instruction_assembled
3080
      jmp_reg_32bit:
3082
      jmp_reg_32bit:
3081
	cmp	[code_type],64
3083
	cmp	[code_type],64
3082
	je	illegal_instruction
3084
	je	illegal_instruction
3083
	call	store_nomem_instruction
3085
	call	store_nomem_instruction
3084
	jmp	instruction_assembled
3086
	jmp	instruction_assembled
3085
      jmp_reg_16bit:
3087
      jmp_reg_16bit:
3086
	call	operand_16bit
3088
	call	operand_16bit
3087
	call	store_nomem_instruction
3089
	call	store_nomem_instruction
3088
	jmp	instruction_assembled
3090
	jmp	instruction_assembled
3089
      jmp_imm:
3091
      jmp_imm:
3090
	cmp	byte [esi],'.'
3092
	cmp	byte [esi],'.'
3091
	je	invalid_value
3093
	je	invalid_value
3092
	mov	ebx,esi
3094
	mov	ebx,esi
3093
	dec	esi
3095
	dec	esi
3094
	call	skip_symbol
3096
	call	skip_symbol
3095
	xchg	esi,ebx
3097
	xchg	esi,ebx
3096
	cmp	byte [ebx],':'
3098
	cmp	byte [ebx],':'
3097
	je	jmp_far
3099
	je	jmp_far
3098
	cmp	[jump_type],3
3100
	cmp	[jump_type],3
3099
	je	invalid_operand
3101
	je	invalid_operand
3100
      jmp_near:
3102
      jmp_near:
3101
	mov	al,[operand_size]
3103
	mov	al,[operand_size]
3102
	cmp	al,2
3104
	cmp	al,2
3103
	je	jmp_imm_16bit
3105
	je	jmp_imm_16bit
3104
	cmp	al,4
3106
	cmp	al,4
3105
	je	jmp_imm_32bit
3107
	je	jmp_imm_32bit
3106
	cmp	al,8
3108
	cmp	al,8
3107
	je	jmp_imm_64bit
3109
	je	jmp_imm_64bit
3108
	or	al,al
3110
	or	al,al
3109
	jnz	invalid_operand_size
3111
	jnz	invalid_operand_size
3110
	cmp	[code_type],16
3112
	cmp	[code_type],16
3111
	je	jmp_imm_16bit
3113
	je	jmp_imm_16bit
3112
	cmp	[code_type],64
3114
	cmp	[code_type],64
3113
	je	jmp_imm_64bit
3115
	je	jmp_imm_64bit
3114
      jmp_imm_32bit:
3116
      jmp_imm_32bit:
3115
	cmp	[code_type],64
3117
	cmp	[code_type],64
3116
	je	invalid_operand_size
3118
	je	invalid_operand_size
3117
	call	get_address_dword_value
3119
	call	get_address_dword_value
3118
	cmp	[code_type],16
3120
	cmp	[code_type],16
3119
	jne	jmp_imm_32bit_prefix_ok
3121
	jne	jmp_imm_32bit_prefix_ok
3120
	mov	byte [edi],66h
3122
	mov	byte [edi],66h
3121
	inc	edi
3123
	inc	edi
3122
      jmp_imm_32bit_prefix_ok:
3124
      jmp_imm_32bit_prefix_ok:
3123
	call	calculate_jump_offset
3125
	call	calculate_jump_offset
3124
	cdq
3126
	cdq
3125
	call	check_for_short_jump
3127
	call	check_for_short_jump
3126
	jc	jmp_short
3128
	jc	jmp_short
3127
      jmp_imm_32bit_store:
3129
      jmp_imm_32bit_store:
3128
	mov	edx,eax
3130
	mov	edx,eax
3129
	sub	edx,3
3131
	sub	edx,3
3130
	mov	al,[base_code]
3132
	mov	al,[base_code]
3131
	stos	byte [edi]
3133
	stos	byte [edi]
3132
	mov	eax,edx
3134
	mov	eax,edx
3133
	call	mark_relocation
3135
	call	mark_relocation
3134
	stos	dword [edi]
3136
	stos	dword [edi]
3135
	jmp	instruction_assembled
3137
	jmp	instruction_assembled
3136
      jmp_imm_64bit:
3138
      jmp_imm_64bit:
3137
	cmp	[code_type],64
3139
	cmp	[code_type],64
3138
	jne	invalid_operand_size
3140
	jne	invalid_operand_size
3139
	call	get_address_qword_value
3141
	call	get_address_qword_value
3140
	call	calculate_jump_offset
3142
	call	calculate_jump_offset
3141
	mov	ecx,edx
3143
	mov	ecx,edx
3142
	cdq
3144
	cdq
3143
	cmp	edx,ecx
3145
	cmp	edx,ecx
3144
	jne	value_out_of_range
3146
	jne	value_out_of_range
3145
	call	check_for_short_jump
3147
	call	check_for_short_jump
3146
	jnc	jmp_imm_32bit_store
3148
	jnc	jmp_imm_32bit_store
3147
      jmp_short:
3149
      jmp_short:
3148
	mov	ah,al
3150
	mov	ah,al
3149
	mov	al,0EBh
3151
	mov	al,0EBh
3150
	stos	word [edi]
3152
	stos	word [edi]
3151
	jmp	instruction_assembled
3153
	jmp	instruction_assembled
3152
      jmp_imm_16bit:
3154
      jmp_imm_16bit:
3153
	call	get_address_word_value
3155
	call	get_address_word_value
3154
	cmp	[code_type],16
3156
	cmp	[code_type],16
3155
	je	jmp_imm_16bit_prefix_ok
3157
	je	jmp_imm_16bit_prefix_ok
3156
	mov	byte [edi],66h
3158
	mov	byte [edi],66h
3157
	inc	edi
3159
	inc	edi
3158
      jmp_imm_16bit_prefix_ok:
3160
      jmp_imm_16bit_prefix_ok:
3159
	call	calculate_jump_offset
3161
	call	calculate_jump_offset
3160
	cwde
3162
	cwde
3161
	cdq
3163
	cdq
3162
	call	check_for_short_jump
3164
	call	check_for_short_jump
3163
	jc	jmp_short
3165
	jc	jmp_short
3164
	cmp	[value_type],0
3166
	cmp	[value_type],0
3165
	jne	invalid_use_of_symbol
3167
	jne	invalid_use_of_symbol
3166
	mov	edx,eax
3168
	mov	edx,eax
3167
	dec	edx
3169
	dec	edx
3168
	mov	al,[base_code]
3170
	mov	al,[base_code]
3169
	stos	byte [edi]
3171
	stos	byte [edi]
3170
	mov	eax,edx
3172
	mov	eax,edx
3171
	stos	word [edi]
3173
	stos	word [edi]
3172
	jmp	instruction_assembled
3174
	jmp	instruction_assembled
3173
      calculate_jump_offset:
3175
      calculate_jump_offset:
3174
	add	edi,2
3176
	add	edi,2
3175
	call	calculate_relative_offset
3177
	call	calculate_relative_offset
3176
	sub	edi,2
3178
	sub	edi,2
3177
	ret
3179
	ret
3178
      check_for_short_jump:
3180
      check_for_short_jump:
3179
	cmp	[jump_type],1
3181
	cmp	[jump_type],1
3180
	je	forced_short
3182
	je	forced_short
3181
	ja	no_short_jump
3183
	ja	no_short_jump
3182
	cmp	[base_code],0E8h
3184
	cmp	[base_code],0E8h
3183
	je	no_short_jump
3185
	je	no_short_jump
3184
	cmp	[value_type],0
3186
	cmp	[value_type],0
3185
	jne	no_short_jump
3187
	jne	no_short_jump
3186
	cmp	eax,80h
3188
	cmp	eax,80h
3187
	jb	short_jump
3189
	jb	short_jump
3188
	cmp	eax,-80h
3190
	cmp	eax,-80h
3189
	jae	short_jump
3191
	jae	short_jump
3190
      no_short_jump:
3192
      no_short_jump:
3191
	clc
3193
	clc
3192
	ret
3194
	ret
3193
      forced_short:
3195
      forced_short:
3194
	cmp	[base_code],0E8h
3196
	cmp	[base_code],0E8h
3195
	je	illegal_instruction
3197
	je	illegal_instruction
3196
	cmp	[next_pass_needed],0
3198
	cmp	[next_pass_needed],0
3197
	jne	jmp_short_value_type_ok
3199
	jne	jmp_short_value_type_ok
3198
	cmp	[value_type],0
3200
	cmp	[value_type],0
3199
	jne	invalid_use_of_symbol
3201
	jne	invalid_use_of_symbol
3200
      jmp_short_value_type_ok:
3202
      jmp_short_value_type_ok:
3201
	cmp	eax,-80h
3203
	cmp	eax,-80h
3202
	jae	short_jump
3204
	jae	short_jump
3203
	cmp	eax,80h
3205
	cmp	eax,80h
3204
	jae	jump_out_of_range
3206
	jae	jump_out_of_range
3205
      short_jump:
3207
      short_jump:
3206
	stc
3208
	stc
3207
	ret
3209
	ret
3208
      jump_out_of_range:
3210
      jump_out_of_range:
3209
	cmp	[error_line],0
3211
	cmp	[error_line],0
3210
	jne	instruction_assembled
3212
	jne	instruction_assembled
3211
	mov	eax,[current_line]
3213
	mov	eax,[current_line]
3212
	mov	[error_line],eax
3214
	mov	[error_line],eax
3213
	mov	[error],relative_jump_out_of_range
3215
	mov	[error],relative_jump_out_of_range
3214
	jmp	instruction_assembled
3216
	jmp	instruction_assembled
3215
      jmp_far:
3217
      jmp_far:
3216
	cmp	[jump_type],2
3218
	cmp	[jump_type],2
3217
	je	invalid_operand
3219
	je	invalid_operand
3218
	cmp	[code_type],64
3220
	cmp	[code_type],64
3219
	je	illegal_instruction
3221
	je	illegal_instruction
3220
	mov	al,[extended_code]
3222
	mov	al,[extended_code]
3221
	mov	[base_code],al
3223
	mov	[base_code],al
3222
	call	get_word_value
3224
	call	get_word_value
3223
	push	eax
3225
	push	eax
3224
	inc	esi
3226
	inc	esi
3225
	lods	byte [esi]
3227
	lods	byte [esi]
3226
	cmp	al,'('
3228
	cmp	al,'('
3227
	jne	invalid_operand
3229
	jne	invalid_operand
3228
	mov	al,[value_type]
3230
	mov	al,[value_type]
3229
	push	eax [symbol_identifier]
3231
	push	eax [symbol_identifier]
3230
	cmp	byte [esi],'.'
3232
	cmp	byte [esi],'.'
3231
	je	invalid_value
3233
	je	invalid_value
3232
	mov	al,[operand_size]
3234
	mov	al,[operand_size]
3233
	cmp	al,4
3235
	cmp	al,4
3234
	je	jmp_far_16bit
3236
	je	jmp_far_16bit
3235
	cmp	al,6
3237
	cmp	al,6
3236
	je	jmp_far_32bit
3238
	je	jmp_far_32bit
3237
	or	al,al
3239
	or	al,al
3238
	jnz	invalid_operand_size
3240
	jnz	invalid_operand_size
3239
	cmp	[code_type],16
3241
	cmp	[code_type],16
3240
	jne	jmp_far_32bit
3242
	jne	jmp_far_32bit
3241
      jmp_far_16bit:
3243
      jmp_far_16bit:
3242
	call	get_word_value
3244
	call	get_word_value
3243
	mov	ebx,eax
3245
	mov	ebx,eax
3244
	call	operand_16bit
3246
	call	operand_16bit
3245
	call	store_instruction_code
3247
	call	store_instruction_code
3246
	mov	ax,bx
3248
	mov	ax,bx
3247
	call	mark_relocation
3249
	call	mark_relocation
3248
	stos	word [edi]
3250
	stos	word [edi]
3249
      jmp_far_segment:
3251
      jmp_far_segment:
3250
	pop	[symbol_identifier] eax
3252
	pop	[symbol_identifier] eax
3251
	mov	[value_type],al
3253
	mov	[value_type],al
3252
	pop	eax
3254
	pop	eax
3253
	call	mark_relocation
3255
	call	mark_relocation
3254
	stos	word [edi]
3256
	stos	word [edi]
3255
	jmp	instruction_assembled
3257
	jmp	instruction_assembled
3256
      jmp_far_32bit:
3258
      jmp_far_32bit:
3257
	call	get_dword_value
3259
	call	get_dword_value
3258
	mov	ebx,eax
3260
	mov	ebx,eax
3259
	call	operand_32bit
3261
	call	operand_32bit
3260
	call	store_instruction_code
3262
	call	store_instruction_code
3261
	mov	eax,ebx
3263
	mov	eax,ebx
3262
	call	mark_relocation
3264
	call	mark_relocation
3263
	stos	dword [edi]
3265
	stos	dword [edi]
3264
	jmp	jmp_far_segment
3266
	jmp	jmp_far_segment
3265
conditional_jump:
3267
conditional_jump:
3266
	mov	[base_code],al
3268
	mov	[base_code],al
3267
	lods	byte [esi]
3269
	lods	byte [esi]
3268
	call	get_jump_operator
3270
	call	get_jump_operator
3269
	cmp	[jump_type],3
3271
	cmp	[jump_type],3
3270
	je	invalid_operand
3272
	je	invalid_operand
3271
	call	get_size_operator
3273
	call	get_size_operator
3272
	cmp	al,'('
3274
	cmp	al,'('
3273
	jne	invalid_operand
3275
	jne	invalid_operand
3274
	cmp	byte [esi],'.'
3276
	cmp	byte [esi],'.'
3275
	je	invalid_value
3277
	je	invalid_value
3276
	mov	al,[operand_size]
3278
	mov	al,[operand_size]
3277
	cmp	al,2
3279
	cmp	al,2
3278
	je	conditional_jump_16bit
3280
	je	conditional_jump_16bit
3279
	cmp	al,4
3281
	cmp	al,4
3280
	je	conditional_jump_32bit
3282
	je	conditional_jump_32bit
3281
	cmp	al,8
3283
	cmp	al,8
3282
	je	conditional_jump_64bit
3284
	je	conditional_jump_64bit
3283
	or	al,al
3285
	or	al,al
3284
	jnz	invalid_operand_size
3286
	jnz	invalid_operand_size
3285
	cmp	[code_type],16
3287
	cmp	[code_type],16
3286
	je	conditional_jump_16bit
3288
	je	conditional_jump_16bit
3287
	cmp	[code_type],64
3289
	cmp	[code_type],64
3288
	je	conditional_jump_64bit
3290
	je	conditional_jump_64bit
3289
      conditional_jump_32bit:
3291
      conditional_jump_32bit:
3290
	cmp	[code_type],64
3292
	cmp	[code_type],64
3291
	je	invalid_operand_size
3293
	je	invalid_operand_size
3292
	call	get_address_dword_value
3294
	call	get_address_dword_value
3293
	cmp	[code_type],16
3295
	cmp	[code_type],16
3294
	jne	conditional_jump_32bit_prefix_ok
3296
	jne	conditional_jump_32bit_prefix_ok
3295
	mov	byte [edi],66h
3297
	mov	byte [edi],66h
3296
	inc	edi
3298
	inc	edi
3297
      conditional_jump_32bit_prefix_ok:
3299
      conditional_jump_32bit_prefix_ok:
3298
	call	calculate_jump_offset
3300
	call	calculate_jump_offset
3299
	cdq
3301
	cdq
3300
	call	check_for_short_jump
3302
	call	check_for_short_jump
3301
	jc	conditional_jump_short
3303
	jc	conditional_jump_short
3302
      conditional_jump_32bit_store:
3304
      conditional_jump_32bit_store:
3303
	mov	edx,eax
3305
	mov	edx,eax
3304
	sub	edx,4
3306
	sub	edx,4
3305
	mov	ah,[base_code]
3307
	mov	ah,[base_code]
3306
	add	ah,10h
3308
	add	ah,10h
3307
	mov	al,0Fh
3309
	mov	al,0Fh
3308
	stos	word [edi]
3310
	stos	word [edi]
3309
	mov	eax,edx
3311
	mov	eax,edx
3310
	call	mark_relocation
3312
	call	mark_relocation
3311
	stos	dword [edi]
3313
	stos	dword [edi]
3312
	jmp	instruction_assembled
3314
	jmp	instruction_assembled
3313
      conditional_jump_64bit:
3315
      conditional_jump_64bit:
3314
	cmp	[code_type],64
3316
	cmp	[code_type],64
3315
	jne	invalid_operand_size
3317
	jne	invalid_operand_size
3316
	call	get_address_qword_value
3318
	call	get_address_qword_value
3317
	call	calculate_jump_offset
3319
	call	calculate_jump_offset
3318
	mov	ecx,edx
3320
	mov	ecx,edx
3319
	cdq
3321
	cdq
3320
	cmp	edx,ecx
3322
	cmp	edx,ecx
3321
	jne	value_out_of_range
3323
	jne	value_out_of_range
3322
	call	check_for_short_jump
3324
	call	check_for_short_jump
3323
	jnc	conditional_jump_32bit_store
3325
	jnc	conditional_jump_32bit_store
3324
      conditional_jump_short:
3326
      conditional_jump_short:
3325
	mov	ah,al
3327
	mov	ah,al
3326
	mov	al,[base_code]
3328
	mov	al,[base_code]
3327
	stos	word [edi]
3329
	stos	word [edi]
3328
	jmp	instruction_assembled
3330
	jmp	instruction_assembled
3329
      conditional_jump_16bit:
3331
      conditional_jump_16bit:
3330
	call	get_address_word_value
3332
	call	get_address_word_value
3331
	cmp	[code_type],16
3333
	cmp	[code_type],16
3332
	je	conditional_jump_16bit_prefix_ok
3334
	je	conditional_jump_16bit_prefix_ok
3333
	mov	byte [edi],66h
3335
	mov	byte [edi],66h
3334
	inc	edi
3336
	inc	edi
3335
      conditional_jump_16bit_prefix_ok:
3337
      conditional_jump_16bit_prefix_ok:
3336
	call	calculate_jump_offset
3338
	call	calculate_jump_offset
3337
	cwde
3339
	cwde
3338
	cdq
3340
	cdq
3339
	call	check_for_short_jump
3341
	call	check_for_short_jump
3340
	jc	conditional_jump_short
3342
	jc	conditional_jump_short
3341
	cmp	[value_type],0
3343
	cmp	[value_type],0
3342
	jne	invalid_use_of_symbol
3344
	jne	invalid_use_of_symbol
3343
	mov	edx,eax
3345
	mov	edx,eax
3344
	sub	edx,2
3346
	sub	edx,2
3345
	mov	ah,[base_code]
3347
	mov	ah,[base_code]
3346
	add	ah,10h
3348
	add	ah,10h
3347
	mov	al,0Fh
3349
	mov	al,0Fh
3348
	stos	word [edi]
3350
	stos	word [edi]
3349
	mov	eax,edx
3351
	mov	eax,edx
3350
	stos	word [edi]
3352
	stos	word [edi]
3351
	jmp	instruction_assembled
3353
	jmp	instruction_assembled
3352
loop_instruction_16bit:
3354
loop_instruction_16bit:
3353
	cmp	[code_type],64
3355
	cmp	[code_type],64
3354
	je	illegal_instruction
3356
	je	illegal_instruction
3355
	mov	dl,al
3357
	mov	dl,al
3356
	call	address_16bit_prefix
3358
	call	address_16bit_prefix
3357
	mov	al,dl
3359
	mov	al,dl
3358
	jmp	loop_instruction
3360
	jmp	loop_instruction
3359
loop_instruction_32bit:
3361
loop_instruction_32bit:
3360
	mov	dl,al
3362
	mov	dl,al
3361
	call	address_32bit_prefix
3363
	call	address_32bit_prefix
3362
	mov	al,dl
3364
	mov	al,dl
3363
	jmp	loop_instruction
3365
	jmp	loop_instruction
3364
loop_instruction_64bit:
3366
loop_instruction_64bit:
3365
	cmp	[code_type],64
3367
	cmp	[code_type],64
3366
	jne	illegal_instruction
3368
	jne	illegal_instruction
3367
loop_instruction:
3369
loop_instruction:
3368
	mov	[base_code],al
3370
	mov	[base_code],al
3369
	lods	byte [esi]
3371
	lods	byte [esi]
3370
	call	get_jump_operator
3372
	call	get_jump_operator
3371
	cmp	[jump_type],1
3373
	cmp	[jump_type],1
3372
	ja	invalid_operand
3374
	ja	invalid_operand
3373
	call	get_size_operator
3375
	call	get_size_operator
3374
	cmp	al,'('
3376
	cmp	al,'('
3375
	jne	invalid_operand
3377
	jne	invalid_operand
3376
	cmp	byte [esi],'.'
3378
	cmp	byte [esi],'.'
3377
	je	invalid_value
3379
	je	invalid_value
3378
	mov	al,[operand_size]
3380
	mov	al,[operand_size]
3379
	cmp	al,2
3381
	cmp	al,2
3380
	je	loop_jump_16bit
3382
	je	loop_jump_16bit
3381
	cmp	al,4
3383
	cmp	al,4
3382
	je	loop_jump_32bit
3384
	je	loop_jump_32bit
3383
	cmp	al,8
3385
	cmp	al,8
3384
	je	loop_jump_64bit
3386
	je	loop_jump_64bit
3385
	or	al,al
3387
	or	al,al
3386
	jnz	invalid_operand_size
3388
	jnz	invalid_operand_size
3387
	cmp	[code_type],16
3389
	cmp	[code_type],16
3388
	je	loop_jump_16bit
3390
	je	loop_jump_16bit
3389
	cmp	[code_type],64
3391
	cmp	[code_type],64
3390
	je	loop_jump_64bit
3392
	je	loop_jump_64bit
3391
      loop_jump_32bit:
3393
      loop_jump_32bit:
3392
	cmp	[code_type],64
3394
	cmp	[code_type],64
3393
	je	invalid_operand_size
3395
	je	invalid_operand_size
3394
	call	get_address_dword_value
3396
	call	get_address_dword_value
3395
	cmp	[code_type],16
3397
	cmp	[code_type],16
3396
	jne	loop_jump_32bit_prefix_ok
3398
	jne	loop_jump_32bit_prefix_ok
3397
	mov	byte [edi],66h
3399
	mov	byte [edi],66h
3398
	inc	edi
3400
	inc	edi
3399
      loop_jump_32bit_prefix_ok:
3401
      loop_jump_32bit_prefix_ok:
3400
	call	calculate_jump_offset
3402
	call	calculate_jump_offset
3401
	cdq
3403
	cdq
3402
      make_loop_jump:
3404
      make_loop_jump:
3403
	call	check_for_short_jump
3405
	call	check_for_short_jump
3404
	jc	conditional_jump_short
3406
	jc	conditional_jump_short
3405
	jmp	jump_out_of_range
3407
	jmp	jump_out_of_range
3406
      loop_jump_64bit:
3408
      loop_jump_64bit:
3407
	cmp	[code_type],64
3409
	cmp	[code_type],64
3408
	jne	invalid_operand_size
3410
	jne	invalid_operand_size
3409
	call	get_address_qword_value
3411
	call	get_address_qword_value
3410
	call	calculate_jump_offset
3412
	call	calculate_jump_offset
3411
	mov	ecx,edx
3413
	mov	ecx,edx
3412
	cdq
3414
	cdq
3413
	cmp	edx,ecx
3415
	cmp	edx,ecx
3414
	jne	value_out_of_range
3416
	jne	value_out_of_range
3415
	jmp	make_loop_jump
3417
	jmp	make_loop_jump
3416
      loop_jump_16bit:
3418
      loop_jump_16bit:
3417
	call	get_address_word_value
3419
	call	get_address_word_value
3418
	cmp	[code_type],16
3420
	cmp	[code_type],16
3419
	je	loop_jump_16bit_prefix_ok
3421
	je	loop_jump_16bit_prefix_ok
3420
	mov	byte [edi],66h
3422
	mov	byte [edi],66h
3421
	inc	edi
3423
	inc	edi
3422
      loop_jump_16bit_prefix_ok:
3424
      loop_jump_16bit_prefix_ok:
3423
	call	calculate_jump_offset
3425
	call	calculate_jump_offset
3424
	cwde
3426
	cwde
3425
	cdq
3427
	cdq
3426
	jmp	make_loop_jump
3428
	jmp	make_loop_jump
3427
 
3429
 
3428
movs_instruction:
3430
movs_instruction:
3429
	lods	byte [esi]
3431
	lods	byte [esi]
3430
	call	get_size_operator
3432
	call	get_size_operator
3431
	cmp	al,'['
3433
	cmp	al,'['
3432
	jne	invalid_operand
3434
	jne	invalid_operand
3433
	call	get_address
3435
	call	get_address
3434
	or	eax,eax
3436
	or	eax,eax
3435
	jnz	invalid_address
3437
	jnz	invalid_address
3436
	or	bl,ch
3438
	or	bl,ch
3437
	jnz	invalid_address
3439
	jnz	invalid_address
3438
	cmp	[segment_register],1
3440
	cmp	[segment_register],1
3439
	ja	invalid_address
3441
	ja	invalid_address
3440
	push	ebx
3442
	push	ebx
3441
	lods	byte [esi]
3443
	lods	byte [esi]
3442
	cmp	al,','
3444
	cmp	al,','
3443
	jne	invalid_operand
3445
	jne	invalid_operand
3444
	lods	byte [esi]
3446
	lods	byte [esi]
3445
	call	get_size_operator
3447
	call	get_size_operator
3446
	cmp	al,'['
3448
	cmp	al,'['
3447
	jne	invalid_operand
3449
	jne	invalid_operand
3448
	call	get_address
3450
	call	get_address
3449
	pop	edx
3451
	pop	edx
3450
	or	eax,eax
3452
	or	eax,eax
3451
	jnz	invalid_address
3453
	jnz	invalid_address
3452
	or	bl,ch
3454
	or	bl,ch
3453
	jnz	invalid_address
3455
	jnz	invalid_address
3454
	mov	al,dh
3456
	mov	al,dh
3455
	mov	ah,bh
3457
	mov	ah,bh
3456
	shr	al,4
3458
	shr	al,4
3457
	shr	ah,4
3459
	shr	ah,4
3458
	cmp	al,ah
3460
	cmp	al,ah
3459
	jne	address_sizes_do_not_agree
3461
	jne	address_sizes_do_not_agree
3460
	and	bh,111b
3462
	and	bh,111b
3461
	and	dh,111b
3463
	and	dh,111b
3462
	cmp	bh,6
3464
	cmp	bh,6
3463
	jne	invalid_address
3465
	jne	invalid_address
3464
	cmp	dh,7
3466
	cmp	dh,7
3465
	jne	invalid_address
3467
	jne	invalid_address
3466
	cmp	al,2
3468
	cmp	al,2
3467
	je	movs_address_16bit
3469
	je	movs_address_16bit
3468
	cmp	al,4
3470
	cmp	al,4
3469
	je	movs_address_32bit
3471
	je	movs_address_32bit
3470
	cmp	[code_type],64
3472
	cmp	[code_type],64
3471
	jne	invalid_address_size
3473
	jne	invalid_address_size
3472
	jmp	movs_store
3474
	jmp	movs_store
3473
      movs_address_32bit:
3475
      movs_address_32bit:
3474
	call	address_32bit_prefix
3476
	call	address_32bit_prefix
3475
	jmp	movs_store
3477
	jmp	movs_store
3476
      movs_address_16bit:
3478
      movs_address_16bit:
3477
	cmp	[code_type],64
3479
	cmp	[code_type],64
3478
	je	invalid_address_size
3480
	je	invalid_address_size
3479
	call	address_16bit_prefix
3481
	call	address_16bit_prefix
3480
      movs_store:
3482
      movs_store:
3481
	cmp	[segment_register],4
3483
	cmp	[segment_register],4
3482
	je	movs_segment_ok
3484
	je	movs_segment_ok
3483
	call	store_segment_prefix
3485
	call	store_segment_prefix
3484
      movs_segment_ok:
3486
      movs_segment_ok:
3485
	mov	al,0A4h
3487
	mov	al,0A4h
3486
	mov	bl,[operand_size]
3488
	mov	bl,[operand_size]
3487
	cmp	bl,1
3489
	cmp	bl,1
3488
	je	simple_instruction
3490
	je	simple_instruction
3489
	inc	al
3491
	inc	al
3490
	cmp	bl,2
3492
	cmp	bl,2
3491
	je	simple_instruction_16bit
3493
	je	simple_instruction_16bit
3492
	cmp	bl,4
3494
	cmp	bl,4
3493
	je	simple_instruction_32bit
3495
	je	simple_instruction_32bit
3494
	cmp	bl,8
3496
	cmp	bl,8
3495
	je	simple_instruction_64bit
3497
	je	simple_instruction_64bit
3496
	or	bl,bl
3498
	or	bl,bl
3497
	jz	operand_size_not_specified
3499
	jz	operand_size_not_specified
3498
	jmp	invalid_operand_size
3500
	jmp	invalid_operand_size
3499
lods_instruction:
3501
lods_instruction:
3500
	lods	byte [esi]
3502
	lods	byte [esi]
3501
	call	get_size_operator
3503
	call	get_size_operator
3502
	cmp	al,'['
3504
	cmp	al,'['
3503
	jne	invalid_operand
3505
	jne	invalid_operand
3504
	call	get_address
3506
	call	get_address
3505
	or	eax,eax
3507
	or	eax,eax
3506
	jnz	invalid_address
3508
	jnz	invalid_address
3507
	or	bl,ch
3509
	or	bl,ch
3508
	jnz	invalid_address
3510
	jnz	invalid_address
3509
	cmp	bh,26h
3511
	cmp	bh,26h
3510
	je	lods_address_16bit
3512
	je	lods_address_16bit
3511
	cmp	bh,46h
3513
	cmp	bh,46h
3512
	je	lods_address_32bit
3514
	je	lods_address_32bit
3513
	cmp	bh,86h
3515
	cmp	bh,86h
3514
	jne	invalid_address
3516
	jne	invalid_address
3515
	cmp	[code_type],64
3517
	cmp	[code_type],64
3516
	jne	invalid_address_size
3518
	jne	invalid_address_size
3517
	jmp	lods_store
3519
	jmp	lods_store
3518
      lods_address_32bit:
3520
      lods_address_32bit:
3519
	call	address_32bit_prefix
3521
	call	address_32bit_prefix
3520
	jmp	lods_store
3522
	jmp	lods_store
3521
      lods_address_16bit:
3523
      lods_address_16bit:
3522
	cmp	[code_type],64
3524
	cmp	[code_type],64
3523
	je	invalid_address_size
3525
	je	invalid_address_size
3524
	call	address_16bit_prefix
3526
	call	address_16bit_prefix
3525
      lods_store:
3527
      lods_store:
3526
	cmp	[segment_register],4
3528
	cmp	[segment_register],4
3527
	je	lods_segment_ok
3529
	je	lods_segment_ok
3528
	call	store_segment_prefix
3530
	call	store_segment_prefix
3529
      lods_segment_ok:
3531
      lods_segment_ok:
3530
	mov	al,0ACh
3532
	mov	al,0ACh
3531
	mov	bl,[operand_size]
3533
	mov	bl,[operand_size]
3532
	cmp	bl,1
3534
	cmp	bl,1
3533
	je	simple_instruction
3535
	je	simple_instruction
3534
	inc	al
3536
	inc	al
3535
	cmp	bl,2
3537
	cmp	bl,2
3536
	je	simple_instruction_16bit
3538
	je	simple_instruction_16bit
3537
	cmp	bl,4
3539
	cmp	bl,4
3538
	je	simple_instruction_32bit
3540
	je	simple_instruction_32bit
3539
	cmp	bl,8
3541
	cmp	bl,8
3540
	je	simple_instruction_64bit
3542
	je	simple_instruction_64bit
3541
	or	bl,bl
3543
	or	bl,bl
3542
	jz	operand_size_not_specified
3544
	jz	operand_size_not_specified
3543
	jmp	invalid_operand_size
3545
	jmp	invalid_operand_size
3544
stos_instruction:
3546
stos_instruction:
3545
	mov	[base_code],al
3547
	mov	[base_code],al
3546
	lods	byte [esi]
3548
	lods	byte [esi]
3547
	call	get_size_operator
3549
	call	get_size_operator
3548
	cmp	al,'['
3550
	cmp	al,'['
3549
	jne	invalid_operand
3551
	jne	invalid_operand
3550
	call	get_address
3552
	call	get_address
3551
	or	eax,eax
3553
	or	eax,eax
3552
	jnz	invalid_address
3554
	jnz	invalid_address
3553
	or	bl,ch
3555
	or	bl,ch
3554
	jnz	invalid_address
3556
	jnz	invalid_address
3555
	cmp	bh,27h
3557
	cmp	bh,27h
3556
	je	stos_address_16bit
3558
	je	stos_address_16bit
3557
	cmp	bh,47h
3559
	cmp	bh,47h
3558
	je	stos_address_32bit
3560
	je	stos_address_32bit
3559
	cmp	bh,87h
3561
	cmp	bh,87h
3560
	jne	invalid_address
3562
	jne	invalid_address
3561
	cmp	[code_type],64
3563
	cmp	[code_type],64
3562
	jne	invalid_address_size
3564
	jne	invalid_address_size
3563
	jmp	stos_store
3565
	jmp	stos_store
3564
      stos_address_32bit:
3566
      stos_address_32bit:
3565
	call	address_32bit_prefix
3567
	call	address_32bit_prefix
3566
	jmp	stos_store
3568
	jmp	stos_store
3567
      stos_address_16bit:
3569
      stos_address_16bit:
3568
	cmp	[code_type],64
3570
	cmp	[code_type],64
3569
	je	invalid_address_size
3571
	je	invalid_address_size
3570
	call	address_16bit_prefix
3572
	call	address_16bit_prefix
3571
      stos_store:
3573
      stos_store:
3572
	cmp	[segment_register],1
3574
	cmp	[segment_register],1
3573
	ja	invalid_address
3575
	ja	invalid_address
3574
	mov	al,[base_code]
3576
	mov	al,[base_code]
3575
	mov	bl,[operand_size]
3577
	mov	bl,[operand_size]
3576
	cmp	bl,1
3578
	cmp	bl,1
3577
	je	simple_instruction
3579
	je	simple_instruction
3578
	inc	al
3580
	inc	al
3579
	cmp	bl,2
3581
	cmp	bl,2
3580
	je	simple_instruction_16bit
3582
	je	simple_instruction_16bit
3581
	cmp	bl,4
3583
	cmp	bl,4
3582
	je	simple_instruction_32bit
3584
	je	simple_instruction_32bit
3583
	cmp	bl,8
3585
	cmp	bl,8
3584
	je	simple_instruction_64bit
3586
	je	simple_instruction_64bit
3585
	or	bl,bl
3587
	or	bl,bl
3586
	jz	operand_size_not_specified
3588
	jz	operand_size_not_specified
3587
	jmp	invalid_operand_size
3589
	jmp	invalid_operand_size
3588
cmps_instruction:
3590
cmps_instruction:
3589
	lods	byte [esi]
3591
	lods	byte [esi]
3590
	call	get_size_operator
3592
	call	get_size_operator
3591
	cmp	al,'['
3593
	cmp	al,'['
3592
	jne	invalid_operand
3594
	jne	invalid_operand
3593
	call	get_address
3595
	call	get_address
3594
	or	eax,eax
3596
	or	eax,eax
3595
	jnz	invalid_address
3597
	jnz	invalid_address
3596
	or	bl,ch
3598
	or	bl,ch
3597
	jnz	invalid_address
3599
	jnz	invalid_address
3598
	mov	al,[segment_register]
3600
	mov	al,[segment_register]
3599
	push	eax ebx
3601
	push	eax ebx
3600
	lods	byte [esi]
3602
	lods	byte [esi]
3601
	cmp	al,','
3603
	cmp	al,','
3602
	jne	invalid_operand
3604
	jne	invalid_operand
3603
	lods	byte [esi]
3605
	lods	byte [esi]
3604
	call	get_size_operator
3606
	call	get_size_operator
3605
	cmp	al,'['
3607
	cmp	al,'['
3606
	jne	invalid_operand
3608
	jne	invalid_operand
3607
	call	get_address
3609
	call	get_address
3608
	or	eax,eax
3610
	or	eax,eax
3609
	jnz	invalid_address
3611
	jnz	invalid_address
3610
	or	bl,ch
3612
	or	bl,ch
3611
	jnz	invalid_address
3613
	jnz	invalid_address
3612
	pop	edx eax
3614
	pop	edx eax
3613
	cmp	[segment_register],1
3615
	cmp	[segment_register],1
3614
	ja	invalid_address
3616
	ja	invalid_address
3615
	mov	[segment_register],al
3617
	mov	[segment_register],al
3616
	mov	al,dh
3618
	mov	al,dh
3617
	mov	ah,bh
3619
	mov	ah,bh
3618
	shr	al,4
3620
	shr	al,4
3619
	shr	ah,4
3621
	shr	ah,4
3620
	cmp	al,ah
3622
	cmp	al,ah
3621
	jne	address_sizes_do_not_agree
3623
	jne	address_sizes_do_not_agree
3622
	and	bh,111b
3624
	and	bh,111b
3623
	and	dh,111b
3625
	and	dh,111b
3624
	cmp	bh,7
3626
	cmp	bh,7
3625
	jne	invalid_address
3627
	jne	invalid_address
3626
	cmp	dh,6
3628
	cmp	dh,6
3627
	jne	invalid_address
3629
	jne	invalid_address
3628
	cmp	al,2
3630
	cmp	al,2
3629
	je	cmps_address_16bit
3631
	je	cmps_address_16bit
3630
	cmp	al,4
3632
	cmp	al,4
3631
	je	cmps_address_32bit
3633
	je	cmps_address_32bit
3632
	cmp	[code_type],64
3634
	cmp	[code_type],64
3633
	jne	invalid_address_size
3635
	jne	invalid_address_size
3634
	jmp	cmps_store
3636
	jmp	cmps_store
3635
      cmps_address_32bit:
3637
      cmps_address_32bit:
3636
	call	address_32bit_prefix
3638
	call	address_32bit_prefix
3637
	jmp	cmps_store
3639
	jmp	cmps_store
3638
      cmps_address_16bit:
3640
      cmps_address_16bit:
3639
	cmp	[code_type],64
3641
	cmp	[code_type],64
3640
	je	invalid_address_size
3642
	je	invalid_address_size
3641
	call	address_16bit_prefix
3643
	call	address_16bit_prefix
3642
      cmps_store:
3644
      cmps_store:
3643
	cmp	[segment_register],4
3645
	cmp	[segment_register],4
3644
	je	cmps_segment_ok
3646
	je	cmps_segment_ok
3645
	call	store_segment_prefix
3647
	call	store_segment_prefix
3646
      cmps_segment_ok:
3648
      cmps_segment_ok:
3647
	mov	al,0A6h
3649
	mov	al,0A6h
3648
	mov	bl,[operand_size]
3650
	mov	bl,[operand_size]
3649
	cmp	bl,1
3651
	cmp	bl,1
3650
	je	simple_instruction
3652
	je	simple_instruction
3651
	inc	al
3653
	inc	al
3652
	cmp	bl,2
3654
	cmp	bl,2
3653
	je	simple_instruction_16bit
3655
	je	simple_instruction_16bit
3654
	cmp	bl,4
3656
	cmp	bl,4
3655
	je	simple_instruction_32bit
3657
	je	simple_instruction_32bit
3656
	cmp	bl,8
3658
	cmp	bl,8
3657
	je	simple_instruction_64bit
3659
	je	simple_instruction_64bit
3658
	or	bl,bl
3660
	or	bl,bl
3659
	jz	operand_size_not_specified
3661
	jz	operand_size_not_specified
3660
	jmp	invalid_operand_size
3662
	jmp	invalid_operand_size
3661
ins_instruction:
3663
ins_instruction:
3662
	lods	byte [esi]
3664
	lods	byte [esi]
3663
	call	get_size_operator
3665
	call	get_size_operator
3664
	cmp	al,'['
3666
	cmp	al,'['
3665
	jne	invalid_operand
3667
	jne	invalid_operand
3666
	call	get_address
3668
	call	get_address
3667
	or	eax,eax
3669
	or	eax,eax
3668
	jnz	invalid_address
3670
	jnz	invalid_address
3669
	or	bl,ch
3671
	or	bl,ch
3670
	jnz	invalid_address
3672
	jnz	invalid_address
3671
	cmp	bh,27h
3673
	cmp	bh,27h
3672
	je	ins_address_16bit
3674
	je	ins_address_16bit
3673
	cmp	bh,47h
3675
	cmp	bh,47h
3674
	je	ins_address_32bit
3676
	je	ins_address_32bit
3675
	cmp	bh,87h
3677
	cmp	bh,87h
3676
	jne	invalid_address
3678
	jne	invalid_address
3677
	cmp	[code_type],64
3679
	cmp	[code_type],64
3678
	jne	invalid_address_size
3680
	jne	invalid_address_size
3679
	jmp	ins_store
3681
	jmp	ins_store
3680
      ins_address_32bit:
3682
      ins_address_32bit:
3681
	call	address_32bit_prefix
3683
	call	address_32bit_prefix
3682
	jmp	ins_store
3684
	jmp	ins_store
3683
      ins_address_16bit:
3685
      ins_address_16bit:
3684
	cmp	[code_type],64
3686
	cmp	[code_type],64
3685
	je	invalid_address_size
3687
	je	invalid_address_size
3686
	call	address_16bit_prefix
3688
	call	address_16bit_prefix
3687
      ins_store:
3689
      ins_store:
3688
	cmp	[segment_register],1
3690
	cmp	[segment_register],1
3689
	ja	invalid_address
3691
	ja	invalid_address
3690
	lods	byte [esi]
3692
	lods	byte [esi]
3691
	cmp	al,','
3693
	cmp	al,','
3692
	jne	invalid_operand
3694
	jne	invalid_operand
3693
	lods	byte [esi]
3695
	lods	byte [esi]
3694
	cmp	al,10h
3696
	cmp	al,10h
3695
	jne	invalid_operand
3697
	jne	invalid_operand
3696
	lods	byte [esi]
3698
	lods	byte [esi]
3697
	cmp	al,22h
3699
	cmp	al,22h
3698
	jne	invalid_operand
3700
	jne	invalid_operand
3699
	mov	al,6Ch
3701
	mov	al,6Ch
3700
	mov	bl,[operand_size]
3702
	mov	bl,[operand_size]
3701
	cmp	bl,1
3703
	cmp	bl,1
3702
	je	simple_instruction
3704
	je	simple_instruction
3703
	inc	al
3705
	inc	al
3704
	cmp	bl,2
3706
	cmp	bl,2
3705
	je	simple_instruction_16bit
3707
	je	simple_instruction_16bit
3706
	cmp	bl,4
3708
	cmp	bl,4
3707
	je	simple_instruction_32bit
3709
	je	simple_instruction_32bit
3708
	or	bl,bl
3710
	or	bl,bl
3709
	jz	operand_size_not_specified
3711
	jz	operand_size_not_specified
3710
	jmp	invalid_operand_size
3712
	jmp	invalid_operand_size
3711
outs_instruction:
3713
outs_instruction:
3712
	lods	byte [esi]
3714
	lods	byte [esi]
3713
	cmp	al,10h
3715
	cmp	al,10h
3714
	jne	invalid_operand
3716
	jne	invalid_operand
3715
	lods	byte [esi]
3717
	lods	byte [esi]
3716
	cmp	al,22h
3718
	cmp	al,22h
3717
	jne	invalid_operand
3719
	jne	invalid_operand
3718
	lods	byte [esi]
3720
	lods	byte [esi]
3719
	cmp	al,','
3721
	cmp	al,','
3720
	jne	invalid_operand
3722
	jne	invalid_operand
3721
	lods	byte [esi]
3723
	lods	byte [esi]
3722
	call	get_size_operator
3724
	call	get_size_operator
3723
	cmp	al,'['
3725
	cmp	al,'['
3724
	jne	invalid_operand
3726
	jne	invalid_operand
3725
	call	get_address
3727
	call	get_address
3726
	or	eax,eax
3728
	or	eax,eax
3727
	jnz	invalid_address
3729
	jnz	invalid_address
3728
	or	bl,ch
3730
	or	bl,ch
3729
	jnz	invalid_address
3731
	jnz	invalid_address
3730
	cmp	bh,26h
3732
	cmp	bh,26h
3731
	je	outs_address_16bit
3733
	je	outs_address_16bit
3732
	cmp	bh,46h
3734
	cmp	bh,46h
3733
	je	outs_address_32bit
3735
	je	outs_address_32bit
3734
	cmp	bh,86h
3736
	cmp	bh,86h
3735
	jne	invalid_address
3737
	jne	invalid_address
3736
	cmp	[code_type],64
3738
	cmp	[code_type],64
3737
	jne	invalid_address_size
3739
	jne	invalid_address_size
3738
	jmp	outs_store
3740
	jmp	outs_store
3739
      outs_address_32bit:
3741
      outs_address_32bit:
3740
	call	address_32bit_prefix
3742
	call	address_32bit_prefix
3741
	jmp	outs_store
3743
	jmp	outs_store
3742
      outs_address_16bit:
3744
      outs_address_16bit:
3743
	cmp	[code_type],64
3745
	cmp	[code_type],64
3744
	je	invalid_address_size
3746
	je	invalid_address_size
3745
	call	address_16bit_prefix
3747
	call	address_16bit_prefix
3746
      outs_store:
3748
      outs_store:
3747
	cmp	[segment_register],4
3749
	cmp	[segment_register],4
3748
	je	outs_segment_ok
3750
	je	outs_segment_ok
3749
	call	store_segment_prefix
3751
	call	store_segment_prefix
3750
      outs_segment_ok:
3752
      outs_segment_ok:
3751
	mov	al,6Eh
3753
	mov	al,6Eh
3752
	mov	bl,[operand_size]
3754
	mov	bl,[operand_size]
3753
	cmp	bl,1
3755
	cmp	bl,1
3754
	je	simple_instruction
3756
	je	simple_instruction
3755
	inc	al
3757
	inc	al
3756
	cmp	bl,2
3758
	cmp	bl,2
3757
	je	simple_instruction_16bit
3759
	je	simple_instruction_16bit
3758
	cmp	bl,4
3760
	cmp	bl,4
3759
	je	simple_instruction_32bit
3761
	je	simple_instruction_32bit
3760
	or	bl,bl
3762
	or	bl,bl
3761
	jz	operand_size_not_specified
3763
	jz	operand_size_not_specified
3762
	jmp	invalid_operand_size
3764
	jmp	invalid_operand_size
3763
xlat_instruction:
3765
xlat_instruction:
3764
	lods	byte [esi]
3766
	lods	byte [esi]
3765
	call	get_size_operator
3767
	call	get_size_operator
3766
	cmp	al,'['
3768
	cmp	al,'['
3767
	jne	invalid_operand
3769
	jne	invalid_operand
3768
	call	get_address
3770
	call	get_address
3769
	or	eax,eax
3771
	or	eax,eax
3770
	jnz	invalid_address
3772
	jnz	invalid_address
3771
	or	bl,ch
3773
	or	bl,ch
3772
	jnz	invalid_address
3774
	jnz	invalid_address
3773
	cmp	bh,23h
3775
	cmp	bh,23h
3774
	je	xlat_address_16bit
3776
	je	xlat_address_16bit
3775
	cmp	bh,43h
3777
	cmp	bh,43h
3776
	je	xlat_address_32bit
3778
	je	xlat_address_32bit
3777
	cmp	bh,83h
3779
	cmp	bh,83h
3778
	jne	invalid_address
3780
	jne	invalid_address
3779
	cmp	[code_type],64
3781
	cmp	[code_type],64
3780
	jne	invalid_address_size
3782
	jne	invalid_address_size
3781
	jmp	xlat_store
3783
	jmp	xlat_store
3782
      xlat_address_32bit:
3784
      xlat_address_32bit:
3783
	call	address_32bit_prefix
3785
	call	address_32bit_prefix
3784
	jmp	xlat_store
3786
	jmp	xlat_store
3785
      xlat_address_16bit:
3787
      xlat_address_16bit:
3786
	cmp	[code_type],64
3788
	cmp	[code_type],64
3787
	je	invalid_address_size
3789
	je	invalid_address_size
3788
	call	address_16bit_prefix
3790
	call	address_16bit_prefix
3789
      xlat_store:
3791
      xlat_store:
3790
	call	store_segment_prefix_if_necessary
3792
	call	store_segment_prefix_if_necessary
3791
	mov	al,0D7h
3793
	mov	al,0D7h
3792
	cmp	[operand_size],1
3794
	cmp	[operand_size],1
3793
	jbe	simple_instruction
3795
	jbe	simple_instruction
3794
	jmp	invalid_operand_size
3796
	jmp	invalid_operand_size
3795
 
3797
 
3796
pm_word_instruction:
3798
pm_word_instruction:
3797
	mov	ah,al
3799
	mov	ah,al
3798
	shr	ah,4
3800
	shr	ah,4
3799
	and	al,111b
3801
	and	al,111b
3800
	mov	[base_code],0Fh
3802
	mov	[base_code],0Fh
3801
	mov	[extended_code],ah
3803
	mov	[extended_code],ah
3802
	mov	[postbyte_register],al
3804
	mov	[postbyte_register],al
3803
	lods	byte [esi]
3805
	lods	byte [esi]
3804
	call	get_size_operator
3806
	call	get_size_operator
3805
	cmp	al,10h
3807
	cmp	al,10h
3806
	je	pm_reg
3808
	je	pm_reg
3807
      pm_mem:
3809
      pm_mem:
3808
	cmp	al,'['
3810
	cmp	al,'['
3809
	jne	invalid_operand
3811
	jne	invalid_operand
3810
	call	get_address
3812
	call	get_address
3811
	mov	al,[operand_size]
3813
	mov	al,[operand_size]
3812
	cmp	al,2
3814
	cmp	al,2
3813
	je	pm_mem_store
3815
	je	pm_mem_store
3814
	or	al,al
3816
	or	al,al
3815
	jnz	invalid_operand_size
3817
	jnz	invalid_operand_size
3816
      pm_mem_store:
3818
      pm_mem_store:
3817
	call	store_instruction
3819
	call	store_instruction
3818
	jmp	instruction_assembled
3820
	jmp	instruction_assembled
3819
      pm_reg:
3821
      pm_reg:
3820
	lods	byte [esi]
3822
	lods	byte [esi]
3821
	call	convert_register
3823
	call	convert_register
3822
	mov	bl,al
3824
	mov	bl,al
3823
	cmp	ah,2
3825
	cmp	ah,2
3824
	jne	invalid_operand_size
3826
	jne	invalid_operand_size
3825
	call	store_nomem_instruction
3827
	call	store_nomem_instruction
3826
	jmp	instruction_assembled
3828
	jmp	instruction_assembled
3827
pm_store_word_instruction:
3829
pm_store_word_instruction:
3828
	mov	ah,al
3830
	mov	ah,al
3829
	shr	ah,4
3831
	shr	ah,4
3830
	and	al,111b
3832
	and	al,111b
3831
	mov	[base_code],0Fh
3833
	mov	[base_code],0Fh
3832
	mov	[extended_code],ah
3834
	mov	[extended_code],ah
3833
	mov	[postbyte_register],al
3835
	mov	[postbyte_register],al
3834
	lods	byte [esi]
3836
	lods	byte [esi]
3835
	call	get_size_operator
3837
	call	get_size_operator
3836
	cmp	al,10h
3838
	cmp	al,10h
3837
	jne	pm_mem
3839
	jne	pm_mem
3838
	lods	byte [esi]
3840
	lods	byte [esi]
3839
	call	convert_register
3841
	call	convert_register
3840
	mov	bl,al
3842
	mov	bl,al
3841
	mov	al,ah
3843
	mov	al,ah
3842
	call	operand_autodetect
3844
	call	operand_autodetect
3843
	call	store_nomem_instruction
3845
	call	store_nomem_instruction
3844
	jmp	instruction_assembled
3846
	jmp	instruction_assembled
3845
lgdt_instruction:
3847
lgdt_instruction:
3846
	mov	[base_code],0Fh
3848
	mov	[base_code],0Fh
3847
	mov	[extended_code],1
3849
	mov	[extended_code],1
3848
	mov	[postbyte_register],al
3850
	mov	[postbyte_register],al
3849
	lods	byte [esi]
3851
	lods	byte [esi]
3850
	call	get_size_operator
3852
	call	get_size_operator
3851
	cmp	al,'['
3853
	cmp	al,'['
3852
	jne	invalid_operand
3854
	jne	invalid_operand
3853
	call	get_address
3855
	call	get_address
3854
	mov	al,[operand_size]
3856
	mov	al,[operand_size]
3855
	cmp	al,6
3857
	cmp	al,6
3856
	je	lgdt_mem_48bit
3858
	je	lgdt_mem_48bit
3857
	cmp	al,10
3859
	cmp	al,10
3858
	je	lgdt_mem_80bit
3860
	je	lgdt_mem_80bit
3859
	or	al,al
3861
	or	al,al
3860
	jnz	invalid_operand_size
3862
	jnz	invalid_operand_size
3861
	jmp	lgdt_mem_store
3863
	jmp	lgdt_mem_store
3862
      lgdt_mem_80bit:
3864
      lgdt_mem_80bit:
3863
	cmp	[code_type],64
3865
	cmp	[code_type],64
3864
	jne	illegal_instruction
3866
	jne	illegal_instruction
3865
	jmp	lgdt_mem_store
3867
	jmp	lgdt_mem_store
3866
      lgdt_mem_48bit:
3868
      lgdt_mem_48bit:
3867
	cmp	[code_type],64
3869
	cmp	[code_type],64
3868
	je	illegal_instruction
3870
	je	illegal_instruction
3869
	cmp	[postbyte_register],2
3871
	cmp	[postbyte_register],2
3870
	jb	lgdt_mem_store
3872
	jb	lgdt_mem_store
3871
	call	operand_32bit
3873
	call	operand_32bit
3872
      lgdt_mem_store:
3874
      lgdt_mem_store:
3873
	call	store_instruction
3875
	call	store_instruction
3874
	jmp	instruction_assembled
3876
	jmp	instruction_assembled
3875
lar_instruction:
3877
lar_instruction:
3876
	mov	[extended_code],al
3878
	mov	[extended_code],al
3877
	mov	[base_code],0Fh
3879
	mov	[base_code],0Fh
3878
	lods	byte [esi]
3880
	lods	byte [esi]
3879
	call	get_size_operator
3881
	call	get_size_operator
3880
	cmp	al,10h
3882
	cmp	al,10h
3881
	jne	invalid_operand
3883
	jne	invalid_operand
3882
	lods	byte [esi]
3884
	lods	byte [esi]
3883
	call	convert_register
3885
	call	convert_register
3884
	mov	[postbyte_register],al
3886
	mov	[postbyte_register],al
3885
	lods	byte [esi]
3887
	lods	byte [esi]
3886
	cmp	al,','
3888
	cmp	al,','
3887
	jne	invalid_operand
3889
	jne	invalid_operand
3888
	xor	al,al
3890
	xor	al,al
3889
	xchg	al,[operand_size]
3891
	xchg	al,[operand_size]
3890
	call	operand_autodetect
3892
	call	operand_autodetect
3891
	lods	byte [esi]
3893
	lods	byte [esi]
3892
	call	get_size_operator
3894
	call	get_size_operator
3893
	cmp	al,10h
3895
	cmp	al,10h
3894
	je	lar_reg_reg
3896
	je	lar_reg_reg
3895
	cmp	al,'['
3897
	cmp	al,'['
3896
	jne	invalid_operand
3898
	jne	invalid_operand
3897
	call	get_address
3899
	call	get_address
3898
	mov	al,[operand_size]
3900
	mov	al,[operand_size]
3899
	or	al,al
3901
	or	al,al
3900
	jz	lar_reg_mem
3902
	jz	lar_reg_mem
3901
	cmp	al,2
3903
	cmp	al,2
3902
	jne	invalid_operand_size
3904
	jne	invalid_operand_size
3903
      lar_reg_mem:
3905
      lar_reg_mem:
3904
	call	store_instruction
3906
	call	store_instruction
3905
	jmp	instruction_assembled
3907
	jmp	instruction_assembled
3906
      lar_reg_reg:
3908
      lar_reg_reg:
3907
	lods	byte [esi]
3909
	lods	byte [esi]
3908
	call	convert_register
3910
	call	convert_register
3909
	cmp	ah,2
3911
	cmp	ah,2
3910
	jne	invalid_operand_size
3912
	jne	invalid_operand_size
3911
	mov	bl,al
3913
	mov	bl,al
3912
	call	store_nomem_instruction
3914
	call	store_nomem_instruction
3913
	jmp	instruction_assembled
3915
	jmp	instruction_assembled
3914
invlpg_instruction:
3916
invlpg_instruction:
3915
	mov	[base_code],0Fh
3917
	mov	[base_code],0Fh
3916
	mov	[extended_code],1
3918
	mov	[extended_code],1
3917
	mov	[postbyte_register],7
3919
	mov	[postbyte_register],7
3918
	lods	byte [esi]
3920
	lods	byte [esi]
3919
	call	get_size_operator
3921
	call	get_size_operator
3920
	cmp	al,'['
3922
	cmp	al,'['
3921
	jne	invalid_operand
3923
	jne	invalid_operand
3922
	call	get_address
3924
	call	get_address
3923
	call	store_instruction
3925
	call	store_instruction
3924
	jmp	instruction_assembled
3926
	jmp	instruction_assembled
3925
swapgs_instruction:
3927
swapgs_instruction:
3926
	mov	[base_code],0Fh
3928
	mov	[base_code],0Fh
3927
	mov	[extended_code],1
3929
	mov	[extended_code],1
3928
	mov	[postbyte_register],7
3930
	mov	[postbyte_register],7
3929
	mov	bl,al
3931
	mov	bl,al
3930
	call	store_nomem_instruction
3932
	call	store_nomem_instruction
3931
	jmp	instruction_assembled
3933
	jmp	instruction_assembled
3932
 
3934
 
3933
basic_486_instruction:
3935
basic_486_instruction:
3934
	mov	[base_code],0Fh
3936
	mov	[base_code],0Fh
3935
	mov	[extended_code],al
3937
	mov	[extended_code],al
3936
	lods	byte [esi]
3938
	lods	byte [esi]
3937
	call	get_size_operator
3939
	call	get_size_operator
3938
	cmp	al,10h
3940
	cmp	al,10h
3939
	je	basic_486_reg
3941
	je	basic_486_reg
3940
	cmp	al,'['
3942
	cmp	al,'['
3941
	jne	invalid_operand
3943
	jne	invalid_operand
3942
	call	get_address
3944
	call	get_address
3943
	push	edx ebx ecx
3945
	push	edx ebx ecx
3944
	lods	byte [esi]
3946
	lods	byte [esi]
3945
	cmp	al,','
3947
	cmp	al,','
3946
	jne	invalid_operand
3948
	jne	invalid_operand
3947
	lods	byte [esi]
3949
	lods	byte [esi]
3948
	call	get_size_operator
3950
	call	get_size_operator
3949
	cmp	al,10h
3951
	cmp	al,10h
3950
	jne	invalid_operand
3952
	jne	invalid_operand
3951
	lods	byte [esi]
3953
	lods	byte [esi]
3952
	call	convert_register
3954
	call	convert_register
3953
	mov	[postbyte_register],al
3955
	mov	[postbyte_register],al
3954
	pop	ecx ebx edx
3956
	pop	ecx ebx edx
3955
	mov	al,ah
3957
	mov	al,ah
3956
	cmp	al,1
3958
	cmp	al,1
3957
	je	basic_486_mem_reg_8bit
3959
	je	basic_486_mem_reg_8bit
3958
	call	operand_autodetect
3960
	call	operand_autodetect
3959
	inc	[extended_code]
3961
	inc	[extended_code]
3960
      basic_486_mem_reg_8bit:
3962
      basic_486_mem_reg_8bit:
3961
	call	store_instruction
3963
	call	store_instruction
3962
	jmp	instruction_assembled
3964
	jmp	instruction_assembled
3963
      basic_486_reg:
3965
      basic_486_reg:
3964
	lods	byte [esi]
3966
	lods	byte [esi]
3965
	call	convert_register
3967
	call	convert_register
3966
	mov	[postbyte_register],al
3968
	mov	[postbyte_register],al
3967
	lods	byte [esi]
3969
	lods	byte [esi]
3968
	cmp	al,','
3970
	cmp	al,','
3969
	jne	invalid_operand
3971
	jne	invalid_operand
3970
	lods	byte [esi]
3972
	lods	byte [esi]
3971
	call	get_size_operator
3973
	call	get_size_operator
3972
	cmp	al,10h
3974
	cmp	al,10h
3973
	jne	invalid_operand
3975
	jne	invalid_operand
3974
	lods	byte [esi]
3976
	lods	byte [esi]
3975
	call	convert_register
3977
	call	convert_register
3976
	mov	bl,[postbyte_register]
3978
	mov	bl,[postbyte_register]
3977
	mov	[postbyte_register],al
3979
	mov	[postbyte_register],al
3978
	mov	al,ah
3980
	mov	al,ah
3979
	cmp	al,1
3981
	cmp	al,1
3980
	je	basic_486_reg_reg_8bit
3982
	je	basic_486_reg_reg_8bit
3981
	call	operand_autodetect
3983
	call	operand_autodetect
3982
	inc	[extended_code]
3984
	inc	[extended_code]
3983
      basic_486_reg_reg_8bit:
3985
      basic_486_reg_reg_8bit:
3984
	call	store_nomem_instruction
3986
	call	store_nomem_instruction
3985
	jmp	instruction_assembled
3987
	jmp	instruction_assembled
3986
bswap_instruction:
3988
bswap_instruction:
3987
	lods	byte [esi]
3989
	lods	byte [esi]
3988
	call	get_size_operator
3990
	call	get_size_operator
3989
	cmp	al,10h
3991
	cmp	al,10h
3990
	jne	invalid_operand
3992
	jne	invalid_operand
3991
	lods	byte [esi]
3993
	lods	byte [esi]
3992
	call	convert_register
3994
	call	convert_register
3993
	test	al,1000b
3995
	test	al,1000b
3994
	jz	bswap_reg_code_ok
3996
	jz	bswap_reg_code_ok
3995
	or	[rex_prefix],41h
3997
	or	[rex_prefix],41h
3996
	and	al,111b
3998
	and	al,111b
3997
      bswap_reg_code_ok:
3999
      bswap_reg_code_ok:
3998
	add	al,0C8h
4000
	add	al,0C8h
3999
	mov	[extended_code],al
4001
	mov	[extended_code],al
4000
	mov	[base_code],0Fh
4002
	mov	[base_code],0Fh
4001
	cmp	ah,8
4003
	cmp	ah,8
4002
	je	bswap_reg64
4004
	je	bswap_reg64
4003
	cmp	ah,4
4005
	cmp	ah,4
4004
	jne	invalid_operand_size
4006
	jne	invalid_operand_size
4005
	call	operand_32bit
4007
	call	operand_32bit
4006
	call	store_instruction_code
4008
	call	store_instruction_code
4007
	jmp	instruction_assembled
4009
	jmp	instruction_assembled
4008
      bswap_reg64:
4010
      bswap_reg64:
4009
	call	operand_64bit
4011
	call	operand_64bit
4010
	call	store_instruction_code
4012
	call	store_instruction_code
4011
	jmp	instruction_assembled
4013
	jmp	instruction_assembled
4012
cmpxchgx_instruction:
4014
cmpxchgx_instruction:
4013
	mov	[base_code],0Fh
4015
	mov	[base_code],0Fh
4014
	mov	[extended_code],0C7h
4016
	mov	[extended_code],0C7h
4015
	mov	[postbyte_register],al
4017
	mov	[postbyte_register],al
4016
	lods	byte [esi]
4018
	lods	byte [esi]
4017
	call	get_size_operator
4019
	call	get_size_operator
4018
	cmp	al,'['
4020
	cmp	al,'['
4019
	jne	invalid_operand
4021
	jne	invalid_operand
4020
	call	get_address
4022
	call	get_address
4021
	mov	ah,1
4023
	mov	ah,1
4022
	xchg	[postbyte_register],ah
4024
	xchg	[postbyte_register],ah
4023
	mov	al,[operand_size]
4025
	mov	al,[operand_size]
4024
	or	al,al
4026
	or	al,al
4025
	jz	cmpxchgx_size_ok
4027
	jz	cmpxchgx_size_ok
4026
	cmp	al,ah
4028
	cmp	al,ah
4027
	jne	invalid_operand_size
4029
	jne	invalid_operand_size
4028
      cmpxchgx_size_ok:
4030
      cmpxchgx_size_ok:
4029
	cmp	ah,16
4031
	cmp	ah,16
4030
	jne	cmpxchgx_store
4032
	jne	cmpxchgx_store
4031
	call	operand_64bit
4033
	call	operand_64bit
4032
      cmpxchgx_store:
4034
      cmpxchgx_store:
4033
	call	store_instruction
4035
	call	store_instruction
4034
	jmp	instruction_assembled
4036
	jmp	instruction_assembled
4035
nop_instruction:
4037
nop_instruction:
4036
	mov	ah,[esi]
4038
	mov	ah,[esi]
4037
	cmp	ah,10h
4039
	cmp	ah,10h
4038
	je	extended_nop
4040
	je	extended_nop
4039
	cmp	ah,11h
4041
	cmp	ah,11h
4040
	je	extended_nop
4042
	je	extended_nop
4041
	cmp	ah,'['
4043
	cmp	ah,'['
4042
	je	extended_nop
4044
	je	extended_nop
4043
	stos	byte [edi]
4045
	stos	byte [edi]
4044
	jmp	instruction_assembled
4046
	jmp	instruction_assembled
4045
      extended_nop:
4047
      extended_nop:
4046
	mov	[base_code],0Fh
4048
	mov	[base_code],0Fh
4047
	mov	[extended_code],1Fh
4049
	mov	[extended_code],1Fh
4048
	mov	[postbyte_register],0
4050
	mov	[postbyte_register],0
4049
	lods	byte [esi]
4051
	lods	byte [esi]
4050
	call	get_size_operator
4052
	call	get_size_operator
4051
	cmp	al,10h
4053
	cmp	al,10h
4052
	je	extended_nop_reg
4054
	je	extended_nop_reg
4053
	cmp	al,'['
4055
	cmp	al,'['
4054
	jne	invalid_operand
4056
	jne	invalid_operand
4055
	call	get_address
4057
	call	get_address
4056
	mov	al,[operand_size]
4058
	mov	al,[operand_size]
4057
	or	al,al
4059
	or	al,al
4058
	jz	extended_nop_nosize
4060
	jz	extended_nop_nosize
4059
	call	operand_autodetect
4061
	call	operand_autodetect
4060
      extended_nop_store:
4062
      extended_nop_store:
4061
	call	store_instruction
4063
	call	store_instruction
4062
	jmp	instruction_assembled
4064
	jmp	instruction_assembled
4063
      extended_nop_nosize:
4065
      extended_nop_nosize:
4064
	cmp	[error_line],0
4066
	cmp	[error_line],0
4065
	jne	extended_nop_store
4067
	jne	extended_nop_store
4066
	mov	eax,[current_line]
4068
	mov	eax,[current_line]
4067
	mov	[error_line],eax
4069
	mov	[error_line],eax
4068
	mov	[error],operand_size_not_specified
4070
	mov	[error],operand_size_not_specified
4069
	jmp	extended_nop_store
4071
	jmp	extended_nop_store
4070
      extended_nop_reg:
4072
      extended_nop_reg:
4071
	lods	byte [esi]
4073
	lods	byte [esi]
4072
	call	convert_register
4074
	call	convert_register
4073
	mov	bl,al
4075
	mov	bl,al
4074
	mov	al,ah
4076
	mov	al,ah
4075
	call	operand_autodetect
4077
	call	operand_autodetect
4076
	call	store_nomem_instruction
4078
	call	store_nomem_instruction
4077
	jmp	instruction_assembled
4079
	jmp	instruction_assembled
4078
 
4080
 
4079
basic_fpu_instruction:
4081
basic_fpu_instruction:
4080
	mov	[postbyte_register],al
4082
	mov	[postbyte_register],al
4081
	mov	[base_code],0D8h
4083
	mov	[base_code],0D8h
4082
	lods	byte [esi]
4084
	lods	byte [esi]
4083
	call	get_size_operator
4085
	call	get_size_operator
4084
	cmp	al,10h
4086
	cmp	al,10h
4085
	je	basic_fpu_streg
4087
	je	basic_fpu_streg
4086
	cmp	al,'['
4088
	cmp	al,'['
4087
	je	basic_fpu_mem
4089
	je	basic_fpu_mem
4088
	dec	esi
4090
	dec	esi
4089
	mov	ah,[postbyte_register]
4091
	mov	ah,[postbyte_register]
4090
	cmp	ah,2
4092
	cmp	ah,2
4091
	jb	invalid_operand
4093
	jb	invalid_operand
4092
	cmp	ah,3
4094
	cmp	ah,3
4093
	ja	invalid_operand
4095
	ja	invalid_operand
4094
	mov	bl,1
4096
	mov	bl,1
4095
	call	store_nomem_instruction
4097
	call	store_nomem_instruction
4096
	jmp	instruction_assembled
4098
	jmp	instruction_assembled
4097
      basic_fpu_mem:
4099
      basic_fpu_mem:
4098
	call	get_address
4100
	call	get_address
4099
	mov	al,[operand_size]
4101
	mov	al,[operand_size]
4100
	cmp	al,4
4102
	cmp	al,4
4101
	je	basic_fpu_mem_32bit
4103
	je	basic_fpu_mem_32bit
4102
	cmp	al,8
4104
	cmp	al,8
4103
	je	basic_fpu_mem_64bit
4105
	je	basic_fpu_mem_64bit
4104
	or	al,al
4106
	or	al,al
4105
	jnz	invalid_operand_size
4107
	jnz	invalid_operand_size
4106
	cmp	[error_line],0
4108
	cmp	[error_line],0
4107
	jne	basic_fpu_mem_32bit
4109
	jne	basic_fpu_mem_32bit
4108
	mov	eax,[current_line]
4110
	mov	eax,[current_line]
4109
	mov	[error_line],eax
4111
	mov	[error_line],eax
4110
	mov	[error],operand_size_not_specified
4112
	mov	[error],operand_size_not_specified
4111
      basic_fpu_mem_32bit:
4113
      basic_fpu_mem_32bit:
4112
	call	store_instruction
4114
	call	store_instruction
4113
	jmp	instruction_assembled
4115
	jmp	instruction_assembled
4114
      basic_fpu_mem_64bit:
4116
      basic_fpu_mem_64bit:
4115
	mov	[base_code],0DCh
4117
	mov	[base_code],0DCh
4116
	call	store_instruction
4118
	call	store_instruction
4117
	jmp	instruction_assembled
4119
	jmp	instruction_assembled
4118
      basic_fpu_streg:
4120
      basic_fpu_streg:
4119
	lods	byte [esi]
4121
	lods	byte [esi]
4120
	call	convert_fpu_register
4122
	call	convert_fpu_register
4121
	mov	bl,al
4123
	mov	bl,al
4122
	mov	ah,[postbyte_register]
4124
	mov	ah,[postbyte_register]
4123
	cmp	ah,2
4125
	cmp	ah,2
4124
	je	basic_fpu_single_streg
4126
	je	basic_fpu_single_streg
4125
	cmp	ah,3
4127
	cmp	ah,3
4126
	je	basic_fpu_single_streg
4128
	je	basic_fpu_single_streg
4127
	or	al,al
4129
	or	al,al
4128
	jz	basic_fpu_st0
4130
	jz	basic_fpu_st0
4129
	test	ah,110b
4131
	test	ah,110b
4130
	jz	basic_fpu_streg_st0
4132
	jz	basic_fpu_streg_st0
4131
	xor	[postbyte_register],1
4133
	xor	[postbyte_register],1
4132
      basic_fpu_streg_st0:
4134
      basic_fpu_streg_st0:
4133
	lods	byte [esi]
4135
	lods	byte [esi]
4134
	cmp	al,','
4136
	cmp	al,','
4135
	jne	invalid_operand
4137
	jne	invalid_operand
4136
	lods	byte [esi]
4138
	lods	byte [esi]
4137
	call	get_size_operator
4139
	call	get_size_operator
4138
	cmp	al,10h
4140
	cmp	al,10h
4139
	jne	invalid_operand
4141
	jne	invalid_operand
4140
	lods	byte [esi]
4142
	lods	byte [esi]
4141
	call	convert_fpu_register
4143
	call	convert_fpu_register
4142
	or	al,al
4144
	or	al,al
4143
	jnz	invalid_operand
4145
	jnz	invalid_operand
4144
	mov	[base_code],0DCh
4146
	mov	[base_code],0DCh
4145
	call	store_nomem_instruction
4147
	call	store_nomem_instruction
4146
	jmp	instruction_assembled
4148
	jmp	instruction_assembled
4147
      basic_fpu_st0:
4149
      basic_fpu_st0:
4148
	lods	byte [esi]
4150
	lods	byte [esi]
4149
	cmp	al,','
4151
	cmp	al,','
4150
	jne	invalid_operand
4152
	jne	invalid_operand
4151
	lods	byte [esi]
4153
	lods	byte [esi]
4152
	call	get_size_operator
4154
	call	get_size_operator
4153
	cmp	al,10h
4155
	cmp	al,10h
4154
	jne	invalid_operand
4156
	jne	invalid_operand
4155
	lods	byte [esi]
4157
	lods	byte [esi]
4156
	call	convert_fpu_register
4158
	call	convert_fpu_register
4157
	mov	bl,al
4159
	mov	bl,al
4158
      basic_fpu_single_streg:
4160
      basic_fpu_single_streg:
4159
	mov	[base_code],0D8h
4161
	mov	[base_code],0D8h
4160
	call	store_nomem_instruction
4162
	call	store_nomem_instruction
4161
	jmp	instruction_assembled
4163
	jmp	instruction_assembled
4162
simple_fpu_instruction:
4164
simple_fpu_instruction:
4163
	mov	ah,al
4165
	mov	ah,al
4164
	or	ah,11000000b
4166
	or	ah,11000000b
4165
	mov	al,0D9h
4167
	mov	al,0D9h
4166
	stos	word [edi]
4168
	stos	word [edi]
4167
	jmp	instruction_assembled
4169
	jmp	instruction_assembled
4168
fi_instruction:
4170
fi_instruction:
4169
	mov	[postbyte_register],al
4171
	mov	[postbyte_register],al
4170
	lods	byte [esi]
4172
	lods	byte [esi]
4171
	call	get_size_operator
4173
	call	get_size_operator
4172
	cmp	al,'['
4174
	cmp	al,'['
4173
	jne	invalid_operand
4175
	jne	invalid_operand
4174
	call	get_address
4176
	call	get_address
4175
	mov	al,[operand_size]
4177
	mov	al,[operand_size]
4176
	cmp	al,2
4178
	cmp	al,2
4177
	je	fi_mem_16bit
4179
	je	fi_mem_16bit
4178
	cmp	al,4
4180
	cmp	al,4
4179
	je	fi_mem_32bit
4181
	je	fi_mem_32bit
4180
	or	al,al
4182
	or	al,al
4181
	jnz	invalid_operand_size
4183
	jnz	invalid_operand_size
4182
	cmp	[error_line],0
4184
	cmp	[error_line],0
4183
	jne	fi_mem_32bit
4185
	jne	fi_mem_32bit
4184
	mov	eax,[current_line]
4186
	mov	eax,[current_line]
4185
	mov	[error_line],eax
4187
	mov	[error_line],eax
4186
	mov	[error],operand_size_not_specified
4188
	mov	[error],operand_size_not_specified
4187
      fi_mem_32bit:
4189
      fi_mem_32bit:
4188
	mov	[base_code],0DAh
4190
	mov	[base_code],0DAh
4189
	call	store_instruction
4191
	call	store_instruction
4190
	jmp	instruction_assembled
4192
	jmp	instruction_assembled
4191
      fi_mem_16bit:
4193
      fi_mem_16bit:
4192
	mov	[base_code],0DEh
4194
	mov	[base_code],0DEh
4193
	call	store_instruction
4195
	call	store_instruction
4194
	jmp	instruction_assembled
4196
	jmp	instruction_assembled
4195
fld_instruction:
4197
fld_instruction:
4196
	mov	[postbyte_register],al
4198
	mov	[postbyte_register],al
4197
	lods	byte [esi]
4199
	lods	byte [esi]
4198
	call	get_size_operator
4200
	call	get_size_operator
4199
	cmp	al,10h
4201
	cmp	al,10h
4200
	je	fld_streg
4202
	je	fld_streg
4201
	cmp	al,'['
4203
	cmp	al,'['
4202
	jne	invalid_operand
4204
	jne	invalid_operand
4203
	call	get_address
4205
	call	get_address
4204
	mov	al,[operand_size]
4206
	mov	al,[operand_size]
4205
	cmp	al,4
4207
	cmp	al,4
4206
	je	fld_mem_32bit
4208
	je	fld_mem_32bit
4207
	cmp	al,8
4209
	cmp	al,8
4208
	je	fld_mem_64bit
4210
	je	fld_mem_64bit
4209
	cmp	al,10
4211
	cmp	al,10
4210
	je	fld_mem_80bit
4212
	je	fld_mem_80bit
4211
	or	al,al
4213
	or	al,al
4212
	jnz	invalid_operand_size
4214
	jnz	invalid_operand_size
4213
	cmp	[error_line],0
4215
	cmp	[error_line],0
4214
	jne	fld_mem_32bit
4216
	jne	fld_mem_32bit
4215
	mov	eax,[current_line]
4217
	mov	eax,[current_line]
4216
	mov	[error_line],eax
4218
	mov	[error_line],eax
4217
	mov	[error],operand_size_not_specified
4219
	mov	[error],operand_size_not_specified
4218
      fld_mem_32bit:
4220
      fld_mem_32bit:
4219
	mov	[base_code],0D9h
4221
	mov	[base_code],0D9h
4220
	call	store_instruction
4222
	call	store_instruction
4221
	jmp	instruction_assembled
4223
	jmp	instruction_assembled
4222
      fld_mem_64bit:
4224
      fld_mem_64bit:
4223
	mov	[base_code],0DDh
4225
	mov	[base_code],0DDh
4224
	call	store_instruction
4226
	call	store_instruction
4225
	jmp	instruction_assembled
4227
	jmp	instruction_assembled
4226
      fld_mem_80bit:
4228
      fld_mem_80bit:
4227
	mov	al,[postbyte_register]
4229
	mov	al,[postbyte_register]
4228
	cmp	al,0
4230
	cmp	al,0
4229
	je	fld_mem_80bit_store
4231
	je	fld_mem_80bit_store
4230
	dec	[postbyte_register]
4232
	dec	[postbyte_register]
4231
	cmp	al,3
4233
	cmp	al,3
4232
	je	fld_mem_80bit_store
4234
	je	fld_mem_80bit_store
4233
	jmp	invalid_operand_size
4235
	jmp	invalid_operand_size
4234
      fld_mem_80bit_store:
4236
      fld_mem_80bit_store:
4235
	add	[postbyte_register],5
4237
	add	[postbyte_register],5
4236
	mov	[base_code],0DBh
4238
	mov	[base_code],0DBh
4237
	call	store_instruction
4239
	call	store_instruction
4238
	jmp	instruction_assembled
4240
	jmp	instruction_assembled
4239
      fld_streg:
4241
      fld_streg:
4240
	lods	byte [esi]
4242
	lods	byte [esi]
4241
	call	convert_fpu_register
4243
	call	convert_fpu_register
4242
	mov	bl,al
4244
	mov	bl,al
4243
	cmp	[postbyte_register],2
4245
	cmp	[postbyte_register],2
4244
	jae	fst_streg
4246
	jae	fst_streg
4245
	mov	[base_code],0D9h
4247
	mov	[base_code],0D9h
4246
	call	store_nomem_instruction
4248
	call	store_nomem_instruction
4247
	jmp	instruction_assembled
4249
	jmp	instruction_assembled
4248
      fst_streg:
4250
      fst_streg:
4249
	mov	[base_code],0DDh
4251
	mov	[base_code],0DDh
4250
	call	store_nomem_instruction
4252
	call	store_nomem_instruction
4251
	jmp	instruction_assembled
4253
	jmp	instruction_assembled
4252
fild_instruction:
4254
fild_instruction:
4253
	mov	[postbyte_register],al
4255
	mov	[postbyte_register],al
4254
	lods	byte [esi]
4256
	lods	byte [esi]
4255
	call	get_size_operator
4257
	call	get_size_operator
4256
	cmp	al,'['
4258
	cmp	al,'['
4257
	jne	invalid_operand
4259
	jne	invalid_operand
4258
	call	get_address
4260
	call	get_address
4259
	mov	al,[operand_size]
4261
	mov	al,[operand_size]
4260
	cmp	al,2
4262
	cmp	al,2
4261
	je	fild_mem_16bit
4263
	je	fild_mem_16bit
4262
	cmp	al,4
4264
	cmp	al,4
4263
	je	fild_mem_32bit
4265
	je	fild_mem_32bit
4264
	cmp	al,8
4266
	cmp	al,8
4265
	je	fild_mem_64bit
4267
	je	fild_mem_64bit
4266
	or	al,al
4268
	or	al,al
4267
	jnz	invalid_operand_size
4269
	jnz	invalid_operand_size
4268
	cmp	[error_line],0
4270
	cmp	[error_line],0
4269
	jne	fild_mem_32bit
4271
	jne	fild_mem_32bit
4270
	mov	eax,[current_line]
4272
	mov	eax,[current_line]
4271
	mov	[error_line],eax
4273
	mov	[error_line],eax
4272
	mov	[error],operand_size_not_specified
4274
	mov	[error],operand_size_not_specified
4273
      fild_mem_32bit:
4275
      fild_mem_32bit:
4274
	mov	[base_code],0DBh
4276
	mov	[base_code],0DBh
4275
	call	store_instruction
4277
	call	store_instruction
4276
	jmp	instruction_assembled
4278
	jmp	instruction_assembled
4277
      fild_mem_16bit:
4279
      fild_mem_16bit:
4278
	mov	[base_code],0DFh
4280
	mov	[base_code],0DFh
4279
	call	store_instruction
4281
	call	store_instruction
4280
	jmp	instruction_assembled
4282
	jmp	instruction_assembled
4281
      fild_mem_64bit:
4283
      fild_mem_64bit:
4282
	mov	al,[postbyte_register]
4284
	mov	al,[postbyte_register]
4283
	cmp	al,1
4285
	cmp	al,1
4284
	je	fisttp_64bit_store
4286
	je	fisttp_64bit_store
4285
	jb	fild_mem_64bit_store
4287
	jb	fild_mem_64bit_store
4286
	dec	[postbyte_register]
4288
	dec	[postbyte_register]
4287
	cmp	al,3
4289
	cmp	al,3
4288
	je	fild_mem_64bit_store
4290
	je	fild_mem_64bit_store
4289
	jmp	invalid_operand_size
4291
	jmp	invalid_operand_size
4290
      fild_mem_64bit_store:
4292
      fild_mem_64bit_store:
4291
	add	[postbyte_register],5
4293
	add	[postbyte_register],5
4292
	mov	[base_code],0DFh
4294
	mov	[base_code],0DFh
4293
	call	store_instruction
4295
	call	store_instruction
4294
	jmp	instruction_assembled
4296
	jmp	instruction_assembled
4295
      fisttp_64bit_store:
4297
      fisttp_64bit_store:
4296
	mov	[base_code],0DDh
4298
	mov	[base_code],0DDh
4297
	call	store_instruction
4299
	call	store_instruction
4298
	jmp	instruction_assembled
4300
	jmp	instruction_assembled
4299
fbld_instruction:
4301
fbld_instruction:
4300
	mov	[postbyte_register],al
4302
	mov	[postbyte_register],al
4301
	lods	byte [esi]
4303
	lods	byte [esi]
4302
	call	get_size_operator
4304
	call	get_size_operator
4303
	cmp	al,'['
4305
	cmp	al,'['
4304
	jne	invalid_operand
4306
	jne	invalid_operand
4305
	call	get_address
4307
	call	get_address
4306
	mov	al,[operand_size]
4308
	mov	al,[operand_size]
4307
	or	al,al
4309
	or	al,al
4308
	jz	fbld_mem_80bit
4310
	jz	fbld_mem_80bit
4309
	cmp	al,10
4311
	cmp	al,10
4310
	je	fbld_mem_80bit
4312
	je	fbld_mem_80bit
4311
	jmp	invalid_operand_size
4313
	jmp	invalid_operand_size
4312
      fbld_mem_80bit:
4314
      fbld_mem_80bit:
4313
	mov	[base_code],0DFh
4315
	mov	[base_code],0DFh
4314
	call	store_instruction
4316
	call	store_instruction
4315
	jmp	instruction_assembled
4317
	jmp	instruction_assembled
4316
faddp_instruction:
4318
faddp_instruction:
4317
	mov	[postbyte_register],al
4319
	mov	[postbyte_register],al
4318
	mov	[base_code],0DEh
4320
	mov	[base_code],0DEh
4319
	mov	edx,esi
4321
	mov	edx,esi
4320
	lods	byte [esi]
4322
	lods	byte [esi]
4321
	call	get_size_operator
4323
	call	get_size_operator
4322
	cmp	al,10h
4324
	cmp	al,10h
4323
	je	faddp_streg
4325
	je	faddp_streg
4324
	mov	esi,edx
4326
	mov	esi,edx
4325
	mov	bl,1
4327
	mov	bl,1
4326
	call	store_nomem_instruction
4328
	call	store_nomem_instruction
4327
	jmp	instruction_assembled
4329
	jmp	instruction_assembled
4328
      faddp_streg:
4330
      faddp_streg:
4329
	lods	byte [esi]
4331
	lods	byte [esi]
4330
	call	convert_fpu_register
4332
	call	convert_fpu_register
4331
	mov	bl,al
4333
	mov	bl,al
4332
	lods	byte [esi]
4334
	lods	byte [esi]
4333
	cmp	al,','
4335
	cmp	al,','
4334
	jne	invalid_operand
4336
	jne	invalid_operand
4335
	lods	byte [esi]
4337
	lods	byte [esi]
4336
	call	get_size_operator
4338
	call	get_size_operator
4337
	cmp	al,10h
4339
	cmp	al,10h
4338
	jne	invalid_operand
4340
	jne	invalid_operand
4339
	lods	byte [esi]
4341
	lods	byte [esi]
4340
	call	convert_fpu_register
4342
	call	convert_fpu_register
4341
	or	al,al
4343
	or	al,al
4342
	jnz	invalid_operand
4344
	jnz	invalid_operand
4343
	call	store_nomem_instruction
4345
	call	store_nomem_instruction
4344
	jmp	instruction_assembled
4346
	jmp	instruction_assembled
4345
fcompp_instruction:
4347
fcompp_instruction:
4346
	mov	ax,0D9DEh
4348
	mov	ax,0D9DEh
4347
	stos	word [edi]
4349
	stos	word [edi]
4348
	jmp	instruction_assembled
4350
	jmp	instruction_assembled
4349
fucompp_instruction:
4351
fucompp_instruction:
4350
	mov	ax,0E9DAh
4352
	mov	ax,0E9DAh
4351
	stos	word [edi]
4353
	stos	word [edi]
4352
	jmp	instruction_assembled
4354
	jmp	instruction_assembled
4353
fxch_instruction:
4355
fxch_instruction:
4354
	mov	dx,01D9h
4356
	mov	dx,01D9h
4355
	jmp	fpu_single_operand
4357
	jmp	fpu_single_operand
4356
ffreep_instruction:
4358
ffreep_instruction:
4357
	mov	dx,00DFh
4359
	mov	dx,00DFh
4358
	jmp	fpu_single_operand
4360
	jmp	fpu_single_operand
4359
ffree_instruction:
4361
ffree_instruction:
4360
	mov	dl,0DDh
4362
	mov	dl,0DDh
4361
	mov	dh,al
4363
	mov	dh,al
4362
      fpu_single_operand:
4364
      fpu_single_operand:
4363
	mov	ebx,esi
4365
	mov	ebx,esi
4364
	lods	byte [esi]
4366
	lods	byte [esi]
4365
	call	get_size_operator
4367
	call	get_size_operator
4366
	cmp	al,10h
4368
	cmp	al,10h
4367
	je	fpu_streg
4369
	je	fpu_streg
4368
	or	dh,dh
4370
	or	dh,dh
4369
	jz	invalid_operand
4371
	jz	invalid_operand
4370
	mov	esi,ebx
4372
	mov	esi,ebx
4371
	shl	dh,3
4373
	shl	dh,3
4372
	or	dh,11000001b
4374
	or	dh,11000001b
4373
	mov	ax,dx
4375
	mov	ax,dx
4374
	stos	word [edi]
4376
	stos	word [edi]
4375
	jmp	instruction_assembled
4377
	jmp	instruction_assembled
4376
      fpu_streg:
4378
      fpu_streg:
4377
	lods	byte [esi]
4379
	lods	byte [esi]
4378
	call	convert_fpu_register
4380
	call	convert_fpu_register
4379
	shl	dh,3
4381
	shl	dh,3
4380
	or	dh,al
4382
	or	dh,al
4381
	or	dh,11000000b
4383
	or	dh,11000000b
4382
	mov	ax,dx
4384
	mov	ax,dx
4383
	stos	word [edi]
4385
	stos	word [edi]
4384
	jmp	instruction_assembled
4386
	jmp	instruction_assembled
4385
fstenv_instruction:
4387
fstenv_instruction:
4386
	mov	byte [edi],9Bh
4388
	mov	byte [edi],9Bh
4387
	inc	edi
4389
	inc	edi
4388
fldenv_instruction:
4390
fldenv_instruction:
4389
	mov	[base_code],0D9h
4391
	mov	[base_code],0D9h
4390
	jmp	fpu_mem
4392
	jmp	fpu_mem
4391
fsave_instruction:
4393
fsave_instruction:
4392
	mov	byte [edi],9Bh
4394
	mov	byte [edi],9Bh
4393
	inc	edi
4395
	inc	edi
4394
fnsave_instruction:
4396
fnsave_instruction:
4395
	mov	[base_code],0DDh
4397
	mov	[base_code],0DDh
4396
      fpu_mem:
4398
      fpu_mem:
4397
	mov	[postbyte_register],al
4399
	mov	[postbyte_register],al
4398
	lods	byte [esi]
4400
	lods	byte [esi]
4399
	call	get_size_operator
4401
	call	get_size_operator
4400
	cmp	al,'['
4402
	cmp	al,'['
4401
	jne	invalid_operand
4403
	jne	invalid_operand
4402
	call	get_address
4404
	call	get_address
4403
	cmp	[operand_size],0
4405
	cmp	[operand_size],0
4404
	jne	invalid_operand_size
4406
	jne	invalid_operand_size
4405
	call	store_instruction
4407
	call	store_instruction
4406
	jmp	instruction_assembled
4408
	jmp	instruction_assembled
4407
fstcw_instruction:
4409
fstcw_instruction:
4408
	mov	byte [edi],9Bh
4410
	mov	byte [edi],9Bh
4409
	inc	edi
4411
	inc	edi
4410
fldcw_instruction:
4412
fldcw_instruction:
4411
	mov	[postbyte_register],al
4413
	mov	[postbyte_register],al
4412
	mov	[base_code],0D9h
4414
	mov	[base_code],0D9h
4413
	lods	byte [esi]
4415
	lods	byte [esi]
4414
	call	get_size_operator
4416
	call	get_size_operator
4415
	cmp	al,'['
4417
	cmp	al,'['
4416
	jne	invalid_operand
4418
	jne	invalid_operand
4417
	call	get_address
4419
	call	get_address
4418
	mov	al,[operand_size]
4420
	mov	al,[operand_size]
4419
	or	al,al
4421
	or	al,al
4420
	jz	fldcw_mem_16bit
4422
	jz	fldcw_mem_16bit
4421
	cmp	al,2
4423
	cmp	al,2
4422
	je	fldcw_mem_16bit
4424
	je	fldcw_mem_16bit
4423
	jmp	invalid_operand_size
4425
	jmp	invalid_operand_size
4424
      fldcw_mem_16bit:
4426
      fldcw_mem_16bit:
4425
	call	store_instruction
4427
	call	store_instruction
4426
	jmp	instruction_assembled
4428
	jmp	instruction_assembled
4427
fstsw_instruction:
4429
fstsw_instruction:
4428
	mov	al,9Bh
4430
	mov	al,9Bh
4429
	stos	byte [edi]
4431
	stos	byte [edi]
4430
fnstsw_instruction:
4432
fnstsw_instruction:
4431
	mov	[base_code],0DDh
4433
	mov	[base_code],0DDh
4432
	mov	[postbyte_register],7
4434
	mov	[postbyte_register],7
4433
	lods	byte [esi]
4435
	lods	byte [esi]
4434
	call	get_size_operator
4436
	call	get_size_operator
4435
	cmp	al,10h
4437
	cmp	al,10h
4436
	je	fstsw_reg
4438
	je	fstsw_reg
4437
	cmp	al,'['
4439
	cmp	al,'['
4438
	jne	invalid_operand
4440
	jne	invalid_operand
4439
	call	get_address
4441
	call	get_address
4440
	mov	al,[operand_size]
4442
	mov	al,[operand_size]
4441
	or	al,al
4443
	or	al,al
4442
	jz	fstsw_mem_16bit
4444
	jz	fstsw_mem_16bit
4443
	cmp	al,2
4445
	cmp	al,2
4444
	je	fstsw_mem_16bit
4446
	je	fstsw_mem_16bit
4445
	jmp	invalid_operand_size
4447
	jmp	invalid_operand_size
4446
      fstsw_mem_16bit:
4448
      fstsw_mem_16bit:
4447
	call	store_instruction
4449
	call	store_instruction
4448
	jmp	instruction_assembled
4450
	jmp	instruction_assembled
4449
      fstsw_reg:
4451
      fstsw_reg:
4450
	lods	byte [esi]
4452
	lods	byte [esi]
4451
	call	convert_register
4453
	call	convert_register
4452
	cmp	ax,0200h
4454
	cmp	ax,0200h
4453
	jne	invalid_operand
4455
	jne	invalid_operand
4454
	mov	ax,0E0DFh
4456
	mov	ax,0E0DFh
4455
	stos	word [edi]
4457
	stos	word [edi]
4456
	jmp	instruction_assembled
4458
	jmp	instruction_assembled
4457
finit_instruction:
4459
finit_instruction:
4458
	mov	byte [edi],9Bh
4460
	mov	byte [edi],9Bh
4459
	inc	edi
4461
	inc	edi
4460
fninit_instruction:
4462
fninit_instruction:
4461
	mov	ah,al
4463
	mov	ah,al
4462
	mov	al,0DBh
4464
	mov	al,0DBh
4463
	stos	word [edi]
4465
	stos	word [edi]
4464
	jmp	instruction_assembled
4466
	jmp	instruction_assembled
4465
fcmov_instruction:
4467
fcmov_instruction:
4466
	mov	dh,0DAh
4468
	mov	dh,0DAh
4467
	jmp	fcomi_streg
4469
	jmp	fcomi_streg
4468
fcomi_instruction:
4470
fcomi_instruction:
4469
	mov	dh,0DBh
4471
	mov	dh,0DBh
4470
	jmp	fcomi_streg
4472
	jmp	fcomi_streg
4471
fcomip_instruction:
4473
fcomip_instruction:
4472
	mov	dh,0DFh
4474
	mov	dh,0DFh
4473
      fcomi_streg:
4475
      fcomi_streg:
4474
	mov	dl,al
4476
	mov	dl,al
4475
	lods	byte [esi]
4477
	lods	byte [esi]
4476
	call	get_size_operator
4478
	call	get_size_operator
4477
	cmp	al,10h
4479
	cmp	al,10h
4478
	jne	invalid_operand
4480
	jne	invalid_operand
4479
	lods	byte [esi]
4481
	lods	byte [esi]
4480
	call	convert_fpu_register
4482
	call	convert_fpu_register
4481
	mov	ah,al
4483
	mov	ah,al
4482
	cmp	byte [esi],','
4484
	cmp	byte [esi],','
4483
	je	fcomi_st0_streg
4485
	je	fcomi_st0_streg
4484
	add	ah,dl
4486
	add	ah,dl
4485
	mov	al,dh
4487
	mov	al,dh
4486
	stos	word [edi]
4488
	stos	word [edi]
4487
	jmp	instruction_assembled
4489
	jmp	instruction_assembled
4488
      fcomi_st0_streg:
4490
      fcomi_st0_streg:
4489
	or	ah,ah
4491
	or	ah,ah
4490
	jnz	invalid_operand
4492
	jnz	invalid_operand
4491
	inc	esi
4493
	inc	esi
4492
	lods	byte [esi]
4494
	lods	byte [esi]
4493
	call	get_size_operator
4495
	call	get_size_operator
4494
	cmp	al,10h
4496
	cmp	al,10h
4495
	jne	invalid_operand
4497
	jne	invalid_operand
4496
	lods	byte [esi]
4498
	lods	byte [esi]
4497
	call	convert_fpu_register
4499
	call	convert_fpu_register
4498
	mov	ah,al
4500
	mov	ah,al
4499
	add	ah,dl
4501
	add	ah,dl
4500
	mov	al,dh
4502
	mov	al,dh
4501
	stos	word [edi]
4503
	stos	word [edi]
4502
	jmp	instruction_assembled
4504
	jmp	instruction_assembled
4503
 
4505
 
4504
basic_mmx_instruction:
4506
basic_mmx_instruction:
4505
	mov	[base_code],0Fh
4507
	mov	[base_code],0Fh
4506
	mov	[extended_code],al
4508
	mov	[extended_code],al
4507
      mmx_instruction:
4509
      mmx_instruction:
4508
	lods	byte [esi]
4510
	lods	byte [esi]
4509
	call	get_size_operator
4511
	call	get_size_operator
4510
	cmp	al,10h
4512
	cmp	al,10h
4511
	jne	invalid_operand
4513
	jne	invalid_operand
4512
	lods	byte [esi]
4514
	lods	byte [esi]
4513
	call	convert_mmx_register
4515
	call	convert_mmx_register
4514
	call	make_mmx_prefix
4516
	call	make_mmx_prefix
4515
	mov	[postbyte_register],al
4517
	mov	[postbyte_register],al
4516
	lods	byte [esi]
4518
	lods	byte [esi]
4517
	cmp	al,','
4519
	cmp	al,','
4518
	jne	invalid_operand
4520
	jne	invalid_operand
4519
	lods	byte [esi]
4521
	lods	byte [esi]
4520
	call	get_size_operator
4522
	call	get_size_operator
4521
	cmp	al,10h
4523
	cmp	al,10h
4522
	je	mmx_mmreg_mmreg
4524
	je	mmx_mmreg_mmreg
4523
	cmp	al,'['
4525
	cmp	al,'['
4524
	jne	invalid_operand
4526
	jne	invalid_operand
4525
      mmx_mmreg_mem:
4527
      mmx_mmreg_mem:
4526
	call	get_address
4528
	call	get_address
4527
	call	store_instruction
4529
	call	store_instruction
4528
	jmp	instruction_assembled
4530
	jmp	instruction_assembled
4529
      mmx_mmreg_mmreg:
4531
      mmx_mmreg_mmreg:
4530
	lods	byte [esi]
4532
	lods	byte [esi]
4531
	call	convert_mmx_register
4533
	call	convert_mmx_register
4532
	mov	bl,al
4534
	mov	bl,al
4533
	call	store_nomem_instruction
4535
	call	store_nomem_instruction
4534
	jmp	instruction_assembled
4536
	jmp	instruction_assembled
4535
mmx_ps_instruction:
4537
mmx_ps_instruction:
4536
	mov	[base_code],0Fh
4538
	mov	[base_code],0Fh
4537
	mov	[extended_code],al
4539
	mov	[extended_code],al
4538
	lods	byte [esi]
4540
	lods	byte [esi]
4539
	call	get_size_operator
4541
	call	get_size_operator
4540
	cmp	al,10h
4542
	cmp	al,10h
4541
	jne	invalid_operand
4543
	jne	invalid_operand
4542
	lods	byte [esi]
4544
	lods	byte [esi]
4543
	call	convert_mmx_register
4545
	call	convert_mmx_register
4544
	call	make_mmx_prefix
4546
	call	make_mmx_prefix
4545
	mov	[postbyte_register],al
4547
	mov	[postbyte_register],al
4546
	lods	byte [esi]
4548
	lods	byte [esi]
4547
	cmp	al,','
4549
	cmp	al,','
4548
	jne	invalid_operand
4550
	jne	invalid_operand
4549
	mov	[operand_size],0
4551
	mov	[operand_size],0
4550
	lods	byte [esi]
4552
	lods	byte [esi]
4551
	call	get_size_operator
4553
	call	get_size_operator
4552
	cmp	al,10h
4554
	cmp	al,10h
4553
	je	mmx_mmreg_mmreg
4555
	je	mmx_mmreg_mmreg
4554
	cmp	al,'('
4556
	cmp	al,'('
4555
	je	mmx_ps_mmreg_imm8
4557
	je	mmx_ps_mmreg_imm8
4556
	cmp	al,'['
4558
	cmp	al,'['
4557
	je	mmx_mmreg_mem
4559
	je	mmx_mmreg_mem
4558
	jmp	invalid_operand
4560
	jmp	invalid_operand
4559
      mmx_ps_mmreg_imm8:
4561
      mmx_ps_mmreg_imm8:
4560
	call	get_byte_value
4562
	call	get_byte_value
4561
	mov	byte [value],al
4563
	mov	byte [value],al
4562
	test	[operand_size],not 1
4564
	test	[operand_size],not 1
4563
	jnz	invalid_value
4565
	jnz	invalid_value
4564
	mov	bl,[extended_code]
4566
	mov	bl,[extended_code]
4565
	mov	al,bl
4567
	mov	al,bl
4566
	shr	bl,4
4568
	shr	bl,4
4567
	and	al,1111b
4569
	and	al,1111b
4568
	add	al,70h
4570
	add	al,70h
4569
	mov	[extended_code],al
4571
	mov	[extended_code],al
4570
	sub	bl,0Ch
4572
	sub	bl,0Ch
4571
	shl	bl,1
4573
	shl	bl,1
4572
	xchg	bl,[postbyte_register]
4574
	xchg	bl,[postbyte_register]
4573
	call	store_nomem_instruction
4575
	call	store_nomem_instruction
4574
	mov	al,byte [value]
4576
	mov	al,byte [value]
4575
	stos	byte [edi]
4577
	stos	byte [edi]
4576
	jmp	instruction_assembled
4578
	jmp	instruction_assembled
4577
pextrw_instruction:
4579
pextrw_instruction:
4578
	mov	[base_code],0Fh
4580
	mov	[base_code],0Fh
4579
	mov	[extended_code],al
4581
	mov	[extended_code],al
4580
	lods	byte [esi]
4582
	lods	byte [esi]
4581
	call	get_size_operator
4583
	call	get_size_operator
4582
	cmp	al,10h
4584
	cmp	al,10h
4583
	jne	invalid_operand
4585
	jne	invalid_operand
4584
	lods	byte [esi]
4586
	lods	byte [esi]
4585
	call	convert_register
4587
	call	convert_register
4586
	cmp	ah,4
4588
	cmp	ah,4
4587
	jnz	invalid_operand_size
4589
	jnz	invalid_operand_size
4588
	mov	[postbyte_register],al
4590
	mov	[postbyte_register],al
4589
	mov	[operand_size],0
4591
	mov	[operand_size],0
4590
	lods	byte [esi]
4592
	lods	byte [esi]
4591
	cmp	al,','
4593
	cmp	al,','
4592
	jne	invalid_operand
4594
	jne	invalid_operand
4593
	lods	byte [esi]
4595
	lods	byte [esi]
4594
	call	get_size_operator
4596
	call	get_size_operator
4595
	cmp	al,10h
4597
	cmp	al,10h
4596
	jne	invalid_operand
4598
	jne	invalid_operand
4597
	lods	byte [esi]
4599
	lods	byte [esi]
4598
	call	convert_mmx_register
4600
	call	convert_mmx_register
4599
	mov	bl,al
4601
	mov	bl,al
4600
	call	make_mmx_prefix
4602
	call	make_mmx_prefix
4601
	cmp	[extended_code],0C5h
4603
	cmp	[extended_code],0C5h
4602
	je	mmx_nomem_imm8
4604
	je	mmx_nomem_imm8
4603
	call	store_nomem_instruction
4605
	call	store_nomem_instruction
4604
	jmp	instruction_assembled
4606
	jmp	instruction_assembled
4605
      mmx_imm8:
4607
      mmx_imm8:
4606
	push	ebx ecx edx
4608
	push	ebx ecx edx
4607
	mov	[operand_size],0
4609
	mov	[operand_size],0
4608
	lods	byte [esi]
4610
	lods	byte [esi]
4609
	cmp	al,','
4611
	cmp	al,','
4610
	jne	invalid_operand
4612
	jne	invalid_operand
4611
	lods	byte [esi]
4613
	lods	byte [esi]
4612
	call	get_size_operator
4614
	call	get_size_operator
4613
	test	ah,not 1
4615
	test	ah,not 1
4614
	jnz	invalid_operand_size
4616
	jnz	invalid_operand_size
4615
	cmp	al,'('
4617
	cmp	al,'('
4616
	jne	invalid_operand
4618
	jne	invalid_operand
4617
	call	get_byte_value
4619
	call	get_byte_value
4618
	mov	byte [value],al
4620
	mov	byte [value],al
4619
	pop	edx ecx ebx
4621
	pop	edx ecx ebx
4620
	call	store_instruction_with_imm8
4622
	call	store_instruction_with_imm8
4621
	jmp	instruction_assembled
4623
	jmp	instruction_assembled
4622
      mmx_nomem_imm8:
4624
      mmx_nomem_imm8:
4623
	call	store_nomem_instruction
4625
	call	store_nomem_instruction
4624
	mov	[operand_size],0
4626
	mov	[operand_size],0
4625
	lods	byte [esi]
4627
	lods	byte [esi]
4626
	cmp	al,','
4628
	cmp	al,','
4627
	jne	invalid_operand
4629
	jne	invalid_operand
4628
	lods	byte [esi]
4630
	lods	byte [esi]
4629
	call	get_size_operator
4631
	call	get_size_operator
4630
	test	ah,not 1
4632
	test	ah,not 1
4631
	jnz	invalid_operand_size
4633
	jnz	invalid_operand_size
4632
	cmp	al,'('
4634
	cmp	al,'('
4633
	jne	invalid_operand
4635
	jne	invalid_operand
4634
	call	get_byte_value
4636
	call	get_byte_value
4635
	stosb
4637
	stosb
4636
	jmp	instruction_assembled
4638
	jmp	instruction_assembled
4637
pinsrw_instruction:
4639
pinsrw_instruction:
4638
	mov	[extended_code],al
4640
	mov	[extended_code],al
4639
	mov	[base_code],0Fh
4641
	mov	[base_code],0Fh
4640
	lods	byte [esi]
4642
	lods	byte [esi]
4641
	call	get_size_operator
4643
	call	get_size_operator
4642
	cmp	al,10h
4644
	cmp	al,10h
4643
	jne	invalid_operand
4645
	jne	invalid_operand
4644
	lods	byte [esi]
4646
	lods	byte [esi]
4645
	call	convert_mmx_register
4647
	call	convert_mmx_register
4646
	call	make_mmx_prefix
4648
	call	make_mmx_prefix
4647
	mov	[postbyte_register],al
4649
	mov	[postbyte_register],al
4648
	mov	[operand_size],0
4650
	mov	[operand_size],0
4649
	lods	byte [esi]
4651
	lods	byte [esi]
4650
	cmp	al,','
4652
	cmp	al,','
4651
	jne	invalid_operand
4653
	jne	invalid_operand
4652
	lods	byte [esi]
4654
	lods	byte [esi]
4653
	call	get_size_operator
4655
	call	get_size_operator
4654
	cmp	al,10h
4656
	cmp	al,10h
4655
	je	pinsrw_mmreg_reg
4657
	je	pinsrw_mmreg_reg
4656
	cmp	al,'['
4658
	cmp	al,'['
4657
	jne	invalid_operand
4659
	jne	invalid_operand
4658
	call	get_address
4660
	call	get_address
4659
	cmp	[operand_size],0
4661
	cmp	[operand_size],0
4660
	je	mmx_imm8
4662
	je	mmx_imm8
4661
	cmp	[operand_size],2
4663
	cmp	[operand_size],2
4662
	jne	invalid_operand_size
4664
	jne	invalid_operand_size
4663
	jmp	mmx_imm8
4665
	jmp	mmx_imm8
4664
      pinsrw_mmreg_reg:
4666
      pinsrw_mmreg_reg:
4665
	lods	byte [esi]
4667
	lods	byte [esi]
4666
	call	convert_register
4668
	call	convert_register
4667
	cmp	ah,4
4669
	cmp	ah,4
4668
	jne	invalid_operand_size
4670
	jne	invalid_operand_size
4669
	mov	bl,al
4671
	mov	bl,al
4670
	jmp	mmx_nomem_imm8
4672
	jmp	mmx_nomem_imm8
4671
pshufw_instruction:
4673
pshufw_instruction:
4672
	mov	[mmx_size],8
4674
	mov	[mmx_size],8
4673
	mov	[operand_prefix],al
4675
	mov	[operand_prefix],al
4674
	jmp	pshuf_instruction
4676
	jmp	pshuf_instruction
4675
pshufd_instruction:
4677
pshufd_instruction:
4676
	mov	[mmx_size],16
4678
	mov	[mmx_size],16
4677
	mov	[operand_prefix],al
4679
	mov	[operand_prefix],al
4678
      pshuf_instruction:
4680
      pshuf_instruction:
4679
	mov	[base_code],0Fh
4681
	mov	[base_code],0Fh
4680
	mov	[extended_code],70h
4682
	mov	[extended_code],70h
4681
	lods	byte [esi]
4683
	lods	byte [esi]
4682
	call	get_size_operator
4684
	call	get_size_operator
4683
	cmp	al,10h
4685
	cmp	al,10h
4684
	jne	invalid_operand
4686
	jne	invalid_operand
4685
	lods	byte [esi]
4687
	lods	byte [esi]
4686
	call	convert_mmx_register
4688
	call	convert_mmx_register
4687
	cmp	ah,[mmx_size]
4689
	cmp	ah,[mmx_size]
4688
	jne	invalid_operand_size
4690
	jne	invalid_operand_size
4689
	mov	[postbyte_register],al
4691
	mov	[postbyte_register],al
4690
	lods	byte [esi]
4692
	lods	byte [esi]
4691
	cmp	al,','
4693
	cmp	al,','
4692
	jne	invalid_operand
4694
	jne	invalid_operand
4693
	lods	byte [esi]
4695
	lods	byte [esi]
4694
	call	get_size_operator
4696
	call	get_size_operator
4695
	cmp	al,10h
4697
	cmp	al,10h
4696
	je	pshuf_mmreg_mmreg
4698
	je	pshuf_mmreg_mmreg
4697
	cmp	al,'['
4699
	cmp	al,'['
4698
	jne	invalid_operand
4700
	jne	invalid_operand
4699
	call	get_address
4701
	call	get_address
4700
	jmp	mmx_imm8
4702
	jmp	mmx_imm8
4701
      pshuf_mmreg_mmreg:
4703
      pshuf_mmreg_mmreg:
4702
	lods	byte [esi]
4704
	lods	byte [esi]
4703
	call	convert_mmx_register
4705
	call	convert_mmx_register
4704
	mov	bl,al
4706
	mov	bl,al
4705
	jmp	mmx_nomem_imm8
4707
	jmp	mmx_nomem_imm8
4706
movd_instruction:
4708
movd_instruction:
4707
	mov	[base_code],0Fh
4709
	mov	[base_code],0Fh
4708
	mov	[extended_code],7Eh
4710
	mov	[extended_code],7Eh
4709
	lods	byte [esi]
4711
	lods	byte [esi]
4710
	call	get_size_operator
4712
	call	get_size_operator
4711
	cmp	al,10h
4713
	cmp	al,10h
4712
	je	movd_reg
4714
	je	movd_reg
4713
	cmp	al,'['
4715
	cmp	al,'['
4714
	jne	invalid_operand
4716
	jne	invalid_operand
4715
	call	get_address
4717
	call	get_address
4716
	test	[operand_size],not 4
4718
	test	[operand_size],not 4
4717
	jnz	invalid_operand_size
4719
	jnz	invalid_operand_size
4718
	mov	[operand_size],0
4720
	mov	[operand_size],0
4719
	lods	byte [esi]
4721
	lods	byte [esi]
4720
	cmp	al,','
4722
	cmp	al,','
4721
	jne	invalid_operand
4723
	jne	invalid_operand
4722
	lods	byte [esi]
4724
	lods	byte [esi]
4723
	call	get_size_operator
4725
	call	get_size_operator
4724
	cmp	al,10h
4726
	cmp	al,10h
4725
	jne	invalid_operand
4727
	jne	invalid_operand
4726
	lods	byte [esi]
4728
	lods	byte [esi]
4727
	call	convert_mmx_register
4729
	call	convert_mmx_register
4728
	call	make_mmx_prefix
4730
	call	make_mmx_prefix
4729
	mov	[postbyte_register],al
4731
	mov	[postbyte_register],al
4730
	call	store_instruction
4732
	call	store_instruction
4731
	jmp	instruction_assembled
4733
	jmp	instruction_assembled
4732
      movd_reg:
4734
      movd_reg:
4733
	lods	byte [esi]
4735
	lods	byte [esi]
4734
	cmp	al,0B0h
4736
	cmp	al,0B0h
4735
	jae	movd_mmreg
4737
	jae	movd_mmreg
4736
	call	convert_register
4738
	call	convert_register
4737
	cmp	ah,4
4739
	cmp	ah,4
4738
	jne	invalid_operand_size
4740
	jne	invalid_operand_size
4739
	mov	[operand_size],0
4741
	mov	[operand_size],0
4740
	mov	bl,al
4742
	mov	bl,al
4741
	lods	byte [esi]
4743
	lods	byte [esi]
4742
	cmp	al,','
4744
	cmp	al,','
4743
	jne	invalid_operand
4745
	jne	invalid_operand
4744
	lods	byte [esi]
4746
	lods	byte [esi]
4745
	call	get_size_operator
4747
	call	get_size_operator
4746
	cmp	al,10h
4748
	cmp	al,10h
4747
	jne	invalid_operand
4749
	jne	invalid_operand
4748
	lods	byte [esi]
4750
	lods	byte [esi]
4749
	call	convert_mmx_register
4751
	call	convert_mmx_register
4750
	mov	[postbyte_register],al
4752
	mov	[postbyte_register],al
4751
	call	make_mmx_prefix
4753
	call	make_mmx_prefix
4752
	call	store_nomem_instruction
4754
	call	store_nomem_instruction
4753
	jmp	instruction_assembled
4755
	jmp	instruction_assembled
4754
      movd_mmreg:
4756
      movd_mmreg:
4755
	mov	[extended_code],6Eh
4757
	mov	[extended_code],6Eh
4756
	call	convert_mmx_register
4758
	call	convert_mmx_register
4757
	call	make_mmx_prefix
4759
	call	make_mmx_prefix
4758
	mov	[postbyte_register],al
4760
	mov	[postbyte_register],al
4759
	mov	[operand_size],0
4761
	mov	[operand_size],0
4760
	lods	byte [esi]
4762
	lods	byte [esi]
4761
	cmp	al,','
4763
	cmp	al,','
4762
	jne	invalid_operand
4764
	jne	invalid_operand
4763
	lods	byte [esi]
4765
	lods	byte [esi]
4764
	call	get_size_operator
4766
	call	get_size_operator
4765
	cmp	al,10h
4767
	cmp	al,10h
4766
	je	movd_mmreg_reg
4768
	je	movd_mmreg_reg
4767
	cmp	al,'['
4769
	cmp	al,'['
4768
	jne	invalid_operand
4770
	jne	invalid_operand
4769
	call	get_address
4771
	call	get_address
4770
	test	[operand_size],not 4
4772
	test	[operand_size],not 4
4771
	jnz	invalid_operand_size
4773
	jnz	invalid_operand_size
4772
	call	store_instruction
4774
	call	store_instruction
4773
	jmp	instruction_assembled
4775
	jmp	instruction_assembled
4774
      movd_mmreg_reg:
4776
      movd_mmreg_reg:
4775
	lods	byte [esi]
4777
	lods	byte [esi]
4776
	call	convert_register
4778
	call	convert_register
4777
	cmp	ah,4
4779
	cmp	ah,4
4778
	jne	invalid_operand_size
4780
	jne	invalid_operand_size
4779
	mov	bl,al
4781
	mov	bl,al
4780
	call	store_nomem_instruction
4782
	call	store_nomem_instruction
4781
	jmp	instruction_assembled
4783
	jmp	instruction_assembled
4782
      make_mmx_prefix:
4784
      make_mmx_prefix:
4783
	cmp	[operand_size],16
4785
	cmp	[operand_size],16
4784
	jne	no_mmx_prefix
4786
	jne	no_mmx_prefix
4785
	mov	[operand_prefix],66h
4787
	mov	[operand_prefix],66h
4786
      no_mmx_prefix:
4788
      no_mmx_prefix:
4787
	ret
4789
	ret
4788
movq_instruction:
4790
movq_instruction:
4789
	mov	[base_code],0Fh
4791
	mov	[base_code],0Fh
4790
	lods	byte [esi]
4792
	lods	byte [esi]
4791
	call	get_size_operator
4793
	call	get_size_operator
4792
	cmp	al,10h
4794
	cmp	al,10h
4793
	je	movq_reg
4795
	je	movq_reg
4794
	cmp	al,'['
4796
	cmp	al,'['
4795
	jne	invalid_operand
4797
	jne	invalid_operand
4796
	call	get_address
4798
	call	get_address
4797
	test	[operand_size],not 8
4799
	test	[operand_size],not 8
4798
	jnz	invalid_operand_size
4800
	jnz	invalid_operand_size
4799
	mov	[operand_size],0
4801
	mov	[operand_size],0
4800
	lods	byte [esi]
4802
	lods	byte [esi]
4801
	cmp	al,','
4803
	cmp	al,','
4802
	jne	invalid_operand
4804
	jne	invalid_operand
4803
	lods	byte [esi]
4805
	lods	byte [esi]
4804
	cmp	al,10h
4806
	cmp	al,10h
4805
	jne	invalid_operand
4807
	jne	invalid_operand
4806
	lods	byte [esi]
4808
	lods	byte [esi]
4807
	call	convert_mmx_register
4809
	call	convert_mmx_register
4808
	mov	[postbyte_register],al
4810
	mov	[postbyte_register],al
4809
	cmp	ah,16
4811
	cmp	ah,16
4810
	je	movq_mem_xmmreg
4812
	je	movq_mem_xmmreg
4811
	mov	[extended_code],7Fh
4813
	mov	[extended_code],7Fh
4812
	call	store_instruction
4814
	call	store_instruction
4813
	jmp	instruction_assembled
4815
	jmp	instruction_assembled
4814
     movq_mem_xmmreg:
4816
     movq_mem_xmmreg:
4815
	mov	[extended_code],0D6h
4817
	mov	[extended_code],0D6h
4816
	mov	[operand_prefix],66h
4818
	mov	[operand_prefix],66h
4817
	call	store_instruction
4819
	call	store_instruction
4818
	jmp	instruction_assembled
4820
	jmp	instruction_assembled
4819
     movq_reg:
4821
     movq_reg:
4820
	lods	byte [esi]
4822
	lods	byte [esi]
4821
	cmp	al,0B0h
4823
	cmp	al,0B0h
4822
	jae	movq_mmreg
4824
	jae	movq_mmreg
4823
	call	convert_register
4825
	call	convert_register
4824
	cmp	ah,8
4826
	cmp	ah,8
4825
	jne	invalid_operand_size
4827
	jne	invalid_operand_size
4826
	mov	bl,al
4828
	mov	bl,al
4827
	lods	byte [esi]
4829
	lods	byte [esi]
4828
	cmp	al,','
4830
	cmp	al,','
4829
	jne	invalid_operand
4831
	jne	invalid_operand
4830
	lods	byte [esi]
4832
	lods	byte [esi]
4831
	call	get_size_operator
4833
	call	get_size_operator
4832
	cmp	al,10h
4834
	cmp	al,10h
4833
	jne	invalid_operand
4835
	jne	invalid_operand
4834
	lods	byte [esi]
4836
	lods	byte [esi]
4835
	call	convert_mmx_register
4837
	call	convert_mmx_register
4836
	mov	[postbyte_register],al
4838
	mov	[postbyte_register],al
4837
	call	make_mmx_prefix
4839
	call	make_mmx_prefix
4838
	mov	[extended_code],7Eh
4840
	mov	[extended_code],7Eh
4839
	call	operand_64bit
4841
	call	operand_64bit
4840
	call	store_nomem_instruction
4842
	call	store_nomem_instruction
4841
	jmp	instruction_assembled
4843
	jmp	instruction_assembled
4842
     movq_mmreg:
4844
     movq_mmreg:
4843
	call	convert_mmx_register
4845
	call	convert_mmx_register
4844
	mov	[postbyte_register],al
4846
	mov	[postbyte_register],al
4845
	mov	[extended_code],6Fh
4847
	mov	[extended_code],6Fh
4846
	mov	[mmx_size],ah
4848
	mov	[mmx_size],ah
4847
	cmp	ah,16
4849
	cmp	ah,16
4848
	jne	movq_mmreg_
4850
	jne	movq_mmreg_
4849
	mov	[extended_code],7Eh
4851
	mov	[extended_code],7Eh
4850
	mov	[operand_prefix],0F3h
4852
	mov	[operand_prefix],0F3h
4851
      movq_mmreg_:
4853
      movq_mmreg_:
4852
	lods	byte [esi]
4854
	lods	byte [esi]
4853
	cmp	al,','
4855
	cmp	al,','
4854
	jne	invalid_operand
4856
	jne	invalid_operand
4855
	mov	[operand_size],0
4857
	mov	[operand_size],0
4856
	lods	byte [esi]
4858
	lods	byte [esi]
4857
	call	get_size_operator
4859
	call	get_size_operator
4858
	cmp	al,10h
4860
	cmp	al,10h
4859
	je	movq_mmreg_reg
4861
	je	movq_mmreg_reg
4860
	call	get_address
4862
	call	get_address
4861
	test	[operand_size],not 8
4863
	test	[operand_size],not 8
4862
	jnz	invalid_operand_size
4864
	jnz	invalid_operand_size
4863
	call	store_instruction
4865
	call	store_instruction
4864
	jmp	instruction_assembled
4866
	jmp	instruction_assembled
4865
      movq_mmreg_reg:
4867
      movq_mmreg_reg:
4866
	lods	byte [esi]
4868
	lods	byte [esi]
4867
	cmp	al,0B0h
4869
	cmp	al,0B0h
4868
	jae	movq_mmreg_mmreg
4870
	jae	movq_mmreg_mmreg
4869
	mov	[operand_size],0
4871
	mov	[operand_size],0
4870
	call	convert_register
4872
	call	convert_register
4871
	cmp	ah,8
4873
	cmp	ah,8
4872
	jne	invalid_operand_size
4874
	jne	invalid_operand_size
4873
	mov	[extended_code],6Eh
4875
	mov	[extended_code],6Eh
4874
	mov	[operand_prefix],0
4876
	mov	[operand_prefix],0
4875
	mov	bl,al
4877
	mov	bl,al
4876
	cmp	[mmx_size],16
4878
	cmp	[mmx_size],16
4877
	jne	movq_mmreg_reg_store
4879
	jne	movq_mmreg_reg_store
4878
	mov	[operand_prefix],66h
4880
	mov	[operand_prefix],66h
4879
      movq_mmreg_reg_store:
4881
      movq_mmreg_reg_store:
4880
	call	operand_64bit
4882
	call	operand_64bit
4881
	call	store_nomem_instruction
4883
	call	store_nomem_instruction
4882
	jmp	instruction_assembled
4884
	jmp	instruction_assembled
4883
      movq_mmreg_mmreg:
4885
      movq_mmreg_mmreg:
4884
	call	convert_mmx_register
4886
	call	convert_mmx_register
4885
	mov	bl,al
4887
	mov	bl,al
4886
	call	store_nomem_instruction
4888
	call	store_nomem_instruction
4887
	jmp	instruction_assembled
4889
	jmp	instruction_assembled
4888
movdq_instruction:
4890
movdq_instruction:
4889
	mov	[operand_prefix],al
4891
	mov	[operand_prefix],al
4890
	mov	[base_code],0Fh
4892
	mov	[base_code],0Fh
4891
	mov	[extended_code],6Fh
4893
	mov	[extended_code],6Fh
4892
	lods	byte [esi]
4894
	lods	byte [esi]
4893
	call	get_size_operator
4895
	call	get_size_operator
4894
	cmp	al,10h
4896
	cmp	al,10h
4895
	je	movdq_mmreg
4897
	je	movdq_mmreg
4896
	cmp	al,'['
4898
	cmp	al,'['
4897
	jne	invalid_operand
4899
	jne	invalid_operand
4898
	call	get_address
4900
	call	get_address
4899
	lods	byte [esi]
4901
	lods	byte [esi]
4900
	cmp	al,','
4902
	cmp	al,','
4901
	jne	invalid_operand
4903
	jne	invalid_operand
4902
	lods	byte [esi]
4904
	lods	byte [esi]
4903
	call	get_size_operator
4905
	call	get_size_operator
4904
	cmp	al,10h
4906
	cmp	al,10h
4905
	jne	invalid_operand
4907
	jne	invalid_operand
4906
	lods	byte [esi]
4908
	lods	byte [esi]
4907
	call	convert_mmx_register
4909
	call	convert_mmx_register
4908
	cmp	ah,16
4910
	cmp	ah,16
4909
	jne	invalid_operand_size
4911
	jne	invalid_operand_size
4910
	mov	[postbyte_register],al
4912
	mov	[postbyte_register],al
4911
	mov	[extended_code],7Fh
4913
	mov	[extended_code],7Fh
4912
	call	store_instruction
4914
	call	store_instruction
4913
	jmp	instruction_assembled
4915
	jmp	instruction_assembled
4914
      movdq_mmreg:
4916
      movdq_mmreg:
4915
	lods	byte [esi]
4917
	lods	byte [esi]
4916
	call	convert_mmx_register
4918
	call	convert_mmx_register
4917
	cmp	ah,16
4919
	cmp	ah,16
4918
	jne	invalid_operand_size
4920
	jne	invalid_operand_size
4919
	mov	[postbyte_register],al
4921
	mov	[postbyte_register],al
4920
	lods	byte [esi]
4922
	lods	byte [esi]
4921
	cmp	al,','
4923
	cmp	al,','
4922
	jne	invalid_operand
4924
	jne	invalid_operand
4923
	lods	byte [esi]
4925
	lods	byte [esi]
4924
	call	get_size_operator
4926
	call	get_size_operator
4925
	cmp	al,10h
4927
	cmp	al,10h
4926
	je	movdq_mmreg_mmreg
4928
	je	movdq_mmreg_mmreg
4927
	cmp	al,'['
4929
	cmp	al,'['
4928
	jne	invalid_operand
4930
	jne	invalid_operand
4929
	call	get_address
4931
	call	get_address
4930
	call	store_instruction
4932
	call	store_instruction
4931
	jmp	instruction_assembled
4933
	jmp	instruction_assembled
4932
      movdq_mmreg_mmreg:
4934
      movdq_mmreg_mmreg:
4933
	lods	byte [esi]
4935
	lods	byte [esi]
4934
	call	convert_mmx_register
4936
	call	convert_mmx_register
4935
	cmp	ah,16
4937
	cmp	ah,16
4936
	jne	invalid_operand_size
4938
	jne	invalid_operand_size
4937
	mov	bl,al
4939
	mov	bl,al
4938
	call	store_nomem_instruction
4940
	call	store_nomem_instruction
4939
	jmp	instruction_assembled
4941
	jmp	instruction_assembled
4940
lddqu_instruction:
4942
lddqu_instruction:
4941
	lods	byte [esi]
4943
	lods	byte [esi]
4942
	call	get_size_operator
4944
	call	get_size_operator
4943
	cmp	al,10h
4945
	cmp	al,10h
4944
	jne	invalid_operand
4946
	jne	invalid_operand
4945
	lods	byte [esi]
4947
	lods	byte [esi]
4946
	call	convert_mmx_register
4948
	call	convert_mmx_register
4947
	cmp	ah,16
4949
	cmp	ah,16
4948
	jne	invalid_operand_size
4950
	jne	invalid_operand_size
4949
	push	eax
4951
	push	eax
4950
	lods	byte [esi]
4952
	lods	byte [esi]
4951
	cmp	al,','
4953
	cmp	al,','
4952
	jne	invalid_operand
4954
	jne	invalid_operand
4953
	lods	byte [esi]
4955
	lods	byte [esi]
4954
	call	get_size_operator
4956
	call	get_size_operator
4955
	cmp	al,'['
4957
	cmp	al,'['
4956
	jne	invalid_operand
4958
	jne	invalid_operand
4957
	call	get_address
4959
	call	get_address
4958
	pop	eax
4960
	pop	eax
4959
	mov	[postbyte_register],al
4961
	mov	[postbyte_register],al
4960
	mov	[operand_prefix],0F2h
4962
	mov	[operand_prefix],0F2h
4961
	mov	[base_code],0Fh
4963
	mov	[base_code],0Fh
4962
	mov	[extended_code],0F0h
4964
	mov	[extended_code],0F0h
4963
	call	store_instruction
4965
	call	store_instruction
4964
	jmp	instruction_assembled
4966
	jmp	instruction_assembled
4965
movq2dq_instruction:
4967
movq2dq_instruction:
4966
	lods	byte [esi]
4968
	lods	byte [esi]
4967
	call	get_size_operator
4969
	call	get_size_operator
4968
	cmp	al,10h
4970
	cmp	al,10h
4969
	jne	invalid_operand
4971
	jne	invalid_operand
4970
	lods	byte [esi]
4972
	lods	byte [esi]
4971
	call	convert_mmx_register
4973
	call	convert_mmx_register
4972
	cmp	ah,16
4974
	cmp	ah,16
4973
	jne	invalid_operand_size
4975
	jne	invalid_operand_size
4974
	mov	[postbyte_register],al
4976
	mov	[postbyte_register],al
4975
	mov	[operand_size],0
4977
	mov	[operand_size],0
4976
	lods	byte [esi]
4978
	lods	byte [esi]
4977
	cmp	al,','
4979
	cmp	al,','
4978
	jne	invalid_operand
4980
	jne	invalid_operand
4979
	lods	byte [esi]
4981
	lods	byte [esi]
4980
	call	get_size_operator
4982
	call	get_size_operator
4981
	cmp	al,10h
4983
	cmp	al,10h
4982
	jne	invalid_operand
4984
	jne	invalid_operand
4983
	lods	byte [esi]
4985
	lods	byte [esi]
4984
	call	convert_mmx_register
4986
	call	convert_mmx_register
4985
	cmp	ah,8
4987
	cmp	ah,8
4986
	jne	invalid_operand_size
4988
	jne	invalid_operand_size
4987
	mov	bl,al
4989
	mov	bl,al
4988
	mov	[operand_prefix],0F3h
4990
	mov	[operand_prefix],0F3h
4989
	mov	[base_code],0Fh
4991
	mov	[base_code],0Fh
4990
	mov	[extended_code],0D6h
4992
	mov	[extended_code],0D6h
4991
	call	store_nomem_instruction
4993
	call	store_nomem_instruction
4992
	jmp	instruction_assembled
4994
	jmp	instruction_assembled
4993
movdq2q_instruction:
4995
movdq2q_instruction:
4994
	lods	byte [esi]
4996
	lods	byte [esi]
4995
	call	get_size_operator
4997
	call	get_size_operator
4996
	cmp	al,10h
4998
	cmp	al,10h
4997
	jne	invalid_operand
4999
	jne	invalid_operand
4998
	lods	byte [esi]
5000
	lods	byte [esi]
4999
	call	convert_mmx_register
5001
	call	convert_mmx_register
5000
	cmp	ah,8
5002
	cmp	ah,8
5001
	jne	invalid_operand_size
5003
	jne	invalid_operand_size
5002
	mov	[postbyte_register],al
5004
	mov	[postbyte_register],al
5003
	mov	[operand_size],0
5005
	mov	[operand_size],0
5004
	lods	byte [esi]
5006
	lods	byte [esi]
5005
	cmp	al,','
5007
	cmp	al,','
5006
	jne	invalid_operand
5008
	jne	invalid_operand
5007
	lods	byte [esi]
5009
	lods	byte [esi]
5008
	call	get_size_operator
5010
	call	get_size_operator
5009
	cmp	al,10h
5011
	cmp	al,10h
5010
	jne	invalid_operand
5012
	jne	invalid_operand
5011
	lods	byte [esi]
5013
	lods	byte [esi]
5012
	call	convert_mmx_register
5014
	call	convert_mmx_register
5013
	cmp	ah,16
5015
	cmp	ah,16
5014
	jne	invalid_operand_size
5016
	jne	invalid_operand_size
5015
	mov	bl,al
5017
	mov	bl,al
5016
	mov	[operand_prefix],0F2h
5018
	mov	[operand_prefix],0F2h
5017
	mov	[base_code],0Fh
5019
	mov	[base_code],0Fh
5018
	mov	[extended_code],0D6h
5020
	mov	[extended_code],0D6h
5019
	call	store_nomem_instruction
5021
	call	store_nomem_instruction
5020
	jmp	instruction_assembled
5022
	jmp	instruction_assembled
5021
 
5023
 
5022
sse_ps_instruction:
5024
sse_ps_instruction:
5023
	mov	[mmx_size],16
5025
	mov	[mmx_size],16
5024
	jmp	sse_instruction
5026
	jmp	sse_instruction
5025
sse_pd_instruction:
5027
sse_pd_instruction:
5026
	mov	[mmx_size],16
5028
	mov	[mmx_size],16
5027
	mov	[operand_prefix],66h
5029
	mov	[operand_prefix],66h
5028
	jmp	sse_instruction
5030
	jmp	sse_instruction
5029
sse_ss_instruction:
5031
sse_ss_instruction:
5030
	mov	[mmx_size],4
5032
	mov	[mmx_size],4
5031
	mov	[operand_prefix],0F3h
5033
	mov	[operand_prefix],0F3h
5032
	jmp	sse_instruction
5034
	jmp	sse_instruction
5033
sse_sd_instruction:
5035
sse_sd_instruction:
5034
	mov	[mmx_size],8
5036
	mov	[mmx_size],8
5035
	mov	[operand_prefix],0F2h
5037
	mov	[operand_prefix],0F2h
5036
	jmp	sse_instruction
5038
	jmp	sse_instruction
5037
comiss_instruction:
5039
comiss_instruction:
5038
	mov	[mmx_size],4
5040
	mov	[mmx_size],4
5039
	jmp	sse_instruction
5041
	jmp	sse_instruction
5040
comisd_instruction:
5042
comisd_instruction:
5041
	mov	[mmx_size],8
5043
	mov	[mmx_size],8
5042
	mov	[operand_prefix],66h
5044
	mov	[operand_prefix],66h
5043
	jmp	sse_instruction
5045
	jmp	sse_instruction
5044
cvtps2pd_instruction:
5046
cvtps2pd_instruction:
5045
	mov	[mmx_size],8
5047
	mov	[mmx_size],8
5046
	jmp	sse_instruction
5048
	jmp	sse_instruction
5047
cvtpd2dq_instruction:
5049
cvtpd2dq_instruction:
5048
	mov	[mmx_size],16
5050
	mov	[mmx_size],16
5049
	mov	[operand_prefix],0F2h
5051
	mov	[operand_prefix],0F2h
5050
	jmp	sse_instruction
5052
	jmp	sse_instruction
5051
cvtdq2pd_instruction:
5053
cvtdq2pd_instruction:
5052
	mov	[mmx_size],16
5054
	mov	[mmx_size],16
5053
	mov	[operand_prefix],0F3h
5055
	mov	[operand_prefix],0F3h
5054
sse_instruction:
5056
sse_instruction:
5055
	mov	[base_code],0Fh
5057
	mov	[base_code],0Fh
5056
	mov	[extended_code],al
5058
	mov	[extended_code],al
5057
	lods	byte [esi]
5059
	lods	byte [esi]
5058
	call	get_size_operator
5060
	call	get_size_operator
5059
	cmp	al,10h
5061
	cmp	al,10h
5060
	jne	invalid_operand
5062
	jne	invalid_operand
5061
      sse_xmmreg:
5063
      sse_xmmreg:
5062
	lods	byte [esi]
5064
	lods	byte [esi]
5063
	call	convert_mmx_register
5065
	call	convert_mmx_register
5064
	cmp	ah,16
5066
	cmp	ah,16
5065
	jne	invalid_operand_size
5067
	jne	invalid_operand_size
5066
      sse_reg:
5068
      sse_reg:
5067
	mov	[postbyte_register],al
5069
	mov	[postbyte_register],al
5068
	mov	[operand_size],0
5070
	mov	[operand_size],0
5069
	lods	byte [esi]
5071
	lods	byte [esi]
5070
	cmp	al,','
5072
	cmp	al,','
5071
	jne	invalid_operand
5073
	jne	invalid_operand
5072
	lods	byte [esi]
5074
	lods	byte [esi]
5073
	call	get_size_operator
5075
	call	get_size_operator
5074
	cmp	al,10h
5076
	cmp	al,10h
5075
	je	sse_xmmreg_xmmreg
5077
	je	sse_xmmreg_xmmreg
5076
      sse_reg_mem:
5078
      sse_reg_mem:
5077
	cmp	al,'['
5079
	cmp	al,'['
5078
	jne	invalid_operand
5080
	jne	invalid_operand
5079
	call	get_address
5081
	call	get_address
5080
	cmp	[operand_size],0
5082
	cmp	[operand_size],0
5081
	je	sse_mem_size_ok
5083
	je	sse_mem_size_ok
5082
	mov	al,[mmx_size]
5084
	mov	al,[mmx_size]
5083
	cmp	[operand_size],al
5085
	cmp	[operand_size],al
5084
	jne	invalid_operand_size
5086
	jne	invalid_operand_size
5085
      sse_mem_size_ok:
5087
      sse_mem_size_ok:
5086
	cmp	[extended_code],0C6h
5088
	cmp	[extended_code],0C6h
5087
	je	mmx_imm8
5089
	je	mmx_imm8
5088
	call	store_instruction
5090
	call	store_instruction
5089
	jmp	instruction_assembled
5091
	jmp	instruction_assembled
5090
      sse_xmmreg_xmmreg:
5092
      sse_xmmreg_xmmreg:
5091
	cmp	[operand_prefix],66h
5093
	cmp	[operand_prefix],66h
5092
	jne	sse_xmmreg_xmmreg_ok
5094
	jne	sse_xmmreg_xmmreg_ok
5093
	cmp	[extended_code],12h
5095
	cmp	[extended_code],12h
5094
	je	invalid_operand
5096
	je	invalid_operand
5095
	cmp	[extended_code],16h
5097
	cmp	[extended_code],16h
5096
	je	invalid_operand
5098
	je	invalid_operand
5097
      sse_xmmreg_xmmreg_ok:
5099
      sse_xmmreg_xmmreg_ok:
5098
	lods	byte [esi]
5100
	lods	byte [esi]
5099
	call	convert_mmx_register
5101
	call	convert_mmx_register
5100
	cmp	ah,16
5102
	cmp	ah,16
5101
	jne	invalid_operand_size
5103
	jne	invalid_operand_size
5102
	mov	bl,al
5104
	mov	bl,al
5103
	cmp	[extended_code],0C6h
5105
	cmp	[extended_code],0C6h
5104
	je	mmx_nomem_imm8
5106
	je	mmx_nomem_imm8
5105
	call	store_nomem_instruction
5107
	call	store_nomem_instruction
5106
	jmp	instruction_assembled
5108
	jmp	instruction_assembled
5107
ps_dq_instruction:
5109
ps_dq_instruction:
5108
	mov	[postbyte_register],al
5110
	mov	[postbyte_register],al
5109
	mov	[operand_prefix],66h
5111
	mov	[operand_prefix],66h
5110
	mov	[base_code],0Fh
5112
	mov	[base_code],0Fh
5111
	mov	[extended_code],73h
5113
	mov	[extended_code],73h
5112
	lods	byte [esi]
5114
	lods	byte [esi]
5113
	call	get_size_operator
5115
	call	get_size_operator
5114
	cmp	al,10h
5116
	cmp	al,10h
5115
	jne	invalid_operand
5117
	jne	invalid_operand
5116
	lods	byte [esi]
5118
	lods	byte [esi]
5117
	call	convert_mmx_register
5119
	call	convert_mmx_register
5118
	cmp	ah,16
5120
	cmp	ah,16
5119
	jne	invalid_operand_size
5121
	jne	invalid_operand_size
5120
	mov	bl,al
5122
	mov	bl,al
5121
	jmp	mmx_nomem_imm8
5123
	jmp	mmx_nomem_imm8
5122
movpd_instruction:
5124
movpd_instruction:
5123
	mov	[operand_prefix],66h
5125
	mov	[operand_prefix],66h
5124
movps_instruction:
5126
movps_instruction:
5125
	mov	[base_code],0Fh
5127
	mov	[base_code],0Fh
5126
	mov	[extended_code],al
5128
	mov	[extended_code],al
5127
	mov	[mmx_size],16
5129
	mov	[mmx_size],16
5128
	jmp	sse_mov_instruction
5130
	jmp	sse_mov_instruction
5129
movss_instruction:
5131
movss_instruction:
5130
	mov	[mmx_size],4
5132
	mov	[mmx_size],4
5131
	mov	[operand_prefix],0F3h
5133
	mov	[operand_prefix],0F3h
5132
	jmp	sse_movs
5134
	jmp	sse_movs
5133
movsd_instruction:
5135
movsd_instruction:
5134
	mov	al,0A5h
5136
	mov	al,0A5h
5135
	mov	ah,[esi]
5137
	mov	ah,[esi]
5136
	or	ah,ah
5138
	or	ah,ah
5137
	jz	simple_instruction_32bit
5139
	jz	simple_instruction_32bit
5138
	cmp	ah,0Fh
5140
	cmp	ah,0Fh
5139
	je	simple_instruction_32bit
5141
	je	simple_instruction_32bit
5140
	mov	[mmx_size],8
5142
	mov	[mmx_size],8
5141
	mov	[operand_prefix],0F2h
5143
	mov	[operand_prefix],0F2h
5142
      sse_movs:
5144
      sse_movs:
5143
	mov	[base_code],0Fh
5145
	mov	[base_code],0Fh
5144
	mov	[extended_code],10h
5146
	mov	[extended_code],10h
5145
	jmp	sse_mov_instruction
5147
	jmp	sse_mov_instruction
5146
sse_mov_instruction:
5148
sse_mov_instruction:
5147
	lods	byte [esi]
5149
	lods	byte [esi]
5148
	call	get_size_operator
5150
	call	get_size_operator
5149
	cmp	al,10h
5151
	cmp	al,10h
5150
	je	sse_xmmreg
5152
	je	sse_xmmreg
5151
      sse_mem:
5153
      sse_mem:
5152
	cmp	al,'['
5154
	cmp	al,'['
5153
	jne	invalid_operand
5155
	jne	invalid_operand
5154
	inc	[extended_code]
5156
	inc	[extended_code]
5155
	call	get_address
5157
	call	get_address
5156
	cmp	[operand_size],0
5158
	cmp	[operand_size],0
5157
	je	sse_mem_xmmreg
5159
	je	sse_mem_xmmreg
5158
	mov	al,[mmx_size]
5160
	mov	al,[mmx_size]
5159
	cmp	[operand_size],al
5161
	cmp	[operand_size],al
5160
	jne	invalid_operand_size
5162
	jne	invalid_operand_size
5161
	mov	[operand_size],0
5163
	mov	[operand_size],0
5162
      sse_mem_xmmreg:
5164
      sse_mem_xmmreg:
5163
	lods	byte [esi]
5165
	lods	byte [esi]
5164
	cmp	al,','
5166
	cmp	al,','
5165
	jne	invalid_operand
5167
	jne	invalid_operand
5166
	lods	byte [esi]
5168
	lods	byte [esi]
5167
	call	get_size_operator
5169
	call	get_size_operator
5168
	cmp	al,10h
5170
	cmp	al,10h
5169
	jne	invalid_operand
5171
	jne	invalid_operand
5170
	lods	byte [esi]
5172
	lods	byte [esi]
5171
	call	convert_mmx_register
5173
	call	convert_mmx_register
5172
	cmp	ah,16
5174
	cmp	ah,16
5173
	jne	invalid_operand_size
5175
	jne	invalid_operand_size
5174
	mov	[postbyte_register],al
5176
	mov	[postbyte_register],al
5175
	call	store_instruction
5177
	call	store_instruction
5176
	jmp	instruction_assembled
5178
	jmp	instruction_assembled
5177
movlpd_instruction:
5179
movlpd_instruction:
5178
	mov	[operand_prefix],66h
5180
	mov	[operand_prefix],66h
5179
movlps_instruction:
5181
movlps_instruction:
5180
	mov	[base_code],0Fh
5182
	mov	[base_code],0Fh
5181
	mov	[extended_code],al
5183
	mov	[extended_code],al
5182
	mov	[mmx_size],8
5184
	mov	[mmx_size],8
5183
	lods	byte [esi]
5185
	lods	byte [esi]
5184
	call	get_size_operator
5186
	call	get_size_operator
5185
	cmp	al,10h
5187
	cmp	al,10h
5186
	jne	sse_mem
5188
	jne	sse_mem
5187
	lods	byte [esi]
5189
	lods	byte [esi]
5188
	call	convert_mmx_register
5190
	call	convert_mmx_register
5189
	cmp	ah,16
5191
	cmp	ah,16
5190
	jne	invalid_operand_size
5192
	jne	invalid_operand_size
5191
	mov	[postbyte_register],al
5193
	mov	[postbyte_register],al
5192
	mov	[operand_size],0
5194
	mov	[operand_size],0
5193
	lods	byte [esi]
5195
	lods	byte [esi]
5194
	cmp	al,','
5196
	cmp	al,','
5195
	jne	invalid_operand
5197
	jne	invalid_operand
5196
	lods	byte [esi]
5198
	lods	byte [esi]
5197
	call	get_size_operator
5199
	call	get_size_operator
5198
	jmp	sse_reg_mem
5200
	jmp	sse_reg_mem
5199
movhlps_instruction:
5201
movhlps_instruction:
5200
	mov	[base_code],0Fh
5202
	mov	[base_code],0Fh
5201
	mov	[extended_code],al
5203
	mov	[extended_code],al
5202
	mov	[mmx_size],0
5204
	mov	[mmx_size],0
5203
	lods	byte [esi]
5205
	lods	byte [esi]
5204
	call	get_size_operator
5206
	call	get_size_operator
5205
	cmp	al,10h
5207
	cmp	al,10h
5206
	jne	invalid_operand
5208
	jne	invalid_operand
5207
	lods	byte [esi]
5209
	lods	byte [esi]
5208
	call	convert_mmx_register
5210
	call	convert_mmx_register
5209
	cmp	ah,16
5211
	cmp	ah,16
5210
	jne	invalid_operand_size
5212
	jne	invalid_operand_size
5211
	mov	[postbyte_register],al
5213
	mov	[postbyte_register],al
5212
	lods	byte [esi]
5214
	lods	byte [esi]
5213
	cmp	al,','
5215
	cmp	al,','
5214
	jne	invalid_operand
5216
	jne	invalid_operand
5215
	lods	byte [esi]
5217
	lods	byte [esi]
5216
	call	get_size_operator
5218
	call	get_size_operator
5217
	cmp	al,10h
5219
	cmp	al,10h
5218
	je	sse_xmmreg_xmmreg_ok
5220
	je	sse_xmmreg_xmmreg_ok
5219
	jmp	invalid_operand
5221
	jmp	invalid_operand
5220
maskmovq_instruction:
5222
maskmovq_instruction:
5221
	mov	cl,8
5223
	mov	cl,8
5222
	jmp	maskmov_instruction
5224
	jmp	maskmov_instruction
5223
maskmovdqu_instruction:
5225
maskmovdqu_instruction:
5224
	mov	cl,16
5226
	mov	cl,16
5225
	mov	[operand_prefix],66h
5227
	mov	[operand_prefix],66h
5226
      maskmov_instruction:
5228
      maskmov_instruction:
5227
	mov	[base_code],0Fh
5229
	mov	[base_code],0Fh
5228
	mov	[extended_code],0F7h
5230
	mov	[extended_code],0F7h
5229
	lods	byte [esi]
5231
	lods	byte [esi]
5230
	call	get_size_operator
5232
	call	get_size_operator
5231
	cmp	al,10h
5233
	cmp	al,10h
5232
	jne	invalid_operand
5234
	jne	invalid_operand
5233
	lods	byte [esi]
5235
	lods	byte [esi]
5234
	call	convert_mmx_register
5236
	call	convert_mmx_register
5235
	cmp	ah,cl
5237
	cmp	ah,cl
5236
	jne	invalid_operand_size
5238
	jne	invalid_operand_size
5237
	mov	[postbyte_register],al
5239
	mov	[postbyte_register],al
5238
	lods	byte [esi]
5240
	lods	byte [esi]
5239
	cmp	al,','
5241
	cmp	al,','
5240
	jne	invalid_operand
5242
	jne	invalid_operand
5241
	lods	byte [esi]
5243
	lods	byte [esi]
5242
	call	get_size_operator
5244
	call	get_size_operator
5243
	cmp	al,10h
5245
	cmp	al,10h
5244
	jne	invalid_operand
5246
	jne	invalid_operand
5245
	lods	byte [esi]
5247
	lods	byte [esi]
5246
	call	convert_mmx_register
5248
	call	convert_mmx_register
5247
	mov	bl,al
5249
	mov	bl,al
5248
	call	store_nomem_instruction
5250
	call	store_nomem_instruction
5249
	jmp	instruction_assembled
5251
	jmp	instruction_assembled
5250
movmskpd_instruction:
5252
movmskpd_instruction:
5251
	mov	[operand_prefix],66h
5253
	mov	[operand_prefix],66h
5252
movmskps_instruction:
5254
movmskps_instruction:
5253
	mov	[base_code],0Fh
5255
	mov	[base_code],0Fh
5254
	mov	[extended_code],50h
5256
	mov	[extended_code],50h
5255
	lods	byte [esi]
5257
	lods	byte [esi]
5256
	call	get_size_operator
5258
	call	get_size_operator
5257
	cmp	al,10h
5259
	cmp	al,10h
5258
	jne	invalid_operand
5260
	jne	invalid_operand
5259
	lods	byte [esi]
5261
	lods	byte [esi]
5260
	call	convert_register
5262
	call	convert_register
5261
	cmp	ah,4
5263
	cmp	ah,4
5262
	jne	invalid_operand_size
5264
	jne	invalid_operand_size
5263
	mov	[operand_size],0
5265
	mov	[operand_size],0
5264
	mov	[postbyte_register],al
5266
	mov	[postbyte_register],al
5265
	lods	byte [esi]
5267
	lods	byte [esi]
5266
	cmp	al,','
5268
	cmp	al,','
5267
	jne	invalid_operand
5269
	jne	invalid_operand
5268
	lods	byte [esi]
5270
	lods	byte [esi]
5269
	call	get_size_operator
5271
	call	get_size_operator
5270
	cmp	al,10h
5272
	cmp	al,10h
5271
	jne	invalid_operand
5273
	jne	invalid_operand
5272
	lods	byte [esi]
5274
	lods	byte [esi]
5273
	call	convert_mmx_register
5275
	call	convert_mmx_register
5274
	cmp	ah,16
5276
	cmp	ah,16
5275
	jne	invalid_operand_size
5277
	jne	invalid_operand_size
5276
	mov	bl,al
5278
	mov	bl,al
5277
	call	store_nomem_instruction
5279
	call	store_nomem_instruction
5278
	jmp	instruction_assembled
5280
	jmp	instruction_assembled
5279
cmppd_instruction:
5281
cmppd_instruction:
5280
	mov	[operand_prefix],66h
5282
	mov	[operand_prefix],66h
5281
cmpps_instruction:
5283
cmpps_instruction:
5282
	mov	[base_code],0Fh
5284
	mov	[base_code],0Fh
5283
	mov	[extended_code],0C2h
5285
	mov	[extended_code],0C2h
5284
	mov	[mmx_size],16
5286
	mov	[mmx_size],16
5285
	mov	byte [value],-1
5287
	mov	byte [value],-1
5286
	jmp	sse_cmp_instruction
5288
	jmp	sse_cmp_instruction
5287
cmp_pd_instruction:
5289
cmp_pd_instruction:
5288
	mov	[operand_prefix],66h
5290
	mov	[operand_prefix],66h
5289
cmp_ps_instruction:
5291
cmp_ps_instruction:
5290
	mov	[base_code],0Fh
5292
	mov	[base_code],0Fh
5291
	mov	[extended_code],0C2h
5293
	mov	[extended_code],0C2h
5292
	mov	[mmx_size],16
5294
	mov	[mmx_size],16
5293
	mov	byte [value],al
5295
	mov	byte [value],al
5294
	jmp	sse_cmp_instruction
5296
	jmp	sse_cmp_instruction
5295
cmpss_instruction:
5297
cmpss_instruction:
5296
	mov	[mmx_size],4
5298
	mov	[mmx_size],4
5297
	mov	[operand_prefix],0F3h
5299
	mov	[operand_prefix],0F3h
5298
	jmp	cmpsx_instruction
5300
	jmp	cmpsx_instruction
5299
cmpsd_instruction:
5301
cmpsd_instruction:
5300
	mov	al,0A7h
5302
	mov	al,0A7h
5301
	mov	ah,[esi]
5303
	mov	ah,[esi]
5302
	or	ah,ah
5304
	or	ah,ah
5303
	jz	simple_instruction_32bit
5305
	jz	simple_instruction_32bit
5304
	cmp	ah,0Fh
5306
	cmp	ah,0Fh
5305
	je	simple_instruction_32bit
5307
	je	simple_instruction_32bit
5306
	mov	[mmx_size],8
5308
	mov	[mmx_size],8
5307
	mov	[operand_prefix],0F2h
5309
	mov	[operand_prefix],0F2h
5308
      cmpsx_instruction:
5310
      cmpsx_instruction:
5309
	mov	[base_code],0Fh
5311
	mov	[base_code],0Fh
5310
	mov	[extended_code],0C2h
5312
	mov	[extended_code],0C2h
5311
	mov	byte [value],-1
5313
	mov	byte [value],-1
5312
	jmp	sse_cmp_instruction
5314
	jmp	sse_cmp_instruction
5313
cmp_ss_instruction:
5315
cmp_ss_instruction:
5314
	mov	[mmx_size],4
5316
	mov	[mmx_size],4
5315
	mov	[operand_prefix],0F3h
5317
	mov	[operand_prefix],0F3h
5316
	jmp	cmp_sx_instruction
5318
	jmp	cmp_sx_instruction
5317
cmp_sd_instruction:
5319
cmp_sd_instruction:
5318
	mov	[mmx_size],8
5320
	mov	[mmx_size],8
5319
	mov	[operand_prefix],0F2h
5321
	mov	[operand_prefix],0F2h
5320
      cmp_sx_instruction:
5322
      cmp_sx_instruction:
5321
	mov	[base_code],0Fh
5323
	mov	[base_code],0Fh
5322
	mov	[extended_code],0C2h
5324
	mov	[extended_code],0C2h
5323
	mov	byte [value],al
5325
	mov	byte [value],al
5324
sse_cmp_instruction:
5326
sse_cmp_instruction:
5325
	lods	byte [esi]
5327
	lods	byte [esi]
5326
	call	get_size_operator
5328
	call	get_size_operator
5327
	cmp	al,10h
5329
	cmp	al,10h
5328
	jne	invalid_operand
5330
	jne	invalid_operand
5329
	lods	byte [esi]
5331
	lods	byte [esi]
5330
	call	convert_mmx_register
5332
	call	convert_mmx_register
5331
	cmp	ah,16
5333
	cmp	ah,16
5332
	jne	invalid_operand_size
5334
	jne	invalid_operand_size
5333
	mov	[postbyte_register],al
5335
	mov	[postbyte_register],al
5334
	lods	byte [esi]
5336
	lods	byte [esi]
5335
	cmp	al,','
5337
	cmp	al,','
5336
	jne	invalid_operand
5338
	jne	invalid_operand
5337
	mov	[operand_size],0
5339
	mov	[operand_size],0
5338
	lods	byte [esi]
5340
	lods	byte [esi]
5339
	call	get_size_operator
5341
	call	get_size_operator
5340
	cmp	al,10h
5342
	cmp	al,10h
5341
	je	sse_cmp_xmmreg_xmmreg
5343
	je	sse_cmp_xmmreg_xmmreg
5342
	cmp	al,'['
5344
	cmp	al,'['
5343
	jne	invalid_operand
5345
	jne	invalid_operand
5344
	call	get_address
5346
	call	get_address
5345
	mov	al,[operand_size]
5347
	mov	al,[operand_size]
5346
	or	al,al
5348
	or	al,al
5347
	jz	sse_cmp_size_ok
5349
	jz	sse_cmp_size_ok
5348
	cmp	al,[mmx_size]
5350
	cmp	al,[mmx_size]
5349
	jne	invalid_operand_size
5351
	jne	invalid_operand_size
5350
      sse_cmp_size_ok:
5352
      sse_cmp_size_ok:
5351
	push	ebx ecx edx
5353
	push	ebx ecx edx
5352
	call	get_nextbyte
5354
	call	get_nextbyte
5353
	pop	edx ecx ebx
5355
	pop	edx ecx ebx
5354
	call	store_instruction_with_imm8
5356
	call	store_instruction_with_imm8
5355
	jmp	instruction_assembled
5357
	jmp	instruction_assembled
5356
      sse_cmp_xmmreg_xmmreg:
5358
      sse_cmp_xmmreg_xmmreg:
5357
	lods	byte [esi]
5359
	lods	byte [esi]
5358
	call	convert_mmx_register
5360
	call	convert_mmx_register
5359
	cmp	ah,16
5361
	cmp	ah,16
5360
	jne	invalid_operand_size
5362
	jne	invalid_operand_size
5361
	mov	bl,al
5363
	mov	bl,al
5362
	call	store_nomem_instruction
5364
	call	store_nomem_instruction
5363
	call	get_nextbyte
5365
	call	get_nextbyte
5364
	mov	al,byte [value]
5366
	mov	al,byte [value]
5365
	stos	byte [edi]
5367
	stos	byte [edi]
5366
	jmp	instruction_assembled
5368
	jmp	instruction_assembled
5367
      get_nextbyte:
5369
      get_nextbyte:
5368
	cmp	byte [value],-1
5370
	cmp	byte [value],-1
5369
	jne	nextbyte_ok
5371
	jne	nextbyte_ok
5370
	mov	[operand_size],0
5372
	mov	[operand_size],0
5371
	lods	byte [esi]
5373
	lods	byte [esi]
5372
	cmp	al,','
5374
	cmp	al,','
5373
	jne	invalid_operand
5375
	jne	invalid_operand
5374
	lods	byte [esi]
5376
	lods	byte [esi]
5375
	call	get_size_operator
5377
	call	get_size_operator
5376
	test	[operand_size],not 1
5378
	test	[operand_size],not 1
5377
	jnz	invalid_value
5379
	jnz	invalid_value
5378
	cmp	al,'('
5380
	cmp	al,'('
5379
	jne	invalid_operand
5381
	jne	invalid_operand
5380
	call	get_byte_value
5382
	call	get_byte_value
5381
	cmp	al,7
5383
	cmp	al,7
5382
	ja	invalid_value
5384
	ja	invalid_value
5383
	mov	byte [value],al
5385
	mov	byte [value],al
5384
      nextbyte_ok:
5386
      nextbyte_ok:
5385
	ret
5387
	ret
5386
cvtpi2pd_instruction:
5388
cvtpi2pd_instruction:
5387
	mov	[operand_prefix],66h
5389
	mov	[operand_prefix],66h
5388
cvtpi2ps_instruction:
5390
cvtpi2ps_instruction:
5389
	mov	[base_code],0Fh
5391
	mov	[base_code],0Fh
5390
	mov	[extended_code],al
5392
	mov	[extended_code],al
5391
	lods	byte [esi]
5393
	lods	byte [esi]
5392
	call	get_size_operator
5394
	call	get_size_operator
5393
	cmp	al,10h
5395
	cmp	al,10h
5394
	jne	invalid_operand
5396
	jne	invalid_operand
5395
	lods	byte [esi]
5397
	lods	byte [esi]
5396
	call	convert_mmx_register
5398
	call	convert_mmx_register
5397
	cmp	ah,16
5399
	cmp	ah,16
5398
	jne	invalid_operand_size
5400
	jne	invalid_operand_size
5399
	mov	[postbyte_register],al
5401
	mov	[postbyte_register],al
5400
	mov	[operand_size],0
5402
	mov	[operand_size],0
5401
	lods	byte [esi]
5403
	lods	byte [esi]
5402
	cmp	al,','
5404
	cmp	al,','
5403
	jne	invalid_operand
5405
	jne	invalid_operand
5404
	lods	byte [esi]
5406
	lods	byte [esi]
5405
	call	get_size_operator
5407
	call	get_size_operator
5406
	cmp	al,10h
5408
	cmp	al,10h
5407
	je	cvtpi_xmmreg_xmmreg
5409
	je	cvtpi_xmmreg_xmmreg
5408
	cmp	al,'['
5410
	cmp	al,'['
5409
	jne	invalid_operand
5411
	jne	invalid_operand
5410
	call	get_address
5412
	call	get_address
5411
	cmp	[operand_size],0
5413
	cmp	[operand_size],0
5412
	je	cvtpi_size_ok
5414
	je	cvtpi_size_ok
5413
	cmp	[operand_size],8
5415
	cmp	[operand_size],8
5414
	jne	invalid_operand_size
5416
	jne	invalid_operand_size
5415
      cvtpi_size_ok:
5417
      cvtpi_size_ok:
5416
	call	store_instruction
5418
	call	store_instruction
5417
	jmp	instruction_assembled
5419
	jmp	instruction_assembled
5418
      cvtpi_xmmreg_xmmreg:
5420
      cvtpi_xmmreg_xmmreg:
5419
	lods	byte [esi]
5421
	lods	byte [esi]
5420
	call	convert_mmx_register
5422
	call	convert_mmx_register
5421
	cmp	ah,8
5423
	cmp	ah,8
5422
	jne	invalid_operand_size
5424
	jne	invalid_operand_size
5423
	mov	bl,al
5425
	mov	bl,al
5424
	call	store_nomem_instruction
5426
	call	store_nomem_instruction
5425
	jmp	instruction_assembled
5427
	jmp	instruction_assembled
5426
cvtsi2ss_instruction:
5428
cvtsi2ss_instruction:
5427
	mov	[operand_prefix],0F3h
5429
	mov	[operand_prefix],0F3h
5428
	jmp	cvtsi_instruction
5430
	jmp	cvtsi_instruction
5429
cvtsi2sd_instruction:
5431
cvtsi2sd_instruction:
5430
	mov	[operand_prefix],0F2h
5432
	mov	[operand_prefix],0F2h
5431
      cvtsi_instruction:
5433
      cvtsi_instruction:
5432
	mov	[base_code],0Fh
5434
	mov	[base_code],0Fh
5433
	mov	[extended_code],al
5435
	mov	[extended_code],al
5434
	lods	byte [esi]
5436
	lods	byte [esi]
5435
	call	get_size_operator
5437
	call	get_size_operator
5436
	cmp	al,10h
5438
	cmp	al,10h
5437
	jne	invalid_operand
5439
	jne	invalid_operand
5438
	lods	byte [esi]
5440
	lods	byte [esi]
5439
	call	convert_mmx_register
5441
	call	convert_mmx_register
5440
	cmp	ah,16
5442
	cmp	ah,16
5441
	jne	invalid_operand_size
5443
	jne	invalid_operand_size
5442
	mov	[postbyte_register],al
5444
	mov	[postbyte_register],al
5443
	mov	[operand_size],0
5445
	mov	[operand_size],0
5444
	lods	byte [esi]
5446
	lods	byte [esi]
5445
	cmp	al,','
5447
	cmp	al,','
5446
	jne	invalid_operand
5448
	jne	invalid_operand
5447
	lods	byte [esi]
5449
	lods	byte [esi]
5448
	call	get_size_operator
5450
	call	get_size_operator
5449
	cmp	al,10h
5451
	cmp	al,10h
5450
	je	cvtsi_xmmreg_reg
5452
	je	cvtsi_xmmreg_reg
5451
	cmp	al,'['
5453
	cmp	al,'['
5452
	jne	invalid_operand
5454
	jne	invalid_operand
5453
	call	get_address
5455
	call	get_address
5454
	cmp	[operand_size],0
5456
	cmp	[operand_size],0
5455
	je	cvtsi_size_ok
5457
	je	cvtsi_size_ok
5456
	cmp	[operand_size],4
5458
	cmp	[operand_size],4
5457
	jne	invalid_operand_size
5459
	jne	invalid_operand_size
5458
      cvtsi_size_ok:
5460
      cvtsi_size_ok:
5459
	call	store_instruction
5461
	call	store_instruction
5460
	jmp	instruction_assembled
5462
	jmp	instruction_assembled
5461
      cvtsi_xmmreg_reg:
5463
      cvtsi_xmmreg_reg:
5462
	lods	byte [esi]
5464
	lods	byte [esi]
5463
	call	convert_register
5465
	call	convert_register
5464
	cmp	ah,4
5466
	cmp	ah,4
5465
	je	cvtsi_xmmreg_reg_store
5467
	je	cvtsi_xmmreg_reg_store
5466
	cmp	ah,8
5468
	cmp	ah,8
5467
	jne	invalid_operand_size
5469
	jne	invalid_operand_size
5468
	call	operand_64bit
5470
	call	operand_64bit
5469
      cvtsi_xmmreg_reg_store:
5471
      cvtsi_xmmreg_reg_store:
5470
	mov	bl,al
5472
	mov	bl,al
5471
	call	store_nomem_instruction
5473
	call	store_nomem_instruction
5472
	jmp	instruction_assembled
5474
	jmp	instruction_assembled
5473
cvtps2pi_instruction:
5475
cvtps2pi_instruction:
5474
	mov	[mmx_size],8
5476
	mov	[mmx_size],8
5475
	jmp	cvtpd_instruction
5477
	jmp	cvtpd_instruction
5476
cvtpd2pi_instruction:
5478
cvtpd2pi_instruction:
5477
	mov	[operand_prefix],66h
5479
	mov	[operand_prefix],66h
5478
	mov	[mmx_size],16
5480
	mov	[mmx_size],16
5479
      cvtpd_instruction:
5481
      cvtpd_instruction:
5480
	mov	[base_code],0Fh
5482
	mov	[base_code],0Fh
5481
	mov	[extended_code],al
5483
	mov	[extended_code],al
5482
	lods	byte [esi]
5484
	lods	byte [esi]
5483
	call	get_size_operator
5485
	call	get_size_operator
5484
	cmp	al,10h
5486
	cmp	al,10h
5485
	jne	invalid_operand
5487
	jne	invalid_operand
5486
	lods	byte [esi]
5488
	lods	byte [esi]
5487
	call	convert_mmx_register
5489
	call	convert_mmx_register
5488
	cmp	ah,8
5490
	cmp	ah,8
5489
	jne	invalid_operand_size
5491
	jne	invalid_operand_size
5490
	mov	[operand_size],0
5492
	mov	[operand_size],0
5491
	jmp	sse_reg
5493
	jmp	sse_reg
5492
cvtss2si_instruction:
5494
cvtss2si_instruction:
5493
	mov	[operand_prefix],0F3h
5495
	mov	[operand_prefix],0F3h
5494
	mov	[mmx_size],4
5496
	mov	[mmx_size],4
5495
	jmp	cvt2si_instruction
5497
	jmp	cvt2si_instruction
5496
cvtsd2si_instruction:
5498
cvtsd2si_instruction:
5497
	mov	[operand_prefix],0F2h
5499
	mov	[operand_prefix],0F2h
5498
	mov	[mmx_size],8
5500
	mov	[mmx_size],8
5499
      cvt2si_instruction:
5501
      cvt2si_instruction:
5500
	mov	[extended_code],al
5502
	mov	[extended_code],al
5501
	mov	[base_code],0Fh
5503
	mov	[base_code],0Fh
5502
	lods	byte [esi]
5504
	lods	byte [esi]
5503
	call	get_size_operator
5505
	call	get_size_operator
5504
	cmp	al,10h
5506
	cmp	al,10h
5505
	jne	invalid_operand
5507
	jne	invalid_operand
5506
	lods	byte [esi]
5508
	lods	byte [esi]
5507
	call	convert_register
5509
	call	convert_register
5508
	mov	[operand_size],0
5510
	mov	[operand_size],0
5509
	cmp	ah,4
5511
	cmp	ah,4
5510
	je	sse_reg
5512
	je	sse_reg
5511
	cmp	ah,8
5513
	cmp	ah,8
5512
	jne	invalid_operand_size
5514
	jne	invalid_operand_size
5513
	call	operand_64bit
5515
	call	operand_64bit
5514
	jmp	sse_reg
5516
	jmp	sse_reg
5515
 
5517
 
5516
ssse3_instruction:
5518
ssse3_instruction:
5517
	mov	[base_code],0Fh
5519
	mov	[base_code],0Fh
5518
	mov	[extended_code],38h
5520
	mov	[extended_code],38h
5519
	mov	[supplemental_code],al
5521
	mov	[supplemental_code],al
5520
	jmp	mmx_instruction
5522
	jmp	mmx_instruction
5521
palignr_instruction:
5523
palignr_instruction:
5522
	mov	[base_code],0Fh
5524
	mov	[base_code],0Fh
5523
	mov	[extended_code],3Ah
5525
	mov	[extended_code],3Ah
5524
	mov	[supplemental_code],0Fh
5526
	mov	[supplemental_code],0Fh
5525
	lods	byte [esi]
5527
	lods	byte [esi]
5526
	call	get_size_operator
5528
	call	get_size_operator
5527
	cmp	al,10h
5529
	cmp	al,10h
5528
	jne	invalid_operand
5530
	jne	invalid_operand
5529
	lods	byte [esi]
5531
	lods	byte [esi]
5530
	call	convert_mmx_register
5532
	call	convert_mmx_register
5531
	call	make_mmx_prefix
5533
	call	make_mmx_prefix
5532
	mov	[postbyte_register],al
5534
	mov	[postbyte_register],al
5533
	lods	byte [esi]
5535
	lods	byte [esi]
5534
	cmp	al,','
5536
	cmp	al,','
5535
	jne	invalid_operand
5537
	jne	invalid_operand
5536
	lods	byte [esi]
5538
	lods	byte [esi]
5537
	call	get_size_operator
5539
	call	get_size_operator
5538
	cmp	al,10h
5540
	cmp	al,10h
5539
	je	palignr_mmreg_mmreg
5541
	je	palignr_mmreg_mmreg
5540
	cmp	al,'['
5542
	cmp	al,'['
5541
	jne	invalid_operand
5543
	jne	invalid_operand
5542
	call	get_address
5544
	call	get_address
5543
	jmp	mmx_imm8
5545
	jmp	mmx_imm8
5544
      palignr_mmreg_mmreg:
5546
      palignr_mmreg_mmreg:
5545
	lods	byte [esi]
5547
	lods	byte [esi]
5546
	call	convert_mmx_register
5548
	call	convert_mmx_register
5547
	mov	bl,al
5549
	mov	bl,al
5548
	jmp	mmx_nomem_imm8
5550
	jmp	mmx_nomem_imm8
5549
amd3dnow_instruction:
5551
amd3dnow_instruction:
5550
	mov	[base_code],0Fh
5552
	mov	[base_code],0Fh
5551
	mov	[extended_code],0Fh
5553
	mov	[extended_code],0Fh
5552
	mov	byte [value],al
5554
	mov	byte [value],al
5553
	lods	byte [esi]
5555
	lods	byte [esi]
5554
	call	get_size_operator
5556
	call	get_size_operator
5555
	cmp	al,10h
5557
	cmp	al,10h
5556
	jne	invalid_operand
5558
	jne	invalid_operand
5557
	lods	byte [esi]
5559
	lods	byte [esi]
5558
	call	convert_mmx_register
5560
	call	convert_mmx_register
5559
	cmp	ah,8
5561
	cmp	ah,8
5560
	jne	invalid_operand_size
5562
	jne	invalid_operand_size
5561
	mov	[postbyte_register],al
5563
	mov	[postbyte_register],al
5562
	lods	byte [esi]
5564
	lods	byte [esi]
5563
	cmp	al,','
5565
	cmp	al,','
5564
	jne	invalid_operand
5566
	jne	invalid_operand
5565
	lods	byte [esi]
5567
	lods	byte [esi]
5566
	call	get_size_operator
5568
	call	get_size_operator
5567
	cmp	al,10h
5569
	cmp	al,10h
5568
	je	amd3dnow_mmreg_mmreg
5570
	je	amd3dnow_mmreg_mmreg
5569
	cmp	al,'['
5571
	cmp	al,'['
5570
	jne	invalid_operand
5572
	jne	invalid_operand
5571
	call	get_address
5573
	call	get_address
5572
	call	store_instruction_with_imm8
5574
	call	store_instruction_with_imm8
5573
	jmp	instruction_assembled
5575
	jmp	instruction_assembled
5574
      amd3dnow_mmreg_mmreg:
5576
      amd3dnow_mmreg_mmreg:
5575
	lods	byte [esi]
5577
	lods	byte [esi]
5576
	call	convert_mmx_register
5578
	call	convert_mmx_register
5577
	cmp	ah,8
5579
	cmp	ah,8
5578
	jne	invalid_operand_size
5580
	jne	invalid_operand_size
5579
	mov	bl,al
5581
	mov	bl,al
5580
	call	store_nomem_instruction
5582
	call	store_nomem_instruction
5581
	mov	al,byte [value]
5583
	mov	al,byte [value]
5582
	stos	byte [edi]
5584
	stos	byte [edi]
5583
	jmp	instruction_assembled
5585
	jmp	instruction_assembled
5584
 
5586
 
5585
fxsave_instruction:
5587
fxsave_instruction:
5586
	mov	[extended_code],0AEh
5588
	mov	[extended_code],0AEh
5587
	mov	[base_code],0Fh
5589
	mov	[base_code],0Fh
5588
	mov	[postbyte_register],al
5590
	mov	[postbyte_register],al
5589
	lods	byte [esi]
5591
	lods	byte [esi]
5590
	call	get_size_operator
5592
	call	get_size_operator
5591
	cmp	al,'['
5593
	cmp	al,'['
5592
	jne	invalid_operand
5594
	jne	invalid_operand
5593
	call	get_address
5595
	call	get_address
5594
	mov	ah,[operand_size]
5596
	mov	ah,[operand_size]
5595
	or	ah,ah
5597
	or	ah,ah
5596
	jz	fxsave_size_ok
5598
	jz	fxsave_size_ok
5597
	mov	al,[postbyte_register]
5599
	mov	al,[postbyte_register]
5598
	cmp	al,111b
5600
	cmp	al,111b
5599
	je	clflush_size_check
5601
	je	clflush_size_check
5600
	cmp	al,10b
5602
	cmp	al,10b
5601
	jb	invalid_operand_size
5603
	jb	invalid_operand_size
5602
	cmp	al,11b
5604
	cmp	al,11b
5603
	ja	invalid_operand_size
5605
	ja	invalid_operand_size
5604
	cmp	ah,4
5606
	cmp	ah,4
5605
	jne	invalid_operand_size
5607
	jne	invalid_operand_size
5606
	jmp	fxsave_size_ok
5608
	jmp	fxsave_size_ok
5607
      clflush_size_check:
5609
      clflush_size_check:
5608
	cmp	ah,1
5610
	cmp	ah,1
5609
	jne	invalid_operand_size
5611
	jne	invalid_operand_size
5610
      fxsave_size_ok:
5612
      fxsave_size_ok:
5611
	call	store_instruction
5613
	call	store_instruction
5612
	jmp	instruction_assembled
5614
	jmp	instruction_assembled
5613
prefetch_instruction:
5615
prefetch_instruction:
5614
	mov	[extended_code],18h
5616
	mov	[extended_code],18h
5615
      prefetch_mem_8bit:
5617
      prefetch_mem_8bit:
5616
	mov	[base_code],0Fh
5618
	mov	[base_code],0Fh
5617
	mov	[postbyte_register],al
5619
	mov	[postbyte_register],al
5618
	lods	byte [esi]
5620
	lods	byte [esi]
5619
	call	get_size_operator
5621
	call	get_size_operator
5620
	cmp	al,'['
5622
	cmp	al,'['
5621
	jne	invalid_operand
5623
	jne	invalid_operand
5622
	or	ah,ah
5624
	or	ah,ah
5623
	jz	prefetch_size_ok
5625
	jz	prefetch_size_ok
5624
	cmp	ah,1
5626
	cmp	ah,1
5625
	jne	invalid_operand_size
5627
	jne	invalid_operand_size
5626
      prefetch_size_ok:
5628
      prefetch_size_ok:
5627
	call	get_address
5629
	call	get_address
5628
	call	store_instruction
5630
	call	store_instruction
5629
	jmp	instruction_assembled
5631
	jmp	instruction_assembled
5630
amd_prefetch_instruction:
5632
amd_prefetch_instruction:
5631
	mov	[extended_code],0Dh
5633
	mov	[extended_code],0Dh
5632
	jmp	prefetch_mem_8bit
5634
	jmp	prefetch_mem_8bit
5633
fence_instruction:
5635
fence_instruction:
5634
	mov	bl,al
5636
	mov	bl,al
5635
	mov	ax,0AE0Fh
5637
	mov	ax,0AE0Fh
5636
	stos	word [edi]
5638
	stos	word [edi]
5637
	mov	al,bl
5639
	mov	al,bl
5638
	stos	byte [edi]
5640
	stos	byte [edi]
5639
	jmp	instruction_assembled
5641
	jmp	instruction_assembled
5640
pause_instruction:
5642
pause_instruction:
5641
	mov	ax,90F3h
5643
	mov	ax,90F3h
5642
	stos	word [edi]
5644
	stos	word [edi]
5643
	jmp	instruction_assembled
5645
	jmp	instruction_assembled
5644
movntq_instruction:
5646
movntq_instruction:
5645
	mov	[mmx_size],8
5647
	mov	[mmx_size],8
5646
	jmp	movnt_instruction
5648
	jmp	movnt_instruction
5647
movntps_instruction:
5649
movntps_instruction:
5648
	mov	[mmx_size],16
5650
	mov	[mmx_size],16
5649
	jmp	movnt_instruction
5651
	jmp	movnt_instruction
5650
movntdq_instruction:
5652
movntdq_instruction:
5651
	mov	[operand_prefix],66h
5653
	mov	[operand_prefix],66h
5652
	mov	[mmx_size],16
5654
	mov	[mmx_size],16
5653
      movnt_instruction:
5655
      movnt_instruction:
5654
	mov	[extended_code],al
5656
	mov	[extended_code],al
5655
	mov	[base_code],0Fh
5657
	mov	[base_code],0Fh
5656
	lods	byte [esi]
5658
	lods	byte [esi]
5657
	call	get_size_operator
5659
	call	get_size_operator
5658
	cmp	al,'['
5660
	cmp	al,'['
5659
	jne	invalid_operand
5661
	jne	invalid_operand
5660
	call	get_address
5662
	call	get_address
5661
	lods	byte [esi]
5663
	lods	byte [esi]
5662
	cmp	al,','
5664
	cmp	al,','
5663
	jne	invalid_operand
5665
	jne	invalid_operand
5664
	lods	byte [esi]
5666
	lods	byte [esi]
5665
	call	get_size_operator
5667
	call	get_size_operator
5666
	cmp	al,10h
5668
	cmp	al,10h
5667
	jne	invalid_operand
5669
	jne	invalid_operand
5668
	lods	byte [esi]
5670
	lods	byte [esi]
5669
	call	convert_mmx_register
5671
	call	convert_mmx_register
5670
	cmp	ah,[mmx_size]
5672
	cmp	ah,[mmx_size]
5671
	jne	invalid_operand_size
5673
	jne	invalid_operand_size
5672
	mov	[postbyte_register],al
5674
	mov	[postbyte_register],al
5673
	call	store_instruction
5675
	call	store_instruction
5674
	jmp	instruction_assembled
5676
	jmp	instruction_assembled
5675
movnti_instruction:
5677
movnti_instruction:
5676
	mov	[base_code],0Fh
5678
	mov	[base_code],0Fh
5677
	mov	[extended_code],al
5679
	mov	[extended_code],al
5678
	lods	byte [esi]
5680
	lods	byte [esi]
5679
	call	get_size_operator
5681
	call	get_size_operator
5680
	cmp	al,'['
5682
	cmp	al,'['
5681
	jne	invalid_operand
5683
	jne	invalid_operand
5682
	call	get_address
5684
	call	get_address
5683
	lods	byte [esi]
5685
	lods	byte [esi]
5684
	cmp	al,','
5686
	cmp	al,','
5685
	jne	invalid_operand
5687
	jne	invalid_operand
5686
	lods	byte [esi]
5688
	lods	byte [esi]
5687
	call	get_size_operator
5689
	call	get_size_operator
5688
	cmp	al,10h
5690
	cmp	al,10h
5689
	jne	invalid_operand
5691
	jne	invalid_operand
5690
	lods	byte [esi]
5692
	lods	byte [esi]
5691
	call	convert_register
5693
	call	convert_register
5692
	cmp	ah,4
5694
	cmp	ah,4
5693
	je	movnti_store
5695
	je	movnti_store
5694
	cmp	ah,8
5696
	cmp	ah,8
5695
	jne	invalid_operand_size
5697
	jne	invalid_operand_size
5696
	call	operand_64bit
5698
	call	operand_64bit
5697
      movnti_store:
5699
      movnti_store:
5698
	mov	[postbyte_register],al
5700
	mov	[postbyte_register],al
5699
	call	store_instruction
5701
	call	store_instruction
5700
	jmp	instruction_assembled
5702
	jmp	instruction_assembled
5701
monitor_instruction:
5703
monitor_instruction:
5702
	mov	[postbyte_register],al
5704
	mov	[postbyte_register],al
5703
	lods	byte [esi]
5705
	lods	byte [esi]
5704
	call	get_size_operator
5706
	call	get_size_operator
5705
	cmp	al,10h
5707
	cmp	al,10h
5706
	jne	invalid_operand
5708
	jne	invalid_operand
5707
	lods	byte [esi]
5709
	lods	byte [esi]
5708
	call	convert_register
5710
	call	convert_register
5709
	cmp	ax,0400h
5711
	cmp	ax,0400h
5710
	jne	invalid_operand
5712
	jne	invalid_operand
5711
	lods	byte [esi]
5713
	lods	byte [esi]
5712
	cmp	al,','
5714
	cmp	al,','
5713
	jne	invalid_operand
5715
	jne	invalid_operand
5714
	lods	byte [esi]
5716
	lods	byte [esi]
5715
	call	get_size_operator
5717
	call	get_size_operator
5716
	cmp	al,10h
5718
	cmp	al,10h
5717
	jne	invalid_operand
5719
	jne	invalid_operand
5718
	lods	byte [esi]
5720
	lods	byte [esi]
5719
	call	convert_register
5721
	call	convert_register
5720
	cmp	ax,0401h
5722
	cmp	ax,0401h
5721
	jne	invalid_operand
5723
	jne	invalid_operand
5722
	cmp	[postbyte_register],0C8h
5724
	cmp	[postbyte_register],0C8h
5723
	jne	monitor_instruction_store
5725
	jne	monitor_instruction_store
5724
	lods	byte [esi]
5726
	lods	byte [esi]
5725
	cmp	al,','
5727
	cmp	al,','
5726
	jne	invalid_operand
5728
	jne	invalid_operand
5727
	lods	byte [esi]
5729
	lods	byte [esi]
5728
	call	get_size_operator
5730
	call	get_size_operator
5729
	cmp	al,10h
5731
	cmp	al,10h
5730
	jne	invalid_operand
5732
	jne	invalid_operand
5731
	lods	byte [esi]
5733
	lods	byte [esi]
5732
	call	convert_register
5734
	call	convert_register
5733
	cmp	ax,0402h
5735
	cmp	ax,0402h
5734
	jne	invalid_operand
5736
	jne	invalid_operand
5735
      monitor_instruction_store:
5737
      monitor_instruction_store:
5736
	mov	ax,010Fh
5738
	mov	ax,010Fh
5737
	stos	word [edi]
5739
	stos	word [edi]
5738
	mov	al,[postbyte_register]
5740
	mov	al,[postbyte_register]
5739
	stos	byte [edi]
5741
	stos	byte [edi]
5740
	jmp	instruction_assembled
5742
	jmp	instruction_assembled
5741
 
5743
 
5742
simple_vmx_instruction:
5744
simple_vmx_instruction:
5743
	mov	ah,al
5745
	mov	ah,al
5744
	mov	al,0Fh
5746
	mov	al,0Fh
5745
	stos	byte [edi]
5747
	stos	byte [edi]
5746
	mov	al,1
5748
	mov	al,1
5747
	stos	word [edi]
5749
	stos	word [edi]
5748
	jmp	instruction_assembled
5750
	jmp	instruction_assembled
5749
vmclear_instruction:
5751
vmclear_instruction:
5750
	mov	[operand_prefix],66h
5752
	mov	[operand_prefix],66h
5751
	jmp	vmx_instruction
5753
	jmp	vmx_instruction
5752
vmxon_instruction:
5754
vmxon_instruction:
5753
	mov	[operand_prefix],0F3h
5755
	mov	[operand_prefix],0F3h
5754
vmx_instruction:
5756
vmx_instruction:
5755
	mov	[postbyte_register],al
5757
	mov	[postbyte_register],al
5756
	mov	[extended_code],0C7h
5758
	mov	[extended_code],0C7h
5757
	lods	byte [esi]
5759
	lods	byte [esi]
5758
	call	get_size_operator
5760
	call	get_size_operator
5759
	cmp	al,'['
5761
	cmp	al,'['
5760
	jne	invalid_operand
5762
	jne	invalid_operand
5761
	call	get_address
5763
	call	get_address
5762
	mov	al,[operand_size]
5764
	mov	al,[operand_size]
5763
	or	al,al
5765
	or	al,al
5764
	jz	vmx_size_ok
5766
	jz	vmx_size_ok
5765
	cmp	al,8
5767
	cmp	al,8
5766
	jne	invalid_operand_size
5768
	jne	invalid_operand_size
5767
      vmx_size_ok:
5769
      vmx_size_ok:
5768
	mov	[base_code],0Fh
5770
	mov	[base_code],0Fh
5769
	call	store_instruction
5771
	call	store_instruction
5770
	jmp	instruction_assembled
5772
	jmp	instruction_assembled
5771
vmread_instruction:
5773
vmread_instruction:
5772
	mov	[extended_code],78h
5774
	mov	[extended_code],78h
5773
	lods	byte [esi]
5775
	lods	byte [esi]
5774
	call	get_size_operator
5776
	call	get_size_operator
5775
	cmp	al,'['
5777
	cmp	al,'['
5776
	jne	invalid_operand
5778
	jne	invalid_operand
5777
	call	get_address
5779
	call	get_address
5778
	lods	byte [esi]
5780
	lods	byte [esi]
5779
	cmp	al,','
5781
	cmp	al,','
5780
	jne	invalid_operand
5782
	jne	invalid_operand
5781
	lods	byte [esi]
5783
	lods	byte [esi]
5782
	call	get_size_operator
5784
	call	get_size_operator
5783
	cmp	al,10h
5785
	cmp	al,10h
5784
	jne	invalid_operand
5786
	jne	invalid_operand
5785
	lods	byte [esi]
5787
	lods	byte [esi]
5786
	call	convert_register
5788
	call	convert_register
5787
	mov	[postbyte_register],al
5789
	mov	[postbyte_register],al
5788
      vmread_check_size:
5790
      vmread_check_size:
5789
	cmp	[code_type],64
5791
	cmp	[code_type],64
5790
	je	vmread_long
5792
	je	vmread_long
5791
	cmp	[operand_size],4
5793
	cmp	[operand_size],4
5792
	je	vmx_size_ok
5794
	je	vmx_size_ok
5793
	jmp	invalid_operand_size
5795
	jmp	invalid_operand_size
5794
      vmread_long:
5796
      vmread_long:
5795
	cmp	[operand_size],8
5797
	cmp	[operand_size],8
5796
	je	vmx_size_ok
5798
	je	vmx_size_ok
5797
	jmp	invalid_operand_size
5799
	jmp	invalid_operand_size
5798
vmwrite_instruction:
5800
vmwrite_instruction:
5799
	mov	[extended_code],79h
5801
	mov	[extended_code],79h
5800
	lods	byte [esi]
5802
	lods	byte [esi]
5801
	call	get_size_operator
5803
	call	get_size_operator
5802
	cmp	al,10h
5804
	cmp	al,10h
5803
	jne	invalid_operand
5805
	jne	invalid_operand
5804
	lods	byte [esi]
5806
	lods	byte [esi]
5805
	call	convert_register
5807
	call	convert_register
5806
	mov	[postbyte_register],al
5808
	mov	[postbyte_register],al
5807
	lods	byte [esi]
5809
	lods	byte [esi]
5808
	cmp	al,','
5810
	cmp	al,','
5809
	jne	invalid_operand
5811
	jne	invalid_operand
5810
	lods	byte [esi]
5812
	lods	byte [esi]
5811
	call	get_size_operator
5813
	call	get_size_operator
5812
	cmp	al,'['
5814
	cmp	al,'['
5813
	jne	invalid_operand
5815
	jne	invalid_operand
5814
	call	get_address
5816
	call	get_address
5815
	jmp	vmread_check_size
5817
	jmp	vmread_check_size
5816
simple_svm_instruction:
5818
simple_svm_instruction:
5817
	push	eax
5819
	push	eax
5818
	mov	[base_code],0Fh
5820
	mov	[base_code],0Fh
5819
	mov	[extended_code],1
5821
	mov	[extended_code],1
5820
	lods	byte [esi]
5822
	lods	byte [esi]
5821
	call	get_size_operator
5823
	call	get_size_operator
5822
	cmp	al,10h
5824
	cmp	al,10h
5823
	jne	invalid_operand
5825
	jne	invalid_operand
5824
	lods	byte [esi]
5826
	lods	byte [esi]
5825
	call	convert_register
5827
	call	convert_register
5826
	or	al,al
5828
	or	al,al
5827
	jnz	invalid_operand
5829
	jnz	invalid_operand
5828
      simple_svm_detect_size:
5830
      simple_svm_detect_size:
5829
	cmp	ah,2
5831
	cmp	ah,2
5830
	je	simple_svm_16bit
5832
	je	simple_svm_16bit
5831
	cmp	ah,4
5833
	cmp	ah,4
5832
	je	simple_svm_32bit
5834
	je	simple_svm_32bit
5833
	cmp	[code_type],64
5835
	cmp	[code_type],64
5834
	jne	invalid_operand_size
5836
	jne	invalid_operand_size
5835
	jmp	simple_svm_store
5837
	jmp	simple_svm_store
5836
      simple_svm_16bit:
5838
      simple_svm_16bit:
5837
	cmp	[code_type],16
5839
	cmp	[code_type],16
5838
	je	simple_svm_store
5840
	je	simple_svm_store
5839
	cmp	[code_type],64
5841
	cmp	[code_type],64
5840
	je	invalid_operand_size
5842
	je	invalid_operand_size
5841
	jmp	prefixed_svm_store
5843
	jmp	prefixed_svm_store
5842
      simple_svm_32bit:
5844
      simple_svm_32bit:
5843
	cmp	[code_type],32
5845
	cmp	[code_type],32
5844
	je	simple_svm_store
5846
	je	simple_svm_store
5845
      prefixed_svm_store:
5847
      prefixed_svm_store:
5846
	mov	al,67h
5848
	mov	al,67h
5847
	stos	byte [edi]
5849
	stos	byte [edi]
5848
      simple_svm_store:
5850
      simple_svm_store:
5849
	call	store_instruction_code
5851
	call	store_instruction_code
5850
	pop	eax
5852
	pop	eax
5851
	stos	byte [edi]
5853
	stos	byte [edi]
5852
	jmp	instruction_assembled
5854
	jmp	instruction_assembled
5853
skinit_instruction:
5855
skinit_instruction:
5854
	lods	byte [esi]
5856
	lods	byte [esi]
5855
	call	get_size_operator
5857
	call	get_size_operator
5856
	cmp	al,10h
5858
	cmp	al,10h
5857
	jne	invalid_operand
5859
	jne	invalid_operand
5858
	lods	byte [esi]
5860
	lods	byte [esi]
5859
	call	convert_register
5861
	call	convert_register
5860
	cmp	ax,0400h
5862
	cmp	ax,0400h
5861
	jne	invalid_operand
5863
	jne	invalid_operand
5862
	mov	al,0DEh
5864
	mov	al,0DEh
5863
	jmp	simple_vmx_instruction
5865
	jmp	simple_vmx_instruction
5864
invlpga_instruction:
5866
invlpga_instruction:
5865
	push	eax
5867
	push	eax
5866
	mov	[base_code],0Fh
5868
	mov	[base_code],0Fh
5867
	mov	[extended_code],1
5869
	mov	[extended_code],1
5868
	lods	byte [esi]
5870
	lods	byte [esi]
5869
	call	get_size_operator
5871
	call	get_size_operator
5870
	cmp	al,10h
5872
	cmp	al,10h
5871
	jne	invalid_operand
5873
	jne	invalid_operand
5872
	lods	byte [esi]
5874
	lods	byte [esi]
5873
	call	convert_register
5875
	call	convert_register
5874
	or	al,al
5876
	or	al,al
5875
	jnz	invalid_operand
5877
	jnz	invalid_operand
5876
	mov	bl,ah
5878
	mov	bl,ah
5877
	mov	[operand_size],0
5879
	mov	[operand_size],0
5878
	lods	byte [esi]
5880
	lods	byte [esi]
5879
	cmp	al,','
5881
	cmp	al,','
5880
	jne	invalid_operand
5882
	jne	invalid_operand
5881
	lods	byte [esi]
5883
	lods	byte [esi]
5882
	call	get_size_operator
5884
	call	get_size_operator
5883
	cmp	al,10h
5885
	cmp	al,10h
5884
	jne	invalid_operand
5886
	jne	invalid_operand
5885
	lods	byte [esi]
5887
	lods	byte [esi]
5886
	call	convert_register
5888
	call	convert_register
5887
	cmp	ax,0401h
5889
	cmp	ax,0401h
5888
	jne	invalid_operand
5890
	jne	invalid_operand
5889
	mov	ah,bl
5891
	mov	ah,bl
5890
	jmp	simple_svm_detect_size
5892
	jmp	simple_svm_detect_size
5891
 
5893
 
5892
convert_register:
5894
convert_register:
5893
	mov	ah,al
5895
	mov	ah,al
5894
	shr	ah,4
5896
	shr	ah,4
5895
	and	al,0Fh
5897
	and	al,0Fh
5896
	cmp	ah,8
5898
	cmp	ah,8
5897
	je	match_register_size
5899
	je	match_register_size
5898
	cmp	ah,4
5900
	cmp	ah,4
5899
	ja	invalid_operand
5901
	ja	invalid_operand
5900
	cmp	ah,1
5902
	cmp	ah,1
5901
	ja	match_register_size
5903
	ja	match_register_size
5902
	cmp	al,4
5904
	cmp	al,4
5903
	jb	match_register_size
5905
	jb	match_register_size
5904
	or	ah,ah
5906
	or	ah,ah
5905
	jz	high_byte_register
5907
	jz	high_byte_register
5906
	or	[rex_prefix],40h
5908
	or	[rex_prefix],40h
5907
      match_register_size:
5909
      match_register_size:
5908
	cmp	ah,[operand_size]
5910
	cmp	ah,[operand_size]
5909
	je	register_size_ok
5911
	je	register_size_ok
5910
	cmp	[operand_size],0
5912
	cmp	[operand_size],0
5911
	jne	operand_sizes_do_not_match
5913
	jne	operand_sizes_do_not_match
5912
	mov	[operand_size],ah
5914
	mov	[operand_size],ah
5913
      register_size_ok:
5915
      register_size_ok:
5914
	ret
5916
	ret
5915
      high_byte_register:
5917
      high_byte_register:
5916
	mov	ah,1
5918
	mov	ah,1
5917
	or	[rex_prefix],80h
5919
	or	[rex_prefix],80h
5918
	jmp	match_register_size
5920
	jmp	match_register_size
5919
convert_fpu_register:
5921
convert_fpu_register:
5920
	mov	ah,al
5922
	mov	ah,al
5921
	shr	ah,4
5923
	shr	ah,4
5922
	and	al,111b
5924
	and	al,111b
5923
	cmp	ah,10
5925
	cmp	ah,10
5924
	jne	invalid_operand
5926
	jne	invalid_operand
5925
	jmp	match_register_size
5927
	jmp	match_register_size
5926
convert_mmx_register:
5928
convert_mmx_register:
5927
	mov	ah,al
5929
	mov	ah,al
5928
	shr	ah,4
5930
	shr	ah,4
5929
	cmp	ah,0Ch
5931
	cmp	ah,0Ch
5930
	je	xmm_register
5932
	je	xmm_register
5931
	ja	invalid_operand
5933
	ja	invalid_operand
5932
	and	al,111b
5934
	and	al,111b
5933
	cmp	ah,0Bh
5935
	cmp	ah,0Bh
5934
	jne	invalid_operand
5936
	jne	invalid_operand
5935
	mov	ah,8
5937
	mov	ah,8
5936
	jmp	match_register_size
5938
	jmp	match_register_size
5937
      xmm_register:
5939
      xmm_register:
5938
	and	al,0Fh
5940
	and	al,0Fh
5939
	mov	ah,16
5941
	mov	ah,16
5940
	cmp	al,8
5942
	cmp	al,8
5941
	jb	match_register_size
5943
	jb	match_register_size
5942
	cmp	[code_type],64
5944
	cmp	[code_type],64
5943
	jne	invalid_operand
5945
	jne	invalid_operand
5944
	jmp	match_register_size
5946
	jmp	match_register_size
5945
get_size_operator:
5947
get_size_operator:
5946
	xor	ah,ah
5948
	xor	ah,ah
5947
	cmp	al,11h
5949
	cmp	al,11h
5948
	jne	no_size_operator
5950
	jne	no_size_operator
5949
	mov	[size_declared],1
5951
	mov	[size_declared],1
5950
	lods	word [esi]
5952
	lods	word [esi]
5951
	xchg	al,ah
5953
	xchg	al,ah
5952
	mov	[size_override],1
5954
	mov	[size_override],1
5953
	cmp	ah,[operand_size]
5955
	cmp	ah,[operand_size]
5954
	je	size_operator_ok
5956
	je	size_operator_ok
5955
	cmp	[operand_size],0
5957
	cmp	[operand_size],0
5956
	jne	operand_sizes_do_not_match
5958
	jne	operand_sizes_do_not_match
5957
	mov	[operand_size],ah
5959
	mov	[operand_size],ah
5958
      size_operator_ok:
5960
      size_operator_ok:
5959
	ret
5961
	ret
5960
      no_size_operator:
5962
      no_size_operator:
5961
	mov	[size_declared],0
5963
	mov	[size_declared],0
5962
	cmp	al,'['
5964
	cmp	al,'['
5963
	jne	size_operator_ok
5965
	jne	size_operator_ok
5964
	mov	[size_override],0
5966
	mov	[size_override],0
5965
	ret
5967
	ret
5966
get_jump_operator:
5968
get_jump_operator:
5967
	mov	[jump_type],0
5969
	mov	[jump_type],0
5968
	cmp	al,12h
5970
	cmp	al,12h
5969
	jne	jump_operator_ok
5971
	jne	jump_operator_ok
5970
	lods	word [esi]
5972
	lods	word [esi]
5971
	mov	[jump_type],al
5973
	mov	[jump_type],al
5972
	mov	al,ah
5974
	mov	al,ah
5973
      jump_operator_ok:
5975
      jump_operator_ok:
5974
	ret
5976
	ret
5975
get_address:
5977
get_address:
5976
	mov	[segment_register],0
5978
	mov	[segment_register],0
5977
	mov	[address_size],0
5979
	mov	[address_size],0
5978
	mov	al,[code_type]
5980
	mov	al,[code_type]
5979
	shr	al,3
5981
	shr	al,3
5980
	mov	[value_size],al
5982
	mov	[value_size],al
5981
	mov	al,[esi]
5983
	mov	al,[esi]
5982
	and	al,11110000b
5984
	and	al,11110000b
5983
	cmp	al,60h
5985
	cmp	al,60h
5984
	jne	get_size_prefix
5986
	jne	get_size_prefix
5985
	lods	byte [esi]
5987
	lods	byte [esi]
5986
	sub	al,60h
5988
	sub	al,60h
5987
	mov	[segment_register],al
5989
	mov	[segment_register],al
5988
	mov	al,[esi]
5990
	mov	al,[esi]
5989
	and	al,11110000b
5991
	and	al,11110000b
5990
      get_size_prefix:
5992
      get_size_prefix:
5991
	cmp	al,70h
5993
	cmp	al,70h
5992
	jne	address_size_prefix_ok
5994
	jne	address_size_prefix_ok
5993
	lods	byte [esi]
5995
	lods	byte [esi]
5994
	sub	al,70h
5996
	sub	al,70h
5995
	cmp	al,2
5997
	cmp	al,2
5996
	jb	invalid_address_size
5998
	jb	invalid_address_size
5997
	cmp	al,8
5999
	cmp	al,8
5998
	ja	invalid_address_size
6000
	ja	invalid_address_size
5999
	mov	[address_size],al
6001
	mov	[address_size],al
6000
	mov	[value_size],al
6002
	mov	[value_size],al
6001
      address_size_prefix_ok:
6003
      address_size_prefix_ok:
6002
	call	calculate_address
6004
	call	calculate_address
6003
	cmp	byte [esi-1],']'
6005
	cmp	byte [esi-1],']'
6004
	jne	invalid_address
6006
	jne	invalid_address
6005
	mov	[address_high],edx
6007
	mov	[address_high],edx
6006
	mov	edx,eax
6008
	mov	edx,eax
6007
	cmp	[code_type],64
6009
	cmp	[code_type],64
6008
	jne	address_ok
6010
	jne	address_ok
6009
	or	bx,bx
6011
	or	bx,bx
6010
	jnz	address_ok
6012
	jnz	address_ok
6011
	test	ch,0Fh
6013
	test	ch,0Fh
6012
	jnz	address_ok
6014
	jnz	address_ok
6013
      calculate_relative_address:
6015
      calculate_relative_address:
6014
	mov	edx,[address_symbol]
6016
	mov	edx,[address_symbol]
6015
	mov	[symbol_identifier],edx
6017
	mov	[symbol_identifier],edx
6016
	mov	edx,[address_high]
6018
	mov	edx,[address_high]
6017
	call	calculate_relative_offset
6019
	call	calculate_relative_offset
6018
	mov	[address_high],edx
6020
	mov	[address_high],edx
6019
	cdq
6021
	cdq
6020
	cmp	edx,[address_high]
6022
	cmp	edx,[address_high]
6021
	jne	value_out_of_range
6023
	jne	value_out_of_range
6022
	mov	edx,eax
6024
	mov	edx,eax
6023
	ror	ecx,16
6025
	ror	ecx,16
6024
	mov	cl,[value_type]
6026
	mov	cl,[value_type]
6025
	rol	ecx,16
6027
	rol	ecx,16
6026
	mov	bx,0FF00h
6028
	mov	bx,0FF00h
6027
      address_ok:
6029
      address_ok:
6028
	ret
6030
	ret
6029
operand_16bit:
6031
operand_16bit:
6030
	cmp	[code_type],16
6032
	cmp	[code_type],16
6031
	je	size_prefix_ok
6033
	je	size_prefix_ok
6032
	mov	[operand_prefix],66h
6034
	mov	[operand_prefix],66h
6033
	ret
6035
	ret
6034
operand_32bit:
6036
operand_32bit:
6035
	cmp	[code_type],16
6037
	cmp	[code_type],16
6036
	jne	size_prefix_ok
6038
	jne	size_prefix_ok
6037
	mov	[operand_prefix],66h
6039
	mov	[operand_prefix],66h
6038
      size_prefix_ok:
6040
      size_prefix_ok:
6039
	ret
6041
	ret
6040
operand_64bit:
6042
operand_64bit:
6041
	cmp	[code_type],64
6043
	cmp	[code_type],64
6042
	jne	illegal_instruction
6044
	jne	illegal_instruction
6043
	or	[rex_prefix],48h
6045
	or	[rex_prefix],48h
6044
	ret
6046
	ret
6045
operand_autodetect:
6047
operand_autodetect:
6046
	cmp	al,2
6048
	cmp	al,2
6047
	je	operand_16bit
6049
	je	operand_16bit
6048
	cmp	al,4
6050
	cmp	al,4
6049
	je	operand_32bit
6051
	je	operand_32bit
6050
	cmp	al,8
6052
	cmp	al,8
6051
	je	operand_64bit
6053
	je	operand_64bit
6052
	jmp	invalid_operand_size
6054
	jmp	invalid_operand_size
6053
store_segment_prefix_if_necessary:
6055
store_segment_prefix_if_necessary:
6054
	mov	al,[segment_register]
6056
	mov	al,[segment_register]
6055
	or	al,al
6057
	or	al,al
6056
	jz	segment_prefix_ok
6058
	jz	segment_prefix_ok
6057
	cmp	al,3
6059
	cmp	al,3
6058
	je	ss_prefix
6060
	je	ss_prefix
6059
	cmp	al,4
6061
	cmp	al,4
6060
	ja	segment_prefix_386
6062
	ja	segment_prefix_386
6061
	jb	segment_prefix_86
6063
	jb	segment_prefix_86
6062
	cmp	bl,25h
6064
	cmp	bl,25h
6063
	je	segment_prefix_86
6065
	je	segment_prefix_86
6064
	cmp	bh,25h
6066
	cmp	bh,25h
6065
	je	segment_prefix_86
6067
	je	segment_prefix_86
6066
	cmp	bh,45h
6068
	cmp	bh,45h
6067
	je	segment_prefix_86
6069
	je	segment_prefix_86
6068
	cmp	bh,44h
6070
	cmp	bh,44h
6069
	je	segment_prefix_86
6071
	je	segment_prefix_86
6070
	ret
6072
	ret
6071
      ss_prefix:
6073
      ss_prefix:
6072
	cmp	bl,25h
6074
	cmp	bl,25h
6073
	je	segment_prefix_ok
6075
	je	segment_prefix_ok
6074
	cmp	bh,25h
6076
	cmp	bh,25h
6075
	je	segment_prefix_ok
6077
	je	segment_prefix_ok
6076
	cmp	bh,45h
6078
	cmp	bh,45h
6077
	je	segment_prefix_ok
6079
	je	segment_prefix_ok
6078
	cmp	bh,44h
6080
	cmp	bh,44h
6079
	je	segment_prefix_ok
6081
	je	segment_prefix_ok
6080
	jmp	segment_prefix_86
6082
	jmp	segment_prefix_86
6081
store_segment_prefix:
6083
store_segment_prefix:
6082
	mov	al,[segment_register]
6084
	mov	al,[segment_register]
6083
	or	al,al
6085
	or	al,al
6084
	jz	segment_prefix_ok
6086
	jz	segment_prefix_ok
6085
	cmp	al,5
6087
	cmp	al,5
6086
	jae	segment_prefix_386
6088
	jae	segment_prefix_386
6087
      segment_prefix_86:
6089
      segment_prefix_86:
6088
	dec	al
6090
	dec	al
6089
	shl	al,3
6091
	shl	al,3
6090
	add	al,26h
6092
	add	al,26h
6091
	stos	byte [edi]
6093
	stos	byte [edi]
6092
	jmp	segment_prefix_ok
6094
	jmp	segment_prefix_ok
6093
      segment_prefix_386:
6095
      segment_prefix_386:
6094
	add	al,64h-5
6096
	add	al,64h-5
6095
	stos	byte [edi]
6097
	stos	byte [edi]
6096
      segment_prefix_ok:
6098
      segment_prefix_ok:
6097
	ret
6099
	ret
6098
store_instruction_code:
6100
store_instruction_code:
6099
	mov	al,[operand_prefix]
6101
	mov	al,[operand_prefix]
6100
	or	al,al
6102
	or	al,al
6101
	jz	operand_prefix_ok
6103
	jz	operand_prefix_ok
6102
	stos	byte [edi]
6104
	stos	byte [edi]
6103
      operand_prefix_ok:
6105
      operand_prefix_ok:
6104
	mov	al,[rex_prefix]
6106
	mov	al,[rex_prefix]
6105
	test	al,40h
6107
	test	al,40h
6106
	jz	rex_prefix_ok
6108
	jz	rex_prefix_ok
6107
	cmp	[code_type],64
6109
	cmp	[code_type],64
6108
	jne	invalid_operand
6110
	jne	invalid_operand
6109
	test	al,0B0h
6111
	test	al,0B0h
6110
	jnz	prefix_conflict
6112
	jnz	prefix_conflict
6111
	stos	byte [edi]
6113
	stos	byte [edi]
6112
      rex_prefix_ok:
6114
      rex_prefix_ok:
6113
	mov	al,[base_code]
6115
	mov	al,[base_code]
6114
	stos	byte [edi]
6116
	stos	byte [edi]
6115
	cmp	al,0Fh
6117
	cmp	al,0Fh
6116
	jne	instruction_code_ok
6118
	jne	instruction_code_ok
6117
      store_extended_code:
6119
      store_extended_code:
6118
	mov	al,[extended_code]
6120
	mov	al,[extended_code]
6119
	stos	byte [edi]
6121
	stos	byte [edi]
6120
	cmp	al,38h
6122
	cmp	al,38h
6121
	je	store_supplemental_code
6123
	je	store_supplemental_code
6122
	cmp	al,3Ah
6124
	cmp	al,3Ah
6123
	je	store_supplemental_code
6125
	je	store_supplemental_code
6124
      instruction_code_ok:
6126
      instruction_code_ok:
6125
	ret
6127
	ret
6126
      store_supplemental_code:
6128
      store_supplemental_code:
6127
	mov	al,[supplemental_code]
6129
	mov	al,[supplemental_code]
6128
	stos	byte [edi]
6130
	stos	byte [edi]
6129
	ret
6131
	ret
6130
store_nomem_instruction:
6132
store_nomem_instruction:
6131
	test	[postbyte_register],1000b
6133
	test	[postbyte_register],1000b
6132
	jz	nomem_reg_code_ok
6134
	jz	nomem_reg_code_ok
6133
	or	[rex_prefix],44h
6135
	or	[rex_prefix],44h
6134
	and	[postbyte_register],111b
6136
	and	[postbyte_register],111b
6135
      nomem_reg_code_ok:
6137
      nomem_reg_code_ok:
6136
	test	bl,1000b
6138
	test	bl,1000b
6137
	jz	nomem_rm_code_ok
6139
	jz	nomem_rm_code_ok
6138
	or	[rex_prefix],41h
6140
	or	[rex_prefix],41h
6139
	and	bl,111b
6141
	and	bl,111b
6140
      nomem_rm_code_ok:
6142
      nomem_rm_code_ok:
6141
	call	store_instruction_code
6143
	call	store_instruction_code
6142
	mov	al,[postbyte_register]
6144
	mov	al,[postbyte_register]
6143
	shl	al,3
6145
	shl	al,3
6144
	or	al,bl
6146
	or	al,bl
6145
	or	al,11000000b
6147
	or	al,11000000b
6146
	stos	byte [edi]
6148
	stos	byte [edi]
6147
	ret
6149
	ret
6148
store_instruction:
6150
store_instruction:
6149
	mov	[current_offset],edi
6151
	mov	[current_offset],edi
6150
	test	[postbyte_register],1000b
6152
	test	[postbyte_register],1000b
6151
	jz	reg_code_ok
6153
	jz	reg_code_ok
6152
	or	[rex_prefix],44h
6154
	or	[rex_prefix],44h
6153
	and	[postbyte_register],111b
6155
	and	[postbyte_register],111b
6154
      reg_code_ok:
6156
      reg_code_ok:
6155
	call	store_segment_prefix_if_necessary
6157
	call	store_segment_prefix_if_necessary
6156
	or	bx,bx
6158
	or	bx,bx
6157
	jz	address_immediate
6159
	jz	address_immediate
6158
	cmp	bx,0F800h
6160
	cmp	bx,0F800h
6159
	je	address_rip_based
6161
	je	address_rip_based
6160
	cmp	bx,0F400h
6162
	cmp	bx,0F400h
6161
	je	address_eip_based
6163
	je	address_eip_based
6162
	cmp	bx,0FF00h
6164
	cmp	bx,0FF00h
6163
	je	address_relative
6165
	je	address_relative
6164
	mov	al,bl
6166
	mov	al,bl
6165
	or	al,bh
6167
	or	al,bh
6166
	and	al,11110000b
6168
	and	al,11110000b
6167
	cmp	al,80h
6169
	cmp	al,80h
6168
	je	postbyte_64bit
6170
	je	postbyte_64bit
6169
	cmp	al,40h
6171
	cmp	al,40h
6170
	je	postbyte_32bit
6172
	je	postbyte_32bit
6171
	cmp	al,20h
6173
	cmp	al,20h
6172
	jne	invalid_address
6174
	jne	invalid_address
6173
	cmp	[code_type],64
6175
	cmp	[code_type],64
6174
	je	invalid_address_size
6176
	je	invalid_address_size
6175
	call	address_16bit_prefix
6177
	call	address_16bit_prefix
6176
	call	store_instruction_code
6178
	call	store_instruction_code
6177
	cmp	bx,2326h
6179
	cmp	bx,2326h
6178
	je	address_bx_si
6180
	je	address_bx_si
6179
	cmp	bx,2623h
6181
	cmp	bx,2623h
6180
	je	address_bx_si
6182
	je	address_bx_si
6181
	cmp	bx,2327h
6183
	cmp	bx,2327h
6182
	je	address_bx_di
6184
	je	address_bx_di
6183
	cmp	bx,2723h
6185
	cmp	bx,2723h
6184
	je	address_bx_di
6186
	je	address_bx_di
6185
	cmp	bx,2526h
6187
	cmp	bx,2526h
6186
	je	address_bp_si
6188
	je	address_bp_si
6187
	cmp	bx,2625h
6189
	cmp	bx,2625h
6188
	je	address_bp_si
6190
	je	address_bp_si
6189
	cmp	bx,2527h
6191
	cmp	bx,2527h
6190
	je	address_bp_di
6192
	je	address_bp_di
6191
	cmp	bx,2725h
6193
	cmp	bx,2725h
6192
	je	address_bp_di
6194
	je	address_bp_di
6193
	cmp	bx,2600h
6195
	cmp	bx,2600h
6194
	je	address_si
6196
	je	address_si
6195
	cmp	bx,2700h
6197
	cmp	bx,2700h
6196
	je	address_di
6198
	je	address_di
6197
	cmp	bx,2300h
6199
	cmp	bx,2300h
6198
	je	address_bx
6200
	je	address_bx
6199
	cmp	bx,2500h
6201
	cmp	bx,2500h
6200
	je	address_bp
6202
	je	address_bp
6201
	jmp	invalid_address
6203
	jmp	invalid_address
6202
      address_bx_si:
6204
      address_bx_si:
6203
	xor	al,al
6205
	xor	al,al
6204
	jmp	postbyte_16bit
6206
	jmp	postbyte_16bit
6205
      address_bx_di:
6207
      address_bx_di:
6206
	mov	al,1
6208
	mov	al,1
6207
	jmp	postbyte_16bit
6209
	jmp	postbyte_16bit
6208
      address_bp_si:
6210
      address_bp_si:
6209
	mov	al,10b
6211
	mov	al,10b
6210
	jmp	postbyte_16bit
6212
	jmp	postbyte_16bit
6211
      address_bp_di:
6213
      address_bp_di:
6212
	mov	al,11b
6214
	mov	al,11b
6213
	jmp	postbyte_16bit
6215
	jmp	postbyte_16bit
6214
      address_si:
6216
      address_si:
6215
	mov	al,100b
6217
	mov	al,100b
6216
	jmp	postbyte_16bit
6218
	jmp	postbyte_16bit
6217
      address_di:
6219
      address_di:
6218
	mov	al,101b
6220
	mov	al,101b
6219
	jmp	postbyte_16bit
6221
	jmp	postbyte_16bit
6220
      address_bx:
6222
      address_bx:
6221
	mov	al,111b
6223
	mov	al,111b
6222
	jmp	postbyte_16bit
6224
	jmp	postbyte_16bit
6223
      address_bp:
6225
      address_bp:
6224
	mov	al,110b
6226
	mov	al,110b
6225
      postbyte_16bit:
6227
      postbyte_16bit:
6226
	test	ch,22h
6228
	test	ch,22h
6227
	jnz	address_16bit_value
6229
	jnz	address_16bit_value
6228
	or	ch,ch
6230
	or	ch,ch
6229
	jnz	address_sizes_do_not_agree
6231
	jnz	address_sizes_do_not_agree
6230
	cmp	edx,10000h
6232
	cmp	edx,10000h
6231
	jge	value_out_of_range
6233
	jge	value_out_of_range
6232
	cmp	edx,-8000h
6234
	cmp	edx,-8000h
6233
	jl	value_out_of_range
6235
	jl	value_out_of_range
6234
	or	dx,dx
6236
	or	dx,dx
6235
	jz	address
6237
	jz	address
6236
	cmp	dx,80h
6238
	cmp	dx,80h
6237
	jb	address_8bit_value
6239
	jb	address_8bit_value
6238
	cmp	dx,-80h
6240
	cmp	dx,-80h
6239
	jae	address_8bit_value
6241
	jae	address_8bit_value
6240
      address_16bit_value:
6242
      address_16bit_value:
6241
	or	al,10000000b
6243
	or	al,10000000b
6242
	mov	cl,[postbyte_register]
6244
	mov	cl,[postbyte_register]
6243
	shl	cl,3
6245
	shl	cl,3
6244
	or	al,cl
6246
	or	al,cl
6245
	stos	byte [edi]
6247
	stos	byte [edi]
6246
	mov	eax,edx
6248
	mov	eax,edx
6247
	stos	word [edi]
6249
	stos	word [edi]
6248
	ret
6250
	ret
6249
      address_8bit_value:
6251
      address_8bit_value:
6250
	or	al,01000000b
6252
	or	al,01000000b
6251
	mov	cl,[postbyte_register]
6253
	mov	cl,[postbyte_register]
6252
	shl	cl,3
6254
	shl	cl,3
6253
	or	al,cl
6255
	or	al,cl
6254
	stos	byte [edi]
6256
	stos	byte [edi]
6255
	mov	al,dl
6257
	mov	al,dl
6256
	stos	byte [edi]
6258
	stos	byte [edi]
6257
	cmp	dx,80h
6259
	cmp	dx,80h
6258
	jge	value_out_of_range
6260
	jge	value_out_of_range
6259
	cmp	dx,-80h
6261
	cmp	dx,-80h
6260
	jl	value_out_of_range
6262
	jl	value_out_of_range
6261
	ret
6263
	ret
6262
      address:
6264
      address:
6263
	cmp	al,110b
6265
	cmp	al,110b
6264
	je	address_8bit_value
6266
	je	address_8bit_value
6265
	mov	cl,[postbyte_register]
6267
	mov	cl,[postbyte_register]
6266
	shl	cl,3
6268
	shl	cl,3
6267
	or	al,cl
6269
	or	al,cl
6268
	stos	byte [edi]
6270
	stos	byte [edi]
6269
	ret
6271
	ret
6270
      postbyte_32bit:
6272
      postbyte_32bit:
6271
	call	address_32bit_prefix
6273
	call	address_32bit_prefix
6272
	jmp	address_prefix_ok
6274
	jmp	address_prefix_ok
6273
      postbyte_64bit:
6275
      postbyte_64bit:
6274
	cmp	[code_type],64
6276
	cmp	[code_type],64
6275
	jne	invalid_address_size
6277
	jne	invalid_address_size
6276
      address_prefix_ok:
6278
      address_prefix_ok:
6277
	test	bh,1000b
6279
	test	bh,1000b
6278
	jz	base_code_ok
6280
	jz	base_code_ok
6279
	or	[rex_prefix],41h
6281
	or	[rex_prefix],41h
6280
      base_code_ok:
6282
      base_code_ok:
6281
	test	bl,1000b
6283
	test	bl,1000b
6282
	jz	index_code_ok
6284
	jz	index_code_ok
6283
	or	[rex_prefix],42h
6285
	or	[rex_prefix],42h
6284
      index_code_ok:
6286
      index_code_ok:
6285
	call	store_instruction_code
6287
	call	store_instruction_code
6286
	cmp	bl,44h
6288
	cmp	bl,44h
6287
	je	swap_base_with_index
6289
	je	swap_base_with_index
6288
	cmp	bl,84h
6290
	cmp	bl,84h
6289
	jne	base_register_ok
6291
	jne	base_register_ok
6290
      swap_base_with_index:
6292
      swap_base_with_index:
6291
	cmp	cl,1
6293
	cmp	cl,1
6292
	jne	invalid_address
6294
	jne	invalid_address
6293
	xchg	bl,bh
6295
	xchg	bl,bh
6294
	cmp	bl,44h
6296
	cmp	bl,44h
6295
	je	invalid_address
6297
	je	invalid_address
6296
	cmp	bl,84h
6298
	cmp	bl,84h
6297
	je	invalid_address
6299
	je	invalid_address
6298
      base_register_ok:
6300
      base_register_ok:
6299
	or	cl,cl
6301
	or	cl,cl
6300
	jz	only_base_register
6302
	jz	only_base_register
6301
      base_and_index:
6303
      base_and_index:
6302
	mov	al,100b
6304
	mov	al,100b
6303
	xor	ah,ah
6305
	xor	ah,ah
6304
	cmp	cl,1
6306
	cmp	cl,1
6305
	je	scale_ok
6307
	je	scale_ok
6306
	cmp	cl,2
6308
	cmp	cl,2
6307
	je	scale_1
6309
	je	scale_1
6308
	cmp	cl,4
6310
	cmp	cl,4
6309
	je	scale_2
6311
	je	scale_2
6310
	or	ah,11000000b
6312
	or	ah,11000000b
6311
	jmp	scale_ok
6313
	jmp	scale_ok
6312
      scale_2:
6314
      scale_2:
6313
	or	ah,10000000b
6315
	or	ah,10000000b
6314
	jmp	scale_ok
6316
	jmp	scale_ok
6315
      scale_1:
6317
      scale_1:
6316
	or	ah,01000000b
6318
	or	ah,01000000b
6317
      scale_ok:
6319
      scale_ok:
6318
	or	bh,bh
6320
	or	bh,bh
6319
	jz	only_index_register
6321
	jz	only_index_register
6320
	and	bl,111b
6322
	and	bl,111b
6321
	shl	bl,3
6323
	shl	bl,3
6322
	or	ah,bl
6324
	or	ah,bl
6323
	and	bh,111b
6325
	and	bh,111b
6324
	or	ah,bh
6326
	or	ah,bh
6325
	test	ch,44h
6327
	test	ch,44h
6326
	jnz	sib_address_32bit_value
6328
	jnz	sib_address_32bit_value
6327
	test	ch,88h
6329
	test	ch,88h
6328
	jnz	sib_address_32bit_value
6330
	jnz	sib_address_32bit_value
6329
	or	ch,ch
6331
	or	ch,ch
6330
	jnz	address_sizes_do_not_agree
6332
	jnz	address_sizes_do_not_agree
6331
	cmp	bh,5
6333
	cmp	bh,5
6332
	je	address_value
6334
	je	address_value
6333
	or	edx,edx
6335
	or	edx,edx
6334
	jz	sib_address
6336
	jz	sib_address
6335
      address_value:
6337
      address_value:
6336
	cmp	edx,80h
6338
	cmp	edx,80h
6337
	jb	sib_address_8bit_value
6339
	jb	sib_address_8bit_value
6338
	cmp	edx,-80h
6340
	cmp	edx,-80h
6339
	jae	sib_address_8bit_value
6341
	jae	sib_address_8bit_value
6340
      sib_address_32bit_value:
6342
      sib_address_32bit_value:
6341
	or	al,10000000b
6343
	or	al,10000000b
6342
	mov	cl,[postbyte_register]
6344
	mov	cl,[postbyte_register]
6343
	shl	cl,3
6345
	shl	cl,3
6344
	or	al,cl
6346
	or	al,cl
6345
	stos	word [edi]
6347
	stos	word [edi]
6346
      address_32bit_value:
6348
      address_32bit_value:
6347
	cmp	[code_type],64
6349
	cmp	[code_type],64
6348
	jne	store_address_32bit_value
6350
	jne	store_address_32bit_value
6349
	mov	eax,edx
6351
	mov	eax,edx
6350
	cdq
6352
	cdq
6351
	cmp	edx,[address_high]
6353
	cmp	edx,[address_high]
6352
	jne	value_out_of_range
6354
	jne	value_out_of_range
6353
	mov	edx,eax
6355
	mov	edx,eax
6354
	jmp	store_address_32bit_value
6356
	jmp	store_address_32bit_value
6355
      sib_address_8bit_value:
6357
      sib_address_8bit_value:
6356
	or	al,01000000b
6358
	or	al,01000000b
6357
	mov	cl,[postbyte_register]
6359
	mov	cl,[postbyte_register]
6358
	shl	cl,3
6360
	shl	cl,3
6359
	or	al,cl
6361
	or	al,cl
6360
	stos	word [edi]
6362
	stos	word [edi]
6361
	mov	al,dl
6363
	mov	al,dl
6362
	stos	byte [edi]
6364
	stos	byte [edi]
6363
	cmp	edx,80h
6365
	cmp	edx,80h
6364
	jge	value_out_of_range
6366
	jge	value_out_of_range
6365
	cmp	edx,-80h
6367
	cmp	edx,-80h
6366
	jl	value_out_of_range
6368
	jl	value_out_of_range
6367
	ret
6369
	ret
6368
      sib_address:
6370
      sib_address:
6369
	mov	cl,[postbyte_register]
6371
	mov	cl,[postbyte_register]
6370
	shl	cl,3
6372
	shl	cl,3
6371
	or	al,cl
6373
	or	al,cl
6372
	stos	word [edi]
6374
	stos	word [edi]
6373
	ret
6375
	ret
6374
      only_index_register:
6376
      only_index_register:
6375
	or	ah,101b
6377
	or	ah,101b
6376
	and	bl,111b
6378
	and	bl,111b
6377
	shl	bl,3
6379
	shl	bl,3
6378
	or	ah,bl
6380
	or	ah,bl
6379
	mov	cl,[postbyte_register]
6381
	mov	cl,[postbyte_register]
6380
	shl	cl,3
6382
	shl	cl,3
6381
	or	al,cl
6383
	or	al,cl
6382
	stos	word [edi]
6384
	stos	word [edi]
6383
	test	ch,44h
6385
	test	ch,44h
6384
	jnz	address_32bit_value
6386
	jnz	address_32bit_value
6385
	test	ch,88h
6387
	test	ch,88h
6386
	jnz	address_32bit_value
6388
	jnz	address_32bit_value
6387
	or	ch,ch
6389
	or	ch,ch
6388
	jnz	invalid_address_size
6390
	jnz	invalid_address_size
6389
	jmp	address_32bit_value
6391
	jmp	address_32bit_value
6390
      zero_index_register:
6392
      zero_index_register:
6391
	mov	bl,4
6393
	mov	bl,4
6392
	mov	cl,1
6394
	mov	cl,1
6393
	jmp	base_and_index
6395
	jmp	base_and_index
6394
      only_base_register:
6396
      only_base_register:
6395
	mov	al,bh
6397
	mov	al,bh
6396
	and	al,111b
6398
	and	al,111b
6397
	cmp	al,4
6399
	cmp	al,4
6398
	je	zero_index_register
6400
	je	zero_index_register
6399
	test	ch,44h
6401
	test	ch,44h
6400
	jnz	simple_address_32bit_value
6402
	jnz	simple_address_32bit_value
6401
	test	ch,88h
6403
	test	ch,88h
6402
	jnz	simple_address_32bit_value
6404
	jnz	simple_address_32bit_value
6403
	or	ch,ch
6405
	or	ch,ch
6404
	jnz	address_sizes_do_not_agree
6406
	jnz	address_sizes_do_not_agree
6405
	or	edx,edx
6407
	or	edx,edx
6406
	jz	simple_address
6408
	jz	simple_address
6407
	cmp	edx,80h
6409
	cmp	edx,80h
6408
	jb	simple_address_8bit_value
6410
	jb	simple_address_8bit_value
6409
	cmp	edx,-80h
6411
	cmp	edx,-80h
6410
	jae	simple_address_8bit_value
6412
	jae	simple_address_8bit_value
6411
      simple_address_32bit_value:
6413
      simple_address_32bit_value:
6412
	or	al,10000000b
6414
	or	al,10000000b
6413
	mov	cl,[postbyte_register]
6415
	mov	cl,[postbyte_register]
6414
	shl	cl,3
6416
	shl	cl,3
6415
	or	al,cl
6417
	or	al,cl
6416
	stos	byte [edi]
6418
	stos	byte [edi]
6417
	jmp	address_32bit_value
6419
	jmp	address_32bit_value
6418
      simple_address_8bit_value:
6420
      simple_address_8bit_value:
6419
	or	al,01000000b
6421
	or	al,01000000b
6420
	mov	cl,[postbyte_register]
6422
	mov	cl,[postbyte_register]
6421
	shl	cl,3
6423
	shl	cl,3
6422
	or	al,cl
6424
	or	al,cl
6423
	stos	byte [edi]
6425
	stos	byte [edi]
6424
	mov	al,dl
6426
	mov	al,dl
6425
	stos	byte [edi]
6427
	stos	byte [edi]
6426
	cmp	edx,80h
6428
	cmp	edx,80h
6427
	jge	value_out_of_range
6429
	jge	value_out_of_range
6428
	cmp	edx,-80h
6430
	cmp	edx,-80h
6429
	jl	value_out_of_range
6431
	jl	value_out_of_range
6430
	ret
6432
	ret
6431
      simple_address:
6433
      simple_address:
6432
	cmp	al,5
6434
	cmp	al,5
6433
	je	simple_address_8bit_value
6435
	je	simple_address_8bit_value
6434
	mov	cl,[postbyte_register]
6436
	mov	cl,[postbyte_register]
6435
	shl	cl,3
6437
	shl	cl,3
6436
	or	al,cl
6438
	or	al,cl
6437
	stos	byte [edi]
6439
	stos	byte [edi]
6438
	ret
6440
	ret
6439
      address_immediate:
6441
      address_immediate:
6440
	cmp	[code_type],64
6442
	cmp	[code_type],64
6441
	je	address_immediate_sib
6443
	je	address_immediate_sib
6442
	test	ch,44h
6444
	test	ch,44h
6443
	jnz	address_immediate_32bit
6445
	jnz	address_immediate_32bit
6444
	test	ch,22h
6446
	test	ch,22h
6445
	jnz	address_immediate_16bit
6447
	jnz	address_immediate_16bit
6446
	or	ch,ch
6448
	or	ch,ch
6447
	jnz	invalid_address_size
6449
	jnz	invalid_address_size
6448
	cmp	[code_type],16
6450
	cmp	[code_type],16
6449
	je	addressing_16bit
6451
	je	addressing_16bit
6450
      address_immediate_32bit:
6452
      address_immediate_32bit:
6451
	call	address_32bit_prefix
6453
	call	address_32bit_prefix
6452
	call	store_instruction_code
6454
	call	store_instruction_code
6453
      store_immediate_address:
6455
      store_immediate_address:
6454
	mov	al,101b
6456
	mov	al,101b
6455
	mov	cl,[postbyte_register]
6457
	mov	cl,[postbyte_register]
6456
	shl	cl,3
6458
	shl	cl,3
6457
	or	al,cl
6459
	or	al,cl
6458
	stos	byte [edi]
6460
	stos	byte [edi]
6459
      store_address_32bit_value:
6461
      store_address_32bit_value:
6460
	test	ch,0F0h
6462
	test	ch,0F0h
6461
	jz	address_32bit_relocation_ok
6463
	jz	address_32bit_relocation_ok
6462
	mov	eax,ecx
6464
	mov	eax,ecx
6463
	shr	eax,16
6465
	shr	eax,16
6464
	cmp	al,4
6466
	cmp	al,4
6465
	jne	address_32bit_relocation
6467
	jne	address_32bit_relocation
6466
	mov	al,2
6468
	mov	al,2
6467
      address_32bit_relocation:
6469
      address_32bit_relocation:
6468
	xchg	[value_type],al
6470
	xchg	[value_type],al
6469
	mov	ebx,[address_symbol]
6471
	mov	ebx,[address_symbol]
6470
	xchg	ebx,[symbol_identifier]
6472
	xchg	ebx,[symbol_identifier]
6471
	call	mark_relocation
6473
	call	mark_relocation
6472
	mov	[value_type],al
6474
	mov	[value_type],al
6473
	mov	[symbol_identifier],ebx
6475
	mov	[symbol_identifier],ebx
6474
      address_32bit_relocation_ok:
6476
      address_32bit_relocation_ok:
6475
	mov	eax,edx
6477
	mov	eax,edx
6476
	stos	dword [edi]
6478
	stos	dword [edi]
6477
	ret
6479
	ret
6478
      store_address_64bit_value:
6480
      store_address_64bit_value:
6479
	test	ch,0F0h
6481
	test	ch,0F0h
6480
	jz	address_64bit_relocation_ok
6482
	jz	address_64bit_relocation_ok
6481
	mov	eax,ecx
6483
	mov	eax,ecx
6482
	shr	eax,16
6484
	shr	eax,16
6483
	xchg	[value_type],al
6485
	xchg	[value_type],al
6484
	mov	ebx,[address_symbol]
6486
	mov	ebx,[address_symbol]
6485
	xchg	ebx,[symbol_identifier]
6487
	xchg	ebx,[symbol_identifier]
6486
	call	mark_relocation
6488
	call	mark_relocation
6487
	mov	[value_type],al
6489
	mov	[value_type],al
6488
	mov	[symbol_identifier],ebx
6490
	mov	[symbol_identifier],ebx
6489
      address_64bit_relocation_ok:
6491
      address_64bit_relocation_ok:
6490
	mov	eax,edx
6492
	mov	eax,edx
6491
	stos	dword [edi]
6493
	stos	dword [edi]
6492
	mov	eax,[address_high]
6494
	mov	eax,[address_high]
6493
	stos	dword [edi]
6495
	stos	dword [edi]
6494
	ret
6496
	ret
6495
      address_immediate_sib:
6497
      address_immediate_sib:
6496
	test	ch,not 44h
6498
	test	ch,not 44h
6497
	jnz	invalid_address_size
6499
	jnz	invalid_address_size
6498
	test	ecx,0FF0000h
6500
	test	ecx,0FF0000h
6499
	jnz	address_immediate_sib_nosignextend
6501
	jnz	address_immediate_sib_nosignextend
6500
	test	edx,80000000h
6502
	test	edx,80000000h
6501
	jz	address_immediate_sib_prefix_ok
6503
	jz	address_immediate_sib_prefix_ok
6502
      address_immediate_sib_nosignextend:
6504
      address_immediate_sib_nosignextend:
6503
	call	address_32bit_prefix
6505
	call	address_32bit_prefix
6504
      address_immediate_sib_prefix_ok:
6506
      address_immediate_sib_prefix_ok:
6505
	call	store_instruction_code
6507
	call	store_instruction_code
6506
	mov	al,100b
6508
	mov	al,100b
6507
	mov	ah,100101b
6509
	mov	ah,100101b
6508
	mov	cl,[postbyte_register]
6510
	mov	cl,[postbyte_register]
6509
	shl	cl,3
6511
	shl	cl,3
6510
	or	al,cl
6512
	or	al,cl
6511
	stos	word [edi]
6513
	stos	word [edi]
6512
	jmp	store_address_32bit_value
6514
	jmp	store_address_32bit_value
6513
      address_eip_based:
6515
      address_eip_based:
6514
	mov	al,67h
6516
	mov	al,67h
6515
	stos	byte [edi]
6517
	stos	byte [edi]
6516
      address_rip_based:
6518
      address_rip_based:
6517
	cmp	[code_type],64
6519
	cmp	[code_type],64
6518
	jne	invalid_address
6520
	jne	invalid_address
6519
	call	store_instruction_code
6521
	call	store_instruction_code
6520
	jmp	store_immediate_address
6522
	jmp	store_immediate_address
6521
      address_relative:
6523
      address_relative:
6522
	call	store_instruction_code
6524
	call	store_instruction_code
6523
	movzx	eax,[immediate_size]
6525
	movzx	eax,[immediate_size]
6524
	add	eax,edi
6526
	add	eax,edi
6525
	sub	eax,[current_offset]
6527
	sub	eax,[current_offset]
6526
	add	eax,5
6528
	add	eax,5
6527
	sub	edx,eax
6529
	sub	edx,eax
6528
	jo	value_out_of_range
6530
	jo	value_out_of_range
6529
	mov	al,101b
6531
	mov	al,101b
6530
	mov	cl,[postbyte_register]
6532
	mov	cl,[postbyte_register]
6531
	shl	cl,3
6533
	shl	cl,3
6532
	or	al,cl
6534
	or	al,cl
6533
	stos	byte [edi]
6535
	stos	byte [edi]
6534
	shr	ecx,16
6536
	shr	ecx,16
6535
	xchg	[value_type],cl
6537
	xchg	[value_type],cl
6536
	mov	ebx,[address_symbol]
6538
	mov	ebx,[address_symbol]
6537
	xchg	ebx,[symbol_identifier]
6539
	xchg	ebx,[symbol_identifier]
6538
	mov	eax,edx
6540
	mov	eax,edx
6539
	call	mark_relocation
6541
	call	mark_relocation
6540
	mov	[value_type],cl
6542
	mov	[value_type],cl
6541
	mov	[symbol_identifier],ebx
6543
	mov	[symbol_identifier],ebx
6542
	stos	dword [edi]
6544
	stos	dword [edi]
6543
	ret
6545
	ret
6544
      addressing_16bit:
6546
      addressing_16bit:
6545
	cmp	edx,10000h
6547
	cmp	edx,10000h
6546
	jge	address_immediate_32bit
6548
	jge	address_immediate_32bit
6547
	cmp	edx,-8000h
6549
	cmp	edx,-8000h
6548
	jl	address_immediate_32bit
6550
	jl	address_immediate_32bit
6549
	movzx	edx,dx
6551
	movzx	edx,dx
6550
      address_immediate_16bit:
6552
      address_immediate_16bit:
6551
	call	address_16bit_prefix
6553
	call	address_16bit_prefix
6552
	call	store_instruction_code
6554
	call	store_instruction_code
6553
	mov	al,110b
6555
	mov	al,110b
6554
	mov	cl,[postbyte_register]
6556
	mov	cl,[postbyte_register]
6555
	shl	cl,3
6557
	shl	cl,3
6556
	or	al,cl
6558
	or	al,cl
6557
	stos	byte [edi]
6559
	stos	byte [edi]
6558
	mov	eax,edx
6560
	mov	eax,edx
6559
	stos	word [edi]
6561
	stos	word [edi]
6560
	cmp	edx,10000h
6562
	cmp	edx,10000h
6561
	jge	value_out_of_range
6563
	jge	value_out_of_range
6562
	cmp	edx,-8000h
6564
	cmp	edx,-8000h
6563
	jl	value_out_of_range
6565
	jl	value_out_of_range
6564
	ret
6566
	ret
6565
      address_16bit_prefix:
6567
      address_16bit_prefix:
6566
	cmp	[code_type],16
6568
	cmp	[code_type],16
6567
	je	instruction_prefix_ok
6569
	je	instruction_prefix_ok
6568
	mov	al,67h
6570
	mov	al,67h
6569
	stos	byte [edi]
6571
	stos	byte [edi]
6570
	ret
6572
	ret
6571
      address_32bit_prefix:
6573
      address_32bit_prefix:
6572
	cmp	[code_type],32
6574
	cmp	[code_type],32
6573
	je	instruction_prefix_ok
6575
	je	instruction_prefix_ok
6574
	mov	al,67h
6576
	mov	al,67h
6575
	stos	byte [edi]
6577
	stos	byte [edi]
6576
      instruction_prefix_ok:
6578
      instruction_prefix_ok:
6577
	ret
6579
	ret
6578
store_instruction_with_imm8:
6580
store_instruction_with_imm8:
6579
	mov	[immediate_size],1
6581
	mov	[immediate_size],1
6580
	call	store_instruction
6582
	call	store_instruction
6581
	mov	al,byte [value]
6583
	mov	al,byte [value]
6582
	stos	byte [edi]
6584
	stos	byte [edi]
6583
	ret
6585
	ret
6584
store_instruction_with_imm16:
6586
store_instruction_with_imm16:
6585
	mov	[immediate_size],2
6587
	mov	[immediate_size],2
6586
	call	store_instruction
6588
	call	store_instruction
6587
	mov	ax,word [value]
6589
	mov	ax,word [value]
6588
	call	mark_relocation
6590
	call	mark_relocation
6589
	stos	word [edi]
6591
	stos	word [edi]
6590
	ret
6592
	ret
6591
store_instruction_with_imm32:
6593
store_instruction_with_imm32:
6592
	mov	[immediate_size],4
6594
	mov	[immediate_size],4
6593
	call	store_instruction
6595
	call	store_instruction
6594
	mov	eax,dword [value]
6596
	mov	eax,dword [value]
6595
	call	mark_relocation
6597
	call	mark_relocation
6596
	stos	dword [edi]
6598
	stos	dword [edi]
6597
	ret
6599
	ret