News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Help for a MACRO

Started by frktons, November 30, 2012, 06:01:50 AM

Previous topic - Next topic

frktons

Quote from: jj2007 on December 01, 2012, 07:07:57 AM.if  btx(ebx, 15)

It's readable for my n00b's sight.

Quote from: qWord on December 01, 2012, 09:44:22 AM
.if ebx & (1 SHL 15) 8)

It's NOT readable for my n00b's sight.
In other words [sequence of instructions] what we do?
(1 SHL 15) is not a common syntax, I didn'know
it existed. What are we shifting left? Probably ebx, before
a compare, but exactly what this line does?  ::)

Quote from: dedndave on December 02, 2012, 03:52:16 AM
.if bh & 80h

This is readable as well.  :icon_eek:  :eusa_clap:
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

jj2007

Quote from: frktons on December 02, 2012, 09:48:25 AM
Quote from: qWord on December 01, 2012, 09:44:22 AM
.if ebx & (1 SHL 15) 8)

It's NOT readable for my n00b's sight.
In other words [sequence of instructions] what we do?
(1 SHL 15) is not a common syntax, I didn'know
it existed. What are we shifting left?

The "1", actually.
(1 shl 15) is 32768 or 100000000000000b, same as 2^15

I don't like the shl syntax either, but Masm doesn't understand 2^15 :(

frktons

Quote from: jj2007 on December 02, 2012, 10:00:12 AM

The "1", actually.
(1 shl 15) is 32768 or 100000000000000b, same as 2^15

I don't like the shl syntax either, but Masm doesn't understand 2^15 :(

I have to confess I suspected it.

I didn't find in Intel manuals this possibility to shift a constant, is it
a feature of MASM?
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama

MichaelW

Yes, the shifting is done by the MASM "preprocessor" and the result is encoded as a constant.

.if ebx & (1 SHL 15)
.endif


00401000 F7C300800000           test    ebx,8000h
00401006 7400                   jz      loc_00401008


Well Microsoft, here's another nice mess you've gotten us into.

frktons

Quote from: MichaelW on December 02, 2012, 10:09:18 AM
Yes, the shifting is done by the MASM "preprocessor" and the result is encoded as a constant.

.if ebx & (1 SHL 15)
.endif


00401000 F7C300800000           test    ebx,8000h
00401006 7400                   jz      loc_00401008



Thanks Michael, good to know I can do so many things with
MACROS, preprocessor engine, and so on.

Something I could use is:


P2_15  EQU 1 SHL 15 ; The Power of 2 ^ 15

....

.if  ebx & P2_15
     jmp ItsThere
.endif



at least it should be doable, and quite readable for my eyes.  :lol:
There are only two days a year when you can't do anything: one is called yesterday, the other is called tomorrow, so today is the right day to love, believe, do and, above all, live.

Dalai Lama