flat assembler
Message board for the users of flat assembler.

Index > Windows > Learning fasm from masm

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



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Tomasz Grysztar wrote:
This reminded me of the addressing spaces labeling feature, which I promised for fasm 2.0 but may still give it a shot in 1.x line. I think I have an idea how to adapt the 1.x architecture so that it would handle it.


This sounds really interesting. Would you like to share some details? Smile

_________________
Tox ID: 48C0321ADDB2FE5F644BB5E3D58B0D58C35E5BCBC81D7CD333633FEDF1047914A534256478D9
Post 19 Sep 2012, 19:36
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4216
Location: 2018
edfed
nmake wrote:
Tomasz, will fasm support floating point calculations during compile-time later? Another question, does fasm produce any form of signatures in the final executable to identify fasm programs?

+1.0 for the float expression evaluation at compile.

but generating a signature in the output file by the compiler is contrary to the ssso principle, all is in the source.
if you want to sign your file, do it from scratch by putting a db "compiled with fasm",0 message somewhere in the source code.

_________________
Smile fool iem.design
Post 19 Sep 2012, 21:29
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
Yes I definitely need floating point calculation compile-time. Without them I can't produce my complex graphics macros. It is a world apart without fpu compile-time abilities. So I am very much so intrigued to ask mr Tomasz to consider implementing it.

My second question may have appeared wrong, my question was if fasm secretly or not secretly produce any patterns in the executable that doesn't necessarily break with any principles yet it can be used to identify fasm programs. My question is if fasm use a special pattern anywhere in the executable that can be used to backtrace it to fasm. Very Happy

Patterns is a matter of who find the pattern and that boils down to intelligence, which can be used to invalidate a principle like the ssso. Anything that is not intellectually detected can't break any principles either if you know what I mean. Smile
Post 20 Sep 2012, 01:11
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
It is no secret. Each assembler produces a "fingerprint" by the encoding selection. There are many places in the x86 encoding where things can be encoded in different ways with the same length binary and no change in functional correctness.
Post 20 Sep 2012, 01:42
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7409
Location: Kraków, Poland
Tomasz Grysztar
JohnFound wrote:
This sounds really interesting. Would you like to share some details? Smile
I would point you to the recording of my "fasm 2" talk on fasmcon 2009, but it seems that video is no longer available.
But I'm already working on this feature, so you should know it all soon anyway.

nmake wrote:
Tomasz, will fasm support floating point calculations during compile-time later?
I never planned such feature. I would require much work and not be much worth it in my opinion. Some macros could be devised to do that if really needed.
Post 20 Sep 2012, 08:33
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4216
Location: 2018
edfed
in the case you state, there is no problem... maybe it can just be good to have alternate mnemonics for the alternate encodings.
but if the software add undesired bloat like db "encoded by fasm",0 somewhere in the binary, that would be a problem.
Post 20 Sep 2012, 08:34
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc
JohnFound
IMHO my request describes the feature quite comprehensive.
Post 20 Sep 2012, 11:56
View user's profile Send private message Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
eax is the object handle returned from LoadImage function.
ecx points to a local DIBSECTION structure.

Why does this fail? Program crashes with the following code. If I comment it out, the program runs fine again.

invoke GetObject,eax,[sizeof.DIBSECTION],ecx

I am having problem with sizeof, how is it used properly and can someone give me a few variations of how to use it. I am aware that you can declare a sizeof element in a structure, but that would be hard to do with all the structures that I have in my equate include files. hehe. Btw I had to add the DIBSECTION structure to my gdi32 equates file, it was not in there from the beginning.
Post 02 Oct 2012, 14:37
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
nmake wrote:
eax is the object handle returned from LoadImage function.
ecx points to a local DIBSECTION structure.

Why does this fail? Program crashes with the following code. If I comment it out, the program runs fine again.

invoke GetObject,eax,[sizeof.DIBSECTION],ecx

I am having problem with sizeof, how is it used properly and can someone give me a few variations of how to use it. I am aware that you can declare a sizeof element in a structure, but that would be hard to do with all the structures that I have in my equate include files. hehe. Btw I had to add the DIBSECTION structure to my gdi32 equates file, it was not in there from the beginning.
sizeof.DIBSECTION is a constant. Use it without the brackets.
Post 02 Oct 2012, 15:05
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
If I remove the brackets compiling fails if I use it in a parameter of invoke, but if i use mov eax,sizeof.DIBSECTION and then pass eax as a parameter it works. The odd thing is that if I use brackets when passing it as a parameter, it works. So I wonder what you mean?

Btw, do you have experience with directsound? I have made a directsound library consisting of some 1300 lines of assembly isntructions, its a complete directsound wrapper library. But sounds get this crackling sound just as the sound finishes to play, all sounds have this crackling noise at the end. I wonder if this is caused by a primary buffer that contains noise after the sound is played.

I tried to google it and a few people suggested that you needed to write the primary buffer with silence, set volume to max and loop the silence for a duration and that would fix it. I haven't tried it yet, but can anyone (who have any experience with dsound) tell me?
Post 03 Oct 2012, 11:16
View user's profile Send private message Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
I have never coded 64 bit assembly before, I have always used 32 bit. Can anyone tell me how exactly register rotation works, is register rotation a standard default behavior on the majority of 64 bit processors? Does this mean I can reuse rax throughout my code without stalling the cpu?
Post 03 Oct 2012, 11:25
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
Try to imagine sizeof.DIBSECTION as a numeric value, let's say it is 16. If you try this your program will crash:
Code:
mov eax,[16] ;What is at memory address 16?    
The same things happens when you use invoke:
Code:
push [16] ;This will always crash in Windows    
The first page of RAM is always marked as not present so it is not possible to read memory at an address like that.
Post 03 Oct 2012, 11:30
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
nmake wrote:
I have never coded 64 bit assembly before, I have always used 32 bit. Can anyone tell me how exactly register rotation works, is register rotation a standard default behavior on the majority of 64 bit processors? Does this mean I can reuse rax throughout my code without stalling the cpu?
Do you mean register renaming? If so then this is something you should not need to worry about, it is deep inside the architecture and is will change from CPU generation to the next.

AFAIK: All current x86 CPUs do have some form of renaming. But this should not affect how you write your code.
Post 03 Oct 2012, 11:34
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
revolution wrote:
Try to imagine sizeof.DIBSECTION as a numeric value, let's say it is 16. If you try this your program will crash:
Code:
mov eax,[16] ;What is at memory address 16?    
The same things happens when you use invoke:
Code:
push [16] ;This will always crash in Windows    
The first page of RAM is always marked as not present so it is not possible to read memory at an address like that.


The typical pagesize is 4096 bytes and the granularity is 65536 and the lowest memory address is the same, 65536 $10000 and the highest memmory address accessible is $7ffeffff
Post 03 Oct 2012, 11:39
View user's profile Send private message Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
revolution wrote:
nmake wrote:
I have never coded 64 bit assembly before, I have always used 32 bit. Can anyone tell me how exactly register rotation works, is register rotation a standard default behavior on the majority of 64 bit processors? Does this mean I can reuse rax throughout my code without stalling the cpu?
Do you mean register renaming? If so then this is something you should not need to worry about, it is deep inside the architecture and is will change from CPU generation to the next.

AFAIK: All current x86 CPUs do have some form of renaming. But this should not affect how you write your code.


I see, but does this mean that if I use the rax register throughout my program, the cpu will not stall?
Post 03 Oct 2012, 11:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
nmake wrote:
I see, but does this mean that if I use the rax register throughout my program, the cpu will not stall?
There is no way to know. Probably not, but there are so many variables that no one will be able to tell you.
Post 03 Oct 2012, 11:44
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
As far as I get it, I should continue to prevent register stalling as I would normally do?
Post 03 Oct 2012, 11:59
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
nmake wrote:
As far as I get it, I should continue to prevent register stalling as I would normally do?
How will you know if you are preventing such things? Maybe you are making things worse? The only way to know for sure is to time it in your final app.

BTW: I hope you are not breaking the cardinal rule: "Get it working then get it fast."
Post 03 Oct 2012, 12:06
View user's profile Send private message Visit poster's website Reply with quote
nmake



Joined: 13 Sep 2012
Posts: 193
nmake
How can I make things worse if the cpu renames it either way? If I use rax or rcx should not make any difference if the cpu already renames them? But I agree, timing your code often pays off better than trying to understand the code fully to a hundred percent.
Post 03 Oct 2012, 13:03
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 16843
Location: In your JS exploiting you and your system
revolution
nmake wrote:
How can I make things worse if the cpu renames it either way? If I use rax or rcx should not make any difference if the cpu already renames them?
Because there are some special encodings that can be used for EAX, RAX, AX etc. This can affect cache and decoding efficiency.
Post 03 Oct 2012, 13:22
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, 6  Next

< 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-2019, Tomasz Grysztar.

Powered by rwasa.