random.asm 189 B

1234567891011121314
  1. Random_::
  2. ; Generate a random 16-bit value.
  3. ld a, [rDIV]
  4. ld b, a
  5. ld a, [hRandomAdd]
  6. adc b
  7. ld [hRandomAdd], a
  8. ld a, [rDIV]
  9. ld b, a
  10. ld a, [hRandomSub]
  11. sbc b
  12. ld [hRandomSub], a
  13. ret