Question: MIPS Assembly programming. Not C or anything else Write a program that reads a string (from a keyboard), stores it in the memory, and computes

MIPS Assembly programming. Not C or anything else

Write a program that reads a string (from a keyboard), stores it in the memory, and computes and prints the frequency of each upper case, each lowercase, and the space character.

I have coded most of it I just need someone to tell me what is wrong and how to fix it

.data

prompt: .asciiz "Enter a string: "

arrayInput: .space 100

arrLowerCase: .word 0:26

arrUpperCase: .word 0:26

msg: .asciiz "The letter "

msg1: .asciiz " has a frequency of "

newLine: .asciiz " "

space: .word 0:10

.text

main: la $a0, prompt

li $v0, 4

syscall

la $a0, arrayInput

li $a1, 20

li $v0, 8

syscall

la $a0, arrayInput

jal compute

la $a0, arrLowerCase

li $a1, 0

jal print

li $v0, 10

syscall

print: move $t0, $a0

printA: lw $t1, 0($t0)

beqz $t1, dont

beq $a1, 26, endme

add $t0, $t0, 4

add $a1, $a1, 1

la $a0, msg

li $v0, 4

syscall

li $t2, 0

add $t2, $t1, 97

move $a0, $t2

li $v0, 11

syscall

la $a0, msg1

li $v0, 4

syscall

move $a0, $t1

li $v0, 1

syscall

la $a0, newLine

li $v0, 4

syscall

dont: add $t0, $t0, 4

beq $a1, 26, endme

add $a1, $a1, 1

b printA

endme: jr $ra

compute: lb $t0, 0($a0)

add $a0, $a0, 1

beqz $t0, endy

beq $t0, 13, endy

bge $t0, 97, lower

bge $t0, 65, upper

beq $t0, 32 spacy

b compute

spacy: li $t1, 1

li $t3, 0

li $t4, 0

lw $t2, space($t4)

add $t3, $t1, $t2

sw $t3, arrLowerCase($t4)

b compute

lower: ble $t0, 122, contL

b compute

contL: add $t0, $t0, -97

mul $t5, $t0, 4

li $t1, 1

li $t3, 0

lw $t2, arrLowerCase($t5)

add $t3, $t1, $t2

sw $t3, arrLowerCase($t5)

b compute

upper: ble $t0, 90, contU

b compute

contU: add $t0, $t0, -65

mul $t5, $t0, 4

li $t1, 1

li $t3, 0

lw $t2, arrUpperCase($t5)

add $t3, $t1, $t2

sw $t3, arrUpperCase($t5)

b compute

endy: jr $ra

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!