- Move source code from `trunk` into root directory for each library. - Update build files and ASM include paths. Add SPDX license header where appropriate. - Note: Line endings standardised from `CRLF` > `LF`, so best to view diffs with whitespace changes hidden. (Work towards #75, point 3) Reviewed-on: KolibriOS/kolibrios#436 Reviewed-by: Burer <burer@kolibrios.org> Reviewed-by: Ivan B <1+dunkaist@noreply.localhost> Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com> Co-authored-by: Andrew <dent.ace@gmail.com> Co-committed-by: Andrew <dent.ace@gmail.com>
35 lines
945 B
FASM
35 lines
945 B
FASM
;-----------------------------------------------------------------------------+
|
|
; Функция генерации случайного числа в диапозоне 0..99999 |
|
|
;-----------------------------------------------------------------------------+
|
|
; На выходе : eax - случайное число |
|
|
;-----------------------------------------------------------------------------+
|
|
_random:
|
|
push edx ecx ebx
|
|
mov eax,ebx
|
|
or eax,eax
|
|
jnz @f
|
|
rdtsc
|
|
xor eax,edx
|
|
mov ebx,eax
|
|
@@:
|
|
xor edx,edx
|
|
mov ecx,127773
|
|
div ecx
|
|
mov ecx,eax
|
|
mov eax,16807
|
|
mul edx
|
|
mov edx,ecx
|
|
mov ecx,eax
|
|
mov eax,2836
|
|
mul edx
|
|
sub ecx,eax
|
|
xor edx,edx
|
|
mov eax,ecx
|
|
mov ebx,ecx
|
|
mov ecx,100000
|
|
div ecx
|
|
mov eax,edx
|
|
pop ebx ecx edx
|
|
ret
|
|
;->
|