Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4721 | Akyltist | 1 | ;-----------------------------------------------------------------------------+ |
2 | ; Library "utils" (c) Sergei Steshin (Akyltist) | |
||
3 | ;-----------------------------------------------------------------------------+ |
||
4 | ; Charset:DOS-866 Font:Courier New Size:9pt | |
||
5 | ; compiler: FASM 1.69.31 | |
||
6 | ; version: 0.1.0 | |
||
7 | ; last update: 31/03/2014 | |
||
8 | ; e-mail: dr.steshin@gmail.com | |
||
9 | ; license: BSD | |
||
10 | ;-----------------------------------------------------------------------------+ |
||
11 | |||
12 | format MS COFF |
||
13 | |||
14 | public EXPORTS |
||
15 | |||
16 | section '.flat' code readable writable align 16 |
||
17 | |||
18 | include '../../../../proc32.inc' |
||
19 | include '_ftoa.inc' |
||
20 | include '_atof.inc' |
||
21 | include '_rand.inc' |
||
22 | |||
23 | |||
24 | ;-----------------------------------------------------------------------------+ |
||
25 | ; float to ascii string | |
||
26 | ;-----------------------------------------------------------------------------+ |
||
27 | ftoa: ; |
||
28 | mov ebx, dword [esp+4] ; out string |
||
29 | mov eax, dword [esp+8] ; in value |
||
30 | stdcall FloatToString,eax,ebx ; |
||
31 | ret 8 ; |
||
32 | |||
33 | |||
34 | ;-----------------------------------------------------------------------------+ |
||
35 | ; ascii string to float | |
||
36 | ;-----------------------------------------------------------------------------+ |
||
37 | atof: ; |
||
38 | mov ebx, dword [esp+4] ; out <- value |
||
39 | mov eax, dword [esp+8] ; in -> string |
||
40 | stdcall string2float,eax,ebx ; |
||
41 | ret 8 ; |
||
42 | |||
43 | |||
44 | ;-----------------------------------------------------------------------------+ |
||
45 | ; returns a random integer in the range [ 0...99999 ] | |
||
46 | ;-----------------------------------------------------------------------------+ |
||
47 | random: ; |
||
48 | call _random ; out <- eax random |
||
49 | ret ; |
||
50 | |||
51 | ;=============================================================================; |
||
52 | align 16 |
||
53 | EXPORTS: |
||
54 | dd szFtoa , ftoa |
||
55 | dd szAtof , atof |
||
56 | dd szRandom , random |
||
57 | dd 0 , 0 |
||
58 | |||
59 | szFtoa db 'ftoa' ,0 |
||
60 | szAtof db 'atof' ,0 |
||
61 | szRandom db 'random' ,0 |
||
62 | |||
63 | section '.data' data readable writable align 16->-> |
||
64 |