Bond697

Pokemon Crystal RNG Advancement

Jul 18th, 2011
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ROM0:02B1 21 9B FF         ld hl,ff9b          // load counter offset to hl
  2. ROM0:02B4 34               inc (hl)            // increment hl by 1(counter++)
  3. ROM0:02B5 F0 04            ld a,(ff00+04)      // set a to the value at FF04
  4. ROM0:02B7 47               ld b,a              // set b to it
  5. ROM0:02B8 F0 E1            ld a,(ff00+e1)      // RNG byte 1 to a
  6. ROM0:02BA 88               adc b               // add a and b(FF04 to FFE1)
  7. ROM0:02BB E0 E1            ld (ff00+e1),a      // store the new a back to FFE1
  8. ROM0:02BD F0 04            ld a,(ff00+04)      // set a to the value at FF04
  9. ROM0:02BF 47               ld b,a              // set b to it
  10. ROM0:02C0 F0 E2            ld a,(ff00+e2)      // RNG byte 2 to a
  11. ROM0:02C2 98               sbc b               // subtract b from a(FF04 to FFE2)
  12. ROM0:02C3 E0 E2            ld (ff00+e2),a      // store the new a back to FFE2
Advertisement