flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Optimisation directive

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 16 Nov 2011, 22:36
Tomasz, maybe add to fasm optimisation directive that allows to generate jumps into first 64KB of the code.
For example:
use32
"jmp/jcc destination" <- will be converted automatically to -> "jmp/jcc WORD destination" when it is possible
In unreal version of fasm it saves about 3KB space.
By analogy with addressing:
"mov al,[source]" <- will be converted automatically to -> "mov al,[WORD source]" when it is possible

Thanks.
Post 16 Nov 2011, 22:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 16 Nov 2011, 23:17
You can do this sort of thing with macros:
Code:
macro jmp dest {
      local .x
    virtual
             jmp near dest
               load .x dword from $-4
      end virtual
 if .x >= 0xffffff80 | .x <= 0x0000007f
                jmp short dest
      else if dest and not 0xffff = 0
             jmp word dest
       else
                jmp dest
    end if
}
use32

org 0
jmp 0
jmp 128
jmp 150
jmp 0xffff
jmp 0x1000f

org 0x10000
jmp 0
jmp 128
jmp 150
jmp 0xffff
jmp 0x1000f    
Post 16 Nov 2011, 23:17
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 414
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 17 Nov 2011, 15:26
This macro is in conflict with far jmp
Post 17 Nov 2011, 15:26
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20454
Location: In your JS exploiting you and your system
revolution 17 Nov 2011, 15:33
The macro is just an example. You can extend to whatever your needs require.
Post 17 Nov 2011, 15:33
View user's profile Send private message Visit poster's website 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.