All pastes #422273 Raw Edit

projekt2

public text v1 · immutable
·published 2007-04-03 10:56 UTC
rendered paste body
#include <iregdef.h>
        .data
format: .asciiz "%d \n"
        .text
        .globl  start
        .ent    start
start:
        li      v0,0//result
        li      t0,10//n-fakultet
        li      s1,10
next:   jal     fack//Hoppa till subrutin
        la      a0,format
        move    a1,v0
        jal     printf
        addi    s1,s1,-1
        nop
        move    t0,s1
        move    v0,zero
        bgtz    s1,next
        break

fack:   add     v0,t0,v0
        nop
        beq     t0,1,fulhack
        addi    t0,t0,-1
fulhack: nop
loop:   mul     v0,v0,t0
        nop
        addi    t0,t0,-1
        nop
        bgtz    t0,loop
        jr      ra
        .end    start