Question

Write the following program in MIPS for use in the SPIM simulator. 1) Determine the number...

Write the following program in MIPS for use in the SPIM simulator.

1) Determine the number of occurrences of a specific character in a string. The character and the string are input by the user. The program should output

Character <ch> occurs in string <string> <n> times.

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

mov dl, "A"
call CountChar ... print the result ...
mov dl, "B"
call CountChar ... print the result ...


CountChar:
mov dh, 0
mov cx, ... length of input string ...
jcxz Ready
mov bx, ... address of input string ...
Again:
cmp [bx], dl
jne Skip
inc dh
Skip:
inc bx
loop Again
Ready:
retChar

////*** Thank You ***////

Add a comment
Know the answer?
Add Answer to:
Write the following program in MIPS for use in the SPIM simulator. 1) Determine the number...
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