Question

4. Consider the following assembly-language program. Starting values: [A] = $60, [B] = $80, [$C300] = $20, [$C301] = $40 (Hin

this is assembly language for HCS12 / 9S12

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

Solution:

Given, [A] = $60; [B] = $80; [$C300] = $20; [$C301] = $40.

ADDA $C300 ; A \leftarrow [A]+[$C300] i.e. $60 + $20 = $80 will store in A. Now the value [A] = $80.

LDAB $C301; B = [$C301] i.e. $40 will load in [B]. Now the value of [B] = $40.

SBA    ; A  \leftarrow [A] - [B] i.e. $80 - $40 = $40 will store in [A]. Now [A] = $40.

BEQ X1 ; In the above subtraction instruction [A] > [B]. So, it will not jump to X1 loop and proceed to next line.

STAA $C301 ; [$C301] \leftarrow [A] i.e. $40 will store in memory location [$C301].

X1 : STAB $C300 ; [$C300] \leftarrow [B] i.e. $40 will store in memory location [$C300].

WAI.

After execution of the above program, [A] = $40; [B] = $40; [$C300] = $40; [$C301] = $40.

If you have any query, please send a comment. Thank you.

Add a comment
Know the answer?
Add Answer to:
this is assembly language for HCS12 / 9S12 4. Consider the following assembly-language program. Starting values:...
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