Project #13631 - MIPS Programming

 

Write a main program for the MIPS machine that implements a simple encoder/decoder.

The main program should repeatedly prompt the user to enter a string (of 80 characters or less) and should call a function that accepts a single ASCII character as input (in $a0). The function should return in $v0 an encoded form of the input character using the following algorithm:

If the input character is an upper case letter,  the returned value should be

((N-52) modulo 26)+65 

where N is the ASCII code for the letter and N modulo 26 is just the remainder produced by the integer division of  N by 26.

If the input character is a lower case letter,  the returned value should be

((N-84) modulo 26)+97 

If the input character is neither an upper case letter nor a lower case letter, then the function should simply return the exact same input character.

Once the main program reads in the input string typed by the user, it should call the function once for each character in the input string and save the series of returned characters in a buffer whose final contents should be displayed on the console.

Hence the displayed output string will be an encoded version of the original input string.

Note that if the program is run again using the encoded version of the string as input, the resulting output string will be identical to the original un-encoded string.  That is, the same program also decodes the encoded message.

 

 

If the user types in the string “exit” in response to the prompt, then the program should terminate.

Subject Computer
Due By (Pacific Time) 10/03/2013 12:00 am
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy