News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

asm And

Started by ragdog, December 21, 2011, 10:03:29 PM

Previous topic - Next topic

dedndave

sorry ragdog - i did not mean to offend you - just trying to help you understand

ok - let's use a truth table for the lower 2 bits
all the other bits are ignored
i.e. 15 will yield the same result as 3, 12 will yield the same result as 0

input  result
-----  ------
00     does not branch
01     does branch
10     does branch
11     does branch

NoCforMe

Well, I'm still confused, not least of all by your poor English. (Please don't be offended: I'm just being honest, and I'm sure that my skills in whatever your native language is are even worse!).

It seems there are three possible things you're doing here:


  • Checking for EAX being equal to 15
  • Checking for EAX being zero (or not)
  • Checking the lower 2 bits for not both being zero
These are all covered by the following code snippets:


; Test for EAX being 15:
CMP EAX, 15
JE somewhere

; Tests for EAX being zero:
OR EAX, EAX
JZ somewhere

CMP EAX, 0
JE somewhere

; Tests for 2 lower bits of EAX not both being zero:
TEST AL, 3 ;We only need to look at
JNZ somewhere ;  the lowest 8 bits

TEST AL, 00000011B ;Maybe easier to understand
JNZ somewhere ;  using binary


Which is why I keep asking you what you're trying to do. Not what your program in general is trying to do, but what specific test you're trying to do here. It's still not clear at all, which makes it difficult to make suggestions that will work for you. So maybe you can clue us in?