Rev 1039 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1039 | 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 | out_of_memory: |
5 | out_of_memory: |
6 | push _out_of_memory |
6 | push _out_of_memory |
Line 10... | Line 10... | ||
10 | jmp fatal_error |
10 | jmp fatal_error |
11 | main_file_not_found: |
11 | main_file_not_found: |
12 | push _main_file_not_found |
12 | push _main_file_not_found |
13 | jmp fatal_error |
13 | jmp fatal_error |
14 | unexpected_end_of_file: |
14 | write_failed: |
- | 15 | push _write_failed |
|
- | 16 | jmp fatal_error |
|
- | 17 | ||
- | 18 | unexpected_end_of_file: |
|
15 | push _unexpected_end_of_file |
19 | push _unexpected_end_of_file |
16 | jmp fatal_error |
20 | jmp general_error |
17 | code_cannot_be_generated: |
21 | code_cannot_be_generated: |
18 | push _code_cannot_be_generated |
22 | push _code_cannot_be_generated |
19 | jmp fatal_error |
23 | jmp general_error |
20 | format_limitations_exceeded: |
24 | format_limitations_exceeded: |
21 | push _format_limitations_exceeded |
25 | push _format_limitations_exceeded |
22 | jmp fatal_error |
26 | general_error: |
23 | invalid_definition: |
27 | cmp [symbols_file],0 |
24 | push _invalid_definition |
- | |
25 | jmp fatal_error |
28 | je fatal_error |
26 | write_failed: |
29 | call dump_preprocessed_source |
27 | push _write_failed |
- | |
28 | jmp fatal_error |
30 | jmp fatal_error |
29 | 31 | ||
Line 30... | Line 32... | ||
30 | file_not_found: |
32 | file_not_found: |
31 | push _file_not_found |
33 | push _file_not_found |
32 | jmp assembler_error |
34 | jmp error_with_source |
33 | error_reading_file: |
35 | error_reading_file: |
34 | push _error_reading_file |
36 | push _error_reading_file |
35 | jmp assembler_error |
37 | jmp error_with_source |
36 | invalid_file_format: |
38 | invalid_file_format: |
37 | push _invalid_file_format |
39 | push _invalid_file_format |
38 | jmp assembler_error |
40 | jmp error_with_source |
39 | invalid_macro_arguments: |
41 | invalid_macro_arguments: |
40 | push _invalid_macro_arguments |
42 | push _invalid_macro_arguments |
41 | jmp assembler_error |
43 | jmp error_with_source |
42 | incomplete_macro: |
44 | incomplete_macro: |
43 | push _incomplete_macro |
45 | push _incomplete_macro |
44 | jmp assembler_error |
46 | jmp error_with_source |
45 | unexpected_characters: |
47 | unexpected_characters: |
46 | push _unexpected_characters |
48 | push _unexpected_characters |
47 | jmp assembler_error |
49 | jmp error_with_source |
48 | invalid_argument: |
50 | invalid_argument: |
49 | push _invalid_argument |
51 | push _invalid_argument |
50 | jmp assembler_error |
52 | jmp error_with_source |
51 | illegal_instruction: |
53 | illegal_instruction: |
52 | push _illegal_instruction |
54 | push _illegal_instruction |
53 | jmp assembler_error |
55 | jmp error_with_source |
54 | invalid_operand: |
56 | invalid_operand: |
55 | push _invalid_operand |
57 | push _invalid_operand |
56 | jmp assembler_error |
58 | jmp error_with_source |
57 | invalid_operand_size: |
59 | invalid_operand_size: |
58 | push _invalid_operand_size |
60 | push _invalid_operand_size |
59 | jmp assembler_error |
61 | jmp error_with_source |
60 | operand_size_not_specified: |
62 | operand_size_not_specified: |
61 | push _operand_size_not_specified |
63 | push _operand_size_not_specified |
62 | jmp assembler_error |
64 | jmp error_with_source |
63 | operand_sizes_do_not_match: |
65 | operand_sizes_do_not_match: |
64 | push _operand_sizes_do_not_match |
66 | push _operand_sizes_do_not_match |
65 | jmp assembler_error |
67 | jmp error_with_source |
66 | invalid_address_size: |
68 | invalid_address_size: |
67 | push _invalid_address_size |
69 | push _invalid_address_size |
68 | jmp assembler_error |
70 | jmp error_with_source |
69 | address_sizes_do_not_agree: |
71 | address_sizes_do_not_agree: |
70 | push _address_sizes_do_not_agree |
72 | push _address_sizes_do_not_agree |
71 | jmp assembler_error |
73 | jmp error_with_source |
72 | prefix_conflict: |
74 | prefix_conflict: |
73 | push _prefix_conflict |
75 | push _prefix_conflict |
74 | jmp assembler_error |
76 | jmp error_with_source |
75 | long_immediate_not_encodable: |
77 | long_immediate_not_encodable: |
76 | push _long_immediate_not_encodable |
78 | push _long_immediate_not_encodable |
77 | jmp assembler_error |
79 | jmp error_with_source |
78 | relative_jump_out_of_range: |
80 | relative_jump_out_of_range: |
79 | push _relative_jump_out_of_range |
81 | push _relative_jump_out_of_range |
80 | jmp assembler_error |
82 | jmp error_with_source |
81 | invalid_expression: |
83 | invalid_expression: |
82 | push _invalid_expression |
84 | push _invalid_expression |
83 | jmp assembler_error |
85 | jmp error_with_source |
84 | invalid_address: |
86 | invalid_address: |
85 | push _invalid_address |
87 | push _invalid_address |
86 | jmp assembler_error |
88 | jmp error_with_source |
87 | invalid_value: |
89 | invalid_value: |
88 | push _invalid_value |
90 | push _invalid_value |
89 | jmp assembler_error |
91 | jmp error_with_source |
90 | value_out_of_range: |
92 | value_out_of_range: |
91 | push _value_out_of_range |
93 | push _value_out_of_range |
92 | jmp assembler_error |
94 | jmp error_with_source |
93 | undefined_symbol: |
95 | undefined_symbol: |
94 | mov edi,message |
96 | mov edi,message |
95 | mov esi,_undefined_symbol |
97 | mov esi,_undefined_symbol |
96 | call copy_asciiz |
98 | call copy_asciiz |
97 | push message |
99 | push message |
98 | cmp [error_info],0 |
100 | cmp [error_info],0 |
- | 101 | je error_with_source |
|
99 | je assembler_error |
102 | mov esi,[error_info] |
- | 103 | mov esi,[esi+24] |
|
- | 104 | or esi,esi |
|
- | 105 | jz error_with_source |
|
100 | mov byte [edi-1],20h |
106 | mov byte [edi-1],20h |
101 | call write_quoted_symbol_name |
107 | call write_quoted_symbol_name |
102 | jmp assembler_error |
108 | jmp error_with_source |
103 | copy_asciiz: |
109 | copy_asciiz: |
104 | lods byte [esi] |
110 | lods byte [esi] |
105 | stos byte [edi] |
111 | stos byte [edi] |
106 | test al,al |
112 | test al,al |
107 | jnz copy_asciiz |
113 | jnz copy_asciiz |
108 | ret |
114 | ret |
109 | write_quoted_symbol_name: |
115 | write_quoted_symbol_name: |
110 | mov al,27h |
116 | mov al,27h |
111 | stosb |
117 | stosb |
112 | mov esi,[error_info] |
- | |
113 | movzx ecx,byte [esi-1] |
118 | movzx ecx,byte [esi-1] |
114 | rep movs byte [edi],[esi] |
119 | rep movs byte [edi],[esi] |
115 | mov ax,27h |
120 | mov ax,27h |
116 | stosw |
121 | stosw |
117 | ret |
122 | ret |
Line 120... | Line 125... | ||
120 | mov esi,_symbol_out_of_scope_1 |
125 | mov esi,_symbol_out_of_scope_1 |
121 | call copy_asciiz |
126 | call copy_asciiz |
122 | cmp [error_info],0 |
127 | cmp [error_info],0 |
123 | je finish_symbol_out_of_scope_message |
128 | je finish_symbol_out_of_scope_message |
124 | mov byte [edi-1],20h |
129 | mov esi,[error_info] |
- | 130 | mov esi,[esi+24] |
|
- | 131 | or esi,esi |
|
- | 132 | jz finish_symbol_out_of_scope_message |
|
- | 133 | mov byte [edi-1],20h |
|
125 | call write_quoted_symbol_name |
134 | call write_quoted_symbol_name |
126 | finish_symbol_out_of_scope_message: |
135 | finish_symbol_out_of_scope_message: |
127 | mov byte [edi-1],20h |
136 | mov byte [edi-1],20h |
128 | mov esi,_symbol_out_of_scope_2 |
137 | mov esi,_symbol_out_of_scope_2 |
129 | call copy_asciiz |
138 | call copy_asciiz |
130 | push message |
139 | push message |
131 | jmp assembler_error |
140 | jmp error_with_source |
132 | invalid_use_of_symbol: |
141 | invalid_use_of_symbol: |
133 | push _invalid_use_of_symbol |
142 | push _invalid_use_of_symbol |
134 | jmp assembler_error |
143 | jmp error_with_source |
135 | name_too_long: |
144 | name_too_long: |
136 | push _name_too_long |
145 | push _name_too_long |
137 | jmp assembler_error |
146 | jmp error_with_source |
138 | invalid_name: |
147 | invalid_name: |
139 | push _invalid_name |
148 | push _invalid_name |
140 | jmp assembler_error |
149 | jmp error_with_source |
141 | reserved_word_used_as_symbol: |
150 | reserved_word_used_as_symbol: |
142 | push _reserved_word_used_as_symbol |
151 | push _reserved_word_used_as_symbol |
143 | jmp assembler_error |
152 | jmp error_with_source |
144 | symbol_already_defined: |
153 | symbol_already_defined: |
145 | push _symbol_already_defined |
154 | push _symbol_already_defined |
146 | jmp assembler_error |
155 | jmp error_with_source |
147 | missing_end_quote: |
156 | missing_end_quote: |
148 | push _missing_end_quote |
157 | push _missing_end_quote |
149 | jmp assembler_error |
158 | jmp error_with_source |
150 | missing_end_directive: |
159 | missing_end_directive: |
151 | push _missing_end_directive |
160 | push _missing_end_directive |
152 | jmp assembler_error |
161 | jmp error_with_source |
153 | unexpected_instruction: |
162 | unexpected_instruction: |
154 | push _unexpected_instruction |
163 | push _unexpected_instruction |
155 | jmp assembler_error |
164 | jmp error_with_source |
156 | extra_characters_on_line: |
165 | extra_characters_on_line: |
157 | push _extra_characters_on_line |
166 | push _extra_characters_on_line |
158 | jmp assembler_error |
167 | jmp error_with_source |
159 | section_not_aligned_enough: |
168 | section_not_aligned_enough: |
160 | push _section_not_aligned_enough |
169 | push _section_not_aligned_enough |
161 | jmp assembler_error |
170 | jmp error_with_source |
162 | setting_already_specified: |
171 | setting_already_specified: |
163 | push _setting_already_specified |
172 | push _setting_already_specified |
164 | jmp assembler_error |
173 | jmp error_with_source |
165 | data_already_defined: |
174 | data_already_defined: |
166 | push _data_already_defined |
175 | push _data_already_defined |
167 | jmp assembler_error |
176 | jmp error_with_source |
168 | too_many_repeats: |
177 | too_many_repeats: |
169 | push _too_many_repeats |
178 | push _too_many_repeats |
170 | jmp assembler_error |
179 | jmp error_with_source |
171 | invoked_error: |
180 | invoked_error: |
172 | push _invoked_error |
181 | push _invoked_error |
173 | jmp assembler_error |
182 | error_with_source: |
- | 183 | cmp [symbols_file],0 |
|
- | 184 | je assembler_error |
|
- | 185 | call dump_preprocessed_source |
|
- | 186 | call restore_preprocessed_source |
|
- | 187 | jmp assembler_error |
|
174 | 188 | ||
175 | 189 |