SHARE
TWEET

Programming under constraints...

ISSOtm Sep 29th, 2017 (edited) 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Original :
  2.  
  3. ld hl, $A420
  4. ld d, $D8
  5. ld a, b
  6. sub [hl]
  7. ld [hl], b
  8. ld hl, $AD69
  9. add [hl]
  10. ld [hli], a
  11. ret nc
  12. inc [hl]
  13. rst $00
  14.  
  15.  
  16. Result :
  17.  
  18. add sp, $9E ; sp = $DF53, PP move 3 of 28th (?) Pokémon
  19. pop hl ; PP moves 1 and 2
  20. pop de ; PP move 3, only d matters
  21. ld sp, hl
  22. pop hl ; ld hl, $A420
  23. push de ; Perform ld a, d
  24. or $50 ; Padding w/ terminator
  25. pop af ; Reminds me of something... hm.
  26. sub [hl]
  27. push af
  28. call LoadToHL ; Increments hl but who cares
  29. or a ; Padding
  30. or $50 ; Padding & terminator
  31. pop af
  32. pop hl ; ld hl, $A420
  33. add [hl]
  34. call LoadToHL+1
  35. di ; Padding
  36. di
  37. ld d, b ; Terminator
  38. call nc, IncAtHL ; Condition inverted by second LoadToHL
  39. rst $00
  40.  
  41. LoadToHL:
  42. ld a, d
  43. ld [hli], a
  44. ccf ; Used to complement the carry of the second addition
  45. ret
  46.  
  47. IncAtHL:
  48. inc [hl]
  49. ret
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
 
Top