Answered step by step
Verified Expert Solution
Question
1 Approved Answer
MIPS assembly from C for simple arithmetic and prompting user code. please use PCSPIM. Objectives: write assembly language programs to -perform arithmetic and logical operations
MIPS assembly from C for simple arithmetic and prompting user code. please use PCSPIM.
Objectives: write assembly language programs to -perform arithmetic and logical operations on variables -use syscall operations to display integers and strings on the console window -use syscall operations to read integers from the keyboard. Assignment Description: The read int system call (number 5) will cause the running program to stop and wait for the user to type in an integer at the keyboard. The integer will be put into $v0 register and will be available after the syscall completes. Write a MIPS assembly language program which prompts for a user to enter four integers and calls read int four times to read in four integers. The program should perform addition, subtraction, multiplication, integer division, and modulo operation (compute the remainder of their division) using two of these four integers (see the C program below), then display their result on the console window. Also compute num2 (num4 + numl mod 3) *2) um3) where numl is the first read integer, num2 is the second read integer, num3 is the third read integer, and num4 is the forth read integer, and display the result. Name your source code file assignment3.S. The following shows how it looks like in a C progranm int num1, num2, num3, num4, ansl, ans2, ans3, ans4, ans5, ans6 printf C"Enter a value: "); //read an integer from a user input and store it in numl scanf ("%d", &num1) ; printf ("Enter another value: "); //read an integer from a user input and store it in num2 scanf ("%d", &num2); printf ("Enter one more value: ") //read an integer from a user input and store it in num3 scanf ("sd", &num3) printf ("Enter one more value: ") //read an integer from a user input and store it in num4 scanf ("sd", &num4) ans! = num2 +num3 ; //addition printf( "num2+num3-%d ", ans!) ; ans2 = num3-num4; //subtract 1 n printf( "num3-num4-%d ", ans2)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started