uni

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

lab6_ex2.asm (760B)


      1 .eqv SYS_PRINT_STRING   4
      2 .eqv SYS_READ_WORD      5
      3 .eqv SYS_EXIT           10
      4 
      5 .data
      6         inputmsg:   .asciiz "Number: "
      7         ismultstr:  .asciiz "Multiple of 4\n"
      8         isnmultstr: .asciiz "Not a multiple of 4\n"
      9 
     10 .text
     11 .globl main
     12 
     13 main:
     14         li      $v0, SYS_PRINT_STRING
     15         la      $a0, inputmsg
     16         syscall
     17         
     18         li      $v0, SYS_READ_WORD
     19         syscall
     20         
     21         # get 2 lowest bits
     22         andi    $t0, $v0, 3
     23         beq     $t0, 0, ismult
     24         
     25         li      $v0, SYS_PRINT_STRING
     26         la      $a0, isnmultstr
     27         syscall
     28         j       exit
     29         
     30 ismult:
     31         li      $v0, SYS_PRINT_STRING
     32         la      $a0, ismultstr
     33         syscall
     34 
     35 exit:
     36         li      $v0, SYS_EXIT
     37         syscall