Rev 1053 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1053 | Rev 1189 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | mov [free_additional_memory],eax |
35 | mov [free_additional_memory],eax |
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 [display_buffer],eax |
39 | mov [source_start],eax |
- | 40 | mov [display_buffer],eax |
|
40 | mov [hash_tree],eax |
41 | mov [hash_tree],eax |
41 | mov [macro_status],al |
42 | mov [macro_status],al |
42 | mov esi,[input_file] |
43 | mov esi,[input_file] |
43 | mov edx,esi |
44 | mov edx,esi |
44 | call open |
45 | call open |
Line 373... | Line 374... | ||
373 | stc |
374 | stc |
374 | ret |
375 | ret |
375 | directive_ok: |
376 | directive_ok: |
376 | lea esi,[edx+ebp] |
377 | lea esi,[edx+ebp] |
377 | movzx eax,word [ebx] |
378 | call directive_handler |
- | 379 | directive_handler: |
|
- | 380 | pop ecx |
|
- | 381 | movzx eax,word [ebx] |
|
378 | add eax,preprocessor |
382 | add eax,ecx |
379 | clc |
383 | clc |
380 | ret |
384 | ret |
381 | 385 | ||
Line 382... | Line -... | ||
382 | - | ||
383 | preprocess_line: |
386 | preprocess_line: |
384 | mov eax,esp |
387 | mov eax,esp |
385 | sub eax,100h |
388 | sub eax,100h |
386 | jc stack_overflow |
389 | jc stack_overflow |
387 | cmp eax,[stack_limit] |
390 | cmp eax,[stack_limit] |
Line 754... | Line 757... | ||
754 | 757 | ||
Line 755... | Line 758... | ||
755 | define_fix_constant: |
758 | define_fix_constant: |
756 | add edx,5 |
759 | add edx,5 |
757 | add esi,2 |
760 | add esi,2 |
758 | push edx esi |
761 | push edx |
759 | mov esi,edx |
- | |
760 | call skip_parameters |
- | |
761 | xchg esi,[esp] |
- | |
762 | mov ch,11b |
762 | mov ch,11b |
763 | jmp define_preprocessor_constant |
763 | jmp define_preprocessor_constant |
764 | define_equ_constant: |
764 | define_equ_constant: |
765 | add esi,3 |
765 | add esi,3 |
766 | push esi |
766 | push esi |
767 | call process_equ_constants |
767 | call process_equ_constants |
768 | push esi |
- | |
769 | mov esi,[struc_name] |
768 | mov esi,[struc_name] |
770 | mov ch,10b |
769 | mov ch,10b |
771 | define_preprocessor_constant: |
770 | define_preprocessor_constant: |
772 | mov byte [esi-2],3Bh |
771 | mov byte [esi-2],3Bh |
773 | mov cl,[esi-1] |
772 | mov cl,[esi-1] |
774 | call add_preprocessor_symbol |
773 | call add_preprocessor_symbol |
775 | pop esi ebx |
774 | pop ebx |
776 | mov ecx,edi |
775 | mov ecx,edi |
777 | dec ecx |
776 | dec ecx |
778 | sub ecx,ebx |
777 | sub ecx,ebx |
779 | mov [edx+8],ebx |
778 | mov [edx+8],ebx |
780 | mov [edx+12],ecx |
779 | mov [edx+12],ecx |
Line 788... | Line 787... | ||
788 | mov ch,10b |
787 | mov ch,10b |
789 | call add_preprocessor_symbol |
788 | call add_preprocessor_symbol |
790 | movzx eax,byte [esi-1] |
789 | movzx eax,byte [esi-1] |
791 | add esi,eax |
790 | add esi,eax |
792 | push esi edx |
791 | lea ecx,[edi-1] |
793 | call skip_parameters |
- | |
794 | pop edx ebx |
- | |
795 | lea ecx,[esi-1] |
- | |
796 | sub ecx,ebx |
792 | sub ecx,esi |
797 | mov [edx+8],ebx |
793 | mov [edx+8],esi |
798 | mov [edx+12],ecx |
794 | mov [edx+12],ecx |
799 | jmp line_preprocessed |
795 | jmp line_preprocessed |
800 | skip_parameters: |
796 | |
801 | lods byte [esi] |
- | |
802 | or al,al |
- | |
803 | jz parameters_skipped |
- | |
804 | cmp al,'{' |
- | |
805 | je parameters_skipped |
- | |
806 | cmp al,22h |
- | |
807 | je skip_quoted_parameter |
- | |
808 | cmp al,1Ah |
- | |
809 | jne skip_parameters |
- | |
810 | lods byte [esi] |
- | |
811 | movzx eax,al |
- | |
812 | add esi,eax |
- | |
813 | jmp skip_parameters |
- | |
814 | skip_quoted_parameter: |
- | |
815 | lods dword [esi] |
- | |
816 | add esi,eax |
- | |
817 | jmp skip_parameters |
- | |
818 | parameters_skipped: |
- | |
819 | ret |
- | |
820 | - | ||
Line 821... | Line 797... | ||
821 | define_struc: |
797 | define_struc: |
822 | mov ch,1 |
798 | mov ch,1 |
823 | jmp make_macro |
799 | jmp make_macro |
824 | define_macro: |
800 | define_macro: |
Line 957... | Line 933... | ||
957 | mov [error_line],eax |
933 | mov [error_line],eax |
958 | mov [instant_macro_start],esi |
934 | mov [instant_macro_start],esi |
959 | cmp [base_code],10h |
935 | cmp [base_code],10h |
960 | je prepare_match |
936 | je prepare_match |
961 | call skip_parameters |
937 | skip_parameters: |
- | 938 | lods byte [esi] |
|
- | 939 | or al,al |
|
- | 940 | jz parameters_skipped |
|
- | 941 | cmp al,'{' |
|
- | 942 | je parameters_skipped |
|
- | 943 | cmp al,22h |
|
- | 944 | je skip_quoted_parameter |
|
- | 945 | cmp al,1Ah |
|
- | 946 | jne skip_parameters |
|
- | 947 | lods byte [esi] |
|
- | 948 | movzx eax,al |
|
- | 949 | add esi,eax |
|
- | 950 | jmp skip_parameters |
|
962 | instant_macro_parameters_skipped: |
951 | skip_quoted_parameter: |
- | 952 | lods dword [esi] |
|
- | 953 | add esi,eax |
|
- | 954 | jmp skip_parameters |
|
- | 955 | parameters_skipped: |
|
963 | dec esi |
956 | dec esi |
964 | mov [parameters_end],esi |
957 | mov [parameters_end],esi |
965 | lods byte [esi] |
958 | lods byte [esi] |
966 | cmp al,'{' |
959 | cmp al,'{' |
967 | je found_macro_block |
960 | je found_macro_block |
968 | or al,al |
961 | or al,al |
Line 971... | Line 964... | ||
971 | prepare_match: |
964 | prepare_match: |
972 | call skip_pattern |
965 | call skip_pattern |
973 | mov [value_type],80h+10b |
966 | mov [value_type],80h+10b |
974 | call process_symbolic_constants |
967 | call process_symbolic_constants |
975 | jmp instant_macro_parameters_skipped |
968 | jmp parameters_skipped |
976 | skip_pattern: |
969 | skip_pattern: |
977 | lods byte [esi] |
970 | lods byte [esi] |
978 | or al,al |
971 | or al,al |
979 | jz invalid_macro_arguments |
972 | jz invalid_macro_arguments |
980 | cmp al,',' |
973 | cmp al,',' |
981 | je pattern_skipped |
974 | je pattern_skipped |
Line 1520... | Line 1513... | ||
1520 | cmp [base_code],10h |
1513 | cmp [base_code],10h |
1521 | jae do_match |
1514 | jae do_match |
1522 | cmp [base_code],0 |
1515 | cmp [base_code],0 |
1523 | jne do_irp |
1516 | jne do_irp |
1524 | call get_number |
1517 | call precalculate_value |
1525 | jc invalid_value |
- | |
1526 | or ebp,ebp |
- | |
1527 | jnz invalid_value |
- | |
1528 | cmp dword [edi+4],0 |
1518 | cmp eax,0 |
1529 | jne value_out_of_range |
- | |
1530 | mov eax,[edi] |
- | |
1531 | cmp eax,80000000h |
- | |
1532 | jae value_out_of_range |
1519 | jl value_out_of_range |
1533 | push [free_additional_memory] |
1520 | push [free_additional_memory] |
1534 | push [macro_symbols] |
1521 | push [macro_symbols] |
1535 | mov [macro_symbols],0 |
1522 | mov [macro_symbols],0 |
1536 | push [counter_limit] |
1523 | push [counter_limit] |
1537 | mov [struc_name],0 |
1524 | mov [struc_name],0 |
1538 | mov [counter_limit],eax |
1525 | mov [counter_limit],eax |
Line 1556... | Line 1543... | ||
1556 | lods byte [esi] |
1543 | lods byte [esi] |
1557 | cmp al,':' |
1544 | cmp al,':' |
1558 | jne rept_counter_added |
1545 | jne rept_counter_added |
1559 | push edx |
1546 | push edx |
1560 | call get_number |
1547 | call precalculate_value |
1561 | jc invalid_value |
- | |
1562 | or ebp,ebp |
- | |
1563 | jnz invalid_value |
- | |
1564 | cmp dword [edi+4],0 |
1548 | mov edx,eax |
1565 | jne value_out_of_range |
- | |
1566 | mov eax,[edi] |
- | |
1567 | mov edx,eax |
- | |
1568 | add edx,[counter_limit] |
1549 | add edx,[counter_limit] |
1569 | jc value_out_of_range |
1550 | jo value_out_of_range |
1570 | pop edx |
1551 | pop edx |
1571 | mov dword [edx+8],eax |
1552 | mov dword [edx+8],eax |
1572 | lods byte [esi] |
1553 | lods byte [esi] |
1573 | rept_counter_added: |
1554 | rept_counter_added: |
1574 | cmp al,',' |
1555 | cmp al,',' |
1575 | jne rept_counters_ok |
1556 | jne rept_counters_ok |
Line 1604... | Line 1585... | ||
1604 | sub edx,ebx |
1585 | sub edx,ebx |
1605 | mov ecx,edx |
1586 | mov ecx,edx |
1606 | call move_data |
1587 | call move_data |
1607 | jmp initial_preprocessing_ok |
1588 | jmp initial_preprocessing_ok |
1608 | do_irp: |
1589 | precalculate_value: |
- | 1590 | push edi |
|
- | 1591 | call convert_expression |
|
- | 1592 | mov al,')' |
|
- | 1593 | stosb |
|
- | 1594 | push esi |
|
- | 1595 | mov esi,[esp+4] |
|
- | 1596 | call calculate_expression |
|
- | 1597 | mov eax,[edi] |
|
- | 1598 | mov ecx,[edi+4] |
|
- | 1599 | pop esi edi |
|
- | 1600 | cdq |
|
- | 1601 | cmp edx,ecx |
|
- | 1602 | jne value_out_of_range |
|
- | 1603 | ret |
|
- | 1604 | do_irp: |
|
1609 | cmp byte [esi],1Ah |
1605 | cmp byte [esi],1Ah |
1610 | jne invalid_macro_arguments |
1606 | jne invalid_macro_arguments |
1611 | movzx eax,byte [esi+1] |
1607 | movzx eax,byte [esi+1] |
1612 | lea esi,[esi+2+eax] |
1608 | lea esi,[esi+2+eax] |
1613 | lods byte [esi] |
1609 | lods byte [esi] |
Line 1975... | Line 1971... | ||
1975 | jc not_macro_symbol |
1971 | jc not_macro_symbol |
1976 | replace_macro_symbol: |
1972 | replace_macro_symbol: |
1977 | pop edi eax |
1973 | pop edi eax |
1978 | mov ecx,[edx+8] |
1974 | mov ecx,[edx+8] |
1979 | and ecx,not 80000000h |
1975 | mov edx,[edx+12] |
1980 | mov edx,[edx+12] |
- | |
1981 | or edx,edx |
1976 | or edx,edx |
1982 | jz replace_macro_counter |
1977 | jz replace_macro_counter |
1983 | xchg esi,edx |
1978 | and ecx,not 80000000h |
- | 1979 | xchg esi,edx |
|
1984 | call move_data |
1980 | call move_data |
1985 | mov esi,edx |
1981 | mov esi,edx |
1986 | jmp process_macro_line_element |
1982 | jmp process_macro_line_element |
1987 | group_macro_symbol: |
1983 | group_macro_symbol: |
1988 | xor eax,eax |
1984 | xor eax,eax |
Line 2055... | Line 2051... | ||
2055 | mov byte [edi],',' |
2051 | mov byte [edi],',' |
2056 | inc edi |
2052 | inc edi |
2057 | jmp multiple_macro_counter_values |
2053 | jmp multiple_macro_counter_values |
2058 | store_number_symbol: |
2054 | store_number_symbol: |
2059 | mov ax,1Ah |
2055 | cmp ecx,0 |
- | 2056 | jge numer_symbol_sign_ok |
|
- | 2057 | neg ecx |
|
- | 2058 | mov al,'-' |
|
- | 2059 | stos byte [edi] |
|
- | 2060 | numer_symbol_sign_ok: |
|
- | 2061 | mov ax,1Ah |
|
2060 | stos word [edi] |
2062 | stos word [edi] |
2061 | push edi |
2063 | push edi |
2062 | mov eax,ecx |
2064 | mov eax,ecx |
2063 | mov ecx,1000000000 |
2065 | mov ecx,1000000000 |
2064 | xor edx,edx |
2066 | xor edx,edx |