flat assembler
Message board for the users of flat assembler.

Index > Heap > Did you know?

Author
Thread Post new topic Reply to topic
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
in binary : 10 * 10 = 100
In decimal : 10 * 10 = 100
Post 21 Apr 2013, 08:10
View user's profile Send private message Reply with quote
nop



Joined: 01 Sep 2008
Posts: 165
Location: right here left there
nop
typedef wrote:
in binary : 10 * 10 = 100
In decimal : 10 * 10 = 100
and did you know
in binary 100 * 100 = 10000
in decimal 100 * 100 = 10000
and did you know... Wink
Post 21 Apr 2013, 09:32
View user's profile Send private message Reply with quote
alessandro95



Joined: 24 Mar 2013
Posts: 62
alessandro95
and did you know
chosen any base b "10" is the representation of b in base b?

e.g
10 (base 2)=2 (base 10)
10 (base 3)=3 (base 10)
10 (base 4)=4 (base 10)
etc.

and, whatever is the base 100 repesent b^2
e.g.
100 (base 2)=4=2^2 (base 10)
100 (base 3)=9=3^2 (base 10)
100 (base 4)=16=4^2 (base 10)

so, 10*10=100, the base doesn't matter.

which is equivalent to say that in every base b multiplication and division by b are simply shifts left or right, a concept assembly programmers are quite used to Smile
Post 21 Apr 2013, 10:08
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17253
Location: In your JS exploiting you and your system
revolution
Did you know that 31 Oct = 25 Dec.
So that means that Halloween = Christmas.
Post 21 Apr 2013, 10:21
View user's profile Send private message Visit poster's website Reply with quote
MHajduk



Joined: 30 Mar 2006
Posts: 6034
Location: Poland
MHajduk
Image
Post 21 Apr 2013, 12:12
View user's profile Send private message Visit poster's website Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1408
Location: Toronto, Canada
AsmGuru62
Nicely named topic.
Here is what I just discovered -- I learn sometimes too! (very cool!)

There is an instruction called CMOVxx.
So, I wanted to use it to load a structure member.
In C it would look something like that:
Code:
typedef struct
{
        UINT    BytesRemain;
        UINT    BytesReserved;
        PBYTE   RawBuffer;
} DEVICE;

void foo (DEVICE* p)
{
        UINT    room = 0;

        if (p)
        {
                room = p->BytesRemain;
        }
}
    

Basically, if pointer parameter is not NULL, then load a structure member,
using that same pointer.

So, my equivalent in FASM looked like that:
Code:
        mov     esi, [p]
        xor     eax, eax
        test    esi, esi
        cmovnz  eax, [esi + DEVICE.BytesRemain]
    

To my surprise CMOVNZ crashes if ESI is NULL.
And it is written in CPU manual too: the memory operand must be valid
even if instruction will NOT MOVE data according to the condition.

Good to know.
Post 21 Apr 2013, 17:01
View user's profile Send private message Send e-mail Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 20:57; edited 1 time in total
Post 21 Apr 2013, 18:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17253
Location: In your JS exploiting you and your system
revolution
AsmGuru62 wrote:
To my surprise CMOVNZ crashes if ESI is NULL.
And it is written in CPU manual too: the memory operand must be valid
even if instruction will NOT MOVE data according to the condition.
Did you know that only X86 has this silly behaviour. ARM does not have this problem, the memory is not touched for a failing condition.
Post 21 Apr 2013, 22:17
View user's profile Send private message Visit poster's website Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1180
Location: Unknown
HaHaAnonymous
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 20:57; edited 1 time in total
Post 21 Apr 2013, 22:44
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1901
DOS386
Did you know that this had been already discussed?

http://board.flatassembler.net/topic.php?t=2530 Main FAQ -> Group F
http://board.flatassembler.net/topic.php?t=11626
Post 28 Apr 2013, 14:55
View user's profile Send private message 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 can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.