flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Signed numbers, calculator, fasm code

Author
Thread Post new topic Reply to topic
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 24 Nov 2010, 08:32
0.
Hi the board.

1.
Working over a routine or making some calculations i use fasm's calc in some cases to recheck myself.
It's boring much that it does not support unsigned qword operations(division, e.g.).
A "sign" & "unsign" directives could have solved the problem.
That way fasm, to my mind, would have to inform user about sign mode changes through "display" directive.
So that user avoided lot of cry.

2.
Tomasz, set calc's font to ASMEDIT's, please.

3.
Tomasz, open "exprcalc.inc", line ~930, optimize-able for size.
Partial snippet given only.
Code:
        xor     ebx,ebx              ;)
        cmp     dword [edi],0        ;here
        jne     divider_ok
        cmp     dword [edi+4],0      ;here
        jne     divider_ok
        cmp     [next_pass_needed],0 ;here
        je      value_out_of_range
        jmp     div_done
      divider_ok:
        bt      dword [esi+4],31     ;here    cmp dword[esi+4],ebx
        jnc     div_first_sign_ok    ;        js
        not     dword [esi]
        not     dword [esi+4]
        add     dword [esi],1
        adc     dword [esi+4],0      ;here
        ...                          ;there
    
Post 24 Nov 2010, 08:32
View user's profile Send private message Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 24 Nov 2010, 08:45
Code:
        not     dword [esi] 
        not     dword [esi+4] 
        add     dword [esi],1 
        adc     dword [esi+4],0      
    

equals
Code:
        not     dword[esi+4]
        neg     dword[esi]
        adc     dword[esi+4],0 ;ebx
    
Post 24 Nov 2010, 08:45
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 24 Nov 2010, 11:27

hi edemko,

I've also seen a lot of little things like that !
But I think Tomasz does not favor the size,
but rather to maintain readability.
It is more difficult to change a optimized code ...
and less easy to understand it after a while!
I like much to optimize my code to the maximum,
but sometimes i waste a lot of time to understand it again after a long time.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 24 Nov 2010, 11:27
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.