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

Please HELP AND MODIFY MY CODE assembly code calculate a algebraic f and g f = (

ID: 3903123 • Letter: P

Question

Please HELP AND MODIFY MY CODE
assembly code
calculate a algebraic f and g
f = (A^4-4B^3+3C^2-2D)
g = (AB^2+C^2D^3)
without using any intrinsic multiplication instructions, subroutines, and function calls.
write MIPS assembly code that accepts four positive integers A, B, C, and D as input parameters. The
code shall execute in MARS to prompt the user to enter four positive integers represented in decimal,
each separated by the Enter key. The program shall calculate f and g using your own self-written multiplication routine. 
The program will then output f and g in
decimal and binary, using syscall routines for each output.
no multiplication, no division, and no shift instructions shall be used. Namely,
none of { mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu, rem,
sll, sllv, sra, srav, srl, srlv} or else a zero score will result. Thus, it is necessary to
compose your own multiplication technique. must use a loop. No use of Macro, Subroutines, or Functions

This Is my code, but it won't display the output for me, please help and modify it.

.data

prompt: .asciiz " Enter 4 integers for A, B, C, D respectively: "
space: .asciiz " "
decimal: .asciiz "f_ten = "
binary: .asciiz "f_two = "
decimal2: .asciiz "g_ten = "
binary2: .asciiz "g_two = "
.text

main:
        #display prompt
    li $v0, 4      
    la $a0, prompt  
    syscall
    
    #Read A input in $v0 and store it in $t0
    li $v0, 5
    syscall
    move $t0, $v0
    
    #Read B input in $v0 and store it in $t1
    li $v0, 5
    syscall
    move $t1, $v0
    
    #Read C input in $v0 and store it in $t2
    li $v0, 5
    syscall
    move $t2, $v0
    
    #Read D input in $v0 and store it in $t3
    li $v0, 5
    syscall
    move $t3, $v0
    
    
    #Loop (AxA)
    li $t6, 0
    L1:    
        bge $t6, $t0, quit
        add $s1, $s1, $t0  # A=S+A
        addi $t6, $t6, 1   # i=i+1
        j L1
        quit:
    
    #Loop (AxA)
    li $t6, 0
    L1A:
        bge $t6, $s1, quit1A
            add $s5, $s5, $s1
            addi $t6,$t6, 1
            j L1A
        quit1A:    
       
   
    #Loop (4xB)
    li $t6, 0
    L2:
        bge $t6, 4, quit2
            add $s2, $s2, $t1
            addi $t6, $t6, 1
            j L2
        quit2:    

    #Loop (BxB)
    li $t6 , 0
    L2A:
        bge $t6, $t1, quit2A #loop2
            add $s6, $s6, $t1 #add
            addi $t6, $t6, 1 #add immediate
            j L2A #loop2
        quit2A:    # perform proper program termination using syscall for exit

    #Loop (BxB)
    li $t6 , 0 #load immediate
    L2AA:
        bge $t6, $s2, quit2AA #loop2
            add $t7, $t7, $s6 #add
            addi $t6, $t6, 1 #add immediate
            j L2AA #loop2
        quit2AA:    # perform proper program termination using syscall for exit

    #3 Loop (3 x (C x C)) FOR S3    
    li $t6 , 0 #load immediate
    L3:
        bge $t6, $t2, quit3 #loop3
            add $s3, $s3, $t2 #add
            addi $t6,$t6, 1 #add immediate
            j L3 #loop3
        quit3:    # perform proper program termination using syscall for exit

    #3 Loop (3 x (C x C)) FOR S3    
    li $t6 , 0 #load immediate
    L3A:
        bge $t6, 3, quit3A #loop3
            add $s0, $s0, $s3 #add
            addi $t6,$t6, 1 #add immediate
            j L3A #loop3
        quit3A:    # perform proper program termination using syscall for exit

    #4 Loop (2 x D) FOR S4
    li $t6 , 0
    L4:
        bge $t6, 2, quit4 #loop4
            add $s4, $s4, $t3 #add
            addi $t6, $t6, 1 #add immediate
            j L4 #Loop4
        quit4:    # perform proper program termination using syscall for exit

    #5 Loop (A x (B x B)) FOR S
    li $t6 , 0 #load immediate
    li $s1 , 0
    L5:
        bge $t6, $t0, quit5 #loop
            add $s1, $s6, $t0 #add
            addi $t6,$t6, 1 #add immediate
            j L5 #loop1
        quit5:    # perform proper program termination using syscall for exit

    #6 Loop (D x D) FOR S4
    li $t6 , 0
    L6:
        bge $t6, $t3, quit6 #loop4
            add $s6, $s6, $t3 #add
            addi $t6, $t6, 1 #add immediate
            j L6 #Loop4
        quit6:    # perform proper program termination using syscall for exit

    #6 Loop (D) FOR S4
    li $t6 , 0
    L6A:
        bge $t6, $t3, quit6A #loop4
            add $s6, $s6, $t3 #add
            addi $t6, $t6, 1 #add immediate
            j L6A #Loop4
        quit6A:    # perform proper program termination using syscall for exit

    #f is $t8
    li $t8 , 0
    sub $t8, $s5, $t7 # addition
    add $t8, $t8, $s0 # subract
    sub $t8,$t8, $s4  # subract

    #g is $t9
    add $t9, $s1, $s2

Explanation / Answer

ScreenShot

Program

#Variable declaration
.data
   prompt: .asciiz "Please enter A,B,C,D values(only positive integers):"
   fValue: .asciiz "f="
gValue: .asciiz " g="
#Main program
.text
     #User prompt
     la $a0,prompt
     li $v0,4
     syscall
     #read first number and store in s0
     li $v0,5
     syscall
     move $s0,$v0
     #read second number and store in s1
     li $v0,5
     syscall
     move $s1,$v0
     #read third number and store in s2
     li $v0,5
     syscall
     move $s2,$v0
     #read fourth number and store in s3
     li $v0,5
     syscall
     move $s3,$v0
    #A^4
    move $t0,$s0
    li $s4,0
loop:
    blt $t0,1,loop1
    add $s4,$s4,$s0
    addi $t0,$t0,-1
    j loop
loop1:
    move $t0,$s4
    li $s5,0
loop11:
    blt $t0,1,loop2
    add $s5,$s5,$s4
    addi $t0,$t0,-1
    j loop11

#B^3
loop2:
    move $t1,$s5
    move $t0,$s1
    li $s4,0
loop21:
    blt $t0,1,loop22
    add $s4,$s4,$s1
    addi $t0,$t0,-1
    j loop21
loop22:
    move $t0,$s1
    li $s5,0
loop23:
    blt $t0,1,loop24
    add $s5,$s5,$s4
    addi $t0,$t0,-1
    j loop23
loop24:
    li $t0,4
    li $s6,0
loop25:
    blt $t0,1,loop3
    add $s6,$s6,$s5
    addi $t0,$t0,-1
    j loop25
#c^2
loop3:
move $t2,$s6
move $t0,$s2
    li $s4,0
loop31:
    blt $t0,1,loop32
    add $s4,$s4,$s2
    addi $t0,$t0,-1
    j loop31
loop32:
move $t4,$s4
    li $t0,3
    li $s5,0
loop33:
    blt $t0,1,loop4
    add $s5,$s5,$s4
    addi $t0,$t0,-1
    j loop33
#2D
loop4:
    move $t3,$s5
    li $t0,2
    li $s5,0
loop41:
    blt $t0,1,next
    add $s5,$s5,$s3
    addi $t0,$t0,-1
    j loop41
next:
#f = (A^4-4B^3+3C^2-2D)
sub $t1,$t1,$t2
add $t1,$t1,$t3
sub $t1,$t1,$s5
#F display
la $a0,fValue
li $v0,4
syscall
#result display
move $a0,$t1
li $v0,1

#B^2
loopg:
move $t0,$s1
li $s4,0
loopg1:
    blt $t0,1,loopg2
    add $s4,$s4,$s1
    addi $t0,$t0,-1
    j loopg1
#AB^2
loopg2:
    move $t0,$s0
    li $s5,0
loopg3:
    blt $t0,1,loopg4
    add $s5,$s5,$s4
    addi $t0,$t0,-1
    j loopg3
#D^3
loopg4:
    move $t5,$s5
    move $t0,$s3
    li $s4,0
loopg5:
    blt $t0,1,loopg6
    add $s4,$s4,$s3
    addi $t0,$t0,-1
    j loopg5
loopg6:
    move $t0,$s3
    li $s5,0
loopg7:
    blt $t0,1,loopg8
    add $s5,$s5,$s4
    addi $t0,$t0,-1
    j loopg7
#c^2D^3
loopg8:
    move $t0,$t4
    li $s6,0
loopg9:
    blt $t0,1,loopg10
    add $s6,$s6,$s5
    addi $t0,$t0,-1
    j loopg9
loopg10:
#g = (AB^2+C^2D^3)
add $s6,$s6,$t5
syscall
#end of the program
exit:
#g display
la $a0,gValue
li $v0,4
syscall
#result display
move $a0,$s6
li $v0,1
syscall
#end of the program
li $v0,10
syscall

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

Output

Please enter A,B,C,D values(only positive integers):1
2
3
4
f=-12
g=580
-- program is finished running --