home *** CD-ROM | disk | FTP | other *** search
/ ticalc.org / ticalc_org_rev_b.iso / archives / 86 / asm / source / routines / rannum.asm < prev    next >
Encoding:
Assembly Source File  |  2001-07-01  |  385 b   |  17 lines

  1. ;===========================================
  2. ; RandomNumber     [Assembly Coder's Zenith]
  3. ; out: A = psuedo random number
  4. ; modified: AF, BC    (14 bytes/62 t-states)
  5. ;===========================================
  6. RandomNumber:
  7.       ld a,r
  8.   ld b,a
  9.   ld a,($1234)
  10.   _@RandomNumberSeed =$-2
  11.   ld c,a
  12.   ld a,(bc)
  13.   ld (_@RandomNumberSeed),a
  14.   xor b
  15.   sub b
  16.   add a,c
  17.   ret