Subversion Repositories Kolibri OS

Rev

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

Rev 2665 Rev 4039
Line 1... Line 1...
1
; flat assembler core
1
; flat assembler core
2
; Copyright (c) 1999-2012, Tomasz Grysztar.
2
; Copyright (c) 1999-2013, Tomasz Grysztar.
3
; All rights reserved.
3
; All rights reserved.
Line 4... Line 4...
4
 
4
 
5
preprocessor:
5
preprocessor:
6
	mov	edi,characters
6
	mov	edi,characters
Line 36... Line 36...
36
	mov	eax,[additional_memory_end]
36
	mov	eax,[additional_memory_end]
37
	mov	[labels_list],eax
37
	mov	[labels_list],eax
38
	xor	eax,eax
38
	xor	eax,eax
39
	mov	[source_start],eax
39
	mov	[source_start],eax
40
	mov	[display_buffer],eax
40
	mov	[tagged_blocks],eax
41
	mov	[hash_tree],eax
41
	mov	[hash_tree],eax
42
	mov	[error],eax
42
	mov	[error],eax
43
	mov	[macro_status],al
43
	mov	[macro_status],al
44
	mov	esi,[input_file]
44
	mov	esi,[input_file]
45
	mov	edx,esi
45
	mov	edx,esi
46
	call	open
46
	call	open
Line 193... Line 193...
193
      copy_string:
193
      copy_string:
194
	lods	byte [esi]
194
	lods	byte [esi]
195
	stos	byte [edi]
195
	stos	byte [edi]
196
	cmp	al,0Ah
196
	cmp	al,0Ah
197
	je	missing_end_quote
197
	je	no_end_quote
198
	cmp	al,0Dh
198
	cmp	al,0Dh
199
	je	missing_end_quote
199
	je	no_end_quote
200
	or	al,al
200
	or	al,al
201
	jz	missing_end_quote
201
	jz	no_end_quote
202
	cmp	al,1Ah
202
	cmp	al,1Ah
203
	je	missing_end_quote
203
	je	no_end_quote
204
	cmp	al,ah
204
	cmp	al,ah
205
	jne	copy_string
205
	jne	copy_string
206
	lods	byte [esi]
206
	lods	byte [esi]
207
	cmp	al,ah
207
	cmp	al,ah
208
	je	copy_string
208
	je	copy_string
209
	dec	esi
209
	dec	esi
Line 241... Line 241...
241
	jne	backslashed_symbol
241
	jne	backslashed_symbol
242
	stos	byte [edi]
242
	stos	byte [edi]
243
	inc	byte [ecx]
243
	inc	byte [ecx]
244
	jmp	group_backslashes
244
	jmp	group_backslashes
245
      backslashed_symbol:
245
      no_end_quote:
-
 
246
	mov	byte [ebx-5],0
-
 
247
	jmp	missing_end_quote
-
 
248
      backslashed_symbol:
246
	cmp	al,1Ah
249
	cmp	al,1Ah
247
	je	unexpected_end_of_file
250
	je	unexpected_end_of_file
248
	or	al,al
251
	or	al,al
249
	jz	unexpected_end_of_file
252
	jz	unexpected_end_of_file
250
	cmp	al,0Ah
253
	cmp	al,0Ah
Line 552... Line 555...
552
	mov	ch,10b
555
	mov	ch,10b
553
	call	get_preprocessor_symbol
556
	call	get_preprocessor_symbol
554
	jnc	symbolic_constant_in_label
557
	jnc	symbolic_constant_in_label
555
	lea	esi,[esi+ecx+1]
558
	lea	esi,[esi+ecx+1]
556
	jmp	preprocess_instruction
559
	cmp	byte [esi],':'
-
 
560
	jne	preprocess_instruction
-
 
561
	inc	esi
-
 
562
	jmp	preprocess_instruction
557
      symbolic_constant_in_label:
563
      symbolic_constant_in_label:
558
	mov	ebx,[edx+8]
564
	mov	ebx,[edx+8]
559
	mov	ecx,[edx+12]
565
	mov	ecx,[edx+12]
560
	add	ecx,ebx
566
	add	ecx,ebx
561
      check_for_broken_label:
567
      check_for_broken_label:
Line 569... Line 575...
569
	je	label_constant_ok
575
	je	label_constant_ok
570
	cmp	byte [ebx],':'
576
	cmp	byte [ebx],':'
571
	jne	label_broken
577
	jne	label_broken
572
	inc	ebx
578
	inc	ebx
573
	jmp	check_for_broken_label
579
	cmp	byte [ebx],':'
-
 
580
	jne	check_for_broken_label
-
 
581
	inc	ebx
-
 
582
	jmp	check_for_broken_label
574
      label_broken:
583
      label_broken:
575
	push	line_preprocessed
584
	push	line_preprocessed
576
	jmp	replace_symbolic_constant
585
	jmp	replace_symbolic_constant
577
      label_constant_ok:
586
      label_constant_ok:
578
	mov	ecx,edi
587
	mov	ecx,edi
Line 1683... Line 1692...
1683
	xor	ebp,ebp
1692
	xor	ebp,ebp
1684
	or	[default_argument_value],-1
1693
	or	[default_argument_value],-1
1685
	call	skip_macro_argument_value
1694
	call	skip_macro_argument_value
1686
	inc	esi
1695
	inc	esi
1687
      irps_name_ok:
1696
	jmp	irp_parameters_start
-
 
1697
      irps_name_ok:
1688
	cmp	al,','
1698
	cmp	al,','
1689
	jne	invalid_macro_arguments
1699
	jne	invalid_macro_arguments
1690
	mov	al,[esi]
1700
	mov	al,[esi]
1691
	or	al,al
1701
	or	al,al
1692
	jz	instant_macro_done
1702
	jz	instant_macro_done