uni

University stuff
git clone git://git.christosmarg.xyz/uni-assignments.git
Log | Files | Refs | README | LICENSE

lab2.asm (1055B)


      1 .data
      2         numstr1: .asciiz "Number 1: "
      3         numstr2: .asciiz "Number 2: "
      4         resstr:  .asciiz "Result\n"
      5         addstr:  .asciiz "Addition: "
      6         
      7 .text
      8 .globl main
      9 
     10 main:
     11         li      $v0, 4          
     12         la      $a0, numstr1    # print first input message
     13         syscall
     14 
     15         li      $v0, 5          # read first word
     16         syscall
     17         move    $t0, $v0        # store input in t0
     18         
     19         li      $v0, 4          
     20         la      $a0, numstr2    # print second input message
     21         syscall
     22         
     23         li      $v0, 5          # read second word
     24         syscall
     25         move    $t1, $v0        # store input in t1
     26         
     27         li      $v0, 4
     28         la      $a0, resstr
     29         syscall
     30         
     31         la      $a0, addstr     # don't load 4 to v0, it's already there
     32         syscall
     33         
     34         li      $v0, 1
     35         add     $t2, $t0, $t1   # add two inputs
     36         la      $a0, 0($t2)     # load sum and prin it
     37         syscall
     38         
     39         li      $v0, 10         # exit
     40         syscall