Question

Create a MIPS program where you ask a user for 10 digit base 28 number and...

Create a MIPS program where you ask a user for 10 digit base 28 number and output a decimal in mips programming. It should also ignore any character that is not in the base 28 system and count its value as 0.

Example:

Input: 100000xza!

Output: 17210368

Input: xyzxyzxyzx

Output:0

Input: 1000000000

Output: 17210368

Output: 10578455953408

Input: 0000000000

Output:0

Homework Answers

Answer #1
.data
ms1_msg:.asciiz ""
.text
.globl main
main:

la $a0,ms1_msg    
li $v0,4
syscall

li $v0,5          #user enters number and it is stored in t0
syscall
move $t0,$v0


addi $t1,$zero,1  #t1=1
addi $t2,$zero,2  #t2=2
add $t5,$zero,1   #t5=1
add $t8,$zero,$zero 

add $t6,$zero,$t0  #t6=1

loop1:            #trying to find the counter for loop 2

addi $t5,$t5,1    
div $t0,$t2       
mflo $t4          
beq $t4,$t1,loop2 
sub $t0,$t0,$t0   
loop2:            #twith using the counter (t5) I define how many times loop should circle. 

    addi $t9,$t9,1    
    div $t6,$t2       
    mfhi $t7          
    mflo $t8          
    move $a0, $t7     
    li $v0, 1
    syscall
    beq $t9,$t5,exit
    sub $t6,$t6,$t6   
    add $t6,$t8,$t6 
    j loop2           

    exit:                                      
    li $v0,10       
    syscall
add $t0,$t4,$t0
j loop1           
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Using MIPS, create a stack that takes user input until the user inputs 0, then output...
Using MIPS, create a stack that takes user input until the user inputs 0, then output the characters that were entered onto the stack. Make sure to use $sp. Example: Please enter a number. Press 0 to quit: 4 5 2 5 7 0 Your numbers were: 4 5 2 5 7
(1) Ask the user to input a character. You will draw your right triangle with this...
(1) Ask the user to input a character. You will draw your right triangle with this character. (2) Ask the user to input the number of rows (integer). This will also signify the number of characters at the base of the triangle. (3) Use a nested loop to draw the triangle. The first line will only have one character but will now need to output enough spaces such that the character is output at the end of the row instead...
(8 marks) Write a program to ask user to input an integer and display the special...
Write a program to ask user to input an integer and display the special pattern accordingly. REQUIREMENTS The user input is always correct (input verification is not required). Your code must use loop statements (for, while or do-while). Your program should use only the following 3 output statements, one of EACH of the followings: System.out.print("-"); // print # System.out.print("+"); // print + System.out.println(); // print a newline Your code must work exactly like the following example (the text in bold...
In MIPS only!! make a program that multiplies a user input by 15. YOU CAN ONLY...
In MIPS only!! make a program that multiplies a user input by 15. YOU CAN ONLY USE ADDITION AND BITSHIFT OPERATIONS. Also very important, make sure its correct by using the mult and mflo operators (!More Important, explain to me how that's done!) . make sure to display user input and display the output. !!!please put comments on each line of what's happening!!!
3. Create a program which allows the user to swap individual words in an input string....
3. Create a program which allows the user to swap individual words in an input string. Given a string of input, your program should count and store the number of words in a 2D array. The user can then select the index of the words they want to swap. Your program should swap those two words and then print the entire string to ouput. • Use string prompt "> ". • Use indices prompt "Enter two indices: ". • Remove...
This phyton program requires you to accept from the user a three-digit integer (100-999), and prints...
This phyton program requires you to accept from the user a three-digit integer (100-999), and prints the reverse of that integer. You can assume that the input is an integer, but should not assume it's in the right range. If it's not in the right range, print "Illegal input:" and the number. Here are three sample runs: Enter a three digit decimal integer: 234 The number in reverse is: 432 Enter a three digit decimal integer: 1345 Illegal input: 1345...
Create a program to calculate and print basic stats on a set of a given input...
Create a program to calculate and print basic stats on a set of a given input values representing students' scores on an quiz. 1) Ask the user for the total number of quiz scores to be input (assume a positive integer will be given). 2) Create an array to hold all the quiz scores and then get all the scores from input to put into the array. For example, if the user input 10 in step (1) then you should...
Create a program that allows the user to input a list of first names into one...
Create a program that allows the user to input a list of first names into one array and last names into a parallel array. Input should be terminated when the user enters a sentinel character. The output should be a list of emial addresses where the address is of the following form: [email protected] Declare FirstName[100] as String Declare LastName[100] as String Declare email as String Declare K as Integer Declare index as Integer Write "Enter first and last name." Write...
You will write a program that loops until the user selects 0 to exit. In the...
You will write a program that loops until the user selects 0 to exit. In the loop the user interactively selects a menu choice to compress or decompress a file. There are three menu options: Option 0: allows the user to exit the program. Option 1: allows the user to compress the specified input file and store the result in an output file. Option 2: allows the user to decompress the specified input file and store the result in an...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts,...
For this assignment, you will be creating a simple “Magic Number” program. When your program starts, it will present a welcome screen. You will ask the user for their first name and what class they are using the program for (remember that this is a string that has spaces in it), then you will print the following message: NAME, welcome to your Magic Number program. I hope it helps you with your CSCI 1410 class! Note that "NAME" and "CSCI...