Ask your own question, for FREE!
Computer Science 16 Online
OpenStudy (sanaelshazly):

I want an ARM7 Assembly code that checks if a number is Even or Odd. If the number is even, register R3 should contain 1, otherwise contain 0. could somebody help me ?!

OpenStudy (anonymous):

for even number the least significant bit(LSB) is 0 zero for odd number the least significant bit(LSB) is 1 one Algorithm: -->Take any number -->Make logical AND operation of that number with 1 Suppose you have this 10 bit number 0000000011 which is 3 in decimal. Make it AND with 0000000001 so it becomes 0000000011 AND 0000000001 ---------------- 0000000001 ----> result -->Put this result in any register (say R1) and place a check on it The check should be like this: if R1 = 1 then R3 = 0 else R3 = 1 you are done Remember: the result obtained by ANDING 0000000001 with any odd number will always be 0000000001 and by ANDING 0000000001 with even number will always result in 0000000000. now i have told you the algorithm. make the programme its easy but if you feel any problem. just post the problem.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!