[
Index] [
Previous] [
Next]
2.12 RND - Optional Function #2
Rnd
Generates a random number. This is a bit odd... like all inline functions it takes a numeric argument, but in RNDs case this argument is mostly ignored. If it's a negative number it skips a couple of stages of reseeding RND_SEED.
If tghe argument in FACCUM is negative, then skip over the
0C60
FA7C0C
JM 0C7C
Load the seed into FACCUM.
0C69
C8
RZ
Multiply seed by 11,879,546.
0C6A
013598
LXI B,9835
0C6D
117A44
LXI D,447A
Add 0.00000003927678
0C73
012868
LXI B,6828
0C76
1146B1
LXI D,B146
Swap first and third mantissa bytes.
0C7F
7B
MOV A,E
0C80
59
MOV E,C
0C81
4F
MOV C,A
Set FTEMP_SIGN to 0x80 to indicate to FNormalise that it doesn't need to change the sign. Also set FACCUM's exponent to 0 so the result, when normalised, will be less than 1.
0C82
3680
MVI M,80
0C84
2B
DCX H
0C85
46
MOV B,M
0C86
3680
MVI M,80
Exit via a copy of the result to RND_SEED so it can be used for the next time RND is called.
Seed for random number generation.
0C91
52C74F80
RND_SEED
0.811635
[Index] [Previous] [Next]