Subversion Repositories Kolibri OS

Rev

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

Rev 1189 Rev 2287
Line 1... Line 1...
1
; flat assembler core
1
; flat assembler core
2
; Copyright (c) 1999-2009, Tomasz Grysztar.
2
; Copyright (c) 1999-2011, Tomasz Grysztar.
3
; All rights reserved.
3
; All rights reserved.
Line 4... Line 4...
4
 
4
 
5
assembler:
5
assembler:
6
	xor	eax,eax
6
	xor	eax,eax
7
	mov	[stub_size],eax
-
 
8
	mov	[number_of_sections],eax
7
	mov	[stub_size],eax
9
	mov	[current_pass],ax
8
	mov	[current_pass],ax
-
 
9
	mov	[resolver_flags],eax
-
 
10
	mov	[number_of_sections],eax
10
	mov	[resolver_flags],eax
11
	mov	[actual_fixups_size],eax
11
      assembler_loop:
12
      assembler_loop:
12
	mov	eax,[labels_list]
13
	mov	eax,[labels_list]
13
	mov	[display_buffer],eax
14
	mov	[display_buffer],eax
14
	mov	eax,[additional_memory]
15
	mov	eax,[additional_memory]
Line 113... Line 114...
113
	mov	eax,[error_line]
114
	mov	eax,[error_line]
114
	or	eax,eax
115
	or	eax,eax
115
	jz	assemble_ok
116
	jz	assemble_ok
116
	mov	[current_line],eax
117
	mov	[current_line],eax
117
	call	error_handler
118
	cmp	[error],undefined_symbol
-
 
119
	jne	error_confirmed
-
 
120
	mov	eax,[error_info]
-
 
121
	or	eax,eax
-
 
122
	jz	error_confirmed
-
 
123
	test	byte [eax+8],1
-
 
124
	jnz	next_pass
-
 
125
      error_confirmed:
-
 
126
	call	error_handler
118
      error_handler:
127
      error_handler:
119
	mov	eax,[error]
128
	mov	eax,[error]
120
	sub	eax,error_handler
129
	sub	eax,error_handler
121
	add	[esp],eax
130
	add	[esp],eax
122
	ret
131
	ret
Line 358... Line 367...
358
      assemble_instruction:
367
      assemble_instruction:
359
;        mov     [operand_size],0
368
;        mov     [operand_size],0
360
;        mov     [size_override],0
369
;        mov     [size_override],0
361
;        mov     [operand_prefix],0
370
;        mov     [operand_prefix],0
362
;        mov     [rex_prefix],0
371
;        mov     [opcode_prefix],0
363
	mov	dword [operand_size],0
372
	mov	dword [operand_size],0
364
	mov	[opcode_prefix],0
373
;        mov     [rex_prefix],0
365
	mov	[immediate_size],0
374
;        mov     [vex_required],0
-
 
375
;        mov     [vex_register],0
-
 
376
;        mov     [immediate_size],0
366
	call	instruction_handler
377
	mov	dword [rex_prefix],0
-
 
378
	call	instruction_handler
367
      instruction_handler:
379
      instruction_handler:
368
	movzx	ebx,word [esi]
380
	movzx	ebx,word [esi]
369
	mov	al,[esi+2]
381
	mov	al,[esi+2]
370
	add	esi,3
382
	add	esi,3
371
	add	[esp],ebx
383
	add	[esp],ebx
Line 382... Line 394...
382
      source_end:
394
      source_end:
383
	dec	esi
395
	dec	esi
384
	stc
396
	stc
385
	ret
397
	ret
386
skip_line:
398
 
387
	call	skip_symbol
-
 
388
	jnc	skip_line
-
 
389
	ret
-
 
390
skip_symbol:
-
 
391
	lods	byte [esi]
-
 
392
	or	al,al
-
 
393
	jz	nothing_to_skip
-
 
394
	cmp	al,0Fh
-
 
395
	je	nothing_to_skip
-
 
396
	cmp	al,1
-
 
397
	je	skip_instruction
-
 
398
	cmp	al,2
-
 
399
	je	skip_label
-
 
400
	cmp	al,3
-
 
401
	je	skip_label
-
 
402
	cmp	al,20h
-
 
403
	jb	skip_assembler_symbol
-
 
404
	cmp	al,'('
-
 
405
	je	skip_expression
-
 
406
	cmp	al,'['
-
 
407
	je	skip_address
-
 
408
      skip_done:
-
 
409
	clc
-
 
410
	ret
-
 
411
      skip_label:
-
 
412
	add	esi,2
-
 
413
      skip_instruction:
-
 
414
	add	esi,2
-
 
415
      skip_assembler_symbol:
-
 
416
	inc	esi
-
 
417
	jmp	skip_done
-
 
418
      skip_address:
-
 
419
	mov	al,[esi]
-
 
420
	and	al,11110000b
-
 
421
	cmp	al,60h
-
 
422
	jb	skip_expression
-
 
423
	cmp	al,70h
-
 
424
	ja	skip_expression
-
 
425
	inc	esi
-
 
426
	jmp	skip_address
-
 
427
      skip_expression:
-
 
428
	lods	byte [esi]
-
 
429
	or	al,al
-
 
430
	jz	skip_string
-
 
431
	cmp	al,'.'
-
 
432
	je	skip_fp_value
-
 
433
	cmp	al,')'
-
 
434
	je	skip_done
-
 
435
	cmp	al,']'
-
 
436
	je	skip_done
-
 
437
	cmp	al,'!'
-
 
438
	je	skip_expression
-
 
439
	cmp	al,0Fh
-
 
440
	je	skip_expression
-
 
441
	cmp	al,10h
-
 
442
	je	skip_register
-
 
443
	cmp	al,11h
-
 
444
	je	skip_label_value
-
 
445
	cmp	al,80h
-
 
446
	jae	skip_expression
-
 
447
	movzx	eax,al
-
 
448
	add	esi,eax
-
 
449
	jmp	skip_expression
-
 
450
      skip_label_value:
-
 
451
	add	esi,3
-
 
452
      skip_register:
-
 
453
	inc	esi
-
 
454
	jmp	skip_expression
-
 
455
      skip_fp_value:
-
 
456
	add	esi,12
-
 
457
	jmp	skip_done
-
 
458
      skip_string:
-
 
459
	lods	dword [esi]
-
 
460
	add	esi,eax
-
 
461
	inc	esi
-
 
462
	jmp	skip_done
-
 
463
      nothing_to_skip:
-
 
464
	dec	esi
-
 
465
	stc
-
 
466
	ret
-
 
467
 
-
 
Line 468... Line 399...
468
org_directive:
399
org_directive:
469
	lods	byte [esi]
400
	lods	byte [esi]
470
	cmp	al,'('
401
	cmp	al,'('
471
	jne	invalid_argument
402
	jne	invalid_argument
Line 574... Line 505...
574
	cmp	edx,[ebx+4]
505
	cmp	edx,[ebx+4]
575
	mov	[ebx+4],edx
506
	mov	[ebx+4],edx
576
	setne	al
507
	setne	al
577
	or	ah,al
508
	or	ah,al
578
	jmp	finish_label
509
      finish_label:
579
      finish_label:
-
 
580
	cmp	cl,[ebx+10]
510
	cmp	cl,[ebx+10]
581
	mov	[ebx+10],cl
511
	mov	[ebx+10],cl
582
	setne	al
512
	setne	al
583
	or	ah,al
513
	or	ah,al
584
	cmp	ch,[ebx+11]
514
	cmp	ch,[ebx+11]
Line 816... Line 746...
816
	cmp	al,'('
746
	cmp	al,'('
817
	jne	invalid_argument
747
	jne	invalid_argument
818
	cmp	byte [esi],'.'
748
	cmp	byte [esi],'.'
819
	je	invalid_value
749
	je	invalid_value
820
	call	get_dword_value
750
	call	get_count_value
821
	cmp	[next_pass_needed],0
751
	cmp	eax,0
822
	jne	times_value_ok
-
 
823
	cmp	[value_type],0
-
 
824
	jne	invalid_use_of_symbol
-
 
825
      times_value_ok:
-
 
826
	cmp	eax,0
-
 
827
	je	zero_times
752
	je	zero_times
828
	jl	negative_times
753
	cmp	byte [esi],':'
829
	cmp	byte [esi],':'
-
 
830
	jne	times_argument_ok
754
	jne	times_argument_ok
831
	inc	esi
755
	inc	esi
832
      times_argument_ok:
756
      times_argument_ok:
833
	push	[counter]
757
	push	[counter]
834
	push	[counter_limit]
758
	push	[counter_limit]
Line 853... Line 777...
853
	pop	eax
777
	pop	eax
854
	pop	[counter_limit]
778
	pop	[counter_limit]
855
	pop	[counter]
779
	pop	[counter]
856
	jmp	instruction_assembled
780
	jmp	instruction_assembled
857
      negative_times:
781
      zero_times:
858
	cmp	[error_line],0
-
 
859
	jne	zero_times
-
 
860
	mov	eax,[current_line]
-
 
861
	mov	[error_line],eax
-
 
862
	mov	[error],invalid_value
-
 
863
      zero_times:
-
 
864
	call	skip_line
782
	call	skip_symbol
865
	jmp	instruction_assembled
783
	jnc	zero_times
-
 
784
	jmp	instruction_assembled
866
 
785
 
Line 867... Line 786...
867
virtual_directive:
786
virtual_directive:
868
	lods	byte [esi]
787
	lods	byte [esi]
869
	cmp	al,80h
788
	cmp	al,80h
Line 971... Line 890...
971
	mov	[org_symbol],eax
890
	mov	[org_symbol],eax
972
	mov	edi,[ebx+8]
891
	mov	edi,[ebx+8]
973
      remove_structure_data:
892
      remove_structure_data:
974
	push	esi edi
893
	push	esi edi
975
	mov	esi,[structures_buffer]
894
	mov	ecx,ebx
976
	mov	ecx,ebx
-
 
977
	sub	ecx,esi
895
	sub	ecx,[structures_buffer]
978
	lea	edi,[esi+20h]
-
 
979
	mov	[structures_buffer],edi
-
 
980
	shr	ecx,2
896
	shr	ecx,2
981
	rep	movs dword [edi],[esi]
897
	lea	esi,[ebx-4]
-
 
898
	lea	edi,[esi+20h]
-
 
899
	std
-
 
900
	rep	movs dword [edi],[esi]
982
	pop	edi esi
901
	cld
-
 
902
	add	[structures_buffer],20h
-
 
903
	pop	edi esi
983
	ret
904
	ret
984
repeat_directive:
905
repeat_directive:
985
	cmp	[prefixed_instruction],0
906
	cmp	[prefixed_instruction],0
986
	jne	unexpected_instruction
907
	jne	unexpected_instruction
987
	lods	byte [esi]
908
	lods	byte [esi]
988
	cmp	al,'('
909
	cmp	al,'('
989
	jne	invalid_argument
910
	jne	invalid_argument
990
	cmp	byte [esi],'.'
911
	cmp	byte [esi],'.'
991
	je	invalid_value
912
	je	invalid_value
992
	call	get_dword_value
913
	call	get_count_value
993
	cmp	[next_pass_needed],0
914
	cmp	eax,0
994
	jne	repeat_value_ok
-
 
995
	cmp	[value_type],0
-
 
996
	jne	invalid_use_of_symbol
-
 
997
      repeat_value_ok:
-
 
998
	cmp	eax,0
-
 
999
	je	zero_repeat
915
	je	zero_repeat
1000
	jl	negative_repeat
916
	call	allocate_structure_data
1001
	call	allocate_structure_data
-
 
1002
	mov	word [ebx],repeat_directive-instruction_handler
917
	mov	word [ebx],repeat_directive-instruction_handler
1003
	xchg	eax,[counter_limit]
918
	xchg	eax,[counter_limit]
1004
	mov	[ebx+10h],eax
919
	mov	[ebx+10h],eax
1005
	mov	eax,1
920
	mov	eax,1
1006
	xchg	eax,[counter]
921
	xchg	eax,[counter]
Line 1027... Line 942...
1027
	jmp	instruction_assembled
942
	jmp	instruction_assembled
1028
      continue_repeating:
943
      continue_repeating:
1029
	mov	esi,[ebx+8]
944
	mov	esi,[ebx+8]
1030
	jmp	instruction_assembled
945
	jmp	instruction_assembled
1031
      negative_repeat:
946
      zero_repeat:
1032
	cmp	[error_line],0
-
 
1033
	jne	zero_repeat
-
 
1034
	mov	eax,[current_line]
-
 
1035
	mov	[error_line],eax
-
 
1036
	mov	[error],invalid_value
-
 
1037
      zero_repeat:
-
 
1038
	mov	al,[esi]
947
	mov	al,[esi]
1039
	or	al,al
948
	or	al,al
1040
	jz	missing_end_directive
949
	jz	missing_end_directive
1041
	cmp	al,0Fh
950
	cmp	al,0Fh
1042
	jne	extra_characters_on_line
951
	jne	extra_characters_on_line
Line 1185... Line 1094...
1185
	push	[error_line]
1094
	push	[error_line]
1186
	mov	eax,[current_line]
1095
	mov	eax,[current_line]
1187
	mov	[error_line],eax
1096
	mov	[error_line],eax
1188
      find_end_directive:
1097
      find_end_directive:
1189
	call	skip_line
1098
	call	skip_symbol
1190
	lods	byte [esi]
1099
	jnc	find_end_directive
-
 
1100
	lods	byte [esi]
1191
	cmp	al,0Fh
1101
	cmp	al,0Fh
1192
	jne	no_end_directive
1102
	jne	no_end_directive
1193
	lods	dword [esi]
1103
	lods	dword [esi]
1194
	mov	[current_line],eax
1104
	mov	[current_line],eax
1195
      skip_labels:
1105
      skip_labels:
Line 1356... Line 1266...
1356
	xchg	esi,ebx
1266
	xchg	esi,ebx
1357
	cmp	byte [ebx],81h
1267
	cmp	byte [ebx],81h
1358
	jne	simple_data_value
1268
	jne	simple_data_value
1359
	inc	esi
1269
	inc	esi
1360
	call	get_dword_value
1270
	call	get_count_value
1361
	cmp	[next_pass_needed],0
1271
	inc	esi
1362
	jne	dup_value_ok
-
 
1363
	cmp	[value_type],0
-
 
1364
	jne	invalid_use_of_symbol
-
 
1365
      dup_value_ok:
-
 
1366
	inc	esi
-
 
1367
	cmp	eax,0
1272
	or	eax,eax
1368
	jg	dup_positive
1273
	jz	duplicate_zero_times
1369
	cmp	[error_line],0
1274
	cmp	byte [esi],'{'
1370
	jne	dup_invalid
-
 
1371
	mov	eax,[current_line]
-
 
1372
	mov	[error_line],eax
-
 
1373
	mov	[error],invalid_value
-
 
1374
      dup_invalid:
-
 
1375
	mov	eax,1
-
 
1376
      dup_positive:
-
 
1377
	cmp	byte [esi],'{'
-
 
1378
	jne	duplicate_single_data_value
1275
	jne	duplicate_single_data_value
1379
	inc	esi
1276
	inc	esi
1380
      duplicate_data:
1277
      duplicate_data:
1381
	push	eax esi
1278
	push	eax esi
1382
      duplicated_values:
1279
      duplicated_values:
Line 1402... Line 1299...
1402
	dec	eax
1299
	dec	eax
1403
	jz	data_defined
1300
	jz	data_defined
1404
	mov	esi,ebx
1301
	mov	esi,ebx
1405
	jmp	duplicate_single_data_value
1302
	jmp	duplicate_single_data_value
1406
      simple_data_value:
1303
      duplicate_zero_times:
-
 
1304
	cmp	byte [esi],'{'
-
 
1305
	jne	skip_single_data_value
-
 
1306
	inc	esi
-
 
1307
      skip_data_value:
-
 
1308
	call	skip_symbol
-
 
1309
	jc	invalid_argument
-
 
1310
	cmp	byte [esi],'}'
-
 
1311
	jne	skip_data_value
-
 
1312
	inc	esi
-
 
1313
	jmp	data_defined
-
 
1314
      skip_single_data_value:
-
 
1315
	call	skip_symbol
-
 
1316
	jmp	data_defined
-
 
1317
      simple_data_value:
1407
	cmp	edi,[display_buffer]
1318
	cmp	edi,[display_buffer]
1408
	jae	out_of_memory
1319
	jae	out_of_memory
1409
	call	near dword [esp]
1320
	call	near dword [esp]
1410
      data_defined:
1321
      data_defined:
1411
	lods	byte [esi]
1322
	lods	byte [esi]
Line 1689... Line 1600...
1689
	inc	esi
1600
	inc	esi
1690
	cmp	byte [esi],'.'
1601
	cmp	byte [esi],'.'
1691
	je	invalid_value
1602
	je	invalid_value
1692
	push	ebx
1603
	push	ebx
1693
	call	get_dword_value
1604
	call	get_count_value
1694
	pop	ebx
1605
	pop	ebx
1695
	mov	edx,eax
1606
	mov	edx,eax
1696
	sub	[esp],edx
1607
	sub	[esp],edx
1697
	jc	value_out_of_range
1608
	jc	value_out_of_range
1698
      position_ok:
1609
      position_ok:
1699
	cmp	byte [esi],','
1610
	cmp	byte [esi],','
Line 1704... Line 1615...
1704
	inc	esi
1615
	inc	esi
1705
	cmp	byte [esi],'.'
1616
	cmp	byte [esi],'.'
1706
	je	invalid_value
1617
	je	invalid_value
1707
	push	ebx edx
1618
	push	ebx edx
1708
	call	get_dword_value
1619
	call	get_count_value
1709
	pop	edx ebx
1620
	pop	edx ebx
1710
	cmp	eax,[esp]
1621
	cmp	eax,[esp]
1711
	ja	value_out_of_range
1622
	ja	value_out_of_range
1712
	mov	[esp],eax
1623
	mov	[esp],eax
1713
      size_ok:
1624
      size_ok:
1714
	xor	al,al
1625
	xor	al,al
Line 1729... Line 1640...
1729
	jmp	instruction_assembled
1640
	jmp	instruction_assembled
1730
      open_binary_file:
1641
      open_binary_file:
1731
	push	esi
1642
	push	esi
1732
	push	edi
1643
	push	edi
1733
	mov	esi,[current_line]
1644
	mov	eax,[current_line]
1734
	mov	esi,[esi]
1645
      find_current_source_path: 
-
 
1646
	mov	esi,[eax] 
1735
      get_current_path:
1647
	test	byte [eax+7],80h 
-
 
1648
	jz	get_current_path 
-
 
1649
	mov	eax,[eax+12] 
-
 
1650
	jmp	find_current_source_path
-
 
1651
      get_current_path:
1736
	lodsb
1652
	lodsb
1737
	stosb
1653
	stosb
1738
	or	al,al
1654
	or	al,al
1739
	jnz	get_current_path
1655
	jnz	get_current_path
1740
      cut_current_path:
1656
      cut_current_path:
Line 1770... Line 1686...
1770
	cmp	al,'('
1686
	cmp	al,'('
1771
	jne	invalid_argument
1687
	jne	invalid_argument
1772
	cmp	byte [esi],'.'
1688
	cmp	byte [esi],'.'
1773
	je	invalid_value
1689
	je	invalid_value
1774
	call	get_dword_value
1690
	call	get_count_value
1775
	cmp	[next_pass_needed],0
1691
	mov	ecx,eax
1776
	jne	rb_value_ok
-
 
1777
	cmp	[value_type],0
-
 
1778
	jne	invalid_use_of_symbol
-
 
1779
      rb_value_ok:
-
 
1780
	cmp	eax,0
-
 
1781
	jl	reserve_negative
-
 
1782
	mov	ecx,eax
-
 
1783
	mov	edx,ecx
1692
	mov	edx,ecx
1784
	add	edx,edi
1693
	add	edx,edi
1785
	jc	out_of_memory
1694
	jc	out_of_memory
1786
	cmp	edx,[display_buffer]
1695
	cmp	edx,[display_buffer]
1787
	ja	out_of_memory
1696
	ja	out_of_memory
Line 1804... Line 1713...
1804
      reserved_data:
1713
      reserved_data:
1805
	pop	eax
1714
	pop	eax
1806
	call	undefined_data
1715
	call	undefined_data
1807
	jmp	instruction_assembled
1716
	jmp	instruction_assembled
1808
      reserve_negative:
1717
reserve_words:
1809
	cmp	[error_line],0
-
 
1810
	jne	instruction_assembled
-
 
1811
	mov	eax,[current_line]
-
 
1812
	mov	[error_line],eax
-
 
1813
	mov	[error],invalid_value
-
 
1814
	jmp	instruction_assembled
-
 
1815
reserve_words:
-
 
1816
	lods	byte [esi]
1718
	lods	byte [esi]
1817
	cmp	al,'('
1719
	cmp	al,'('
1818
	jne	invalid_argument
1720
	jne	invalid_argument
1819
	cmp	byte [esi],'.'
1721
	cmp	byte [esi],'.'
1820
	je	invalid_value
1722
	je	invalid_value
1821
	call	get_dword_value
1723
	call	get_count_value
1822
	cmp	[next_pass_needed],0
1724
	mov	ecx,eax
1823
	jne	rw_value_ok
-
 
1824
	cmp	[value_type],0
-
 
1825
	jne	invalid_use_of_symbol
-
 
1826
      rw_value_ok:
-
 
1827
	cmp	eax,0
-
 
1828
	jl	reserve_negative
-
 
1829
	mov	ecx,eax
-
 
1830
	mov	edx,ecx
1725
	mov	edx,ecx
1831
	shl	edx,1
1726
	shl	edx,1
1832
	jc	out_of_memory
1727
	jc	out_of_memory
1833
	add	edx,edi
1728
	add	edx,edi
1834
	jc	out_of_memory
1729
	jc	out_of_memory
Line 1852... Line 1747...
1852
	cmp	al,'('
1747
	cmp	al,'('
1853
	jne	invalid_argument
1748
	jne	invalid_argument
1854
	cmp	byte [esi],'.'
1749
	cmp	byte [esi],'.'
1855
	je	invalid_value
1750
	je	invalid_value
1856
	call	get_dword_value
1751
	call	get_count_value
1857
	cmp	[next_pass_needed],0
1752
	mov	ecx,eax
1858
	jne	rd_value_ok
-
 
1859
	cmp	[value_type],0
-
 
1860
	jne	invalid_use_of_symbol
-
 
1861
      rd_value_ok:
-
 
1862
	cmp	eax,0
-
 
1863
	jl	reserve_negative
-
 
1864
	mov	ecx,eax
-
 
1865
	mov	edx,ecx
1753
	mov	edx,ecx
1866
	shl	edx,1
1754
	shl	edx,1
1867
	jc	out_of_memory
1755
	jc	out_of_memory
1868
	shl	edx,1
1756
	shl	edx,1
1869
	jc	out_of_memory
1757
	jc	out_of_memory
Line 1885... Line 1773...
1885
	cmp	al,'('
1773
	cmp	al,'('
1886
	jne	invalid_argument
1774
	jne	invalid_argument
1887
	cmp	byte [esi],'.'
1775
	cmp	byte [esi],'.'
1888
	je	invalid_value
1776
	je	invalid_value
1889
	call	get_dword_value
1777
	call	get_count_value
1890
	cmp	[next_pass_needed],0
1778
	mov	ecx,eax
1891
	jne	rp_value_ok
-
 
1892
	cmp	[value_type],0
-
 
1893
	jne	invalid_use_of_symbol
-
 
1894
      rp_value_ok:
-
 
1895
	cmp	eax,0
-
 
1896
	jl	reserve_negative
-
 
1897
	mov	ecx,eax
-
 
1898
	shl	ecx,1
1779
	shl	ecx,1
1899
	jc	out_of_memory
1780
	jc	out_of_memory
1900
	add	ecx,eax
1781
	add	ecx,eax
1901
	mov	edx,ecx
1782
	mov	edx,ecx
1902
	shl	edx,1
1783
	shl	edx,1
Line 1915... Line 1796...
1915
	cmp	al,'('
1796
	cmp	al,'('
1916
	jne	invalid_argument
1797
	jne	invalid_argument
1917
	cmp	byte [esi],'.'
1798
	cmp	byte [esi],'.'
1918
	je	invalid_value
1799
	je	invalid_value
1919
	call	get_dword_value
1800
	call	get_count_value
1920
	cmp	[next_pass_needed],0
1801
	mov	ecx,eax
1921
	jne	rq_value_ok
-
 
1922
	cmp	[value_type],0
-
 
1923
	jne	invalid_use_of_symbol
-
 
1924
      rq_value_ok:
-
 
1925
	cmp	eax,0
-
 
1926
	jl	reserve_negative
-
 
1927
	mov	ecx,eax
-
 
1928
	shl	ecx,1
1802
	shl	ecx,1
1929
	jc	out_of_memory
1803
	jc	out_of_memory
1930
	mov	edx,ecx
1804
	mov	edx,ecx
1931
	shl	edx,1
1805
	shl	edx,1
1932
	jc	out_of_memory
1806
	jc	out_of_memory
Line 1946... Line 1820...
1946
	cmp	al,'('
1820
	cmp	al,'('
1947
	jne	invalid_argument
1821
	jne	invalid_argument
1948
	cmp	byte [esi],'.'
1822
	cmp	byte [esi],'.'
1949
	je	invalid_value
1823
	je	invalid_value
1950
	call	get_dword_value
1824
	call	get_count_value
1951
	cmp	[next_pass_needed],0
1825
	mov	ecx,eax
1952
	jne	rt_value_ok
-
 
1953
	cmp	[value_type],0
-
 
1954
	jne	invalid_use_of_symbol
-
 
1955
      rt_value_ok:
-
 
1956
	cmp	eax,0
-
 
1957
	jl	reserve_negative
-
 
1958
	mov	ecx,eax
-
 
1959
	shl	ecx,2
1826
	shl	ecx,2
1960
	jc	out_of_memory
1827
	jc	out_of_memory
1961
	add	ecx,eax
1828
	add	ecx,eax
1962
	mov	edx,ecx
1829
	mov	edx,ecx
1963
	shl	edx,1
1830
	shl	edx,1
Line 1976... Line 1843...
1976
	cmp	al,'('
1843
	cmp	al,'('
1977
	jne	invalid_argument
1844
	jne	invalid_argument
1978
	cmp	byte [esi],'.'
1845
	cmp	byte [esi],'.'
1979
	je	invalid_value
1846
	je	invalid_value
1980
	call	get_dword_value
1847
	call	get_count_value
1981
	cmp	[value_type],0
1848
	mov	edx,eax
1982
	jne	invalid_use_of_symbol
-
 
1983
	mov	edx,eax
-
 
1984
	dec	edx
1849
	dec	edx
1985
	test	eax,edx
1850
	test	eax,edx
1986
	jnz	negative_times
1851
	jnz	invalid_align_value
1987
	or	eax,eax
1852
	or	eax,eax
1988
	jz	negative_times
1853
	jz	invalid_align_value
1989
	cmp	eax,1
1854
	cmp	eax,1
1990
	je	instruction_assembled
1855
	je	instruction_assembled
1991
	mov	ecx,edi
1856
	mov	ecx,edi
1992
	sub	ecx,dword [org_origin]
1857
	sub	ecx,dword [org_origin]
1993
	cmp	[org_registers],0
1858
	cmp	[org_registers],0
1994
	jne	section_not_aligned_enough
1859
	jne	section_not_aligned_enough
Line 2021... Line 1886...
2021
	cmp	[next_pass_needed],0
1886
	cmp	[next_pass_needed],0
2022
	je	nops
1887
	je	nops
2023
	add	edi,ecx
1888
	add	edi,ecx
2024
	jmp	reserved_data
1889
	jmp	reserved_data
2025
      nops:
1890
      invalid_align_value:
-
 
1891
	cmp	[error_line],0
-
 
1892
	jne	instruction_assembled
-
 
1893
	mov	eax,[current_line]
-
 
1894
	mov	[error_line],eax
-
 
1895
	mov	[error],invalid_value
-
 
1896
	jmp	instruction_assembled
-
 
1897
      nops:
2026
	mov	eax,90909090h
1898
	mov	eax,90909090h
2027
	shr	ecx,1
1899
	shr	ecx,1
2028
	jnc	nops_stosb_ok
1900
	jnc	nops_stosb_ok
2029
	stos	byte [edi]
1901
	stos	byte [edi]
2030
      nops_stosb_ok:
1902
      nops_stosb_ok: