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...
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 )
Write a program in MIPS assembly language to perform the calculation of the following equation and...
Write a program in MIPS assembly language to perform the calculation of the following equation and save the result accordingly:    f = 5x + 3y + z Assumptions: - Registers can be used to represent variables x, y, z, and f - Initialize x, y, and z to values of your choice. f can be initialized to zero. - Use comments to specify your register usage and explain your logic
Write a MIPS assembly language to transpose a square integer matrix in code
Write a MIPS assembly language to transpose a square integer matrix in code
In MIPS assembly language, write a function that will display the max and min value in...
In MIPS assembly language, write a function that will display the max and min value in an array. Then write a function to calculate and display the average of all values in an array. This must be done in MIPS assembly language.
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,...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT