Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly Language with MIPS need help with the bold/italicized ########################################################################## ############################ data segment ################################ .data legend: .asciiz 0 = EvEv, 1 = EvOd, 2 =

Assembly Language with MIPS need help with the bold/italicized

##########################################################################

############################ data segment ################################

.data

legend: .asciiz "0 = EvEv, 1 = EvOd, 2 = OdEv, 3 = OdOd "

# EvEv = Even-Even, EvOd = Even-Odd, ...

inPrompt1: .asciiz "Enter 1st integer: "

inPrompt2: .asciiz "Enter 2nd integer: "

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, 5

syscall # read 1st integer

move $t1, $v0

li $v0, 4

la $a0, inPrompt2

syscall # print input prompt 2

li $v0, 5

syscall # read 2nd integer

move $t2, $v0

li $v0, 11

li $a0, ' '

syscall

li $v0, 1

move $a0, $t1

syscall # 1st integer

li $v0, 4

la $a0, outLab1

syscall # print " and "

li $v0, 1

move $a0, $t2

syscall # 2nd integer

li $v0, 4

la $a0, outLab2

syscall # print " are "

li $v0, 1

li $a0, 0 # initialize desired output to 0

##########################################################

# Insert NO MORE THAN 5 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).

##########################################################

//This is the part in which I am having difficulty with, our professor is quite hard to understand in class so it's making this profect difficult, I was hoping someone can explain this part to me? I know that in binary it'd be 00 = 0, 01 = 1, 10 = 2, 11 = 3 but im not sure how to achieve this :/

syscall # display desired output

##########################################################

li $v0, 10 # exit gracefully

syscall

########################## sample test runs ##############################

# 0 = EvEv, 1 = EvOd, 2 = OdEv, 3 = OdOd

# Enter 1st integer: 100

# Enter 2nd integer: 200

# 100 and 200 are 0

# -- program is finished running --

#

# Reset: reset completed.

#

# 0 = EvEv, 1 = EvOd, 2 = OdEv, 3 = OdOd

# Enter 1st integer: -202

# Enter 2nd integer: -303

# -202 and -303 are 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

More Books

Students also viewed these Databases questions

Question

Does it use a maximum of two typefaces or fonts?

Answered: 1 week ago