RE: A83: RandInt(


[Prev][Next][Index][Thread]

RE: A83: RandInt(




Well you can use the TruRand funcition by Adam Brooke (can be found on
www.basm.org)... it uses the _random sytemcall to generate a random number
between 0 and hl, and stores the result in hl...

truRand:
  push hl	   ;secure hl for later
  call _random     ;random decimal between 0 and .99999999, returned to op1
  pop hl	   ;get back hl
  call _setxxxxop2 ;set op2 = hl == upper bound
  call _fpMult	   ;multiply op1 by op2
  ld d,0	   ;the decimal places to round to (zero)
  call _round      ;round op1 to d decimal places
  call _convop1    ;set de = op1
  ex de,hl 	   ;exchange the values for de and hl
  ret		   ;return to calling function

-----Oorspronkelijk bericht-----
Van: Anton Kuckartz [mailto:su025882@wolmail.nl]
Verzonden: woensdag 20 september 2000 17:16
Aan: assembly-83@lists.ticalc.org
Onderwerp: A83: RandInt(



I want to use the BASIC command RandInt() in ASM. Is that possible, and what
is the code for it?



Follow-Ups: