Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need completely working MIPS assembly code forthe following:(every part of the c

ID: 2989085 • Letter: N

Question

Need completely working MIPS assembly code forthe following:(every part of the code should be there and I should be aale to run the code just by pasting it directly and then compiling) : (part 3.4 is most important, 3.3 should also be done preferrably) but 3.4 is a must to do:

Reading Level You are tasked to prompt the user to enter a string. The string consists of one or more English words separated by a space without punctuation. Your program should determine the Reading Level of the string based on the number of letters in the longest word, according to the scale listed in Table 1. More formally, write a MIPS assembly code in MARS to prompt and allow the user to enter a line of text. The text entered will be a string of English words without punctuation, except for spaces between any adjacent English words, along with a single period as the final character of the string. Count the number of letters in each English word to identify the longest such word in the string. Calculate the Reading Level according to Table 1 below and output this result on the console display. 3.4 Part C: Toggle Case You are tasked to prompt the user to enter a string of English words. Your program will Toggle the case of each letter in the user's input to produce output whereby the corresponding English words contain reversed case letters of the input. More formally, write MIPS assembly code in MARS to prompt and allow the user to enter a line of text. The text entered will be a string of English words without punctuation, except for spaces between any adjacent English words, along with a single period as the final character of the string. The output is a string of English words containing the same letters of the alphabet in the same sequence, but with the case of each letter toggled from capitalized uppercase, e.g. "A", to the corresponding lowercase letters, e.g. "a", or vice versa depending on the original case of each letter. The output is displayed on the console.

Explanation / Answer

We see that t7 is used to store 1, which is the index of the second element. In SPIM, the second element would not be referenced by an offset of one from the address of the beginning of the array, but instead by an offset of four bytes.

Moving on.

I set have the idea that theArray[t0] would get theArray[t0-1] + theArray[t0-2]. I set t0 to 2 so that it starts at the THIRD ELEMENT of theArray. To accomplish the same effect with MIPS, I must start at an offset of 8.

3.4

org 100h
.model small
.stack 100h

jmp start

msgtype db 13,10,'Type a Letter:','$'
msgsmall db 13,10,'Small letter:','$'
msgcap db 13,10,'Capital Letter:','$'
msginva db 13,10,'Invalid Input!','$'
msgtry db 13,10,'Try again [y/n]:','$'

start:
mov ah, 09h
mov dx, offset msgtype
int 21h
mov ah, 01h
int 21h

cmp al,5Ah
ja comparesmall
cmp al,41h
jae ifcap
jb comparesmall
jmp exit

comparesmall:
cmp al, 7Ah
ja invalid
cmp al, 61h
jae ifsmall
jb invalid

ifsmall:
sub al, 20h
jmp output2

ifcap:
add al, 20h
jmp output1

output1:
mov ah, 09h
mov dx, offset msgsmall
int 21h
mov ah, 02h
jmp exit

output2:
mov ah, 09h
mov dx, offset msgcap
int 21h
jmp exit

invalid:
mov ah, 09h
mov dx, offset msginva
int 21h
jmp try

try:
mov ah, 09h
mov dx, offset msgtry
int 21h
mov ah, 01h
int 21h
cmp al, 'y'
je start
jne exit

exit:
mov ah, 4ch
int 21h
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote