Rev 992 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 992 | Rev 1039 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; flat assembler core |
1 | ; flat assembler core |
2 | ; Copyright (c) 1999-2007, Tomasz Grysztar. |
2 | ; Copyright (c) 1999-2009, Tomasz Grysztar. |
3 | ; All rights reserved. |
3 | ; All rights reserved. |
Line 4... | Line 4... | ||
4 | 4 | ||
5 | convert_expression: |
5 | convert_expression: |
6 | push ebp |
6 | push ebp |
Line 204... | Line 204... | ||
204 | mov esi,[number_start] |
204 | mov esi,[number_start] |
205 | get_dec_digit: |
205 | get_dec_digit: |
206 | cmp esi,ebx |
206 | cmp esi,ebx |
207 | ja number_ok |
207 | ja number_ok |
208 | xor edx,edx |
208 | cmp byte [esi],27h |
- | 209 | je next_dec_digit |
|
- | 210 | xor edx,edx |
|
209 | mov eax,[edi] |
211 | mov eax,[edi] |
210 | shld edx,eax,2 |
212 | shld edx,eax,2 |
211 | shl eax,2 |
213 | shl eax,2 |
212 | add eax,[edi] |
214 | add eax,[edi] |
213 | adc edx,0 |
215 | adc edx,0 |
Line 232... | Line 234... | ||
232 | ja bad_number |
234 | ja bad_number |
233 | add [edi],eax |
235 | add [edi],eax |
234 | adc dword [edi+4],0 |
236 | adc dword [edi+4],0 |
235 | jc dec_out_of_range |
237 | jc dec_out_of_range |
236 | inc esi |
238 | next_dec_digit: |
- | 239 | inc esi |
|
237 | jmp get_dec_digit |
240 | jmp get_dec_digit |
238 | dec_out_of_range: |
241 | dec_out_of_range: |
239 | or ebp,-1 |
242 | or ebp,-1 |
240 | inc esi |
243 | inc esi |
241 | jmp get_dec_digit |
244 | jmp get_dec_digit |
Line 253... | Line 256... | ||
253 | get_bin_digit: |
256 | get_bin_digit: |
254 | cmp esi,[number_start] |
257 | cmp esi,[number_start] |
255 | jb number_ok |
258 | jb number_ok |
256 | movzx eax,byte [esi] |
259 | movzx eax,byte [esi] |
257 | sub al,30h |
260 | cmp al,27h |
- | 261 | je bin_digit_skip |
|
- | 262 | sub al,30h |
|
258 | cmp al,1 |
263 | cmp al,1 |
259 | ja bad_number |
264 | ja bad_number |
260 | xor edx,edx |
265 | xor edx,edx |
261 | mov cl,bl |
266 | mov cl,bl |
262 | dec esi |
267 | dec esi |
Line 277... | Line 282... | ||
277 | or al,al |
282 | or al,al |
278 | jz get_bin_digit |
283 | jz get_bin_digit |
279 | or ebp,-1 |
284 | or ebp,-1 |
280 | jmp get_bin_digit |
285 | jmp get_bin_digit |
281 | pascal_hex_number: |
286 | bin_digit_skip: |
- | 287 | dec esi |
|
- | 288 | jmp get_bin_digit |
|
- | 289 | pascal_hex_number: |
|
282 | cmp cl,1 |
290 | cmp cl,1 |
283 | je bad_number |
291 | je bad_number |
284 | get_hex_number: |
292 | get_hex_number: |
285 | xor bl,bl |
293 | xor bl,bl |
286 | get_hex_digit: |
294 | get_hex_digit: |
287 | cmp esi,[number_start] |
295 | cmp esi,[number_start] |
288 | jb number_ok |
296 | jb number_ok |
289 | movzx eax,byte [esi] |
297 | movzx eax,byte [esi] |
290 | cmp al,'x' |
298 | cmp al,27h |
- | 299 | je hex_digit_skip |
|
- | 300 | cmp al,'x' |
|
291 | je hex_number_ok |
301 | je hex_number_ok |
292 | cmp al,'$' |
302 | cmp al,'$' |
293 | je pascal_hex_ok |
303 | je pascal_hex_ok |
294 | sub al,30h |
304 | sub al,30h |
295 | cmp al,9 |
305 | cmp al,9 |
Line 324... | Line 334... | ||
324 | or al,al |
334 | or al,al |
325 | jz get_hex_digit |
335 | jz get_hex_digit |
326 | or ebp,-1 |
336 | or ebp,-1 |
327 | jmp get_hex_digit |
337 | jmp get_hex_digit |
328 | get_oct_number: |
338 | hex_digit_skip: |
- | 339 | dec esi |
|
- | 340 | jmp get_hex_digit |
|
- | 341 | get_oct_number: |
|
329 | xor bl,bl |
342 | xor bl,bl |
330 | get_oct_digit: |
343 | get_oct_digit: |
331 | cmp esi,[number_start] |
344 | cmp esi,[number_start] |
332 | jb number_ok |
345 | jb number_ok |
333 | movzx eax,byte [esi] |
346 | movzx eax,byte [esi] |
334 | sub al,30h |
347 | cmp al,27h |
- | 348 | je oct_digit_skip |
|
- | 349 | sub al,30h |
|
335 | cmp al,7 |
350 | cmp al,7 |
336 | ja bad_number |
351 | ja bad_number |
337 | oct_digit_ok: |
352 | oct_digit_ok: |
338 | xor edx,edx |
353 | xor edx,edx |
339 | mov cl,bl |
354 | mov cl,bl |
Line 356... | Line 371... | ||
356 | sub cl,32 |
371 | sub cl,32 |
357 | shl eax,cl |
372 | shl eax,cl |
358 | or dword [edi+4],eax |
373 | or dword [edi+4],eax |
359 | jmp get_oct_digit |
374 | jmp get_oct_digit |
360 | oct_out_of_range: |
375 | oct_digit_skip: |
- | 376 | dec esi |
|
- | 377 | jmp get_oct_digit |
|
- | 378 | oct_out_of_range: |
|
361 | or al,al |
379 | or al,al |
362 | jz get_oct_digit |
380 | jz get_oct_digit |
363 | or ebp,-1 |
381 | or ebp,-1 |
364 | jmp get_oct_digit |
382 | jmp get_oct_digit |
365 | hex_number_ok: |
383 | hex_number_ok: |
Line 1734... | Line 1752... | ||
1734 | inc bx |
1752 | inc bx |
1735 | shr eax,1 |
1753 | shr eax,1 |
1736 | fp_dword_ok: |
1754 | fp_dword_ok: |
1737 | add bx,7Fh |
1755 | add bx,7Fh |
1738 | cmp bx,100h |
1756 | cmp bx,0FFh |
1739 | jae value_out_of_range |
1757 | jge value_out_of_range |
1740 | shl ebx,23 |
1758 | cmp bx,0 |
- | 1759 | jg fp_dword_exp_ok |
|
- | 1760 | or eax,1 shl 23 |
|
- | 1761 | mov cx,bx |
|
- | 1762 | neg cx |
|
- | 1763 | inc cx |
|
- | 1764 | cmp cx,23 |
|
- | 1765 | ja value_out_of_range |
|
- | 1766 | xor bx,bx |
|
- | 1767 | shr eax,cl |
|
- | 1768 | jnc fp_dword_exp_ok |
|
- | 1769 | inc eax |
|
- | 1770 | test eax,1 shl 23 |
|
- | 1771 | jz fp_dword_exp_ok |
|
- | 1772 | and eax,1 shl 23 - 1 |
|
- | 1773 | inc bx |
|
- | 1774 | fp_dword_exp_ok: |
|
- | 1775 | shl ebx,23 |
|
1741 | or eax,ebx |
1776 | or eax,ebx |
1742 | fp_dword_store: |
1777 | fp_dword_store: |
1743 | mov bl,[esi+11] |
1778 | mov bl,[esi+11] |
1744 | shl ebx,31 |
1779 | shl ebx,31 |
1745 | or eax,ebx |
1780 | or eax,ebx |
Line 1771... | Line 1806... | ||
1771 | shr edx,1 |
1806 | shr edx,1 |
1772 | rcr eax,1 |
1807 | rcr eax,1 |
1773 | fp_qword_ok: |
1808 | fp_qword_ok: |
1774 | add bx,3FFh |
1809 | add bx,3FFh |
1775 | cmp bx,800h |
1810 | cmp bx,7FFh |
1776 | jae value_out_of_range |
1811 | jge value_out_of_range |
1777 | shl ebx,20 |
1812 | cmp bx,0 |
- | 1813 | jg fp_qword_exp_ok |
|
- | 1814 | or edx,1 shl 20 |
|
- | 1815 | mov cx,bx |
|
- | 1816 | neg cx |
|
- | 1817 | inc cx |
|
- | 1818 | cmp cx,52 |
|
- | 1819 | ja value_out_of_range |
|
- | 1820 | cmp cx,32 |
|
- | 1821 | jbe fp_qword_small_shift |
|
- | 1822 | sub cx,32 |
|
- | 1823 | mov eax,edx |
|
- | 1824 | xor edx,edx |
|
- | 1825 | shr eax,cl |
|
- | 1826 | jmp fp_qword_shift_done |
|
- | 1827 | fp_qword_small_shift: |
|
- | 1828 | mov ebx,edx |
|
- | 1829 | shr edx,cl |
|
- | 1830 | shrd eax,ebx,cl |
|
- | 1831 | fp_qword_shift_done: |
|
- | 1832 | mov bx,0 |
|
- | 1833 | jnc fp_qword_exp_ok |
|
- | 1834 | add eax,1 |
|
- | 1835 | adc edx,0 |
|
- | 1836 | test edx,1 shl 20 |
|
- | 1837 | jz fp_qword_exp_ok |
|
- | 1838 | and edx,1 shl 20 - 1 |
|
- | 1839 | inc bx |
|
- | 1840 | fp_qword_exp_ok: |
|
- | 1841 | shl ebx,20 |
|
1778 | or edx,ebx |
1842 | or edx,ebx |
1779 | fp_qword_store: |
1843 | fp_qword_store: |
1780 | mov bl,[esi+11] |
1844 | mov bl,[esi+11] |
1781 | shl ebx,31 |
1845 | shl ebx,31 |
1782 | or edx,ebx |
1846 | or edx,ebx |