File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #import "random.asm"
2+ #importonce
3+ .filenamespace c128lib
4+
5+ .macro @c128lib_PseudoRandom() { PseudoRandom() }
Original file line number Diff line number Diff line change 1+ /*
2+ * c128lib (c) 2023
3+ * https://github.com/c128lib/framework
4+ */
5+
6+ // #import "chipset/lib/vic2.asm"
7+
8+ #importonce
9+ .filenamespace c128lib
10+
11+ .namespace Random {
12+ }
13+
14+ /*
15+ Generates a random number starting from a given seed.
16+ It's not a real random number generator but generates
17+ a pseudo random number. By passing the same seed, it will
18+ generate always the same number. It is guaranteed to create a
19+ sequence touching every element just once.
20+ Seed must be provided in accumulator and can be from 0 to $ff .
21+ Output number will be available in the accumulator.
22+
23+ Params:
24+ .A - Seed
25+
26+ */
27+ .macro PseudoRandom() {
28+ beq doEor
29+ asl
30+ beq noEor
31+ bcc noEor
32+ doEor:
33+ eor #$1d
34+ noEor:
35+ }
You can’t perform that action at this time.
0 commit comments