Advertisement
NewDenverCity

Beevee encounter routine

May 17th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. .thumb
  2. .global beevee_encounter_routine
  3.  
  4. @the pokemon species gets loaded on 0x080B5012, then calls a function
  5. @for now, beevee's species shall be AB for now, i can change it easily
  6. @r4, r8, and r9 seem to contain the level of the pokemon encountered
  7. @it looks like r1 is disposable at the very beginning, but needs the level before calling the function
  8. @r2 is not used until the function gets called
  9. @r3 contains 118?
  10. @function that gets called is at 0x080B4E68
  11. @beevee table is the species number, and then it ends with 00 00.
  12.  
  13. .equ main, 0x08XXXXXX
  14.  
  15. .align 2
  16. .org 0x080B5014
  17. main_hook:
  18. ldr r1, pointer
  19. bx r1
  20.  
  21. .align 2
  22. pointer: .word main+1
  23.  
  24. .align 2
  25. .org main
  26. main_hook:
  27. cmp r0, #0xAB
  28. beq is_beevee
  29. continue:
  30. mov r1, r4
  31. ldr r2, calc_wild_poke_stats
  32. bl call_with_r2
  33.  
  34. is_beevee:
  35. ldr r2, rand_func
  36. bl call_with_r2
  37. ldr r1, beevee_table
  38. lsr r0, r0, #8 @just makes it more likely that the RNG will load a number that works
  39. sub_loop:
  40. ldrh r2, [r1]
  41. cmp r0, r2
  42. beq continue
  43. cmp r2, #0
  44. beq is_beevee
  45. add r1, r1, #2
  46. b sub_loop
  47.  
  48. call_with_r2:
  49. bx r2
  50.  
  51. .align 2
  52. rand_func: .word 0x0806F5CC+1
  53. beevee_table: .word 0x08XXXXXX
  54. calc_wild_poke_stats: .word 0x080B4E68+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement