Advertisement
wolfboyft

ReduceNumberByAPercent

Jul 16th, 2016
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. ReduceNumberByAPercent:: ; thanks PikalaxALT!
  2. ; number in bc, percentage in a
  3. push af
  4. ld a, b
  5. ld [hMultiplicand + 1], a
  6. ld a, c
  7. ld [hMultiplicand + 2], a
  8. xor a
  9. ld [hMultiplicand], a
  10. pop bc
  11. ld a, 100
  12. sub b
  13. ld [hMultiplier], a
  14. call Multiply
  15. ld a, 100
  16. ld [hDivisor], a
  17. ld b, 4
  18. call Divide
  19. ld a, [hQuotient + 1]
  20. ld b, a
  21. ld a, [hQuotient + 2]
  22. ld c, a
  23. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement