Advertisement
Guest User

pd_cam_beta_optimize

a guest
Nov 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ROUTINE : RIP X Y Z COORDINATES -> CONVERT TO INT -> STORE
  2.     lui     $v0, 0x8009                     # 8009E724
  3.     addiu   $v0, $v0, 0xE724        # load 0x10010020 into v0
  4.     addu    $t5, $v0, $zero        
  5.     addu    $t3, $zero, $zero          
  6. condition:
  7.     lw   $t1, 0x0000 ($v0)          # get pointer from v0
  8.     addiu    $t3, $t3, 0x0004      
  9.     addu     $t1, $t1, $t3              # add 0x4 onto pointer address
  10.     l.s      $f1, ($t1)                    
  11.     cvt.w.s      $f0, $f1                   # convert float into int
  12.     mfc1     $t2, $f0                       # move to general register
  13.     beqz     $t2, flip                      # continue if end of coordinate listing
  14.     subi     $t2, $t2, 0x30             # take off 0x30 as offset for all written coordinates
  15.     sw   $t2, 0x0010 ($t5)            # write into 0x10 ahead of pointer for coords
  16.     addiu    $t5, $t5, 0x0004       # add 0x4 onto v0
  17.     bnez       $t2, condition                  #if coordinates left
  18.     nop
  19.  
  20. # ROUTINE : FLIP CAMERA BYTE -> STORE
  21. flip:
  22.     lui     $t6, 0x8009      
  23.     addiu   $t6, $t6, 0xE96C
  24.     lw  $t0, 0x0000 ($t6)
  25.     addiu   $t1, $zero, 0x0003
  26.     beq     $t0, $t1, equals        # if 0x3 present at 8009E96C, go to equals and write 1
  27.     nop
  28.     sw  $t1, 0x0000 ($t6)       # else store 3
  29.     j   custom_coords       # return
  30. equals:
  31.     addiu   $t2, $zero, 0x0001
  32.     sw  $t2, 0x0000 ($t6)
  33.     lui     $t5, 0x1001                    
  34.     addiu   $t5, $t5, 0x0040
  35.     sw  $zero, 0x0000 ($t5)     # clear fields #
  36.     sw  $zero, 0x0004 ($t5)
  37.     sw  $zero, 0x0008 ($t5)
  38.     nop
  39.    
  40. custom_coords:
  41. # ROUTINE : ALTER TLB TO LOAD FROM CUSTOM COORDINATES
  42.     sub $sp, $sp, -4        # save return address
  43.     sw  $ra, 0x0000 ($sp)
  44.     lui     $t0, 0x7F10     # load address 7F10FF8C
  45.     addiu   $t0, $t0, 0xFF8C   
  46.     addiu   $t1, $zero, 0x0000
  47.     addiu   $t2, $zero, 0x8c68  # store op lw t0, 0x0000 (t5)
  48.     jal     write_clear_reg
  49.     addiu   $t1, $zero, 0x0004
  50.     addiu   $t2, $zero, 0x8c69  # store op lw t1, 0x0004 (t5)
  51.     jal write_clear_reg
  52.     addiu   $t1, $zero, 0x0008
  53.     addiu   $t2, $zero, 0x8c6a  # store op lw t2, 0x0008 (t5)
  54.     sh  $t1, 0x0000 ($t0)
  55.     sh  $t2, 0x0002 ($t0)   # redundancy, but write on final
  56.     jal end
  57.     nop
  58. write_clear_reg:
  59.     sh  $t1, 0x0000 ($t0)
  60.     sh  $t2, 0x0002 ($t0)   # write
  61.     addu    $t1, $zero, $zero
  62.     addu    $t2, $zero, $zero
  63.     addiu   $t0, $t0, 0x0014
  64.     jr $ra
  65. end:
  66.     add $sp, $sp, 4     # pop ra back
  67.     lw  $ra, 0x0000 ($sp)
  68.     jr $ra
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement