|
-
May 15th, 2005, 10:19 AM
#1
Thread Starter
Lively Member
TASM command to checking even or odd number?
Hi guys. I was just wondering if there is a command in TASM to check if the register (16 or 8 bit registers) value is in odd or even number? I'm suppose to do this project where i will add 2 array value into the register. If it check it is odd value it will add 1 into a specific location in an array. If it is even then it will add 0 into a specific array as well. If this command doesn't exist, what other method can i use to check if it is even or odd? Hope you could help me guys. Thanks!
Anime is what i LIVE for, BREATH for, and DIE for!
-
May 15th, 2005, 11:07 AM
#2
Re: TASM command to checking even or odd number?
I'm not sure in TASM - but the concept of checking for ODD or EVEN involves seeing if BIT 0 (value 1) is set in the integer. If 1 is set, then the value is odd - otherwise it's even.
-
May 26th, 2005, 07:58 PM
#3
Addicted Member
Re: TASM command to checking even or odd number?
let say ax (8 bits) is 3F,
so,
3F is 63 is odd
ax strcuture
0011 1111
and
0000 0001
so u got
1 and that is odd
Code:
0AE6:0100 B83F00 MOV AX,003F
0AE6:0103 250100 AND AX,0001
so, the ax after third trace would contained 1 and u know that is odd, if zero, that mean it is even.
if u felt my post make u happy ,
then u could make me happy too by rating my post
-
Oct 24th, 2005, 08:01 AM
#4
Re: TASM command to checking even or odd number?
Or just use the BitTest instruction (bt) that doesn't disrupt the contents of ex...
Code:
mov ax, 3fh
bt ax, 0
jnc EVEN
ODD:
; blah
jmp DONE
EVEN:
; blah
DONE:
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|