Question: Hello, I'm having trouble completing this program in less than four lines using MIPS programming language, we are required to fill in the missing code
| Hello, I'm having trouble completing this program in less than four lines using MIPS programming language, we are required to fill in the missing code as indicated (via comments). |
| IMPORTANT: As indicated in the program's comments: |
| Write no more than certain number of lines of code as indicated. (One instruction per line, and there will be penalty if your code consumes more lines.) |
| Code MUST use only instructions that are allowed i.e., only bit manipulating instructions: (ANDing, ORing, XORing,NORing and shifting). |
| MUST NOT in any way change the lines of code already written. ############################ # prompt user to enter an integer in the range [0, 63], read the integer, # and display if the integer is of type 0 ( <= 31 ) or 1 ( > 31 ) ############################ data segment ################################ .data typeLeg: .asciiz "1 for <=31, 0 for >31 " inputProm: .asciiz "Enter integer between 0 and 63 (inclusive): " outputLab: .asciiz "Integer entered is of type " ############################ code segment ################################ .text .globl main main: li $v0, 4 la $a0, typeLeg syscall # print type legend la $a0, inputProm syscall # print input prompt li $v0, 5 syscall # read integer move $v1, $v0 # save integer read in $v1 li $v0, 11 li $a0, ' ' li $v0, 4 la $a0, outputLab syscall # print output label li $v0, 1 ########################################################## # Insert below NO MORE THAN 4 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 to cause the content of $a0 to become # the desive value (1 or 0) when printed as integer. # You MUST test your completed program for AT LEAST the # test cases shown (and include the result in hardcopy). ########################################################## #Your Code Here syscall # display desired output ########################################################## li $v0, 10 # exit gracefully syscall ########################## test cases ############################## # 1 for <=31, 0 for >31 # Enter integer between 0 and 63 (inclusive): 0 # Integer entered is of type 1 # -- program is finished running -- # # Reset: reset completed. # # 1 for <=31, 0 for >31 # Enter integer between 0 and 63 (inclusive): 31 # Integer entered is of type 1 # -- program is finished running -- # # Reset: reset completed. # # 1 for <=31, 0 for >31 # Enter integer between 0 and 63 (inclusive): 32 # Integer entered is of type 0 # -- program is finished running -- # # Reset: reset completed. |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
