Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have to write a MIPS assembly that asks the user for a string, and inverts the case of every letter in it. My code

I have to write a MIPS assembly that asks the user for a string, and inverts the case of every letter in it.

My code so far only changes the lower case letters to upper case but doesn't change the upper case to lower case.

.data input: .space 20 newline: .asciiz " "

.text .globl main main: li v0, 8 li a1, 20 la a0, input syscall

li v0, 4 li t0, 0

loop: lb t1, input(t0) beq t1, 0, exit blt t1, 'a', case bgt t1, 'z', case sub t1, t1, 32 sb t1, input(t0)

case: addi t0, t0, 1 j loop

exit: li v0, 4 la a0, input syscall

li v0, 10 syscall

The correct output example should be: HelLo WorLd!!!1! -> hELlO wORlD!!!1!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analytics Systems Engineering Cybersecurity Project Management

Authors: Christopher Greco

1st Edition

168392648X, 978-1683926481

More Books

Students also viewed these Databases questions

Question

b. Determine the 95% confidence intervals for the parameters. Pg45

Answered: 1 week ago

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago