Question: 1. Loop4.a File ## Start of file loop4.a ## ## MIPSMARK 1.1 21/4/99 Copyright 1998 J. Waldron. ## All Rights Reserved. See the file README

 1. Loop4.a File ## Start of file loop4.a ## ## MIPSMARK

1. Loop4.a File

## Start of file loop4.a

##

## MIPSMARK 1.1 21/4/99 Copyright 1998 J. Waldron.

## All Rights Reserved. See the file README for

## a full copyright notice.

##

## Question:

## Swap each pair of elements in

## the string "chararray" and

## print the resulting string.

## There will always be an even number

## of characters in "chararray".

##

## Output format must be:

## "badcfe"

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

# #

# text segment #

# #

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

.text

.globl main

main: # execution starts here

# Any changes above this line will be discarded by

# mipsmark. Put your answer between dashed lines.

#-------------- start cut -----------------------

#-------------- end cut -----------------------

# Any changes below this line will be discarded by

# mipsmark. Put your answer between dashed lines.

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

# #

# data segment #

# #

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

.data

chararray:

.asciiz "abcdef"

endl: .asciiz " "

##

## End of file loop4.a

2. logic 1. a file

## Start of file logic1.a

##

## MIPSMARK 1.1 21/4/99 Copyright 1998 J. Waldron.

## All Rights Reserved. See the file README for

## a full copyright notice.

##

## Question:

## "numbers" is an array of five words.

## Calculate the sum of all elements in "numbers"

## that are not multiples of 4.

## Use the and instruction, not div or rem for

## this question.

##

## Output format must be:

## "sum = 20"

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

# #

# text segment #

# #

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

.text

.globl main

main: # execution starts here

# Any changes above this line will be discarded by

# mipsmark. Put your answer between dashed lines.

#-------------- start cut -----------------------

#-------------- end cut -----------------------

# Any changes below this line will be discarded by

# mipsmark. Put your answer between dashed lines.

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

# #

# data segment #

# #

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

.data

numbers:

.word 3,4,12,28,17

ans: .asciiz "sum = "

endl: .asciiz " "

##

## End of file logic1.a

3.logic 2.a file

## Start of file logic2.a

##

## MIPSMARK 1.1 21/4/99 Copyright 1998 J. Waldron.

## All Rights Reserved. See the file README for

## a full copyright notice.

##

## Question:

## "number" is a word.

## Write it out in base 2 as a sequence of 32 bits.

##

## Output format must be:

## "binary is = 00000000000000000000000000010001"

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

# #

# text segment #

# #

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

.text

.globl main

main: # execution starts here

# Any changes above this line will be discarded by

# mipsmark. Put your answer between dashed lines.

#-------------- start cut -----------------------

#-------------- end cut -----------------------

# Any changes below this line will be discarded by

# mipsmark. Put your answer between dashed lines.

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

# #

# data segment #

# #

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

.data

number: .word 17

result: .space 50

ans: .asciiz "binary is = "

endl: .asciiz " "

##

## End of file logic2.a

Please write a complete MIPS assembly language programs for the following questions and print a hardcopy of your code to submit. 1. Swap each pair of elements in the string "chararray" and print the resulting string. There will always be an even number of characters in "chararray". (see loop4.a) 2. "numbers" is an array of five words. Calculate the sum of all elements in "numbers" that are not multiples of 4. Use the and instruction, not div or rem for this question. (See logic1.a file.) 3. "number" is a word. Write it out in base 2 as a sequence of 32 bits. (See logic2.a file.) Please write a complete MIPS assembly language programs for the following questions and print a hardcopy of your code to submit. 1. Swap each pair of elements in the string "chararray" and print the resulting string. There will always be an even number of characters in "chararray". (see loop4.a) 2. "numbers" is an array of five words. Calculate the sum of all elements in "numbers" that are not multiples of 4. Use the and instruction, not div or rem for this question. (See logic1.a file.) 3. "number" is a word. Write it out in base 2 as a sequence of 32 bits. (See logic2.a file.)

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!