Rev 3067 | Rev 5576 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3067 | leency | 1 | /******************************************************************************* |
2 | |||
3 | MenuetOS MineSweeper |
||
4 | Copyright (C) 2003 Ivan Poddubny |
||
5 | |||
6 | This program is free software; you can redistribute it and/or modify |
||
7 | it under the terms of the GNU General Public License as published by |
||
8 | the Free Software Foundation; either version 2 of the License, or |
||
9 | (at your option) any later version. |
||
10 | |||
11 | This program is distributed in the hope that it will be useful, |
||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
14 | GNU General Public License for more details. |
||
15 | |||
16 | You should have received a copy of the GNU General Public License |
||
17 | along with this program; if not, write to the Free Software |
||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
19 | |||
20 | *******************************************************************************/ |
||
21 | |||
22 | inline fastcall int random( ECX) |
||
23 | // get pseudo-random number - получить псевдослучайное число |
||
24 | { |
||
25 | $push ebx |
||
26 | |||
27 | $rdtsc // eax & edx |
||
28 | $xor eax,edx |
||
29 | $not eax |
||
30 | |||
5575 | pavelyakov | 31 | EBX = __generator; |
3067 | leency | 32 | $ror ebx,3 |
33 | $xor ebx,0xdeadbeef |
||
34 | EBX += EAX; |
||
5575 | pavelyakov | 35 | __generator = EBX; |
3067 | leency | 36 | |
37 | EAX += EBX; |
||
38 | EAX = EAX % ECX; |
||
39 | |||
40 | $pop ebx |
||
41 | } |
||
42 | |||
43 | inline fastcall randomize() |
||
5575 | pavelyakov | 44 | // initialize random number __generator - инициализировать генератор случайных чисел |
3067 | leency | 45 | { |
46 | asm |
||
47 | { |
||
48 | mov eax,3 |
||
49 | int 0x40 |
||
50 | ror eax,16 |
||
51 | } |
||
5575 | pavelyakov | 52 | __generator = EAX; |
53 | } |
||
54 |