RND
ZXNet echo conference «code.zx»
From Arseniy Astapenko → To WoWan Nickolaev 7 September 2001
Hello WoWan!
September 06, 2001 01:02, WoWan Nickolaev wrote to Kirill Frolov:
WN>>> Give me the normal procedure of the subject... Without using im
WN>>> 2.
WN> And now on Acma...
=== I quote the file randd.txt ===
Log:15.05.01
11:30 ars y you don’t have a ready-made random 0..255 algorithm in C
good generation?
18:39 RAIDER No problem, I'll text you in a minute.
damn, of course you'll get more, the leg is the first thing
it came to my head, right away:
Random := Random*X + Y
Where X is odd and Y is also.
Linear congruent generator, forgot my article
from ZX review,
oh, my strong point!
I spent so much time on them
18:40 RAIDER in short:
yay, damn, the code started with MOV... :)))))
affects my spectrum emulator on x86
assembler :)
LD HL,(RANDOM)
LD D,H
LD E,L
ADD HL,HL
ADD HL,HL
ADD HL,DE ; multiply by 5
INC HL; +1
LD(RANDOM),HL
ret
19:12 RAIDER admit it, what are you writing? :))))
Are you going to start working on the GBA soon?
19:16 RAIDER Hello
In short, I dug up my article.
the date is 09/06/1993 :))))))Here's the generator charge straight from the article: :))))))
They differ in many ways, you see, this
non-trivial thing, good
generator Especially when you need something like
X := RND
Y := RND // I mean, taking the next number
PLOT (X,Y) // after this
19:16 RAIDER very often we discover that instead of random points
they will start
line up in strange patterns, etc...
In short, scientifically it is called a generator.
bad addiction
clumsy spectrum.
the same congruent according to Knut should look like this
for good
sequences:
19:17 RAIDER LD HL,SEED
LA A,(HL)
SUB #8D
LD(HL),A
INC HL
INC(HL)
INC(HL)
INC(HL)
ADD A,(HL)
INC HL
RRCA
RRC(JL)
ADD A,(HL)
LD(HL),A
RET
19:17 RAIDER SEED DEFB 0,0,0
---------------
It was clearly written from a lantern, but it works, be healthy.
here is the gene from Special FX (remember them - Batman's,
Hyper Active, yes
they made a ton of games):
19:17 RAIDER and INC = 1, i.e. odd.Keep in mind that the most significant bits make the most noise, and they
take it.
those.
LD A,H
- this is purely my generator.
----------
19:17 RAIDER Well, I’ll give you more generators, good ones too.
here is a generator from Jobby (Jobby, Chase programmer
HQ, North Star,
Dark Fusion - I talked to him once, very cool
dude
he gave me a list of his games, I almost fell -
monster!!!!
he made all the toys alone)
19:17 RAIDER LD HL,(SEED)
LD D,H
LD E,L
ADD HL,HL
ADD HL,HL
ADD HL,DE
INC HL
LD (SEED),HL
RET
19:17 RAIDER X(j+1) = ((X(j) * A + B) mod R
where X(j) is the current element of the sequence
and X(j+1) is the next one that we generate
so, it’s better when
A mod 4 =1 and B is odd.
mod - This is the remainder of the division.
when we do multiplication as in the example,
then
what remains in the register after the shift is
MOD
in its simplest form this is what it is
19:18 RAIDER feel the difference :))))))))))))))
--
State of the Art!
Flash inc. Alex Raider
mailto:flashinc@mail.ru19:18 RAIDER in short, there are still a number of genes, but frankly speaking to me
speaking already broke them
interrupt....
contact me if anything...
and finally, on the M68XXX asma
rol.l d0,d0
addq.l #x,d0
or
divs.w #$4433,d0
swap d0
19:18 RAIDER LD HL,SEED
LD C,(HL)
INC HL
LD A,(HL)
SRL C
SRL C
SRL C
XOR C
INC HL
RRA
RL (HL)
DEC HL
RL(HL)
DEC HL
RL(HL)
RET
SEED DEFB 128,255,63
It also obviously works from the flashlight, but it also works.
-----------------
===End quote ===
Ars. mailto:arseniy@pochta.by
From Oleg Parfenov → To WoWaN Nickolaev 10 September 2001
If you don't like it, don't read it!!!
Hello, WoWaN!
Somehow Sun 2 Sep 2001 WoWaN Nickolaev wrote All at 02:34:00 on the topic "RND"
WN> Peace to your house
WN> All!
WN> Throw the normal procedure of the subject to me... Without
WN> use im 2.
Procedure from "ZX review 3.96"
author Kolotov Sergey:
RND LD HL,0
LD A,R
XOR H
LD E,A
AND %00111111
LD D,A
LD A,(DE)
XOR L
LD H,A
XOR E
RRCA
LD L,A
LD (RND+1),HL
RET
Bye, WoWaN!
From Dmitriy Nesmachny → To WoWan Nickolaev 19 September 2001
Hello WoWan!
Saturday 15 Sep 2001 20:31:00, WoWan Nickolaev -> Nik Aleksandrovich:
WN>>> use im 2.
NA>> Damn it, bullshit reg. regeneration and copy with the byte (address
NA>> from regen.) from
NA>> ROM and that's it !!!
WN> The trend is repeating itself! :)
Well, catch it: it looks like there’s a row going back and forth.
===================Start NONAME .C====
RND LD HL,#0000
LD A,H
OR L
JR NZ,RND_P1
INC L
RND_P1 LD A,L
RLCA
XOR H
RLCA
RLCA
XOR H
RLCA
XOR H
RLCA
ADC HL,HL
LD (RND+1),HL
RET
====End NONAME .C====
Best regards, Dmitriy.