Question

For given 10 decimal numbers: 12, 69, 40, 14, 55, 67, 47, 78, 90, and 23,...

For given 10 decimal numbers: 12, 69, 40, 14, 55, 67, 47, 78, 90, and 23, program assembly codes for HCS12 to tell how many of them are even number.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you want to check whether a given number is odd or even, a simple test would be to check the least significant bit of the number
In the program below we check if number f1 is even or odd.
We load the number and check if last bit is 1, if yes then number is odd

To know whether it is even or odd we do the folloqing thing:

If the given number is even, store a “$00” into $1501 and store a “$11” into $1501 for an odd number.

org $1000
data dc.w $F1 ;data to be tested say F1
BRCLR $100,$01,odd ; jump to odd if last bit is 1
LDAA #$00
STAA $1500

end: END

odd: LDAA #$11
STAA $ 1501
BRA end

Add a comment
Know the answer?
Add Answer to:
For given 10 decimal numbers: 12, 69, 40, 14, 55, 67, 47, 78, 90, and 23,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT