Question: In this assignment, you will be using a linked list and strings in MIPS. You will learn: How to move through a linked list. How

In this assignment, you will be using a linked list and strings in MIPS. You will learn:

How to move through a linked list.

How to read and change individual characters in a null-terminated string.

Overview. Develop a MIPS assembly program named CaesarCipher.asm that encrypts or decrypts a sentence using a Caesar cipher (Links to an external site.)Links to an external site.. Each word in the sentence is stored in a linked list. Your job is to perform the Caesar shift on the uppercase letters A-Z in each word. You program then prints out the shifted version of the original sentence.

Caesar cipher. The Caesar cipher is a simple substitution cipher in which each letter in the alphabet is replaced by the letter a given number of position before or after the original letter. For example, using a left shift of -3, the word "THE" would be encrypted as "QEB" since Q is three letters before T, E is three letters before H, and B is three letters before E. A right shift of +3 would decrypt "QEB" to "THE".

In this assignment, you will be using a linked list and strings

The Caesar cipher implements cyclic wrap around. For example, a left shift of -3 would change "A" to "X". Simarly, a right shift of +3 would change "X" back to "A"

Program input and output. The input to the program is defined in a .data segment of the MIPS program. The shift amount is an integer between -26 and positive 26 (inclusive of -26 and 26). Note that shifts of -26, 0, and 26 should end up resulting in the original text. We will not be testing with any shifts outside this range. The words of the sentence are stored in a linked list. The pointer to the first node in the linked list is located at the label first. Here is an example:

### START DATA ### .data shift: .word -3 first: .word node2 .asciiz "HELLO" node2: .word node3 .asciiz "CAESAR" node3: .word -1 .asciiz "CIPHER!!!" ### END DATA ### 

Each node in your linked list should start with a .word that specified the memory address of the next node in the linked list. If a node is the last node in the list, it starts with a .word equal to -1 (e.g. node3 in the above example). After a node's next pointer comes a null-terminated ASCII string containing the character data for the word. Your program should rely only on the labels shift and first and not on any of the other labels. The autograder will be replacing the .data segment between the ### START DATA ### and ### END DATA ### comments. You can leave your .data segment in your submitted code, but it must be between exactly these two comments. Your program should not rely on the exact ordering of the linked list nodes in memory.For example, your program should work the same on the following input which is the same sentence, but just laid out differently in memory:

### START DATA ### .data # Test 1: "HELLO CAESAR CIPHER!!!" -> "EBIIL ZXBPXO ZFMEBO!!!" shift: .word -3 first: .word node2 .asciiz "HELLO" node3: .word -1 .asciiz "CIPHER!!!" node2: .word node3 .asciiz "CAESAR" ### END DATA ### 

Your program should output the shifted version of the uppercase letters A-Z. All other characters (including lowercase a-z) should be left alone. The output for the above input data would be "EBIIL ZXBPXO ZFMEBO!!!". Here are some .data sections and the output you should get for each:

# Test 2: "EBIIL AYCQYP AGNFCP!!!" -> "HELLO CAESAR CIPHER!!!" shift: .word 3 first: .word node2 .asciiz "EBIIL" node2: .word node3 .asciiz "ZXBPXO" node3: .word -1 .asciiz "ZFMEBO!!!" HELLO CAESAR CIPHER!!! -- program is finished running -- # Test 3: "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" -> "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" shift: .word -3 first: .word node2 .asciiz "THE" node2: .word node3 .asciiz "QUICK" node3: .word node4 .asciiz "BROWN" node4: .word node5 .asciiz "FOX" node5: .word node6 .asciiz "JUMPS" node6: .word node7 .asciiz "OVER" node7: .word node8 .asciiz "THE" node8: .word node9 .asciiz "LAZY" node9: .word -1 .asciiz "DOG!" QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD! -- program is finished running -- # Test 4: "QEB NRFZH YOLTK CLU GRJMP LSBO QEB IXWV ALD" -> "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" shift: .word 3 first: .word node2 .asciiz "QEB" node2: .word node3 .asciiz "NRFZH" node3: .word node4 .asciiz "YOLTK" node4: .word node5 .asciiz "CLU" node5: .word node6 .asciiz "GRJMP" node6: .word node7 .asciiz "LSBO" node7: .word node8 .asciiz "QEB" node8: .word node9 .asciiz "IXWV" node9: .word -1 .asciiz "ALD!" THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG! -- program is finished running -- # Test 5: "Don't worry, Be :)" -> "Non't worry, Le :)" shift: .word 10 first: .word node2 .asciiz "Don't" node2: .word node3 .asciiz "worry," node3: .word node4 .asciiz "Be" node4: .word -1 .asciiz ":)" Non't worry, Le :) -- program is finished running -- # Test 6: "SOLO" -> "TPMP" shift: .word 1 first: .word -1 .asciiz "SOLO" TPMP -- program is finished running -- # Test 7: "[[SPIN ME RIGHT ROUND]]" -> "[[SPIN ME RIGHT ROUND]]" shift: .word 26 first: .word node2 .asciiz "[[SPIN" node2: .word node3 .asciiz "ME" node3: .word node4 .asciiz "RIGHT" node4: .word -1 .asciiz "ROUND]]" [[SPIN ME RIGHT ROUND]] -- program is finished running -- # Test 8: "ONE TWO THREE FOUR" -> "POF UXP UISFF GPVS" shift: .word 1 first: .word node4 .asciiz "ONE" node2: .word node3 .asciiz "THREE" node3: .word -1 .asciiz "FOUR" node4: .word node2 .asciiz "TWO" POF UXP UISFF GPVS -- program is finished running -- # Test 9: "" (an empty linked list) -> "" shift: .word 3 first: .word -1 -- program is finished running -- 

ABICIDEIF ABICIDEIF

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!