.:Pudge:. 0 Light Poster

I need to change this code from a sum of squares to 100 to a sum of cubes. What code do i need to add or change and what lines? Thanks

# FILE = figA4.s
# From jws@cs.uga.edu Tue Oct  7 08:46 EDT 2003

    .text
    .align    2
    .globl    main
main:
    subu    $sp,$sp,32
    sw    $ra,20($sp)
    sd    $a0,32($sp)
    sw    $0,24($sp)
    sw    $0,28($sp)
loop:
    lw    $t6,28($sp)
    mul    $t7,$t6,$t6
    lw    $t8,24($sp)
    addu    $t9,$t8,$t7
    sw    $t9,24($sp)
    addu    $t0,$t6,$t6
    sw    $t0,28($sp)
    ble    $t0,100,loop
#    la    $a0,str
#    lw    $a1,24($sp)
#    jal    printf       # we dont have printf, use next 6 instrs:
        la      $a0,str      # 1
        li      $v0,4        # 2
        syscall              # 3
        lw      $a0,24($sp)  # 4
        li      $v0,1        # 5
        syscall              # 6
    move    $v0,$0
    lw    $ra,20($sp)
    addu    $sp,$sp,32
    j    $ra

    .data 
    .align    0
str:
    .asciiz    "The sum of the cubes from 1 to 100 is %d\n"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.