Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .text
  2.     mfc0    $a0 $12                 # read from the status register
  3.         ori     $a0 0xff11              # enable all interrupts
  4.         mtc0    $a0 $12                 # write back to the status register
  5.  
  6.         li      $a0 2                   # enable keyboard interrupt
  7.         sb      $a0 0xffff0013
  8.        
  9.     li  $t9 10000
  10.     li  $t0 0
  11.     mtc1.d  $t0 $f2
  12.     cvt.d.w $f2 $f2
  13.     li  $t1 4
  14.     mtc1.d  $t1 $f4
  15.     cvt.d.w $f4 $f4
  16.     li  $t2 2
  17.     mtc1.d  $t2 $f6
  18.     cvt.d.w $f6 $f6
  19.     li  $t3 1
  20.     mtc1.d  $t3 $f8
  21.     cvt.d.w $f8 $f8
  22.    
  23.     mtc1.d  $t3 $f12
  24.     cvt.d.w $f12    $f12
  25.    
  26.     mtc1.d  $t3 $f10
  27.     cvt.d.w $f10    $f10
  28.    
  29. next:   sub $t9 $t9 2
  30.     mov.d   $f8 $f12
  31.     div.d   $f8 $f8 $f10
  32.     add.d   $f2 $f2 $f8
  33.     add.d   $f10    $f10    $f6
  34.     mov.d   $f8 $f12
  35.     div.d   $f8 $f8 $f10
  36.     sub.d   $f2 $f2 $f8
  37.     add.d   $f10    $f10    $f6
  38.     beqz    $t9 end
  39.     j   next   
  40.    
  41. end:
  42.     mul.d   $f2 $f2 $f4
  43.     mov.d   $f12    $f2
  44.     li  $v0 3
  45.     syscall
  46.    
  47.  
  48. .ktext  0x80000180                      # kernel code starts here
  49.         mfc0    $k0 $12                 # !! disable interrupts
  50.         andi    $k0 $k0 0xfffe          # !!
  51.         mtc0    $k0 $12                 # !!
  52.     eret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement