Each program should be commented (documented) with the following information: 1.
ID: 3836540 • Letter: E
Question
Each program should be commented (documented) with the following information: 1. Your name Last modified date: Program name 2. Description (what the program does) C (or Java) -pseudo-code 3. Registers Use (name of registers and what they will store) Write a MIPS assembly language program that will cover the following steps: Prompt the user to enter a first integer in the range [-10, 0] named integer l Prompt the user to enter a second integer in the range [10, 20] named integer2 Compute 4*int1 +int2//don't use subi; don't use mul Print the value of the result together with a message Repeat The program should enforce the rule that the two entered integers must be in the mentioned intervals. If the entered integer is not in the specified range, prompt again the user to enter an integer in the specified range. Create a sentinel (999 for example) that will allow the user to exit the program. Write a MIPS assembly language program for the following for loop: Pseudocode: for(int j=20; j > 10; j-){total = j + constant: println("for j equal "+j+ ", total equal " +total); The constant value should be prompted from the user. In the program use the sit or the sit! instruction.Explanation / Answer
Program 1a:-
#############################################################################
#Name:??????
#last modified: 9-5-2017
#program name:multiplication using shifts
#Description: this program solves the equation 4*int1+int2 without using mult or subi commands (MIPS)
#Registers used: $v0,$a0,$t1,$t2,$t3
###################################################################################
.data
str1: .ascizz "Enter Integer 1: "
str2: .ascizz "Enter Integer 2: "
str3: .ascizz "4*Int1 + Int2 = "
.text
main:
li $v0,4 #system call for printing a string
la $a0,str1 #address of str1
syscall
li $v0,5 #system call for reading integer
syscall
add $t1,$v0,$zero
li $v0,4 #system call for printing a string
la $a0,str2 #address of str2
syscall
li $v0,5 #system call for reading integer
syscall
add $t2,$v0,$zero
sll $t1, $t1, 2 #4*Int1 using shifts
add $t3,$t1,$t2 #4*Int 1 + Int2
li $v0,4 #system call for printing a string
la $a0,str3 #address of str3
syscall
li $v0,1 #system call for printing integer
move $a0,$t3 #sending the integer to be printed
syscall
li $v0,10 #system call for program exit
syscall
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.