flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fasm as DLL

Goto page Previous  1, 2, 3, 4, 5
Author
Thread Post new topic Reply to topic
masm



Joined: 10 Oct 2014
Posts: 6
masm
please helps how i can compile FASMX64.ASM ? when i complile with last version 1.73.16 it is give me erros.


Description:
Filesize: 81.32 KB
Viewed: 6532 Time(s)

fasm.jpg


Post 12 Aug 2019, 17:30
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7924
Location: Kraków, Poland
Tomasz Grysztar
I'm not sure what might have caused this problem in your case, but I have updated the fasmDLL.zip with re-assembled 1.73.16 version. Please check if the new one works for you.
Post 12 Aug 2019, 19:41
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 952
Location: Belarus
DimonSoft
My first guess was that you’re trying to compile PREPROCE.INC only (start from this file) which doesn’t contain the symbol. Looked through the file and checked that. Choose FASMX64.ASM tab before compiling or better assign it to compiler from context menu.
Post 12 Aug 2019, 21:13
View user's profile Send private message Visit poster's website Reply with quote
Abruzzi



Joined: 30 Sep 2019
Posts: 17
Abruzzi
I used FASM DLL to assembly a simple instruction like xor eax, eax and I wonder why the output_length for this particular instruction is 3 and output binary data is something like 0x6631C0.

I tried to add one more instruction to see how the output is changing and for these two lines
Code:
xor eax, eax
xor eax, eax    

the output_length is 6 and output binary data is 0x6631C06631C0. What is this extra byte (0x66) used for?
Post 09 Jan 2020, 16:02
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 641
Location: Russian Federation, Sochi
ProMiNick
try this sequence
Code:
use16
xor eax, eax    

thou will see output is the same as thours
than try
Code:
use32
xor eax, eax    


use16 mode is by default in fasm
thou could play with these samples too
Code:
use16
xor ax, ax    
Code:
use32
xor ax, ax    


Abruzzi, than I congratulate thou - thou explore bicicle.
Post 09 Jan 2020, 16:48
View user's profile Send private message Send e-mail Reply with quote
Abruzzi



Joined: 30 Sep 2019
Posts: 17
Abruzzi
Many thanks ProMiNick. Indeed using use32 directive the output is 2 bytes length and the resulted opcode is 0x31C0 as I expect.

I tried your examples also.
Code:
use16
xor ax, ax     

generates 0x31C0 as 32 bit mode if I use eax register and
Code:
use32
xor ax, ax     

generates 0x6631C0 as 16 bit mode if I use eax register

I have to dig out to understand why it's encoded in that way. Right now it's just witchcraft. Shocked
Post 09 Jan 2020, 17:16
View user's profile Send private message Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 641
Location: Russian Federation, Sochi
ProMiNick
Post 09 Jan 2020, 17:33
View user's profile Send private message Send e-mail Reply with quote
Abruzzi



Joined: 30 Sep 2019
Posts: 17
Abruzzi
It makes sense now why 66h prefix appear before instruction opcode when I am using 32 bit mode and 16 bit operands and vice versa as I could see. Thank you again ProMiNick.
Post 09 Jan 2020, 18:10
View user's profile Send private message Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker
How can we use this assembler to get the relocatable offsets?

Code:
mov eax,401000h ;Offset
push eax    


It would be great if it supports the read of these types like for example

"Offsets" it writes back the indexes to the offsets. Same for .data section.

Any idea how to achieve that?
Post 09 Dec 2020, 01:24
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18177
Location: In your JS exploiting you and your system
revolution
If you use PE format and include a relocs table then you will get a fully relocatable exe.
Post 09 Dec 2020, 05:08
View user's profile Send private message Visit poster's website Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker
Thx revolution. I have noticed that unrefrenced code is not compiled. Why is this case?
Post 25 Dec 2020, 02:31
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18177
Location: In your JS exploiting you and your system
revolution
If you use the normal fasm proc/endp macros then it has lines like this:
Code:
if used function ; in proc macro
;...
end if ; in endp macro    
Post 25 Dec 2020, 03:15
View user's profile Send private message Visit poster's website Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker
revolution wrote:
If you use the normal fasm proc/endp macros then it has lines like this:
Code:
if used function ; in proc macro
;...
end if ; in endp macro    


You mean the define@proc macro?

Quote:
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name


Ok i found it. Thanks for your help.
Post 25 Dec 2020, 03:46
View user's profile Send private message Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker
I have a question
Does fasm allocate memory for the same data used in source?
Like for example:
Code:
section '.data' data readable writeable
something  db 83886080 dup(?) '80MB     


When assembling, the fasm.exe memory usage goes over 90 MB. Why is this?
Post 01 Jan 2021, 08:34
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18177
Location: In your JS exploiting you and your system
revolution
fasm allocates all data and code in RAM. That includes all uninitialised values.
Post 01 Jan 2021, 08:37
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7924
Location: Kraków, Poland
Tomasz Grysztar
soloworker wrote:
I have a question
Does fasm allocate memory for the same data used in source?
Like for example:
Code:
section '.data' data readable writeable
something  db 83886080 dup(?) '80MB     


When assembling, the fasm.exe memory usage goes over 90 MB. Why is this?
The way fasm handles uninitialized data definitions is very similar to initialized ones, it only cuts them out afterwards when possible.

This was improved in case of fasmg's engine - if you assemble the same thing with fasmg, that uninitialized definition is not going to cause any additional memory usage unless you force it to become initialized by putting something initialized after it in the same section.
Post 01 Jan 2021, 11:48
View user's profile Send private message Visit poster's website Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker
Tomasz Grysztar wrote:
soloworker wrote:
I have a question
Does fasm allocate memory for the same data used in source?
Like for example:
Code:
section '.data' data readable writeable
something  db 83886080 dup(?) '80MB     


When assembling, the fasm.exe memory usage goes over 90 MB. Why is this?
The way fasm handles uninitialized data definitions is very similar to initialized ones, it only cuts them out afterwards when possible.

This was improved in case of fasmg's engine - if you assemble the same thing with fasmg, that uninitialized definition is not going to cause any additional memory usage unless you force it to become initialized by putting something initialized after it in the same section.


Thanks for the tip.
I still don't understand why it uses huge memory (like 400mb) when compiling some relatively small exe under 2mb of size with only this code as data. But the size of the code of (.asm) file is 7mb. So big code with few data will also have this problem.

Code:
section '.data' data readable writeable
sss db 'AXaaaaaaaaaaaaAXaaaaaaaaaaaaAXaaaaaaaaaaaaAXaaaaaaaaaaaa',0
sss2 db 'atatatatatatatatatatatatatatatatatatatatat',0
sss3 db 'tatatatatatatatatatatatatatatatatata',0
sss4 db '53535535355353553535535355353553535535355353553535535355353553535535355353553535535355353553535',0    
Post 07 Mar 2021, 05:04
View user's profile Send private message Reply with quote
soloworker



Joined: 09 Dec 2020
Posts: 9
soloworker
I found why it uses huge memory.
The macro that is responsible for this is
Code:
allow_nesting    
in WIN32AX.inc file.

If i remove it, fasm.exe uses way less memory. What does it do?
Post 09 Mar 2021, 23:42
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3285
Location: vpcmipstrm
bitRAKE
iirc, allow_nesting enables using invoke as parameter to another invoke.
Code:
invoke CommandLineToArgvW, <invoke GetCommandlineW>,ADDR nargs    
etc.

_________________
¯\(°_o)/¯ unlicense.org
Post 10 Mar 2021, 03:16
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:  
Goto page Previous  1, 2, 3, 4, 5

< 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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.