kolibrios/programs/games/hunter/trunk/math.inc
heavyiron 4daae89053 *kernel - fixes in 15.2 by Mario79 and 67 by mike.dld
updated sysfunc.txt
*programs 
         new icons and logo for CPUID and ICON
         added new version of @ICON and ICONMNGR
         fixes in iconedit and calendar from DedOK
         new algoritm of fill background in pic4
         all apps (fasm-writen only) rewriten to use common macros.inc for easy recompile in fastcall mode (there is a bug in https; run need rewrite to use common macros.inc)
         small fixes in build_all.bat script
         

git-svn-id: svn://kolibrios.org@485 a494cfbc-eb01-0410-851d-a64ba20cac60
2007-05-10 13:48:35 +00:00

45 lines
582 B
PHP

;
; Mathematical functions
;
; Author: Trans
; Date: 08.03.2005
; Compiler: FASM
; Target: Hunter - MeOS game
;
rinit dw 0
; Randomize of 8 bits
; In:
; Out: AL - random value
random_8:
push ebx
push ecx
xor eax,eax
mov ax,[rinit]
cmp ax,0
jnz rand_loc_00
mov eax,26
mov ebx,9
int 40h
mov [rinit],ax
shl eax,16
shr eax,16
rand_loc_00:
mov ecx,8
rand_loc_01:
mov bx,ax
and bx,002Dh
xor bh,bl
clc
jpe rand_loc_01a
stc
rand_loc_01a:
rcr ax,1
loop rand_loc_01
mov [rinit],ax
xor ah,ah
pop ecx
pop ebx
retn