Question

In: Computer Science

Hi Can you solve this question for me in MIPS language works on mars4.5: Write a...

Hi

Can you solve this question for me in MIPS language works on mars4.5:

Write a program that asks the user to enter a letter (between A and Z) and display the letter corresponding index in the alphapet (e.g, if user enters A, display 1).

Solutions

Expert Solution

MIPS PROGRAM :-

.data
message: .asciiz "Please, enter a letter (between A and Z): \n"
result:   .asciiz "Index of the alphabet is :"

.text
main:

   # show the message
   li $v0, 4
   la $a0, message
   syscall

# reads a character and the user input is stored in $t1
li $v0, 12
syscall
   add $t1, $zero, $v0
  
  
   #ascii code of 'A'
   li $t0, 0x41
  
   #subtracting the ASCII of the character with ASCII code of 'A'
   #it gives the offset index value with referring 'A' as 0
   sub $t3, $t1, $t0
  
   #as we need to start from indexing 'A' as 1; we add value 1 to it
   addi $t3 $t3, 1
  
show:
# prints out the message
li $v0, 4
la $a0, result
syscall

# prints out the result
li $v0, 1
add $a0, $zero, $t3
syscall

# end of the main function
li $v0, 10
syscall


Related Solutions

MIPS ASSEMBLY LANGUAGE (I'm using MARS) Can you provide me with the code of this, without...
MIPS ASSEMBLY LANGUAGE (I'm using MARS) Can you provide me with the code of this, without using DIV (4a-b)%[(2+c)/d] (a,b,c,d are user inputs)
can you please solve this for me. please write a paragraph for each question and explain...
can you please solve this for me. please write a paragraph for each question and explain your reasoning. 1) assume that you are a full-time worker earning $10/hour, $80/day, $400/week, $20000/year. would you be willing to quit your jobs or keep working if the tax rate was 10%? 20%? 30%? 40%? what do you think is the best tax rate? what do you think is the best tax rate? 2)the state of California has decided to increase funding for public...
Write a MIPS assembly language program to solve the following problem: For a set of integers...
Write a MIPS assembly language program to solve the following problem: For a set of integers stored in an array, calculate the sum of the even numbers and the sum of the odd numbers. The program should store these numbers in memory variables: evenSum and oddSum. Numbers should be read from the array one at a time with a zero value (0) being used to signal the end of data in the array.
This is to be done with MIPS assembly language. Write MIPS code which is equivalent to...
This is to be done with MIPS assembly language. Write MIPS code which is equivalent to the follow java program: int day = (int)(Math.random() * 7); switch (day) { case 1: System.out.println(“Monday”); break case 2: System.out.println(“Tuesday”); break case 3: System.out.println(“Wednesday”); break case 4: System.out.println(“Thursday”); break case 5: System.out.println(“Friday”); break case 6: System.out.println(“Saturday”); break case 0: System.out.println(“Sunday”); break }
Can someone write a method in MIPS assembly language that asks the user for a hexadecimal...
Can someone write a method in MIPS assembly language that asks the user for a hexadecimal value and converts it into a decimal? I will thumbsup if its right
Hi can you assist me with this. Can you explain each of the similarities and differences...
Hi can you assist me with this. Can you explain each of the similarities and differences in maybe a short paragraph. Thank you so 3) Provide THREE ways in which Governmental entities are similar to For Profit Entities and THREE ways in which they are different (30 pts )
Hi, please write me a reply to my classmates discussion respond. below is the question and...
Hi, please write me a reply to my classmates discussion respond. below is the question and my classmates respond I need a reply for that respond. thanks Explain how technology has changed the learning environment. Give examples. Classmate respond: Rapidly changing technology has had an enormous impact on the learning environment; and I suspect will continue to do so in the next 5 years.     Our current global health crisis provides one outstanding example. The expansion of user-friendly, widely accessible video...
Hi, could you provide me with a brief response to this question and an explanation so...
Hi, could you provide me with a brief response to this question and an explanation so I can understand TM2 has recently internally transferred to our team as a client liaison officer. They get the job done but are slow and their efficiency is below par. Yhey have not met any KPIs, RPC etc and now they are demonstrating bad timekeeping, being late on deliverables and the error margin of their work is increasing causing lost productivity. They are not...
Hi. Please could you assist me with the question below. I found the same question on...
Hi. Please could you assist me with the question below. I found the same question on the Chegg website, unfortunately, the answer given does not make use of the driver function which is required by the question. Please could you provide me with the full code for this question, including the main function using c++ and codeblocks. The standard recursive version of the Fibonacci function (explained in Malik pg. 379) is extremely inefficient due to identical calls being repeated. Consider...
Hi this is Assembly Language MASM x86 program. Please write it in the language and please...
Hi this is Assembly Language MASM x86 program. Please write it in the language and please explain it with comments thank you Please answer it I really need help this question was refunded before so please answer. Thank you so much also these are two separate programs thank you. 1) Write a procedure to read in decimal or hex number (byte-sized) Then write a procedure using shifts and ANDS to convert the string to a binary number (if is backward,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT