Question

Problem 2: Write a subroutine which counts the number of Os in the highest Byte in register D5 and returns the count in memo

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

CLR C

MOVE R1,08 %%LENGTH OF BYTE

MOVE R2,00 %% INITIAL COUNT OF NUMBER OF 1'S

MOV R3,given byte %% GIVEN BYTE

UP:ROR R5    %% ROTATE RIGHT -

BCC SKIP %% CHECK CARRY TO CLEAR

INC R2 %% INCREASE THE COUNT

SKIP: BNE R1,UP %%LOOP COUNT EQUALS TO R1

MOVE A2,R2 %% STORE THE VALUE OF R2 IN A2

RTS %% RETURN FROM SUBROUTINE

Add a comment
Know the answer?
Add Answer to:
Problem 2: Write a subroutine which counts the number of O's in the highest Byte in register D5 a...
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