SHARE
TWEET

mips: salva 100 interi nello stack

Dany1858 Jan 21st, 2019 (edited) 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2.     main:
  3.         addi $sp, $sp, -400     #alloco posti in sp
  4.         addi $t0, $zero, 99     #indice per il for
  5.         for:    beq $t0, -1, print
  6.             sll $t1, $t0, 2     #indice stack in Byte
  7.             add $t1, $sp, $t1   #indice stack reale
  8.             sw $t0, 0($t1)      #salvo dato
  9.             addi $t0, $t0, -1   #avanzo indice for
  10.             j for
  11.        
  12.     print:
  13.         addi $t0, $zero, 0      #indice for
  14.         for2:   beq $t0, 100, out
  15.             sll $t1, $t0, 2     #indice stack in Byte
  16.             add $t1, $sp, $t1   #indice stack reale
  17.             lw $a0, 0($t1)      #carico word da stampare
  18.             addi $v0, $zero, 1  #comando syscall
  19.             syscall
  20.             add $t0, $t0, 1     #avanzo indice for
  21.             j for2
  22.         out:    addi $sp, $sp, 400  #dealloco dallo stack
  23.             j exit
  24.    
  25.     exit:
  26.         addi $v0, $zero, 10     #routine di uscita
  27.         syscall
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top