uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

lab4_ex2.asm (630B)


      1 .eqv SYS_PRINT_STRING   4
      2 .eqv SYS_READ_WORD      5
      3 .eqv SYS_EXIT           10
      4 
      5 .data
      6         posstr:    .asciiz "Positive\n"
      7         nonposstr: .asciiz "Non Positive\n"
      8 
      9 .text
     10 .globl main
     11 
     12 main:
     13         li      $v0, SYS_READ_WORD
     14         syscall
     15         
     16         # t0 = 1 if v0 == 0
     17         slt     $t0, $v0, $zero
     18         beq     $t0, $zero, pos
     19         
     20         li      $v0, SYS_PRINT_STRING
     21         la      $a0, nonposstr
     22         syscall
     23          
     24         j       exit
     25         
     26 pos:
     27         li      $v0, SYS_PRINT_STRING
     28         la      $a0, posstr
     29         syscall
     30         
     31 exit:
     32         li      $v0, SYS_EXIT
     33         syscall