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 | assembler: |
5 | assembler: |
6 | xor eax,eax |
6 | xor eax,eax |
Line 10... | Line 10... | ||
10 | mov [number_of_sections],eax |
10 | mov [number_of_sections],eax |
11 | mov [actual_fixups_size],eax |
11 | mov [actual_fixups_size],eax |
12 | assembler_loop: |
12 | assembler_loop: |
13 | mov eax,[labels_list] |
13 | mov eax,[labels_list] |
14 | mov [display_buffer],eax |
14 | mov [tagged_blocks],eax |
15 | mov eax,[additional_memory] |
15 | mov eax,[additional_memory] |
16 | mov [free_additional_memory],eax |
16 | mov [free_additional_memory],eax |
17 | mov eax,[additional_memory_end] |
17 | mov eax,[additional_memory_end] |
18 | mov [structures_buffer],eax |
18 | mov [structures_buffer],eax |
19 | mov esi,[source_start] |
19 | mov esi,[source_start] |
20 | mov edi,[code_start] |
20 | mov edi,[code_start] |
21 | xor eax,eax |
21 | xor eax,eax |
22 | mov dword [adjustment],eax |
22 | mov dword [adjustment],eax |
23 | mov dword [adjustment+4],eax |
23 | mov dword [adjustment+4],eax |
24 | mov dword [org_origin],edi |
24 | mov [addressing_space],eax |
25 | mov dword [org_origin+4],eax |
- | |
26 | mov [org_start],edi |
- | |
27 | mov [org_registers],eax |
- | |
28 | mov [org_symbol],eax |
25 | mov [error_line],eax |
29 | mov [error_line],eax |
- | |
30 | mov [counter],eax |
26 | mov [counter],eax |
31 | mov [format_flags],eax |
27 | mov [format_flags],eax |
32 | mov [number_of_relocations],eax |
28 | mov [number_of_relocations],eax |
33 | mov [undefined_data_end],eax |
29 | mov [undefined_data_end],eax |
34 | mov [file_extension],eax |
30 | mov [file_extension],eax |
35 | mov [next_pass_needed],al |
31 | mov [next_pass_needed],al |
36 | mov [output_format],al |
32 | mov [output_format],al |
37 | mov [org_origin_sign],al |
33 | mov [adjustment_sign],al |
38 | mov [adjustment_sign],al |
- | |
39 | mov [labels_type],al |
34 | mov [code_type],16 |
40 | mov [virtual_data],al |
- | |
41 | mov [code_type],16 |
- | |
42 | pass_loop: |
35 | call init_addressing_space |
- | 36 | pass_loop: |
|
43 | call assemble_line |
37 | call assemble_line |
44 | jnc pass_loop |
38 | jnc pass_loop |
45 | mov eax,[additional_memory_end] |
39 | mov eax,[additional_memory_end] |
46 | cmp eax,[structures_buffer] |
40 | cmp eax,[structures_buffer] |
47 | je pass_done |
41 | je pass_done |
48 | sub eax,20h |
42 | sub eax,18h |
49 | mov eax,[eax+4] |
43 | mov eax,[eax+4] |
50 | mov [current_line],eax |
44 | mov [current_line],eax |
51 | jmp missing_end_directive |
45 | jmp missing_end_directive |
52 | pass_done: |
46 | pass_done: |
53 | call close_pass |
47 | call close_pass |
54 | mov eax,[labels_list] |
48 | mov eax,[labels_list] |
Line 139... | Line 133... | ||
139 | jmp assembler_loop |
133 | jmp assembler_loop |
140 | assemble_ok: |
134 | assemble_ok: |
141 | ret |
135 | ret |
142 | 136 | ||
Line -... | Line 137... | ||
- | 137 | create_addressing_space: |
|
- | 138 | mov ebx,[addressing_space] |
|
- | 139 | test ebx,ebx |
|
- | 140 | jz init_addressing_space |
|
- | 141 | test byte [ebx+0Ah],1 |
|
- | 142 | jnz illegal_instruction |
|
- | 143 | mov eax,edi |
|
- | 144 | sub eax,[ebx+18h] |
|
- | 145 | mov [ebx+1Ch],eax |
|
- | 146 | init_addressing_space: |
|
- | 147 | mov ebx,[tagged_blocks] |
|
- | 148 | mov dword [ebx-4],10h |
|
- | 149 | mov dword [ebx-8],20h |
|
- | 150 | sub ebx,8+20h |
|
- | 151 | cmp ebx,edi |
|
- | 152 | jbe out_of_memory |
|
- | 153 | mov [tagged_blocks],ebx |
|
- | 154 | mov [addressing_space],ebx |
|
- | 155 | xor eax,eax |
|
- | 156 | mov [ebx],edi |
|
- | 157 | mov [ebx+4],eax |
|
- | 158 | mov [ebx+8],eax |
|
- | 159 | mov [ebx+10h],eax |
|
- | 160 | mov [ebx+14h],eax |
|
- | 161 | mov [ebx+18h],edi |
|
- | 162 | mov [ebx+1Ch],eax |
|
- | 163 | ret |
|
- | 164 | ||
143 | assemble_line: |
165 | assemble_line: |
144 | mov eax,[display_buffer] |
166 | mov eax,[tagged_blocks] |
145 | sub eax,100h |
167 | sub eax,100h |
146 | cmp edi,eax |
168 | cmp edi,eax |
147 | ja out_of_memory |
169 | ja out_of_memory |
148 | lods byte [esi] |
170 | lods byte [esi] |
149 | cmp al,1 |
171 | cmp al,1 |
150 | je assemble_instruction |
172 | je assemble_instruction |
151 | jb source_end |
173 | jb source_end |
152 | cmp al,3 |
174 | cmp al,3 |
153 | jb define_label |
175 | jb define_label |
154 | je define_constant |
176 | je define_constant |
- | 177 | cmp al,4 |
|
- | 178 | je label_addressing_space |
|
155 | cmp al,0Fh |
179 | cmp al,0Fh |
156 | je new_line |
180 | je new_line |
157 | cmp al,13h |
181 | cmp al,13h |
158 | je code_type_setting |
182 | je code_type_setting |
159 | cmp al,10h |
183 | cmp al,10h |
Line 162... | Line 186... | ||
162 | jmp segment_prefix |
186 | jmp segment_prefix |
163 | code_type_setting: |
187 | code_type_setting: |
164 | lods byte [esi] |
188 | lods byte [esi] |
165 | mov [code_type],al |
189 | mov [code_type],al |
166 | jmp line_assembled |
190 | jmp instruction_assembled |
167 | new_line: |
191 | new_line: |
168 | lods dword [esi] |
192 | lods dword [esi] |
169 | mov [current_line],eax |
193 | mov [current_line],eax |
170 | mov [prefixed_instruction],0 |
194 | mov [prefixed_instruction],0 |
171 | cmp [symbols_file],0 |
195 | cmp [symbols_file],0 |
172 | je continue_line |
196 | je continue_line |
173 | cmp [next_pass_needed],0 |
197 | cmp [next_pass_needed],0 |
174 | jne continue_line |
198 | jne continue_line |
175 | mov ebx,[display_buffer] |
199 | mov ebx,[tagged_blocks] |
176 | mov dword [ebx-4],1 |
200 | mov dword [ebx-4],1 |
177 | mov dword [ebx-8],1Ch |
201 | mov dword [ebx-8],14h |
178 | sub ebx,8+1Ch |
202 | sub ebx,8+14h |
179 | cmp ebx,edi |
203 | cmp ebx,edi |
180 | jbe out_of_memory |
204 | jbe out_of_memory |
181 | mov [display_buffer],ebx |
205 | mov [tagged_blocks],ebx |
182 | mov [ebx],eax |
206 | mov [ebx],eax |
183 | mov [ebx+4],edi |
207 | mov [ebx+4],edi |
184 | mov eax,dword [org_origin] |
208 | mov eax,[addressing_space] |
185 | mov edx,dword [org_origin+4] |
- | |
186 | mov ecx,[org_registers] |
- | |
187 | mov [ebx+8],eax |
209 | mov [ebx+8],eax |
188 | mov [ebx+8+4],edx |
210 | mov al,[code_type] |
189 | mov [ebx+10h],ecx |
- | |
190 | mov edx,[org_symbol] |
- | |
191 | ; mov al,[virtual_data] |
- | |
192 | ; mov ah,[org_origin_sign] |
- | |
193 | ; shl eax,16 |
- | |
194 | ; mov al,[labels_type] |
- | |
195 | ; mov ah,[code_type] |
- | |
196 | mov eax,dword [labels_type] |
- | |
197 | mov [ebx+14h],edx |
211 | mov [ebx+10h],al |
198 | mov [ebx+18h],eax |
- | |
199 | continue_line: |
212 | continue_line: |
200 | cmp byte [esi],0Fh |
213 | cmp byte [esi],0Fh |
201 | je line_assembled |
214 | je line_assembled |
202 | jmp assemble_line |
215 | jmp assemble_line |
203 | define_label: |
216 | define_label: |
204 | lods dword [esi] |
217 | lods dword [esi] |
Line 213... | Line 226... | ||
213 | make_label: |
226 | make_label: |
214 | mov eax,edi |
227 | mov eax,edi |
215 | xor edx,edx |
228 | xor edx,edx |
216 | xor cl,cl |
229 | xor cl,cl |
217 | sub eax,dword [org_origin] |
230 | mov ebp,[addressing_space] |
- | 231 | sub eax,[ds:ebp] |
|
218 | sbb edx,dword [org_origin+4] |
232 | sbb edx,[ds:ebp+4] |
219 | sbb cl,[org_origin_sign] |
233 | sbb cl,[ds:ebp+8] |
220 | jp label_value_ok |
234 | jp label_value_ok |
221 | call recoverable_overflow |
235 | call recoverable_overflow |
222 | label_value_ok: |
236 | label_value_ok: |
223 | mov [address_sign],cl |
237 | mov [address_sign],cl |
224 | cmp [virtual_data],0 |
238 | test byte [ds:ebp+0Ah],1 |
225 | jne make_virtual_label |
239 | jnz make_virtual_label |
226 | or byte [ebx+9],1 |
240 | or byte [ebx+9],1 |
227 | xchg eax,[ebx] |
241 | xchg eax,[ebx] |
228 | xchg edx,[ebx+4] |
242 | xchg edx,[ebx+4] |
229 | mov ch,[ebx+9] |
243 | mov ch,[ebx+9] |
230 | shr ch,1 |
244 | shr ch,1 |
231 | and ch,1 |
245 | and ch,1 |
Line 249... | Line 263... | ||
249 | mov [ebx+4],edx |
263 | mov [ebx+4],edx |
250 | setne al |
264 | setne al |
251 | or ah,al |
265 | or ah,al |
252 | finish_label: |
266 | finish_label: |
253 | mov ch,[labels_type] |
267 | mov ebp,[addressing_space] |
- | 268 | mov ch,[ds:ebp+9] |
|
254 | mov cl,[label_size] |
269 | mov cl,[label_size] |
255 | mov ebp,[org_registers] |
270 | mov edx,[ds:ebp+14h] |
256 | mov edx,[org_symbol] |
271 | mov ebp,[ds:ebp+10h] |
257 | finish_label_symbol: |
272 | finish_label_symbol: |
258 | mov al,[address_sign] |
273 | mov al,[address_sign] |
259 | xor al,[ebx+9] |
274 | xor al,[ebx+9] |
260 | and al,10b |
275 | and al,10b |
261 | or ah,al |
276 | or ah,al |
262 | xor [ebx+9],al |
277 | xor [ebx+9],al |
Line 287... | Line 302... | ||
287 | test byte [ebx+8],1 |
302 | test byte [ebx+8],1 |
288 | jz new_label |
303 | jz new_label |
289 | cmp cx,[ebx+16] |
304 | cmp cx,[ebx+16] |
290 | je symbol_already_defined |
305 | je symbol_already_defined |
291 | inc cx |
306 | btr dword [ebx+8],10 |
- | 307 | jc requalified_label |
|
- | 308 | inc cx |
|
292 | sub cx,[ebx+16] |
309 | sub cx,[ebx+16] |
293 | setnz al |
310 | setnz al |
294 | or ah,al |
311 | or ah,al |
295 | jz label_made |
312 | jz label_made |
296 | test byte [ebx+8],8 |
313 | test byte [ebx+8],8 |
297 | jz label_made |
314 | jz label_made |
298 | mov cx,[current_pass] |
315 | mov cx,[current_pass] |
299 | cmp cx,[ebx+18] |
316 | cmp cx,[ebx+18] |
300 | jne label_made |
317 | jne label_made |
301 | or [next_pass_needed],-1 |
318 | requalified_label: |
- | 319 | or [next_pass_needed],-1 |
|
302 | label_made: |
320 | label_made: |
303 | ret |
321 | ret |
304 | new_label: |
322 | new_label: |
305 | or byte [ebx+8],1 |
323 | or byte [ebx+8],1 |
306 | ret |
324 | ret |
Line 318... | Line 336... | ||
318 | jnz get_constant_value |
336 | jnz get_constant_value |
319 | mov cx,[current_pass] |
337 | mov cx,[current_pass] |
320 | cmp cx,[eax+16] |
338 | cmp cx,[eax+16] |
321 | je get_constant_value |
339 | je get_constant_value |
322 | and dl,not 1 |
340 | or dl,4 |
323 | mov [eax+8],dl |
341 | mov [eax+8],dl |
324 | get_constant_value: |
342 | get_constant_value: |
325 | push eax |
343 | push eax |
326 | mov al,byte [esi-1] |
344 | mov al,byte [esi-1] |
327 | push eax |
345 | push eax |
328 | or [size_override],-1 |
346 | or [size_override],-1 |
329 | call get_value |
347 | call get_value |
330 | pop ebx |
348 | pop ebx |
331 | mov ch,bl |
349 | mov ch,bl |
332 | pop ebx |
350 | pop ebx |
333 | pop dword [ebx+8] |
351 | pop ecx |
334 | cmp ebx,0Fh |
352 | test cl,4 |
335 | jb invalid_use_of_symbol |
353 | jnz constant_referencing_mode_ok |
336 | je reserved_word_used_as_symbol |
354 | and byte [ebx+8],not 4 |
- | 355 | constant_referencing_mode_ok: |
|
337 | xor cl,cl |
356 | xor cl,cl |
338 | mov ch,[value_type] |
357 | mov ch,[value_type] |
339 | cmp ch,3 |
358 | cmp ch,3 |
340 | je invalid_use_of_symbol |
359 | je invalid_use_of_symbol |
341 | make_constant: |
360 | make_constant: |
342 | and byte [ebx+9],not 1 |
361 | and byte [ebx+9],not 1 |
Line 383... | Line 402... | ||
383 | jne redeclare_constant |
402 | jne redeclare_constant |
384 | test byte [ebx+8],2 |
403 | test byte [ebx+8],2 |
385 | jz symbol_already_defined |
404 | jz symbol_already_defined |
386 | or byte [ebx+8],4 |
405 | or byte [ebx+8],4 |
387 | jmp instruction_assembled |
406 | and byte [ebx+9],not 4 |
- | 407 | jmp instruction_assembled |
|
388 | redeclare_constant: |
408 | redeclare_constant: |
389 | inc cx |
409 | btr dword [ebx+8],10 |
- | 410 | jc requalified_constant |
|
- | 411 | inc cx |
|
390 | sub cx,[ebx+16] |
412 | sub cx,[ebx+16] |
391 | setnz al |
413 | setnz al |
392 | or ah,al |
414 | or ah,al |
393 | jz instruction_assembled |
415 | jz instruction_assembled |
394 | test byte [ebx+8],4 |
416 | test byte [ebx+8],4 |
Line 397... | Line 419... | ||
397 | jz instruction_assembled |
419 | jz instruction_assembled |
398 | mov cx,[current_pass] |
420 | mov cx,[current_pass] |
399 | cmp cx,[ebx+18] |
421 | cmp cx,[ebx+18] |
400 | jne instruction_assembled |
422 | jne instruction_assembled |
401 | or [next_pass_needed],-1 |
423 | requalified_constant: |
- | 424 | or [next_pass_needed],-1 |
|
402 | jmp instruction_assembled |
425 | jmp instruction_assembled |
403 | new_constant: |
426 | new_constant: |
404 | or byte [ebx+8],1+2 |
427 | or byte [ebx+8],1+2 |
405 | jmp instruction_assembled |
428 | jmp instruction_assembled |
406 | assemble_instruction: |
429 | label_addressing_space: |
- | 430 | lods dword [esi] |
|
- | 431 | cmp eax,0Fh |
|
- | 432 | jb invalid_use_of_symbol |
|
- | 433 | je reserved_word_used_as_symbol |
|
- | 434 | mov cx,[current_pass] |
|
- | 435 | test byte [eax+8],1 |
|
- | 436 | jz make_addressing_space_label |
|
- | 437 | cmp cx,[eax+16] |
|
- | 438 | je symbol_already_defined |
|
- | 439 | test byte [eax+9],4 |
|
- | 440 | jnz make_addressing_space_label |
|
- | 441 | or [next_pass_needed],-1 |
|
- | 442 | make_addressing_space_label: |
|
- | 443 | mov dx,[eax+8] |
|
- | 444 | and dx,not (2 or 100h) |
|
- | 445 | or dx,1 or 4 or 400h |
|
- | 446 | mov [eax+8],dx |
|
- | 447 | mov [eax+16],cx |
|
- | 448 | mov edx,[current_line] |
|
- | 449 | mov [eax+28],edx |
|
- | 450 | mov ebx,[addressing_space] |
|
- | 451 | mov [eax],ebx |
|
- | 452 | or byte [ebx+0Ah],2 |
|
- | 453 | jmp continue_line |
|
- | 454 | assemble_instruction: |
|
407 | ; mov [operand_size],0 |
455 | ; mov [operand_size],0 |
408 | ; mov [size_override],0 |
456 | ; mov [size_override],0 |
409 | ; mov [operand_prefix],0 |
457 | ; mov [operand_prefix],0 |
410 | ; mov [opcode_prefix],0 |
458 | ; mov [opcode_prefix],0 |
411 | and dword [operand_size],0 |
459 | and dword [operand_size],0 |
Line 444... | Line 492... | ||
444 | call get_qword_value |
492 | call get_qword_value |
445 | mov cl,[value_type] |
493 | mov cl,[value_type] |
446 | test cl,1 |
494 | test cl,1 |
447 | jnz invalid_use_of_symbol |
495 | jnz invalid_use_of_symbol |
448 | mov [labels_type],cl |
496 | push eax |
449 | mov dword [org_origin],edi |
497 | mov ebx,[addressing_space] |
450 | xor ecx,ecx |
498 | mov eax,edi |
451 | mov dword [org_origin+4],ecx |
499 | sub eax,[ebx+18h] |
- | 500 | mov [ebx+1Ch],eax |
|
452 | mov [org_origin_sign],cl |
501 | test byte [ebx+0Ah],1 |
- | 502 | jnz in_virtual |
|
- | 503 | call init_addressing_space |
|
- | 504 | jmp org_space_ok |
|
- | 505 | in_virtual: |
|
- | 506 | call close_virtual_addressing_space |
|
- | 507 | call init_addressing_space |
|
453 | mov [org_registers],ecx |
508 | or byte [ebx+0Ah],1 |
- | 509 | org_space_ok: |
|
- | 510 | pop eax |
|
- | 511 | mov [ebx+9],cl |
|
454 | mov cl,[value_sign] |
512 | mov cl,[value_sign] |
455 | sub dword [org_origin],eax |
513 | sub [ebx],eax |
456 | sbb dword [org_origin+4],edx |
514 | sbb [ebx+4],edx |
457 | sbb [org_origin_sign],cl |
515 | sbb byte [ebx+8],cl |
458 | jp org_value_ok |
516 | jp org_value_ok |
459 | call recoverable_overflow |
517 | call recoverable_overflow |
460 | org_value_ok: |
518 | org_value_ok: |
461 | mov [org_start],edi |
519 | mov edx,[symbol_identifier] |
462 | mov edx,[symbol_identifier] |
- | |
463 | mov [org_symbol],edx |
520 | mov [ebx+14h],edx |
464 | cmp [output_format],1 |
521 | cmp [output_format],1 |
465 | ja instruction_assembled |
522 | ja instruction_assembled |
466 | cmp edi,[code_start] |
523 | cmp edi,[code_start] |
467 | jne instruction_assembled |
524 | jne instruction_assembled |
468 | cmp eax,100h |
525 | cmp eax,100h |
469 | jne instruction_assembled |
526 | jne instruction_assembled |
Line 500... | Line 557... | ||
500 | inc esi |
557 | inc esi |
501 | lods byte [esi] |
558 | lods byte [esi] |
502 | cmp al,'(' |
559 | cmp al,'(' |
503 | jne invalid_argument |
560 | jne invalid_argument |
504 | push dword [ebx+8] |
561 | push ebx ecx |
505 | push ebx ecx |
- | |
506 | and byte [ebx+8],not 1 |
562 | or byte [ebx+8],4 |
507 | cmp byte [esi],'.' |
563 | cmp byte [esi],'.' |
508 | je invalid_value |
564 | je invalid_value |
509 | call get_address_value |
565 | call get_address_value |
510 | or bh,bh |
566 | or bh,bh |
511 | setnz ch |
567 | setnz ch |
512 | xchg ch,cl |
568 | xchg ch,cl |
Line 514... | Line 570... | ||
514 | shl ebp,16 |
570 | shl ebp,16 |
515 | xchg bl,bh |
571 | xchg bl,bh |
516 | mov bp,bx |
572 | mov bp,bx |
517 | pop ecx ebx |
573 | pop ecx ebx |
518 | pop dword [ebx+8] |
574 | and byte [ebx+8],not 4 |
519 | mov ch,[value_type] |
575 | mov ch,[value_type] |
520 | or ch,ch |
576 | test ch,1 |
521 | jz make_free_label |
- | |
522 | cmp ch,4 |
- | |
523 | je make_free_label |
577 | jnz invalid_use_of_symbol |
524 | cmp ch,2 |
- | |
525 | jne invalid_use_of_symbol |
- | |
526 | make_free_label: |
578 | make_free_label: |
527 | and byte [ebx+9],not 1 |
579 | and byte [ebx+9],not 1 |
528 | cmp eax,[ebx] |
580 | cmp eax,[ebx] |
529 | mov [ebx],eax |
581 | mov [ebx],eax |
530 | setne ah |
582 | setne ah |
531 | cmp edx,[ebx+4] |
583 | cmp edx,[ebx+4] |
Line 556... | Line 608... | ||
556 | ja invalid_value |
608 | ja invalid_value |
557 | mov [operand_size],al |
609 | mov [operand_size],al |
558 | and dword [value],0 |
610 | and dword [value],0 |
559 | and dword [value+4],0 |
611 | and dword [value+4],0 |
560 | lods word [esi] |
612 | lods byte [esi] |
561 | cmp ax,82h+'(' shl 8 |
613 | cmp al,82h |
562 | jne invalid_argument |
614 | jne invalid_argument |
563 | load_from_code: |
615 | call get_data_point |
564 | cmp byte [esi],'.' |
- | |
565 | je invalid_value |
616 | jc value_loaded |
566 | or [size_override],-1 |
617 | push esi edi |
567 | call get_address_value |
- | |
568 | call calculate_relative_offset |
- | |
569 | push esi edi |
- | |
570 | cmp [next_pass_needed],0 |
618 | mov esi,ebx |
571 | jne load_address_type_ok |
- | |
572 | cmp [value_type],0 |
- | |
573 | jne invalid_use_of_symbol |
- | |
574 | load_address_type_ok: |
- | |
575 | cmp edx,-1 |
- | |
576 | jne bad_load_address |
- | |
577 | neg eax |
- | |
578 | mov esi,edi |
- | |
579 | sub esi,eax |
619 | mov edi,value |
580 | jc bad_load_address |
- | |
581 | cmp esi,[org_start] |
- | |
582 | jb bad_load_address |
- | |
583 | mov edi,value |
- | |
584 | movzx ecx,[operand_size] |
620 | rep movs byte [edi],[esi] |
585 | cmp ecx,eax |
- | |
586 | ja bad_load_address |
- | |
587 | rep movs byte [edi],[esi] |
- | |
588 | jmp value_loaded |
621 | pop edi esi |
589 | bad_load_address: |
- | |
590 | call recoverable_overflow |
- | |
591 | value_loaded: |
- | |
592 | pop edi esi |
- | |
593 | mov [value_sign],0 |
622 | value_loaded: |
- | 623 | mov [value_sign],0 |
|
594 | mov eax,dword [value] |
624 | mov eax,dword [value] |
595 | mov edx,dword [value+4] |
625 | mov edx,dword [value+4] |
596 | pop ebx |
626 | pop ebx |
597 | xor cx,cx |
627 | xor cx,cx |
598 | jmp make_constant |
628 | jmp make_constant |
599 | store_directive: |
629 | get_data_point: |
- | 630 | mov ebx,[addressing_space] |
|
- | 631 | mov ecx,edi |
|
- | 632 | sub ecx,[ebx+18h] |
|
- | 633 | mov [ebx+1Ch],ecx |
|
- | 634 | lods byte [esi] |
|
- | 635 | cmp al,'(' |
|
- | 636 | jne invalid_argument |
|
- | 637 | cmp byte [esi],11h |
|
- | 638 | jne get_data_address |
|
- | 639 | cmp word [esi+1+4],'):' |
|
- | 640 | jne get_data_address |
|
- | 641 | inc esi |
|
- | 642 | lods dword [esi] |
|
- | 643 | add esi,2 |
|
- | 644 | cmp byte [esi],'(' |
|
- | 645 | jne invalid_argument |
|
- | 646 | inc esi |
|
- | 647 | cmp eax,0Fh |
|
- | 648 | jbe reserved_word_used_as_symbol |
|
- | 649 | mov edx,undefined_symbol |
|
- | 650 | test byte [eax+8],1 |
|
- | 651 | jz addressing_space_unavailable |
|
- | 652 | mov edx,symbol_out_of_scope |
|
- | 653 | mov cx,[eax+16] |
|
- | 654 | cmp cx,[current_pass] |
|
- | 655 | jne addressing_space_unavailable |
|
- | 656 | test byte [eax+9],4 |
|
- | 657 | jz invalid_use_of_symbol |
|
- | 658 | mov ebx,eax |
|
- | 659 | mov ax,[current_pass] |
|
- | 660 | mov [ebx+18],ax |
|
- | 661 | or byte [ebx+8],8 |
|
- | 662 | cmp [symbols_file],0 |
|
- | 663 | je get_addressing_space |
|
- | 664 | cmp [next_pass_needed],0 |
|
- | 665 | jne get_addressing_space |
|
- | 666 | call store_label_reference |
|
- | 667 | get_addressing_space: |
|
- | 668 | mov ebx,[ebx] |
|
- | 669 | get_data_address: |
|
- | 670 | push ebx |
|
- | 671 | cmp byte [esi],'.' |
|
- | 672 | je invalid_value |
|
- | 673 | or [size_override],-1 |
|
- | 674 | call get_address_value |
|
- | 675 | pop ebp |
|
- | 676 | call calculate_relative_offset |
|
- | 677 | cmp [next_pass_needed],0 |
|
- | 678 | jne data_address_type_ok |
|
- | 679 | cmp [value_type],0 |
|
- | 680 | jne invalid_use_of_symbol |
|
- | 681 | data_address_type_ok: |
|
- | 682 | mov ebx,edi |
|
- | 683 | xor ecx,ecx |
|
- | 684 | add ebx,eax |
|
- | 685 | adc edx,ecx |
|
- | 686 | mov eax,ebx |
|
- | 687 | sub eax,[ds:ebp+18h] |
|
- | 688 | sbb edx,ecx |
|
- | 689 | jnz bad_data_address |
|
- | 690 | mov cl,[operand_size] |
|
- | 691 | add eax,ecx |
|
- | 692 | cmp eax,[ds:ebp+1Ch] |
|
- | 693 | ja bad_data_address |
|
- | 694 | clc |
|
- | 695 | ret |
|
- | 696 | addressing_space_unavailable: |
|
- | 697 | cmp [error_line],0 |
|
- | 698 | jne get_data_address |
|
- | 699 | push [current_line] |
|
- | 700 | pop [error_line] |
|
- | 701 | mov [error],edx |
|
- | 702 | mov [error_info],eax |
|
- | 703 | jmp get_data_address |
|
- | 704 | bad_data_address: |
|
- | 705 | call recoverable_overflow |
|
- | 706 | stc |
|
- | 707 | ret |
|
- | 708 | store_directive: |
|
600 | cmp byte [esi],11h |
709 | cmp byte [esi],11h |
601 | je sized_store |
710 | je sized_store |
602 | lods byte [esi] |
711 | lods byte [esi] |
603 | cmp al,'(' |
712 | cmp al,'(' |
604 | jne invalid_argument |
713 | jne invalid_argument |
Line 614... | Line 723... | ||
614 | cmp [value_type],0 |
723 | cmp [value_type],0 |
615 | jne invalid_use_of_symbol |
724 | jne invalid_use_of_symbol |
616 | mov dword [value],eax |
725 | mov dword [value],eax |
617 | mov dword [value+4],edx |
726 | mov dword [value+4],edx |
618 | lods word [esi] |
727 | lods byte [esi] |
619 | cmp ax,80h+'(' shl 8 |
728 | cmp al,80h |
620 | jne invalid_argument |
729 | jne invalid_argument |
621 | cmp byte [esi],'.' |
730 | call get_data_point |
622 | je invalid_value |
- | |
623 | or [size_override],-1 |
- | |
624 | call get_address_value |
- | |
625 | call calculate_relative_offset |
731 | jc instruction_assembled |
626 | push esi edi |
732 | push esi edi |
627 | cmp [next_pass_needed],0 |
733 | mov esi,value |
628 | jne store_address_type_ok |
- | |
629 | cmp [value_type],0 |
- | |
630 | jne invalid_use_of_symbol |
- | |
631 | store_address_type_ok: |
- | |
632 | cmp edx,-1 |
- | |
633 | jne bad_store_address |
- | |
634 | neg eax |
- | |
635 | sub edi,eax |
- | |
636 | jc bad_store_address |
- | |
637 | cmp edi,[org_start] |
- | |
638 | jb bad_store_address |
- | |
639 | mov esi,value |
- | |
640 | movzx ecx,[operand_size] |
734 | mov edi,ebx |
641 | cmp ecx,eax |
- | |
642 | ja bad_store_address |
735 | rep movs byte [edi],[esi] |
643 | rep movs byte [edi],[esi] |
- | |
644 | mov eax,edi |
736 | mov eax,edi |
645 | pop edi esi |
737 | pop edi esi |
646 | cmp edi,[undefined_data_end] |
738 | cmp ebx,[undefined_data_end] |
647 | jne instruction_assembled |
739 | jae instruction_assembled |
648 | cmp eax,[undefined_data_start] |
740 | cmp eax,[undefined_data_start] |
649 | jbe instruction_assembled |
741 | jbe instruction_assembled |
650 | mov [undefined_data_start],eax |
742 | mov [undefined_data_start],eax |
651 | jmp instruction_assembled |
743 | jmp instruction_assembled |
652 | bad_store_address: |
744 | |
653 | pop edi esi |
- | |
654 | call recoverable_overflow |
- | |
655 | jmp instruction_assembled |
- | |
656 | - | ||
Line 657... | Line 745... | ||
657 | display_directive: |
745 | display_directive: |
658 | lods byte [esi] |
746 | lods byte [esi] |
659 | cmp al,'(' |
747 | cmp al,'(' |
660 | jne invalid_argument |
748 | jne invalid_argument |
Line 663... | Line 751... | ||
663 | inc esi |
751 | inc esi |
664 | lods dword [esi] |
752 | lods dword [esi] |
665 | mov ecx,eax |
753 | mov ecx,eax |
666 | push edi |
754 | push edi |
667 | mov edi,[display_buffer] |
755 | mov edi,[tagged_blocks] |
668 | sub edi,8 |
756 | sub edi,8 |
669 | sub edi,eax |
757 | sub edi,eax |
670 | cmp edi,[esp] |
758 | cmp edi,[esp] |
671 | jbe out_of_memory |
759 | jbe out_of_memory |
672 | mov [display_buffer],edi |
760 | mov [tagged_blocks],edi |
673 | rep movs byte [edi],[esi] |
761 | rep movs byte [edi],[esi] |
674 | stos dword [edi] |
762 | stos dword [edi] |
675 | xor eax,eax |
763 | xor eax,eax |
676 | stos dword [edi] |
764 | stos dword [edi] |
677 | pop edi |
765 | pop edi |
678 | inc esi |
766 | inc esi |
679 | jmp display_next |
767 | jmp display_next |
680 | display_byte: |
768 | display_byte: |
681 | call get_byte_value |
769 | call get_byte_value |
682 | push edi |
770 | push edi |
683 | mov edi,[display_buffer] |
771 | mov edi,[tagged_blocks] |
684 | sub edi,8+1 |
772 | sub edi,8+1 |
685 | mov [display_buffer],edi |
773 | mov [tagged_blocks],edi |
686 | stos byte [edi] |
774 | stos byte [edi] |
687 | mov eax,1 |
775 | mov eax,1 |
688 | stos dword [edi] |
776 | stos dword [edi] |
689 | dec eax |
777 | dec eax |
690 | stos dword [edi] |
778 | stos dword [edi] |
691 | pop edi |
779 | pop edi |
692 | display_next: |
780 | display_next: |
693 | cmp edi,[display_buffer] |
781 | cmp edi,[tagged_blocks] |
694 | ja out_of_memory |
782 | ja out_of_memory |
695 | lods byte [esi] |
783 | lods byte [esi] |
696 | cmp al,',' |
784 | cmp al,',' |
697 | je display_directive |
785 | je display_directive |
698 | dec esi |
786 | dec esi |
699 | jmp instruction_assembled |
787 | jmp instruction_assembled |
700 | show_display_buffer: |
788 | show_display_buffer: |
701 | mov eax,[display_buffer] |
789 | mov eax,[tagged_blocks] |
702 | or eax,eax |
790 | or eax,eax |
703 | jz display_done |
791 | jz display_done |
704 | mov esi,[labels_list] |
792 | mov esi,[labels_list] |
705 | cmp esi,eax |
793 | cmp esi,eax |
706 | je display_done |
794 | je display_done |
707 | display_messages: |
795 | display_messages: |
Line 709... | Line 797... | ||
709 | mov eax,[esi+4] |
797 | mov eax,[esi+4] |
710 | mov ecx,[esi] |
798 | mov ecx,[esi] |
711 | sub esi,ecx |
799 | sub esi,ecx |
712 | test eax,eax |
800 | test eax,eax |
713 | jnz skip_internal_message |
801 | jnz skip_block |
714 | push esi |
802 | push esi |
715 | call display_block |
803 | call display_block |
716 | pop esi |
804 | pop esi |
717 | skip_internal_message: |
805 | skip_block: |
718 | cmp esi,[display_buffer] |
806 | cmp esi,[tagged_blocks] |
719 | jne display_messages |
807 | jne display_messages |
720 | display_done: |
808 | display_done: |
721 | ret |
809 | ret |
722 | 810 | ||
Line 723... | Line 811... | ||
723 | times_directive: |
811 | times_directive: |
Line 777... | Line 865... | ||
777 | setnz ch |
865 | setnz ch |
778 | jmp set_virtual |
866 | jmp set_virtual |
779 | virtual_at_current: |
867 | virtual_at_current: |
780 | dec esi |
868 | dec esi |
781 | mov al,[labels_type] |
869 | mov ebp,[addressing_space] |
- | 870 | mov al,[ds:ebp+9] |
|
782 | mov [value_type],al |
871 | mov [value_type],al |
783 | mov ebp,[org_symbol] |
872 | mov eax,edi |
784 | mov eax,edi |
- | |
785 | xor edx,edx |
873 | xor edx,edx |
786 | xor cl,cl |
874 | xor cl,cl |
787 | sub eax,dword [org_origin] |
875 | sub eax,[ds:ebp] |
788 | sbb edx,dword [org_origin+4] |
876 | sbb edx,[ds:ebp+4] |
789 | sbb cl,[org_origin_sign] |
877 | sbb cl,[ds:ebp+8] |
790 | mov [address_sign],cl |
878 | mov [address_sign],cl |
791 | mov bx,word [org_registers] |
879 | mov bx,[ds:ebp+10h] |
792 | mov cx,word [org_registers+2] |
880 | mov cx,[ds:ebp+10h+2] |
793 | xchg bh,bl |
881 | xchg bh,bl |
794 | xchg ch,cl |
882 | xchg ch,cl |
795 | set_virtual: |
883 | mov ebp,[ds:ebp+14h] |
- | 884 | set_virtual: |
|
796 | push [org_registers] |
885 | xchg bl,bh |
797 | mov byte [org_registers],bh |
886 | xchg cl,ch |
798 | mov byte [org_registers+1],bl |
887 | shl ecx,16 |
799 | mov byte [org_registers+2],ch |
888 | mov cx,bx |
800 | mov byte [org_registers+3],cl |
889 | push ecx eax |
801 | call allocate_structure_data |
890 | call allocate_structure_data |
802 | mov word [ebx],virtual_directive-instruction_handler |
891 | mov word [ebx],virtual_directive-instruction_handler |
803 | mov cl,[address_sign] |
892 | mov ecx,[addressing_space] |
- | 893 | mov [ebx+12],ecx |
|
- | 894 | mov [ebx+8],edi |
|
- | 895 | mov ecx,[current_line] |
|
- | 896 | mov [ebx+4],ecx |
|
- | 897 | mov ebx,[addressing_space] |
|
- | 898 | mov eax,edi |
|
- | 899 | sub eax,[ebx+18h] |
|
- | 900 | mov [ebx+1Ch],eax |
|
- | 901 | call init_addressing_space |
|
- | 902 | or byte [ebx+0Ah],1 |
|
- | 903 | pop eax |
|
- | 904 | mov cl,[address_sign] |
|
804 | not eax |
905 | not eax |
805 | not edx |
906 | not edx |
806 | not cl |
907 | not cl |
807 | add eax,1 |
908 | add eax,1 |
808 | adc edx,0 |
909 | adc edx,0 |
809 | adc cl,0 |
910 | adc cl,0 |
810 | add eax,edi |
911 | add eax,edi |
811 | adc edx,0 |
912 | adc edx,0 |
812 | adc cl,0 |
913 | adc cl,0 |
813 | xchg dword [org_origin],eax |
914 | mov [ebx],eax |
814 | xchg dword [org_origin+4],edx |
- | |
815 | xchg [org_origin_sign],cl |
- | |
816 | mov [ebx+10h],eax |
- | |
817 | mov [ebx+14h],edx |
915 | mov [ebx+4],edx |
818 | pop eax |
916 | mov [ebx+8],cl |
819 | mov [ebx+18h],eax |
- | |
820 | mov al,[virtual_data] |
- | |
821 | and al,0Fh |
- | |
822 | shl cl,4 |
- | |
823 | or al,cl |
- | |
824 | mov [ebx+2],al |
- | |
825 | mov al,[labels_type] |
- | |
826 | mov [ebx+3],al |
- | |
827 | mov eax,edi |
917 | pop dword [ebx+10h] |
828 | xchg eax,[org_start] |
- | |
829 | mov [ebx+0Ch],eax |
- | |
830 | xchg ebp,[org_symbol] |
918 | mov [ebx+14h],ebp |
831 | mov [ebx+1Ch],ebp |
- | |
832 | mov [ebx+8],edi |
919 | mov al,[value_type] |
833 | mov eax,[current_line] |
- | |
834 | mov [ebx+4],eax |
- | |
835 | or [virtual_data],-1 |
- | |
836 | mov al,[value_type] |
- | |
837 | test al,1 |
920 | test al,1 |
838 | jnz invalid_use_of_symbol |
921 | jnz invalid_use_of_symbol |
839 | mov [labels_type],al |
922 | mov [ebx+9],al |
840 | jmp instruction_assembled |
923 | jmp instruction_assembled |
841 | allocate_structure_data: |
924 | allocate_structure_data: |
842 | mov ebx,[structures_buffer] |
925 | mov ebx,[structures_buffer] |
843 | sub ebx,20h |
926 | sub ebx,18h |
844 | cmp ebx,[free_additional_memory] |
927 | cmp ebx,[free_additional_memory] |
845 | jb out_of_memory |
928 | jb out_of_memory |
846 | mov [structures_buffer],ebx |
929 | mov [structures_buffer],ebx |
847 | ret |
930 | ret |
848 | find_structure_data: |
931 | find_structure_data: |
849 | mov ebx,[structures_buffer] |
932 | mov ebx,[structures_buffer] |
Line 851... | Line 934... | ||
851 | cmp ebx,[additional_memory_end] |
934 | cmp ebx,[additional_memory_end] |
852 | je no_such_structure |
935 | je no_such_structure |
853 | cmp ax,[ebx] |
936 | cmp ax,[ebx] |
854 | je structure_data_found |
937 | je structure_data_found |
855 | add ebx,20h |
938 | add ebx,18h |
856 | jmp scan_structures |
939 | jmp scan_structures |
857 | structure_data_found: |
940 | structure_data_found: |
858 | ret |
941 | ret |
859 | no_such_structure: |
942 | no_such_structure: |
860 | stc |
943 | stc |
861 | ret |
944 | ret |
862 | end_virtual: |
945 | end_virtual: |
863 | call find_structure_data |
946 | call find_structure_data |
864 | jc unexpected_instruction |
947 | jc unexpected_instruction |
865 | mov al,[ebx+2] |
948 | push ebx |
866 | mov ah,al |
- | |
867 | shr ah,4 |
- | |
868 | and al,1 |
949 | call close_virtual_addressing_space |
869 | neg al |
- | |
870 | and ah,1 |
- | |
871 | neg ah |
- | |
872 | mov [virtual_data],al |
- | |
873 | mov [org_origin_sign],ah |
950 | pop ebx |
874 | mov al,[ebx+3] |
- | |
875 | mov [labels_type],al |
951 | mov eax,[ebx+12] |
876 | mov eax,[ebx+10h] |
- | |
877 | mov dword [org_origin],eax |
- | |
878 | mov eax,[ebx+14h] |
- | |
879 | mov dword [org_origin+4],eax |
- | |
880 | mov eax,[ebx+18h] |
- | |
881 | mov [org_registers],eax |
952 | mov [addressing_space],eax |
882 | mov eax,[ebx+0Ch] |
- | |
883 | mov [org_start],eax |
- | |
884 | mov eax,[ebx+1Ch] |
953 | mov edi,[ebx+8] |
885 | mov [org_symbol],eax |
- | |
886 | mov edi,[ebx+8] |
- | |
887 | remove_structure_data: |
954 | remove_structure_data: |
888 | push esi edi |
955 | push esi edi |
889 | mov ecx,ebx |
956 | mov ecx,ebx |
890 | sub ecx,[structures_buffer] |
957 | sub ecx,[structures_buffer] |
891 | shr ecx,2 |
958 | shr ecx,2 |
892 | lea esi,[ebx-4] |
959 | lea esi,[ebx-4] |
893 | lea edi,[esi+20h] |
960 | lea edi,[esi+18h] |
894 | std |
961 | std |
895 | rep movs dword [edi],[esi] |
962 | rep movs dword [edi],[esi] |
896 | cld |
963 | cld |
897 | add [structures_buffer],20h |
964 | add [structures_buffer],18h |
898 | pop edi esi |
965 | pop edi esi |
899 | ret |
966 | ret |
900 | repeat_directive: |
967 | close_virtual_addressing_space: |
- | 968 | mov ebx,[addressing_space] |
|
- | 969 | mov eax,edi |
|
- | 970 | sub eax,[ebx+18h] |
|
- | 971 | mov [ebx+1Ch],eax |
|
- | 972 | test byte [ebx+0Ah],2 |
|
- | 973 | jz addressing_space_closed |
|
- | 974 | push esi edi ecx edx |
|
- | 975 | mov ecx,eax |
|
- | 976 | mov eax,[tagged_blocks] |
|
- | 977 | mov dword [eax-4],11h |
|
- | 978 | mov dword [eax-8],ecx |
|
- | 979 | sub eax,8 |
|
- | 980 | sub eax,ecx |
|
- | 981 | mov [tagged_blocks],eax |
|
- | 982 | lea edi,[eax+ecx-1] |
|
- | 983 | xchg eax,[ebx+18h] |
|
- | 984 | lea esi,[eax+ecx-1] |
|
- | 985 | mov eax,edi |
|
- | 986 | sub eax,esi |
|
- | 987 | std |
|
- | 988 | shr ecx,1 |
|
- | 989 | jnc virtual_byte_ok |
|
- | 990 | movs byte [edi],[esi] |
|
- | 991 | virtual_byte_ok: |
|
- | 992 | dec esi |
|
- | 993 | dec edi |
|
- | 994 | shr ecx,1 |
|
- | 995 | jnc virtual_word_ok |
|
- | 996 | movs word [edi],[esi] |
|
- | 997 | virtual_word_ok: |
|
- | 998 | sub esi,2 |
|
- | 999 | sub edi,2 |
|
- | 1000 | rep movs dword [edi],[esi] |
|
- | 1001 | cld |
|
- | 1002 | xor edx,edx |
|
- | 1003 | add [ebx],eax |
|
- | 1004 | adc dword [ebx+4],edx |
|
- | 1005 | adc byte [ebx+8],dl |
|
- | 1006 | pop edx ecx edi esi |
|
- | 1007 | addressing_space_closed: |
|
- | 1008 | ret |
|
- | 1009 | repeat_directive: |
|
901 | cmp [prefixed_instruction],0 |
1010 | cmp [prefixed_instruction],0 |
902 | jne unexpected_instruction |
1011 | jne unexpected_instruction |
903 | lods byte [esi] |
1012 | lods byte [esi] |
904 | cmp al,'(' |
1013 | cmp al,'(' |
905 | jne invalid_argument |
1014 | jne invalid_argument |
Line 1191... | Line 1300... | ||
1191 | cmp ax,while_directive-instruction_handler |
1300 | cmp ax,while_directive-instruction_handler |
1192 | je break_while |
1301 | je break_while |
1193 | cmp ax,if_directive-instruction_handler |
1302 | cmp ax,if_directive-instruction_handler |
1194 | je break_if |
1303 | je break_if |
1195 | add ebx,20h |
1304 | add ebx,18h |
1196 | jmp find_breakable_structure |
1305 | jmp find_breakable_structure |
1197 | break_if: |
1306 | break_if: |
1198 | push [current_line] |
1307 | push [current_line] |
1199 | mov eax,[ebx+4] |
1308 | mov eax,[ebx+4] |
1200 | mov [current_line],eax |
1309 | mov [current_line],eax |
1201 | call remove_structure_data |
1310 | call remove_structure_data |
Line 1233... | Line 1342... | ||
1233 | inc esi |
1342 | inc esi |
1234 | lods dword [esi] |
1343 | lods dword [esi] |
1235 | mov ecx,eax |
1344 | mov ecx,eax |
1236 | lea eax,[edi+ecx] |
1345 | lea eax,[edi+ecx] |
1237 | cmp eax,[display_buffer] |
1346 | cmp eax,[tagged_blocks] |
1238 | ja out_of_memory |
1347 | ja out_of_memory |
1239 | rep movs byte [edi],[esi] |
1348 | rep movs byte [edi],[esi] |
1240 | inc esi |
1349 | inc esi |
1241 | ret |
1350 | ret |
1242 | undefined_data: |
1351 | undefined_data: |
1243 | cmp [virtual_data],0 |
1352 | mov ebp,[addressing_space] |
- | 1353 | test byte [ds:ebp+0Ah],1 |
|
1244 | je mark_undefined_data |
1354 | jz mark_undefined_data |
1245 | ret |
1355 | ret |
1246 | mark_undefined_data: |
1356 | mark_undefined_data: |
1247 | cmp eax,[undefined_data_end] |
1357 | cmp eax,[undefined_data_end] |
1248 | je undefined_data_ok |
1358 | je undefined_data_ok |
1249 | mov [undefined_data_start],eax |
1359 | mov [undefined_data_start],eax |
1250 | undefined_data_ok: |
1360 | undefined_data_ok: |
1251 | mov [undefined_data_end],edi |
1361 | mov [undefined_data_end],edi |
1252 | ret |
1362 | ret |
1253 | define_data: |
1363 | define_data: |
1254 | cmp edi,[display_buffer] |
1364 | cmp edi,[tagged_blocks] |
1255 | jae out_of_memory |
1365 | jae out_of_memory |
1256 | cmp byte [esi],'(' |
1366 | cmp byte [esi],'(' |
1257 | jne simple_data_value |
1367 | jne simple_data_value |
1258 | mov ebx,esi |
1368 | mov ebx,esi |
1259 | inc esi |
1369 | inc esi |
1260 | call skip_expression |
1370 | call skip_expression |
Line 1271... | Line 1381... | ||
1271 | inc esi |
1381 | inc esi |
1272 | duplicate_data: |
1382 | duplicate_data: |
1273 | push eax esi |
1383 | push eax esi |
1274 | duplicated_values: |
1384 | duplicated_values: |
1275 | cmp edi,[display_buffer] |
1385 | cmp edi,[tagged_blocks] |
1276 | jae out_of_memory |
1386 | jae out_of_memory |
1277 | call near dword [esp+8] |
1387 | call near dword [esp+8] |
1278 | lods byte [esi] |
1388 | lods byte [esi] |
1279 | cmp al,',' |
1389 | cmp al,',' |
1280 | je duplicated_values |
1390 | je duplicated_values |
1281 | cmp al,'}' |
1391 | cmp al,'}' |
Line 1285... | Line 1395... | ||
1285 | jz data_defined |
1395 | jz data_defined |
1286 | mov esi,ebx |
1396 | mov esi,ebx |
1287 | jmp duplicate_data |
1397 | jmp duplicate_data |
1288 | duplicate_single_data_value: |
1398 | duplicate_single_data_value: |
1289 | cmp edi,[display_buffer] |
1399 | cmp edi,[tagged_blocks] |
1290 | jae out_of_memory |
1400 | jae out_of_memory |
1291 | push eax esi |
1401 | push eax esi |
1292 | call near dword [esp+8] |
1402 | call near dword [esp+8] |
1293 | pop ebx eax |
1403 | pop ebx eax |
1294 | dec eax |
1404 | dec eax |
1295 | jz data_defined |
1405 | jz data_defined |
Line 1309... | Line 1419... | ||
1309 | skip_single_data_value: |
1419 | skip_single_data_value: |
1310 | call skip_symbol |
1420 | call skip_symbol |
1311 | jmp data_defined |
1421 | jmp data_defined |
1312 | simple_data_value: |
1422 | simple_data_value: |
1313 | cmp edi,[display_buffer] |
1423 | cmp edi,[tagged_blocks] |
1314 | jae out_of_memory |
1424 | jae out_of_memory |
1315 | call near dword [esp] |
1425 | call near dword [esp] |
1316 | data_defined: |
1426 | data_defined: |
1317 | lods byte [esi] |
1427 | lods byte [esi] |
1318 | cmp al,',' |
1428 | cmp al,',' |
1319 | je define_data |
1429 | je define_data |
Line 1352... | Line 1462... | ||
1352 | lods dword [esi] |
1462 | lods dword [esi] |
1353 | mov ecx,eax |
1463 | mov ecx,eax |
1354 | jecxz word_string_ok |
1464 | jecxz word_string_ok |
1355 | lea eax,[edi+ecx*2] |
1465 | lea eax,[edi+ecx*2] |
1356 | cmp eax,[display_buffer] |
1466 | cmp eax,[tagged_blocks] |
1357 | ja out_of_memory |
1467 | ja out_of_memory |
1358 | xor ah,ah |
1468 | xor ah,ah |
1359 | copy_word_string: |
1469 | copy_word_string: |
1360 | lods byte [esi] |
1470 | lods byte [esi] |
1361 | stos word [edi] |
1471 | stos word [edi] |
1362 | loop copy_word_string |
1472 | loop copy_word_string |
Line 1622... | Line 1732... | ||
1622 | pop ecx |
1732 | pop ecx |
1623 | mov edx,edi |
1733 | mov edx,edi |
1624 | add edi,ecx |
1734 | add edi,ecx |
1625 | jc out_of_memory |
1735 | jc out_of_memory |
1626 | cmp edi,[display_buffer] |
1736 | cmp edi,[tagged_blocks] |
1627 | ja out_of_memory |
1737 | ja out_of_memory |
1628 | call read |
1738 | call read |
1629 | jc error_reading_file |
1739 | jc error_reading_file |
1630 | call close |
1740 | call close |
1631 | lods byte [esi] |
1741 | lods byte [esi] |
1632 | cmp al,',' |
1742 | cmp al,',' |
Line 1702... | Line 1812... | ||
1702 | mov ecx,eax |
1812 | mov ecx,eax |
1703 | mov edx,ecx |
1813 | mov edx,ecx |
1704 | add edx,edi |
1814 | add edx,edi |
1705 | jc out_of_memory |
1815 | jc out_of_memory |
1706 | cmp edx,[display_buffer] |
1816 | cmp edx,[tagged_blocks] |
1707 | ja out_of_memory |
1817 | ja out_of_memory |
1708 | push edi |
1818 | push edi |
1709 | cmp [next_pass_needed],0 |
1819 | cmp [next_pass_needed],0 |
1710 | je zero_bytes |
1820 | je zero_bytes |
1711 | add edi,ecx |
1821 | add edi,ecx |
1712 | jmp reserved_data |
1822 | jmp reserved_data |
Line 1737... | Line 1847... | ||
1737 | shl edx,1 |
1847 | shl edx,1 |
1738 | jc out_of_memory |
1848 | jc out_of_memory |
1739 | add edx,edi |
1849 | add edx,edi |
1740 | jc out_of_memory |
1850 | jc out_of_memory |
1741 | cmp edx,[display_buffer] |
1851 | cmp edx,[tagged_blocks] |
1742 | ja out_of_memory |
1852 | ja out_of_memory |
1743 | push edi |
1853 | push edi |
1744 | cmp [next_pass_needed],0 |
1854 | cmp [next_pass_needed],0 |
1745 | je zero_words |
1855 | je zero_words |
1746 | lea edi,[edi+ecx*2] |
1856 | lea edi,[edi+ecx*2] |
1747 | jmp reserved_data |
1857 | jmp reserved_data |
Line 1767... | Line 1877... | ||
1767 | shl edx,1 |
1877 | shl edx,1 |
1768 | jc out_of_memory |
1878 | jc out_of_memory |
1769 | add edx,edi |
1879 | add edx,edi |
1770 | jc out_of_memory |
1880 | jc out_of_memory |
1771 | cmp edx,[display_buffer] |
1881 | cmp edx,[tagged_blocks] |
1772 | ja out_of_memory |
1882 | ja out_of_memory |
1773 | push edi |
1883 | push edi |
1774 | cmp [next_pass_needed],0 |
1884 | cmp [next_pass_needed],0 |
1775 | je zero_dwords |
1885 | je zero_dwords |
1776 | lea edi,[edi+ecx*4] |
1886 | lea edi,[edi+ecx*4] |
1777 | jmp reserved_data |
1887 | jmp reserved_data |
Line 1794... | Line 1904... | ||
1794 | shl edx,1 |
1904 | shl edx,1 |
1795 | jc out_of_memory |
1905 | jc out_of_memory |
1796 | add edx,edi |
1906 | add edx,edi |
1797 | jc out_of_memory |
1907 | jc out_of_memory |
1798 | cmp edx,[display_buffer] |
1908 | cmp edx,[tagged_blocks] |
1799 | ja out_of_memory |
1909 | ja out_of_memory |
1800 | push edi |
1910 | push edi |
1801 | cmp [next_pass_needed],0 |
1911 | cmp [next_pass_needed],0 |
1802 | je zero_words |
1912 | je zero_words |
1803 | lea edi,[edi+ecx*2] |
1913 | lea edi,[edi+ecx*2] |
1804 | jmp reserved_data |
1914 | jmp reserved_data |
Line 1818... | Line 1928... | ||
1818 | shl edx,1 |
1928 | shl edx,1 |
1819 | jc out_of_memory |
1929 | jc out_of_memory |
1820 | add edx,edi |
1930 | add edx,edi |
1821 | jc out_of_memory |
1931 | jc out_of_memory |
1822 | cmp edx,[display_buffer] |
1932 | cmp edx,[tagged_blocks] |
1823 | ja out_of_memory |
1933 | ja out_of_memory |
1824 | push edi |
1934 | push edi |
1825 | cmp [next_pass_needed],0 |
1935 | cmp [next_pass_needed],0 |
1826 | je zero_dwords |
1936 | je zero_dwords |
1827 | lea edi,[edi+ecx*4] |
1937 | lea edi,[edi+ecx*4] |
1828 | jmp reserved_data |
1938 | jmp reserved_data |
Line 1841... | Line 1951... | ||
1841 | shl edx,1 |
1951 | shl edx,1 |
1842 | jc out_of_memory |
1952 | jc out_of_memory |
1843 | add edx,edi |
1953 | add edx,edi |
1844 | jc out_of_memory |
1954 | jc out_of_memory |
1845 | cmp edx,[display_buffer] |
1955 | cmp edx,[tagged_blocks] |
1846 | ja out_of_memory |
1956 | ja out_of_memory |
1847 | push edi |
1957 | push edi |
1848 | cmp [next_pass_needed],0 |
1958 | cmp [next_pass_needed],0 |
1849 | je zero_words |
1959 | je zero_words |
1850 | lea edi,[edi+ecx*2] |
1960 | lea edi,[edi+ecx*2] |
1851 | jmp reserved_data |
1961 | jmp reserved_data |
Line 1864... | Line 1974... | ||
1864 | jz invalid_align_value |
1974 | jz invalid_align_value |
1865 | cmp eax,1 |
1975 | cmp eax,1 |
1866 | je instruction_assembled |
1976 | je instruction_assembled |
1867 | mov ecx,edi |
1977 | mov ecx,edi |
1868 | sub ecx,dword [org_origin] |
1978 | mov ebp,[addressing_space] |
- | 1979 | sub ecx,[ds:ebp] |
|
1869 | cmp [org_registers],0 |
1980 | cmp dword [ds:ebp+10h],0 |
1870 | jne section_not_aligned_enough |
1981 | jne section_not_aligned_enough |
1871 | cmp [labels_type],0 |
1982 | cmp byte [ds:ebp+9],0 |
1872 | je make_alignment |
1983 | je make_alignment |
1873 | cmp [output_format],3 |
1984 | cmp [output_format],3 |
1874 | je pe_alignment |
1985 | je pe_alignment |
1875 | mov ebx,[org_symbol] |
1986 | mov ebx,[ds:ebp+14h] |
1876 | cmp byte [ebx],0 |
1987 | cmp byte [ebx],0 |
1877 | jne section_not_aligned_enough |
1988 | jne section_not_aligned_enough |
1878 | cmp eax,[ebx+10h] |
1989 | cmp eax,[ebx+10h] |
1879 | jbe make_alignment |
1990 | jbe make_alignment |
1880 | jmp section_not_aligned_enough |
1991 | jmp section_not_aligned_enough |
1881 | pe_alignment: |
1992 | pe_alignment: |
Line 1890... | Line 2001... | ||
1890 | inc ecx |
2001 | inc ecx |
1891 | mov edx,ecx |
2002 | mov edx,ecx |
1892 | add edx,edi |
2003 | add edx,edi |
1893 | jc out_of_memory |
2004 | jc out_of_memory |
1894 | cmp edx,[display_buffer] |
2005 | cmp edx,[tagged_blocks] |
1895 | ja out_of_memory |
2006 | ja out_of_memory |
1896 | push edi |
2007 | push edi |
1897 | cmp [next_pass_needed],0 |
2008 | cmp [next_pass_needed],0 |
1898 | je nops |
2009 | je nops |
1899 | add edi,ecx |
2010 | add edi,ecx |
1900 | jmp reserved_data |
2011 | jmp reserved_data |