mirror of
https://github.com/KarolS/millfork.git
synced 2026-04-21 09:16:34 +00:00
Library improvements:
– random module – ensure_mixedcase() function
This commit is contained in:
+7
-1
@@ -39,7 +39,13 @@
|
||||
|
||||
* [`stdlib` module](stdlib/stdlib.md)
|
||||
|
||||
* [Other cross-platform modules](stdlib/other.md)
|
||||
* [`string` module](stdlib/string.md)
|
||||
|
||||
* [Modules for reading input devices](stdlib/input.md)
|
||||
|
||||
* [Other cross-platform modules (`err`, `stdio`, `random`)](stdlib/other.md)
|
||||
|
||||
* [Definitions available on only some platforms](stdlib/frequent.md)
|
||||
|
||||
* [C64-only modules](stdlib/c64.md)
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@
|
||||
|
||||
* [Modules for reading input devices](stdlib/input.md)
|
||||
|
||||
* [Other cross-platform modules (`err`, `stdio`)](stdlib/other.md)
|
||||
* [Other cross-platform modules (`err`, `stdio`, `random`)](stdlib/other.md)
|
||||
|
||||
* [Definitions available on only some platforms](stdlib/frequent.md)
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@ Prints a string of length `len` located at address `str`.
|
||||
Prints a null-terminated string located at address `str`.
|
||||
If the string is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
||||
|
||||
#### `void ensure_mixedcase()`
|
||||
|
||||
On targets that have separate all-caps and mixed-case modes (like most Commodore machines), switches to the mixed-case mode.
|
||||
|
||||
|
||||
## err
|
||||
|
||||
@@ -24,3 +28,29 @@ Standard error codes. All codes other than `err_ok` suggest that the last operat
|
||||
#### `error_number errno`
|
||||
|
||||
The result of the last operation.
|
||||
|
||||
|
||||
## random
|
||||
|
||||
A simple and reasonably fast random number generator. Not suitable for cryptographic or simulation uses.
|
||||
|
||||
#### `word rand_seed`
|
||||
|
||||
Random number generator state.
|
||||
|
||||
#### `byte rand()`
|
||||
|
||||
Get a random byte (0–255) and update the state of the generator.
|
||||
|
||||
#### `void init_rand_seed()`
|
||||
|
||||
Initializes the random number generator state.
|
||||
This may take a long time, even several frames, depending on the target.
|
||||
|
||||
Current implementation:
|
||||
|
||||
* On C64, spends two frames reading noise data from the SID chip.
|
||||
|
||||
* On Z80, reads the refresh register.
|
||||
|
||||
* On all other targets, sets the seed to 1.
|
||||
|
||||
Reference in New Issue
Block a user