Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an MIPS assembly program to exercise system call 1, 2, 4, 5, 6, 8, 10, 11

ID: 3708943 • Letter: W

Question

Write an MIPS assembly program to exercise system call 1, 2, 4, 5, 6, 8, 10, 11 and 12. You are required to provide the source code, as well as the screenshots of the running of the programming in QtSpim System Call Code Service Result uments $a0-value Sf12 float value $f12- double value Sa0-address of string (none) (none) (none) Sa0-address where string to be stored (none) (none) (none) (none) SvO value read sfo value read sf0 -value read print integer print float print double 2 4 print string read integer read float read double read string none Sal-number of characters to read 1 memory allocation Sao number of bytes of storage desired SvO address of block exit (end of program) print character read character (none) Sa0integer (none) 10 (none) (none) char in Sv0 12

Explanation / Answer

Screenshot

-------------------------------------------------------------------------------------------------------

Code

#Variable declaration
.data
        integer: .asciiz "Please enter an integer value :"
        integerResult: .asciiz "Integer= "
        floatVal: .asciiz " Please enter a float value :"
        floatResult: .asciiz "FloatValue= "
        doubleVal: .asciiz " Please enter a Double value :"
        doubleResult: .asciiz "DoubleValue= "
        text: .asciiz " Enter your text:"
        textResult: .asciiz "You entered string is: "
        char: .asciiz "Enter a character:"
        charResult: .asciiz " You entered character is: "
      

#main program      
.text
.globl main
main:
         #Prompt the user to enter integer
         li $v0,4
         la $a0,integer
         syscall
         #Read the user entered integer
         li $v0,5
         syscall
         #Store integer into t0
         move $t0,$v0
         #print integer
         li $v0,4
         la $a0,integerResult
         syscall
         li $v0,1
         move $a0,$t0
         syscall
       
         #Prompt the user to enter float value
         li $v0,4
         la $a0,floatVal
         syscall
         #Read the user entered float value
         li $v0,6
         syscall
         #Store integer into f12 for display
         mov.s $f12,$f0
         #print Float value
         li $v0,4
         la $a0,floatResult
         syscall
         li $v0,2
         syscall
       
         #Prompt the user to enter double value
         li $v0,4
         la $a0,doubleVal
         syscall
         #Read the user entered double value
         li $v0,7
         syscall
         #Store integer into f12 for display
         mov.d $f12,$f0
         #print Float value
         li $v0,4
         la $a0,doubleResult
         syscall
         li $v0,3
         syscall
       
         #Prompt the user to enter a string
         li $v0,4
         la $a0,text
         #string length
         li $a1,20
         syscall
         #Read the user entered text
         li $v0,8
         syscall
         #Store text address in to t0
         move $t0,$a0
         #print text
         li $v0,4
         la $a0,textResult
         syscall
         li $v0,4
         move $a0,$t0
         syscall
       
         #Prompt the user to enter a character
         li $v0,4
         la $a0,char
         syscall
         #Read the user entered character
         li $v0,12
         syscall
         #Store character in to t0
         move $t0,$v0
         #print character
         li $v0,4
         la $a0,charResult
         syscall
         li $v0,11
         move $a0,$t0
         syscall
       
       
         # allocate 32 bytes in heap memory.
         li $v0, 9
         li $a0, 32
         syscall
#end of the program
exit:
         li $v0,10
         syscall
         .end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote