SHARE
TWEET

Untitled

a guest Nov 21st, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .func CoinGet_func
  2. CoinGet_func:
  3.  
  4.     // Store for return
  5.     .local _x, _y
  6.     stx $.x
  7.     sty $.y
  8.    
  9.     // Initialize other variables
  10.     .local _bit, _goal, _index
  11.     lda #1
  12.     sta $.bit
  13.     stx $.goal
  14.     stz $.index
  15.    
  16. CoinGet_func_loop:
  17.     // Load custom index
  18.     ldx $.index
  19.     // Only 16 indices, 2 bytes each
  20.     cpx #0x0020
  21.     bcs $+CoinGet_func_loop_end
  22.        
  23.         lda $=CoinIndexes,x
  24.         cmp $.goal
  25.         bne $+CoinGet_func_loop_skip_equal
  26.        
  27.             // 16 bit set of flags
  28.             lda $=LevelCode
  29.             asl a
  30.             tax
  31.             lda $=CollectedFlag,x
  32.             ora $.bit
  33.             sta $=CollectedFlag,x
  34.             bra $+CoinGet_func_loop_end
  35.        
  36.     CoinGet_func_loop_skip_equal:
  37.  
  38.         // Increment
  39.         inc $.index
  40.         inc $.index
  41.         asl $.bit
  42.         bra $-CoinGet_func_loop
  43.  
  44. CoinGet_func_loop_end:
  45. CoinGet_func_return:
  46.     // Fix our registers
  47.     ldx $.x
  48.     ldy $.y
  49.     return
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top