Question: Using MIPS (assembly language) insert the needed 7 lines of code so the code output the desired outputs shown at the bottom using only bit

Using MIPS (assembly language) insert the needed 7 lines of code so the code output the desired outputs shown at the bottom using only bit wise operations.

################################################## .data legend: .asciiz "0 = UpUp, 1 = UpLo, 2 = LoUp, 3 = LoLo " # UpUp = Uppercase-Uppercase, UpLo = Uppercase-Lowercase, ... inPrompt1: .asciiz "Enter 1st alphabet (A-Z; a-z): " inPrompt2: .asciiz " Enter 2nd alphabet (A-Z; a-z): " outLab1: .asciiz " and " outLab2: .asciiz " are " ############################ code segment ################################ .text .globl main main: li $v0, 4 la $a0, legend syscall # print legend la $a0, inPrompt1 syscall # print input prompt 1 li $v0, 12 syscall # read 1st alphabet move $t1, $v0 li $v0, 4 la $a0, inPrompt2 syscall # print input prompt 2 li $v0, 12 syscall # read 2nd alphabet move $t2, $v0

li $v0, 11 li $a0, ' ' syscall move $a0, $t1 syscall # 1st alphabet li $v0, 4 la $a0, outLab1 syscall # print " and " li $v0, 11 move $a0, $t2 syscall # 2nd alphabet li $v0, 4 la $a0, outLab2 syscall # print " are "

li $v0, 1 li $a0, 0 # initialize desired output to 0

########################################################## # Insert NO MORE THAN 7 lines of code that involve ONLY # bit manipulating instructions (ANDing, ORing, XORing, # NORing and shifting - only whatever that are needed) # so that the program will work just like the sample runs # shown at the bottom (some blank lines edited out). # HINT: Risking telling the obvious, the instructions you # insert are related to bringing the value in $a0 # from the initial value of 0 to the final desired # value (which should be either 0, 1, 2 or 3 when # printed as an integer). # You MUST test your completed program for AT LEAST the # test cases shown (and include the result in hardcopy). ########################################################## syscall # display desired output ########################################################## li $v0, 10 # exit gracefully syscall

########################## sample test runs ############################## # 0 = UpUp, 1 = UpLo, 2 = LoUp, 3 = LoLo # Enter 1st alphabet (A-Z; a-z): P # Enter 2nd alphabet (A-Z; a-z): M # P and M are 0 # -- program is finished running -- # # Reset: reset completed. # # 0 = UpUp, 1 = UpLo, 2 = LoUp, 3 = LoLo # Enter 1st alphabet (A-Z; a-z): A # Enter 2nd alphabet (A-Z; a-z): t # A and t are 1 # -- program is finished running -- # # Reset: reset completed. # # 0 = UpUp, 1 = UpLo, 2 = LoUp, 3 = LoLo # Enter 1st alphabet (A-Z; a-z): b # Enter 2nd alphabet (A-Z; a-z): E # b and E are 2 # -- program is finished running -- # # Reset: reset completed. # # 0 = UpUp, 1 = UpLo, 2 = LoUp, 3 = LoLo # Enter 1st alphabet (A-Z; a-z): q # Enter 2nd alphabet (A-Z; a-z): i # q and i are 3 # -- program is finished running -- ######################## end sample test runs ############################

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!