flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > About fasm coding ADD AL,CL with 02C1

Author
Thread Post new topic Reply to topic
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
Perhaps, i am neglecting something on Intel Docs,that
i cannot find about encoding. Do you know
in which cases fasm does encode like in my manual encoding ?

Code:
ADD EAX,ECX ; 01C8  fasm encoding  <-------
ADD AL,CL   ; 00C8   "    " <------

ADD EDX,ECX ; 01CA   "    "
ADD CL,AL   ; 00C1   "    "
ADD ECX,EAX ; 01C1   "    "

ADD EAX,ECX ; 03C1  manually encoded <-------
ADD AL,CL   ; 02C1  manually encoded <-------
    


Thanks for help
Post 22 Jun 2009, 01:07
View user's profile Send private message Visit poster's website Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 977
Location: Czechoslovakia
MazeGen
If I'm not wrong, you can't force fasm to encode ADD AL, CL as 02C1.
Post 29 Jun 2009, 08:06
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
Yes. This is sometimes used as a kind of "footprint" to determine, which assembler was used to assemble the code.
Post 29 Jun 2009, 09:59
View user's profile Send private message Visit poster's website Reply with quote
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
Tomasz Grysztar wrote:
...a kind of "footprint" to determine, which assembler was used...
I cannot believe yet Shocked that latest Antivirus Software (kaspersky/norton) detect virus in compiled output,again,today yet...

Is there no way to change/personalize opcode generation without using macros with fasm ?
That is very boring, and it is not possible that for a stupid virus f****d Twisted Evil "writer" should we, fasm developers, pay to him our professionality.

Am i asking too much /unreal things ?

Thanks in advance,
hopcode
Post 16 Jan 2010, 08:22
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

sorry, but i don't understand the problem Confused

00 C8 = ADD AL,CL

and

02 C8 = ADD CL,AL

no ?

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Mar 2010, 22:28
View user's profile Send private message Send e-mail Reply with quote
ass0



Joined: 31 Dec 2008
Posts: 521
Location: ( . Y . )
ass0
Yeah I don't understand too.

This means 00 C8 == 02 C8?

How many ways there are to leave a "footprint" for this instruction?

_________________
Image
Nombre: Aquiles Castro.
Location2: about:robots
Post 03 Mar 2010, 00:26
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
ouadji wrote:

sorry, but i don't understand the problem Confused

00 C8 = ADD AL,CL

and

02 C8 = ADD CL,AL

no ?
No.

00 C8 == 02 C1

Both encode add al,cl
Post 03 Mar 2010, 01:19
View user's profile Send private message Visit poster's website Reply with quote
ass0



Joined: 31 Dec 2008
Posts: 521
Location: ( . Y . )
ass0
Oh thanks, i misspelled "02 C8" i meant "02 C1".

But why three values (add, al, cl) are encoded like that?, Is it a "bit vector" encoding?

0xc8 == 0b11001000
0xc1 == 0b11000001

_________________
Image
Nombre: Aquiles Castro.
Location2: about:robots
Post 03 Mar 2010, 01:41
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17671
Location: In your JS exploiting you and your system
revolution
ass0: Have a look at the Intel/AMD manuals to see the encoding formats.
Post 03 Mar 2010, 02:09
View user's profile Send private message Visit poster's website Reply with quote
ass0



Joined: 31 Dec 2008
Posts: 521
Location: ( . Y . )
ass0
OK, merci.

_________________
Image
Nombre: Aquiles Castro.
Location2: about:robots
Post 03 Mar 2010, 02:37
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Quote:
No.
00 C8 == 02 C1
Both encode add al,cl
I didn't read correctly above.
not 00C8/02C8 ... but 00C8/02C1 !
I checked it, indeed both encode "add al,cl".
thanks revolution.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 03 Mar 2010, 08:59
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.