Page 1 of 1
Translate nasm code to Tasm
Posted: Wed Nov 17, 2004 10:29 pm
by os_ambition
Hi,
Please help me to translate this to TASM code
and di, byte -0x20
thank u very much in advance.
os_ambition
Re:Translate nasm code to Tasm
Posted: Thu Nov 18, 2004 2:17 am
by Pype.Clicker
why in the world do you need to use TASM ??
I thought that assembler was obsolete for years ...
btw, if you *really* need it that hard, simply remove the "byte" information (TASM should be able to guess that you'll be happy with a one-byte constant automatically) ...
Re:Translate nasm code to Tasm
Posted: Thu Nov 18, 2004 5:59 pm
by os_ambition
what do you mean by -0x20, is this negative 20 hex? I need this value in tasm.
thank u again
Re:Translate nasm code to Tasm
Posted: Fri Nov 19, 2004 12:53 am
by Candy
os_ambition wrote:
what do you mean by -0x20, is this negative 20 hex? I need this value in tasm.
thank u again
that should be the 2-s complement of 0x20, or (as a byte) 0xE0.
Re:Translate nasm code to Tasm
Posted: Fri Nov 19, 2004 12:55 am
by astrocrep
just try
if that doesn't work then try:
Re:Translate nasm code to Tasm
Posted: Fri Nov 19, 2004 3:26 am
by Pype.Clicker
Candy wrote:
that should be the 2-s complement of 0x20, or (as a byte) 0xE0.
Hey, beware...
the
byte thing means the argument should be encoded as a byte, but it will be expanded to a word ... now, iirc that expansion is
signed.
In other word, we're using (cf p 3-31 of instruction set reference -- 24547107.pdf)
opcode:"83 /4 ib" instruction:"AND r/m16, imm8" description:"r/m16 AND imm8 (sign-extended)"
That means that the equivalent in TASM is
and not
No need to say that the author of the NASM code was an obfuscating person (using 2's complement with bit-by-bit logical instructions makes no sense *at all*)
Re:Translate nasm code to Tasm
Posted: Fri Nov 19, 2004 2:19 pm
by os_ambition
thank u very very much Pype.clicker,
that's why I like TASM, it's simple and straight