Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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_2

Step: 3

blur-text-image_3

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

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions