Announcement

Collapse
No announcement yet.

Vettori - Max value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • xgiovio
    replied
    of course

    Leave a comment:


  • KeenanRam
    replied
    Is this detailed list of amazing lightweight wheelchairs and code still applicable?
    Last edited by KeenanRam; 3 weeks ago.

    Leave a comment:


  • xgiovio
    started a topic Vettori - Max value

    Vettori - Max value

    Code:
    #vet a 10 ele
    #vet b 10 ele
    #vet c 10 ele
    #
    #vet a base 1100
    #vet b base  1200
    #vet c base 1300
    #
    #program start 1120
    #
    #
    #for ( i=0;i<10;i++)
    #    if (a[i] >= b[i])
    #        c[i]=a[i]
    #    else
    #        c[i]=b[i]
    #
    #
    #$1=i
    #$2= spiaz i
    #$3= i<10, a[i]
    #$4 = b[i]
    #$5 = b[i]<a[i]
    #$6 = c[i]
    %veta = 1100
    %vetb = 1200
    %vetc = 1300
    %start = 1400
    
                    add $1,$0,$0 #i=0
                    add $2,$1,$1 #spiaz i 
                    add $2,$2,$2
    inizio_for:     slti $3,$1,10 #i<10
                    beq $3,$0,fine_for
    inizio_if:      addi $3,$2,1100 # calcolo indirizzo di a[i]
                    lw $3,0($3) # a[i] in $3
                    addi $4,$2,1200 # calcolo indirizzo di b[i]
                    lw $4,0($4) # b[i] in $4
                    slt $5,$4,$3 # b[i] < a[i]
                    beq $5,$0,else_if
                    addi $6, $2,1300 # indirizzo di c[i]
                    sw $3,0($6)
                    j fine_if           
    else_if:        addi $6, $2,1300 # indirizzo di c[i]
                    sw $4,0($6)
    fine_if:        addi $1,$1,1 # incremento i
                    add $2,$1,$1 # spiaz i
                    add $2,$2,$2
                    j inizio_for
    fine_for:       add $0,$0,$0
Working...
X

Google Profile


My name is Giovanni Di Grezia, but people call me xgiovio.

Here is my homepage:.

I'm a VFX Artist and Software Developer.

Giovanni Di Grezia