Subversion Repositories Kolibri OS

Rev

Rev 157 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 157 Rev 174
Line 112... Line 112...
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 bx cx
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,'('
Line 126... Line 126...
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	cx bx 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:
Line 158... Line 158...
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	cx bx 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	cx bx 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
Line 194... Line 194...
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	cx bx 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
Line 428... Line 428...
428
	cmp	al,'['
428
	cmp	al,'['
429
	jne	invalid_operand
429
	jne	invalid_operand
430
      mov_mem:
430
      mov_mem:
431
	call	get_address
431
	call	get_address
432
	push	edx bx cx
432
	push	edx ebx ecx
433
	lods	byte [esi]
433
	lods	byte [esi]
434
	cmp	al,','
434
	cmp	al,','
435
	jne	invalid_operand
435
	jne	invalid_operand
436
	lods	byte [esi]
436
	lods	byte [esi]
437
	call	get_size_operator
437
	call	get_size_operator
438
	cmp	al,'('
438
	cmp	al,'('
Line 447... Line 447...
447
	jb	mov_mem_sreg
447
	jb	mov_mem_sreg
448
      mov_mem_general_reg:
448
      mov_mem_general_reg:
449
	call	convert_register
449
	call	convert_register
450
	mov	[postbyte_register],al
450
	mov	[postbyte_register],al
451
	pop	cx bx edx
451
	pop	ecx ebx edx
452
	cmp	ah,1
452
	cmp	ah,1
453
	je	mov_mem_reg_8bit
453
	je	mov_mem_reg_8bit
454
	mov	al,ah
454
	mov	al,ah
455
	call	operand_autodetect
455
	call	operand_autodetect
456
	mov	al,[postbyte_register]
456
	mov	al,[postbyte_register]
457
	or	al,bl
457
	or	al,bl
Line 540... Line 540...
540
	jmp	store_mov_address64
540
	jmp	store_mov_address64
541
      mov_mem_sreg:
541
      mov_mem_sreg:
542
	sub	al,61h
542
	sub	al,61h
543
	mov	[postbyte_register],al
543
	mov	[postbyte_register],al
544
	pop	cx bx edx
544
	pop	ecx ebx edx
545
	mov	ah,[operand_size]
545
	mov	ah,[operand_size]
546
	or	ah,ah
546
	or	ah,ah
547
	jz	mov_mem_sreg_store
547
	jz	mov_mem_sreg_store
548
	cmp	ah,2
548
	cmp	ah,2
549
	jne	invalid_operand_size
549
	jne	invalid_operand_size
550
      mov_mem_sreg_store:
550
      mov_mem_sreg_store:
Line 573... Line 573...
573
	call	get_byte_value
573
	call	get_byte_value
574
	mov	byte [value],al
574
	mov	byte [value],al
575
	mov	[postbyte_register],0
575
	mov	[postbyte_register],0
576
	mov	[base_code],0C6h
576
	mov	[base_code],0C6h
577
	pop	cx bx edx
577
	pop	ecx ebx edx
578
	call	store_instruction_with_imm8
578
	call	store_instruction_with_imm8
579
	jmp	instruction_assembled
579
	jmp	instruction_assembled
580
      mov_mem_imm_16bit:
580
      mov_mem_imm_16bit:
581
	call	operand_16bit
581
	call	operand_16bit
582
	call	get_word_value
582
	call	get_word_value
583
	mov	word [value],ax
583
	mov	word [value],ax
584
	mov	[postbyte_register],0
584
	mov	[postbyte_register],0
585
	mov	[base_code],0C7h
585
	mov	[base_code],0C7h
586
	pop	cx bx edx
586
	pop	ecx ebx edx
587
	call	store_instruction_with_imm16
587
	call	store_instruction_with_imm16
588
	jmp	instruction_assembled
588
	jmp	instruction_assembled
589
      mov_mem_imm_32bit:
589
      mov_mem_imm_32bit:
590
	call	operand_32bit
590
	call	operand_32bit
591
	call	get_dword_value
591
	call	get_dword_value
592
      mov_mem_imm_32bit_store:
592
      mov_mem_imm_32bit_store:
593
	mov	dword [value],eax
593
	mov	dword [value],eax
594
	mov	[postbyte_register],0
594
	mov	[postbyte_register],0
595
	mov	[base_code],0C7h
595
	mov	[base_code],0C7h
596
	pop	cx bx edx
596
	pop	ecx ebx edx
597
	call	store_instruction_with_imm32
597
	call	store_instruction_with_imm32
598
	jmp	instruction_assembled
598
	jmp	instruction_assembled
599
      mov_mem_imm_64bit:
599
      mov_mem_imm_64bit:
600
	cmp	[size_declared],0
600
	cmp	[size_declared],0
601
	jne	long_immediate_not_encodable
601
	jne	long_immediate_not_encodable
602
	call	operand_64bit
602
	call	operand_64bit
Line 996... Line 996...
996
	cmp	al,'['
996
	cmp	al,'['
997
	jne	invalid_operand
997
	jne	invalid_operand
998
      test_mem:
998
      test_mem:
999
	call	get_address
999
	call	get_address
1000
	push	edx bx cx
1000
	push	edx ebx ecx
1001
	lods	byte [esi]
1001
	lods	byte [esi]
1002
	cmp	al,','
1002
	cmp	al,','
1003
	jne	invalid_operand
1003
	jne	invalid_operand
1004
	lods	byte [esi]
1004
	lods	byte [esi]
1005
	call	get_size_operator
1005
	call	get_size_operator
1006
	cmp	al,'('
1006
	cmp	al,'('
Line 1010... Line 1010...
1010
      test_mem_reg:
1010
      test_mem_reg:
1011
	lods	byte [esi]
1011
	lods	byte [esi]
1012
	call	convert_register
1012
	call	convert_register
1013
	mov	[postbyte_register],al
1013
	mov	[postbyte_register],al
1014
	pop	cx bx edx
1014
	pop	ecx ebx edx
1015
	mov	al,ah
1015
	mov	al,ah
1016
	cmp	al,1
1016
	cmp	al,1
1017
	je	test_mem_reg_8bit
1017
	je	test_mem_reg_8bit
1018
	call	operand_autodetect
1018
	call	operand_autodetect
1019
	inc	[base_code]
1019
	inc	[base_code]
1020
      test_mem_reg_8bit:
1020
      test_mem_reg_8bit:
Line 1042... Line 1042...
1042
	call	get_byte_value
1042
	call	get_byte_value
1043
	mov	byte [value],al
1043
	mov	byte [value],al
1044
	mov	[postbyte_register],0
1044
	mov	[postbyte_register],0
1045
	mov	[base_code],0F6h
1045
	mov	[base_code],0F6h
1046
	pop	cx bx edx
1046
	pop	ecx ebx edx
1047
	call	store_instruction_with_imm8
1047
	call	store_instruction_with_imm8
1048
	jmp	instruction_assembled
1048
	jmp	instruction_assembled
1049
      test_mem_imm_16bit:
1049
      test_mem_imm_16bit:
1050
	call	operand_16bit
1050
	call	operand_16bit
1051
	call	get_word_value
1051
	call	get_word_value
1052
	mov	word [value],ax
1052
	mov	word [value],ax
1053
	mov	[postbyte_register],0
1053
	mov	[postbyte_register],0
1054
	mov	[base_code],0F7h
1054
	mov	[base_code],0F7h
1055
	pop	cx bx edx
1055
	pop	ecx ebx edx
1056
	call	store_instruction_with_imm16
1056
	call	store_instruction_with_imm16
1057
	jmp	instruction_assembled
1057
	jmp	instruction_assembled
1058
      test_mem_imm_32bit:
1058
      test_mem_imm_32bit:
1059
	call	operand_32bit
1059
	call	operand_32bit
1060
	call	get_dword_value
1060
	call	get_dword_value
1061
      test_mem_imm_32bit_store:
1061
      test_mem_imm_32bit_store:
1062
	mov	dword [value],eax
1062
	mov	dword [value],eax
1063
	mov	[postbyte_register],0
1063
	mov	[postbyte_register],0
1064
	mov	[base_code],0F7h
1064
	mov	[base_code],0F7h
1065
	pop	cx bx edx
1065
	pop	ecx ebx edx
1066
	call	store_instruction_with_imm32
1066
	call	store_instruction_with_imm32
1067
	jmp	instruction_assembled
1067
	jmp	instruction_assembled
1068
      test_mem_imm_64bit:
1068
      test_mem_imm_64bit:
1069
	cmp	[size_declared],0
1069
	cmp	[size_declared],0
1070
	jne	long_immediate_not_encodable
1070
	jne	long_immediate_not_encodable
1071
	call	operand_64bit
1071
	call	operand_64bit
Line 1198... Line 1198...
1198
	cmp	al,'['
1198
	cmp	al,'['
1199
	jne	invalid_operand
1199
	jne	invalid_operand
1200
      xchg_mem:
1200
      xchg_mem:
1201
	call	get_address
1201
	call	get_address
1202
	push	edx bx cx
1202
	push	edx ebx ecx
1203
	lods	byte [esi]
1203
	lods	byte [esi]
1204
	cmp	al,','
1204
	cmp	al,','
1205
	jne	invalid_operand
1205
	jne	invalid_operand
1206
	lods	byte [esi]
1206
	lods	byte [esi]
1207
	call	get_size_operator
1207
	call	get_size_operator
1208
	cmp	al,10h
1208
	cmp	al,10h
Line 2053... Line 2053...
2053
	cmp	al,'['
2053
	cmp	al,'['
2054
	jne	invalid_operand
2054
	jne	invalid_operand
2055
      sh_mem:
2055
      sh_mem:
2056
	call	get_address
2056
	call	get_address
2057
	push	edx bx cx
2057
	push	edx ebx ecx
2058
	mov	al,[operand_size]
2058
	mov	al,[operand_size]
2059
	push	eax
2059
	push	eax
2060
	mov	[operand_size],0
2060
	mov	[operand_size],0
2061
	lods	byte [esi]
2061
	lods	byte [esi]
2062
	cmp	al,','
2062
	cmp	al,','
2063
	jne	invalid_operand
2063
	jne	invalid_operand
Line 2070... Line 2070...
2070
      sh_mem_reg:
2070
      sh_mem_reg:
2071
	lods	byte [esi]
2071
	lods	byte [esi]
2072
	cmp	al,11h
2072
	cmp	al,11h
2073
	jne	invalid_operand
2073
	jne	invalid_operand
2074
	pop	eax cx bx edx
2074
	pop	eax ecx ebx edx
2075
	cmp	al,1
2075
	cmp	al,1
2076
	je	sh_mem_cl_8bit
2076
	je	sh_mem_cl_8bit
2077
	jb	sh_mem_cl_nosize
2077
	jb	sh_mem_cl_nosize
2078
	call	operand_autodetect
2078
	call	operand_autodetect
2079
	mov	[base_code],0D3h
2079
	mov	[base_code],0D3h
2080
	call	store_instruction
2080
	call	store_instruction
Line 2097... Line 2097...
2097
	jne	invalid_operand_size
2097
	jne	invalid_operand_size
2098
      sh_mem_imm_size_ok:
2098
      sh_mem_imm_size_ok:
2099
	call	get_byte_value
2099
	call	get_byte_value
2100
	mov	byte [value],al
2100
	mov	byte [value],al
2101
	pop	eax cx bx edx
2101
	pop	eax ecx ebx edx
2102
	cmp	al,1
2102
	cmp	al,1
2103
	je	sh_mem_imm_8bit
2103
	je	sh_mem_imm_8bit
2104
	jb	sh_mem_imm_nosize
2104
	jb	sh_mem_imm_nosize
2105
	call	operand_autodetect
2105
	call	operand_autodetect
2106
	cmp	byte [value],1
2106
	cmp	byte [value],1
2107
	je	sh_mem_1
2107
	je	sh_mem_1
Line 2205... Line 2205...
2205
	cmp	al,'['
2205
	cmp	al,'['
2206
	jne	invalid_operand
2206
	jne	invalid_operand
2207
      shd_mem:
2207
      shd_mem:
2208
	call	get_address
2208
	call	get_address
2209
	push	edx bx cx
2209
	push	edx ebx ecx
2210
	lods	byte [esi]
2210
	lods	byte [esi]
2211
	cmp	al,','
2211
	cmp	al,','
2212
	jne	invalid_operand
2212
	jne	invalid_operand
2213
	lods	byte [esi]
2213
	lods	byte [esi]
2214
	call	get_size_operator
2214
	call	get_size_operator
2215
	cmp	al,10h
2215
	cmp	al,10h
Line 2231... Line 2231...
2231
	jne	invalid_operand
2231
	jne	invalid_operand
2232
	lods	byte [esi]
2232
	lods	byte [esi]
2233
	cmp	al,11h
2233
	cmp	al,11h
2234
	jne	invalid_operand
2234
	jne	invalid_operand
2235
	pop	eax cx bx edx
2235
	pop	eax ecx ebx edx
2236
	call	operand_autodetect
2236
	call	operand_autodetect
2237
	inc	[extended_code]
2237
	inc	[extended_code]
2238
	call	store_instruction
2238
	call	store_instruction
2239
	jmp	instruction_assembled
2239
	jmp	instruction_assembled
2240
      shd_mem_reg_imm:
2240
      shd_mem_reg_imm:
2241
	mov	al,[operand_size]
2241
	mov	al,[operand_size]
Line 2245... Line 2245...
2245
	jne	invalid_operand_size
2245
	jne	invalid_operand_size
2246
      shd_mem_reg_imm_size_ok:
2246
      shd_mem_reg_imm_size_ok:
2247
	call	get_byte_value
2247
	call	get_byte_value
2248
	mov	byte [value],al
2248
	mov	byte [value],al
2249
	pop	eax cx bx edx
2249
	pop	eax ecx ebx edx
2250
	call	operand_autodetect
2250
	call	operand_autodetect
2251
	call	store_instruction_with_imm8
2251
	call	store_instruction_with_imm8
2252
	jmp	instruction_assembled
2252
	jmp	instruction_assembled
2253
      shd_reg:
2253
      shd_reg:
2254
	lods	byte [esi]
2254
	lods	byte [esi]
2255
	call	convert_register
2255
	call	convert_register
Line 2420... Line 2420...
2420
	je	bt_reg
2420
	je	bt_reg
2421
	cmp	al,'['
2421
	cmp	al,'['
2422
	jne	invalid_operand
2422
	jne	invalid_operand
2423
	call	get_address
2423
	call	get_address
2424
	push	eax bx cx
2424
	push	eax ebx ecx
2425
	lods	byte [esi]
2425
	lods	byte [esi]
2426
	cmp	al,','
2426
	cmp	al,','
2427
	jne	invalid_operand
2427
	jne	invalid_operand
2428
	cmp	byte [esi],'('
2428
	cmp	byte [esi],'('
2429
	je	bt_mem_imm
2429
	je	bt_mem_imm
2430
	cmp	byte [esi],11h
2430
	cmp	byte [esi],11h
Line 2438... Line 2438...
2438
	jne	invalid_operand
2438
	jne	invalid_operand
2439
	lods	byte [esi]
2439
	lods	byte [esi]
2440
	call	convert_register
2440
	call	convert_register
2441
	mov	[postbyte_register],al
2441
	mov	[postbyte_register],al
2442
	pop	cx bx edx
2442
	pop	ecx ebx edx
2443
	mov	al,ah
2443
	mov	al,ah
2444
	call	operand_autodetect
2444
	call	operand_autodetect
2445
	call	store_instruction
2445
	call	store_instruction
2446
	jmp	instruction_assembled
2446
	jmp	instruction_assembled
2447
      bt_mem_imm:
2447
      bt_mem_imm:
2448
	xor	al,al
2448
	xor	al,al
Line 2464... Line 2464...
2464
	or	al,al
2464
	or	al,al
2465
	jz	bt_mem_imm_nosize
2465
	jz	bt_mem_imm_nosize
2466
	call	operand_autodetect
2466
	call	operand_autodetect
2467
      bt_mem_imm_store:
2467
      bt_mem_imm_store:
2468
	pop	cx bx edx
2468
	pop	ecx ebx edx
2469
	mov	[extended_code],0BAh
2469
	mov	[extended_code],0BAh
2470
	call	store_instruction_with_imm8
2470
	call	store_instruction_with_imm8
2471
	jmp	instruction_assembled
2471
	jmp	instruction_assembled
2472
      bt_mem_imm_nosize:
2472
      bt_mem_imm_nosize:
2473
	cmp	[error_line],0
2473
	cmp	[error_line],0
2474
	jne	bt_mem_imm_store
2474
	jne	bt_mem_imm_store
Line 2618... Line 2618...
2618
	cmp	al,'['
2618
	cmp	al,'['
2619
	jne	invalid_operand
2619
	jne	invalid_operand
2620
      imul_reg_mem:
2620
      imul_reg_mem:
2621
	call	get_address
2621
	call	get_address
2622
	push	edx bx cx
2622
	push	edx ebx ecx
2623
	cmp	byte [esi],','
2623
	cmp	byte [esi],','
2624
	je	imul_reg_mem_imm
2624
	je	imul_reg_mem_imm
2625
	mov	al,[operand_size]
2625
	mov	al,[operand_size]
2626
	call	operand_autodetect
2626
	call	operand_autodetect
2627
	pop	cx bx edx
2627
	pop	ecx ebx edx
2628
	mov	[base_code],0Fh
2628
	mov	[base_code],0Fh
2629
	mov	[extended_code],0AFh
2629
	mov	[extended_code],0AFh
2630
	call	store_instruction
2630
	call	store_instruction
2631
	jmp	instruction_assembled
2631
	jmp	instruction_assembled
2632
      imul_reg_mem_imm:
2632
      imul_reg_mem_imm:
2633
	inc	esi
2633
	inc	esi
Line 2655... Line 2655...
2655
	jl	imul_reg_mem_imm_16bit_store
2655
	jl	imul_reg_mem_imm_16bit_store
2656
	cmp	ax,80h
2656
	cmp	ax,80h
2657
	jl	imul_reg_mem_imm_8bit_store
2657
	jl	imul_reg_mem_imm_8bit_store
2658
      imul_reg_mem_imm_16bit_store:
2658
      imul_reg_mem_imm_16bit_store:
2659
	pop	cx bx edx
2659
	pop	ecx ebx edx
2660
	mov	[base_code],69h
2660
	mov	[base_code],69h
2661
	call	store_instruction_with_imm16
2661
	call	store_instruction_with_imm16
2662
	jmp	instruction_assembled
2662
	jmp	instruction_assembled
2663
      imul_reg_mem_imm_32bit:
2663
      imul_reg_mem_imm_32bit:
2664
	call	operand_32bit
2664
	call	operand_32bit
2665
	call	get_dword_value
2665
	call	get_dword_value
Line 2673... Line 2673...
2673
	jl	imul_reg_mem_imm_32bit_store
2673
	jl	imul_reg_mem_imm_32bit_store
2674
	cmp	eax,80h
2674
	cmp	eax,80h
2675
	jl	imul_reg_mem_imm_8bit_store
2675
	jl	imul_reg_mem_imm_8bit_store
2676
      imul_reg_mem_imm_32bit_store:
2676
      imul_reg_mem_imm_32bit_store:
2677
	pop	cx bx edx
2677
	pop	ecx ebx edx
2678
	mov	[base_code],69h
2678
	mov	[base_code],69h
2679
	call	store_instruction_with_imm32
2679
	call	store_instruction_with_imm32
2680
	jmp	instruction_assembled
2680
	jmp	instruction_assembled
2681
      imul_reg_mem_imm_64bit:
2681
      imul_reg_mem_imm_64bit:
2682
	cmp	[size_declared],0
2682
	cmp	[size_declared],0
2683
	jne	long_immediate_not_encodable
2683
	jne	long_immediate_not_encodable
Line 2686... Line 2686...
2686
	cmp	[value_type],4
2686
	cmp	[value_type],4
2687
	jae	long_immediate_not_encodable
2687
	jae	long_immediate_not_encodable
2688
	jmp	imul_reg_mem_imm_32bit_ok
2688
	jmp	imul_reg_mem_imm_32bit_ok
2689
      imul_reg_mem_imm_8bit_store:
2689
      imul_reg_mem_imm_8bit_store:
2690
	pop	cx bx edx
2690
	pop	ecx ebx edx
2691
	mov	[base_code],6Bh
2691
	mov	[base_code],6Bh
2692
	call	store_instruction_with_imm8
2692
	call	store_instruction_with_imm8
2693
	jmp	instruction_assembled
2693
	jmp	instruction_assembled
2694
      imul_reg_imm:
2694
      imul_reg_imm:
2695
	mov	bl,[postbyte_register]
2695
	mov	bl,[postbyte_register]
2696
	dec	esi
2696
	dec	esi
Line 3166... Line 3166...
3166
	mov	eax,edx
3166
	mov	eax,edx
3167
	stos	word [edi]
3167
	stos	word [edi]
3168
	jmp	instruction_assembled
3168
	jmp	instruction_assembled
3169
      calculate_jump_offset:
3169
      calculate_jump_offset:
3170
	cmp	[value_undefined],0
3170
	add	edi,2
3171
	jne	jump_offset_ok
-
 
3172
	add	eax,dword [org_origin]
-
 
3173
	adc	edx,dword [org_origin+4]
-
 
3174
	lea	ebx,[edi+2]
-
 
3175
	sub	eax,ebx
-
 
3176
	sbb	edx,0
-
 
3177
	mov	bl,[value_type]
3171
	call	calculate_relative_offset
3178
	or	bl,bl
3172
	sub	edi,2
3179
	je	jump_offset_ok
-
 
3180
	test	bl,1
-
 
3181
	jnz	invalid_use_of_symbol
3173
	ret
3182
	cmp	bl,[labels_type]
-
 
3183
	jne	invalid_use_of_symbol
-
 
3184
	mov	[value_type],0
-
 
3185
	mov	ecx,[symbol_identifier]
-
 
3186
	cmp	ecx,[org_symbol]
-
 
3187
	je	jump_offset_ok
-
 
3188
	mov	[value_type],3
-
 
3189
      jump_offset_ok:
-
 
3190
	ret
-
 
3191
      check_for_short_jump:
3174
      check_for_short_jump:
3192
	cmp	[jump_type],1
3175
	cmp	[jump_type],1
3193
	je	forced_short
3176
	je	forced_short
3194
	ja	no_short_jump
3177
	ja	no_short_jump
3195
	cmp	[base_code],0E8h
3178
	cmp	[base_code],0E8h
Line 3608... Line 3591...
3608
	jnz	invalid_address
3591
	jnz	invalid_address
3609
	or	bl,ch
3592
	or	bl,ch
3610
	jnz	invalid_address
3593
	jnz	invalid_address
3611
	mov	al,[segment_register]
3594
	mov	al,[segment_register]
3612
	push	ax bx
3595
	push	eax ebx
3613
	lods	byte [esi]
3596
	lods	byte [esi]
3614
	cmp	al,','
3597
	cmp	al,','
3615
	jne	invalid_operand
3598
	jne	invalid_operand
3616
	lods	byte [esi]
3599
	lods	byte [esi]
3617
	call	get_size_operator
3600
	call	get_size_operator
3618
	cmp	al,'['
3601
	cmp	al,'['
Line 3621... Line 3604...
3621
	or	eax,eax
3604
	or	eax,eax
3622
	jnz	invalid_address
3605
	jnz	invalid_address
3623
	or	bl,ch
3606
	or	bl,ch
3624
	jnz	invalid_address
3607
	jnz	invalid_address
3625
	pop	dx ax
3608
	pop	edx eax
3626
	cmp	[segment_register],1
3609
	cmp	[segment_register],1
3627
	ja	invalid_address
3610
	ja	invalid_address
3628
	mov	[segment_register],al
3611
	mov	[segment_register],al
3629
	mov	al,dh
3612
	mov	al,dh
3630
	mov	ah,bh
3613
	mov	ah,bh
3631
	shr	al,4
3614
	shr	al,4
Line 3952... Line 3935...
3952
	je	basic_486_reg
3935
	je	basic_486_reg
3953
	cmp	al,'['
3936
	cmp	al,'['
3954
	jne	invalid_operand
3937
	jne	invalid_operand
3955
	call	get_address
3938
	call	get_address
3956
	push	edx bx cx
3939
	push	edx ebx ecx
3957
	lods	byte [esi]
3940
	lods	byte [esi]
3958
	cmp	al,','
3941
	cmp	al,','
3959
	jne	invalid_operand
3942
	jne	invalid_operand
3960
	lods	byte [esi]
3943
	lods	byte [esi]
3961
	call	get_size_operator
3944
	call	get_size_operator
3962
	cmp	al,10h
3945
	cmp	al,10h
3963
	jne	invalid_operand
3946
	jne	invalid_operand
3964
	lods	byte [esi]
3947
	lods	byte [esi]
3965
	call	convert_register
3948
	call	convert_register
3966
	mov	[postbyte_register],al
3949
	mov	[postbyte_register],al
3967
	pop	cx bx edx
3950
	pop	ecx ebx edx
3968
	mov	al,ah
3951
	mov	al,ah
3969
	cmp	al,1
3952
	cmp	al,1
3970
	je	basic_486_mem_reg_8bit
3953
	je	basic_486_mem_reg_8bit
3971
	call	operand_autodetect
3954
	call	operand_autodetect
3972
	inc	[extended_code]
3955
	inc	[extended_code]
3973
      basic_486_mem_reg_8bit:
3956
      basic_486_mem_reg_8bit:
Line 4044... Line 4027...
4044
	call	operand_64bit
4027
	call	operand_64bit
4045
      cmpxchgx_store:
4028
      cmpxchgx_store:
4046
	call	store_instruction
4029
	call	store_instruction
4047
	jmp	instruction_assembled
4030
	jmp	instruction_assembled
4048
 
4031
nop_instruction:
-
 
4032
	mov	ah,[esi]
-
 
4033
	cmp	ah,10h
-
 
4034
	je	extended_nop
-
 
4035
	cmp	ah,11h
-
 
4036
	je	extended_nop
-
 
4037
	cmp	ah,'['
-
 
4038
	je	extended_nop
-
 
4039
	stos	byte [edi]
-
 
4040
	jmp	instruction_assembled
-
 
4041
      extended_nop:
-
 
4042
	mov	[base_code],0Fh
-
 
4043
	mov	[extended_code],1Fh
-
 
4044
	mov	[postbyte_register],0
-
 
4045
	lods	byte [esi]
-
 
4046
	call	get_size_operator
-
 
4047
	cmp	al,10h
-
 
4048
	je	extended_nop_reg
-
 
4049
	cmp	al,'['
-
 
4050
	jne	invalid_operand
-
 
4051
	call	get_address
-
 
4052
	mov	al,[operand_size]
-
 
4053
	or	al,al
-
 
4054
	jz	extended_nop_nosize
-
 
4055
	call	operand_autodetect
-
 
4056
      extended_nop_store:
-
 
4057
	call	store_instruction
-
 
4058
	jmp	instruction_assembled
-
 
4059
      extended_nop_nosize:
-
 
4060
	cmp	[error_line],0
-
 
4061
	jne	extended_nop_store
-
 
4062
	mov	eax,[current_line]
-
 
4063
	mov	[error_line],eax
-
 
4064
	mov	[error],operand_size_not_specified
-
 
4065
	jmp	extended_nop_store
-
 
4066
      extended_nop_reg:
-
 
4067
	lods	byte [esi]
-
 
4068
	call	convert_register
-
 
4069
	mov	bl,al
-
 
4070
	mov	al,ah
-
 
4071
	call	operand_autodetect
-
 
4072
	call	store_nomem_instruction
-
 
4073
	jmp	instruction_assembled
-
 
4074
 
Line 4049... Line 4075...
4049
basic_fpu_instruction:
4075
basic_fpu_instruction:
4050
	mov	[postbyte_register],al
4076
	mov	[postbyte_register],al
4051
	mov	[base_code],0D8h
4077
	mov	[base_code],0D8h
4052
	lods	byte [esi]
4078
	lods	byte [esi]
Line 4470... Line 4496...
4470
	mov	al,dh
4496
	mov	al,dh
4471
	stos	word [edi]
4497
	stos	word [edi]
4472
	jmp	instruction_assembled
4498
	jmp	instruction_assembled
4473
 
4499
 
Line 4474... Line 4500...
4474
mmx_instruction:
4500
basic_mmx_instruction:
4475
	mov	[base_code],0Fh
4501
	mov	[base_code],0Fh
4476
	mov	[extended_code],al
4502
	mov	[extended_code],al
-
 
4503
      mmx_instruction:
4477
	lods	byte [esi]
4504
	lods	byte [esi]
4478
	call	get_size_operator
4505
	call	get_size_operator
4479
	cmp	al,10h
4506
	cmp	al,10h
4480
	jne	invalid_operand
4507
	jne	invalid_operand
4481
	lods	byte [esi]
4508
	lods	byte [esi]
Line 4571... Line 4598...
4571
	je	mmx_nomem_imm8
4598
	je	mmx_nomem_imm8
4572
	call	store_nomem_instruction
4599
	call	store_nomem_instruction
4573
	jmp	instruction_assembled
4600
	jmp	instruction_assembled
4574
      mmx_imm8:
4601
      mmx_imm8:
4575
	push	bx cx edx
4602
	push	ebx ecx edx
4576
	mov	[operand_size],0
4603
	mov	[operand_size],0
4577
	lods	byte [esi]
4604
	lods	byte [esi]
4578
	cmp	al,','
4605
	cmp	al,','
4579
	jne	invalid_operand
4606
	jne	invalid_operand
4580
	lods	byte [esi]
4607
	lods	byte [esi]
4581
	call	get_size_operator
4608
	call	get_size_operator
Line 4584... Line 4611...
4584
	cmp	al,'('
4611
	cmp	al,'('
4585
	jne	invalid_operand
4612
	jne	invalid_operand
4586
	call	get_byte_value
4613
	call	get_byte_value
4587
	mov	byte [value],al
4614
	mov	byte [value],al
4588
	pop	edx cx bx
4615
	pop	edx ecx ebx
4589
	call	store_instruction_with_imm8
4616
	call	store_instruction_with_imm8
4590
	jmp	instruction_assembled
4617
	jmp	instruction_assembled
4591
      mmx_nomem_imm8:
4618
      mmx_nomem_imm8:
4592
	call	store_nomem_instruction
4619
	call	store_nomem_instruction
4593
	mov	[operand_size],0
4620
	mov	[operand_size],0
4594
	lods	byte [esi]
4621
	lods	byte [esi]
Line 5316... Line 5343...
5316
	jz	sse_cmp_size_ok
5343
	jz	sse_cmp_size_ok
5317
	cmp	al,[mmx_size]
5344
	cmp	al,[mmx_size]
5318
	jne	invalid_operand_size
5345
	jne	invalid_operand_size
5319
      sse_cmp_size_ok:
5346
      sse_cmp_size_ok:
5320
	push	bx cx edx
5347
	push	ebx ecx edx
5321
	call	get_nextbyte
5348
	call	get_nextbyte
5322
	pop	edx cx bx
5349
	pop	edx ecx ebx
5323
	call	store_instruction_with_imm8
5350
	call	store_instruction_with_imm8
5324
	jmp	instruction_assembled
5351
	jmp	instruction_assembled
5325
      sse_cmp_xmmreg_xmmreg:
5352
      sse_cmp_xmmreg_xmmreg:
5326
	lods	byte [esi]
5353
	lods	byte [esi]
5327
	call	convert_mmx_register
5354
	call	convert_mmx_register
5328
	cmp	ah,16
5355
	cmp	ah,16
Line 5480... Line 5507...
5480
	cmp	ah,8
5507
	cmp	ah,8
5481
	jne	invalid_operand_size
5508
	jne	invalid_operand_size
5482
	call	operand_64bit
5509
	call	operand_64bit
5483
	jmp	sse_reg
5510
	jmp	sse_reg
5484
amd3dnow_instruction:
5511
 
-
 
5512
ssse3_instruction:
-
 
5513
	mov	[base_code],0Fh
-
 
5514
	mov	[extended_code],38h
-
 
5515
	mov	[supplemental_code],al
-
 
5516
	jmp	mmx_instruction
-
 
5517
palignr_instruction:
-
 
5518
	mov	[base_code],0Fh
-
 
5519
	mov	[extended_code],3Ah
-
 
5520
	mov	[supplemental_code],0Fh
-
 
5521
	lods	byte [esi]
-
 
5522
	call	get_size_operator
-
 
5523
	cmp	al,10h
-
 
5524
	jne	invalid_operand
-
 
5525
	lods	byte [esi]
-
 
5526
	call	convert_mmx_register
-
 
5527
	call	make_mmx_prefix
-
 
5528
	mov	[postbyte_register],al
-
 
5529
	lods	byte [esi]
-
 
5530
	cmp	al,','
-
 
5531
	jne	invalid_operand
-
 
5532
	lods	byte [esi]
-
 
5533
	call	get_size_operator
-
 
5534
	cmp	al,10h
-
 
5535
	je	palignr_mmreg_mmreg
-
 
5536
	cmp	al,'['
-
 
5537
	jne	invalid_operand
-
 
5538
	call	get_address
-
 
5539
	jmp	mmx_imm8
-
 
5540
      palignr_mmreg_mmreg:
-
 
5541
	lods	byte [esi]
-
 
5542
	call	convert_mmx_register
-
 
5543
	mov	bl,al
-
 
5544
	jmp	mmx_nomem_imm8
-
 
5545
amd3dnow_instruction:
5485
	mov	[base_code],0Fh
5546
	mov	[base_code],0Fh
5486
	mov	[extended_code],0Fh
5547
	mov	[extended_code],0Fh
5487
	mov	byte [value],al
5548
	mov	byte [value],al
5488
	lods	byte [esi]
5549
	lods	byte [esi]
5489
	call	get_size_operator
5550
	call	get_size_operator
Line 5946... Line 6007...
5946
	test	ch,0Fh
6007
	test	ch,0Fh
5947
	jnz	address_ok
6008
	jnz	address_ok
5948
      calculate_relative_address:
6009
      calculate_relative_address:
5949
	call	calculate_relative_offset
6010
	call	calculate_relative_offset
5950
	cmp	byte [esi-1],']'
6011
	mov	[address_high],edx
5951
	jne	invalid_address
-
 
5952
	mov	[address_high],edx
-
 
5953
	mov	edx,[symbol_identifier]
6012
	mov	edx,[symbol_identifier]
5954
	mov	[address_symbol],edx
6013
	mov	[address_symbol],edx
5955
	mov	edx,eax
6014
	mov	edx,eax
5956
	mov	ch,[value_type]
6015
	mov	bx,0FF00h
5957
	mov	bx,0FF00h
-
 
5958
	xor	cl,cl
6016
      address_ok:
5959
      address_ok:
-
 
5960
	ret
6017
	ret
5961
 
6018
 
Line 5962... Line 6019...
5962
operand_16bit:
6019
operand_16bit:
5963
	cmp	[code_type],16
6020
	cmp	[code_type],16
Line 6049... Line 6106...
6049
	jne	instruction_code_ok
6106
	jne	instruction_code_ok
6050
      store_extended_code:
6107
      store_extended_code:
6051
	mov	al,[extended_code]
6108
	mov	al,[extended_code]
6052
	stos	byte [edi]
6109
	stos	byte [edi]
6053
      instruction_code_ok:
6110
	cmp	al,38h
-
 
6111
	je	store_supplemental_code
-
 
6112
	cmp	al,3Ah
-
 
6113
	je	store_supplemental_code
-
 
6114
      instruction_code_ok:
6054
	ret
6115
	ret
6055
store_nomem_instruction:
6116
      store_supplemental_code:
-
 
6117
	mov	al,[supplemental_code]
-
 
6118
	stos	byte [edi]
-
 
6119
	ret
-
 
6120
store_nomem_instruction:
6056
	test	[postbyte_register],1000b
6121
	test	[postbyte_register],1000b
6057
	jz	nomem_reg_code_ok
6122
	jz	nomem_reg_code_ok
6058
	or	[rex_prefix],44h
6123
	or	[rex_prefix],44h
6059
	and	[postbyte_register],111b
6124
	and	[postbyte_register],111b
6060
      nomem_reg_code_ok:
6125
      nomem_reg_code_ok:
Line 6371... Line 6436...
6371
	stos	byte [edi]
6436
	stos	byte [edi]
6372
      store_address_32bit_value:
6437
      store_address_32bit_value:
6373
	test	ch,0F0h
6438
	test	ch,0F0h
6374
	jz	address_32bit_relocation_ok
6439
	jz	address_32bit_relocation_ok
6375
	mov	al,2
6440
	mov	eax,ecx
6376
	xchg	[value_type],al
6441
	shr	eax,16
-
 
6442
	xchg	[value_type],al
6377
	mov	ebx,[address_symbol]
6443
	mov	ebx,[address_symbol]
6378
	xchg	ebx,[symbol_identifier]
6444
	xchg	ebx,[symbol_identifier]
6379
	call	mark_relocation
6445
	call	mark_relocation
6380
	mov	[value_type],al
6446
	mov	[value_type],al
6381
	mov	[symbol_identifier],ebx
6447
	mov	[symbol_identifier],ebx
Line 6385... Line 6451...
6385
	ret
6451
	ret
6386
      store_address_64bit_value:
6452
      store_address_64bit_value:
6387
	test	ch,0F0h
6453
	test	ch,0F0h
6388
	jz	address_64bit_relocation_ok
6454
	jz	address_64bit_relocation_ok
6389
	mov	al,4
6455
	mov	eax,ecx
6390
	xchg	[value_type],al
6456
	shr	eax,16
-
 
6457
	xchg	[value_type],al
6391
	mov	ebx,[address_symbol]
6458
	mov	ebx,[address_symbol]
6392
	xchg	ebx,[symbol_identifier]
6459
	xchg	ebx,[symbol_identifier]
6393
	call	mark_relocation
6460
	call	mark_relocation
6394
	mov	[value_type],al
6461
	mov	[value_type],al
6395
	mov	[symbol_identifier],ebx
6462
	mov	[symbol_identifier],ebx
Line 6401... Line 6468...
6401
	ret
6468
	ret
6402
      address_immediate_sib:
6469
      address_immediate_sib:
6403
	test	ch,not 44h
6470
	test	ch,not 44h
6404
	jnz	invalid_address_size
6471
	jnz	invalid_address_size
6405
	cmp	[value_type],0
6472
	test	ecx,0FF0000h
6406
	jne	address_immediate_sib_nosignextend
6473
	jnz	address_immediate_sib_nosignextend
6407
	test	edx,80000000h
6474
	test	edx,80000000h
6408
	jz	address_immediate_sib_prefix_ok
6475
	jz	address_immediate_sib_prefix_ok
6409
      address_immediate_sib_nosignextend:
6476
      address_immediate_sib_nosignextend:
6410
	call	address_32bit_prefix
6477
	call	address_32bit_prefix
6411
      address_immediate_sib_prefix_ok:
6478
      address_immediate_sib_prefix_ok:
6412
	call	store_instruction_code
6479
	call	store_instruction_code
Line 6434... Line 6501...
6434
	mov	cl,[postbyte_register]
6501
	mov	cl,[postbyte_register]
6435
	shl	cl,3
6502
	shl	cl,3
6436
	or	al,cl
6503
	or	al,cl
6437
	stos	byte [edi]
6504
	stos	byte [edi]
6438
	xchg	[value_type],ch
6505
	shr	ecx,16
-
 
6506
	xchg	[value_type],cl
6439
	mov	ebx,[address_symbol]
6507
	mov	ebx,[address_symbol]
6440
	xchg	ebx,[symbol_identifier]
6508
	xchg	ebx,[symbol_identifier]
6441
	mov	eax,edx
6509
	mov	eax,edx
6442
	call	mark_relocation
6510
	call	mark_relocation
6443
	mov	[value_type],ch
6511
	mov	[value_type],cl
6444
	mov	[symbol_identifier],ebx
6512
	mov	[symbol_identifier],ebx
6445
	stos	dword [edi]
6513
	stos	dword [edi]
6446
	ret
6514
	ret
6447
      addressing_16bit:
6515
      addressing_16bit:
6448
	cmp	edx,10000h
6516
	cmp	edx,10000h
6449
	jge	address_immediate_32bit
6517
	jge	address_immediate_32bit