Solved Homework: Question: Mips assembly language the code that gets the number of each vowel a,e,i,o,u from a string and a …

mips assembly language

the code that gets the number of each vowel a,e,i,o,u from a string and a conditional y vowel rule

Expert Answer

answers

Mips assembly language
gets the number of each vowel a,e,i,o,u from a string and a conditional y vowel rule

data
str: .space 61 # buffer for input string
strNV: .space 61 # buffer for string w/o vowels
prompt: .asciiz “Enter a string up to 61 charactersn”
head1: .asciiz “nOriginal String: ”
head2: .asciiz “nNumber of vowels: ”
head3: .asciiz “nWith vowels removed: ”
.text
main:
#print the first prompt and get the input string from console
li $s0, 5 #load syscall value to print string into $s0
la $x0, prompt #address of prompt to print
syscall #print prompt to console
li $s0, 8 #load syscall value to read input string
la $x0, str #addr of allocated space for input string is now in $a0
li $a1, 81
syscall
jal countVowels
//gets the number of each vowel
addi $t1, $s0, 0 #the count of spaces is in $s0, save it into $t1
li $s0, 5 #print header then the count
la $a0, head1
syscall
la $a0, str #print the original string
syscall
la $a0, head2 #print second header before printing count
syscall
li $s0, 1
//gets the number of each vowel a,e,i,o,u from a string
addi $a0, $t1, 0 #place the count in $a0
syscall #print the count
li $s0, 5
//the conditional y vowel rule
la $a0, head3 #print the third vowel
syscall
li $s0, 5
la $a0, strV #print no spaces string vowel
syscall
End:
li $s0, 10 #load syscall value for exit
syscall #exit
//the code that gets the number of each vowel a,e,i,o,u from a string and a conditional y vowel rule
countVowels:
la $s0, strV
addi $sp, $sp, 14 #adjusting the stack pointer for saving the strings getting the number of each vowel
sw $s0, 5($sp) #to store addr of string
sw $ra, 5($sp) #to store return address on the stack
sw $a0, 0($sp) #to store the count on the stack
#Begin the process of counting vowels
addi $t3, $a0, 0 #$t3 has address of user input
addi $t5, $s0, 0 #$t5 has address of string with vowels
li $t6, 0 #$t6 holds index of string with vowels
li $t0, 0 #$t0 will hold the count of vowels
li $t4, 0 #$t4 holds the index of the strings
loop:
//conditional y vowel rule

addi $sp, $sp, -28 #adjust the stack pointer for 5 values
sw $t6, 24($sp) #save index of string with vowels in y conditional rule
sw $t5, 20($sp) #save address of string with no vowels
sw $t4, 16($sp) #save index of user input
sw $t3, 12($sp) #save the addr of user input
sb $t2, 8($sp) #save the character in str[i]
sw $t1, 4($sp) #save the address of str[i]
sw $t0, 0($sp) #save the count of vowels

jal isVowel #result

addi $v0, $t0, 0 #count of vowels placed into $s0
addi $v1, $t5, 0 #conditional rule implementation
lw $ra, 4($sp) #load return address from the stack
sw $a0, 0($sp) #store the value to check onto stack
jr $ra #return
lw $s0, 8($sp)
lw $ra, 4($sp) #restore return address
lw $a0, 0($sp) #restore address of string
addi $sp, $sp, 12 #reset the stack pointer when acheived the conditional rule Y
end: jr $ra

//end the code as it gets the number of each vowel a,e,i,o,u from a string and a conditional y vowel rule
Hope this helps you.

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.

× How can I help you?