home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.sberbank.sumy.ua
/
2014.11.ftp.sberbank.sumy.ua.tar
/
ftp.sberbank.sumy.ua
/
incoming
/
1
/
floatdir.asm
< prev
next >
Wrap
Assembly Source File
|
2014-02-08
|
4KB
|
211 lines
.386
.model flat, stdcall
option casemap :none ; case sensitive
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\macros\macros.asm
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
SetMemoryLoc PROTO :DWORD, :DWORD, :DWORD
GetStringLengthLoc PROTO :DWORD
IntToString PROTO :DWORD, :DWORD, :DWORD
CreateCurrentTickDirectoryLoc PROTO
FloatIntAndRemToString PROTO :DWORD, :DWORD
.data
EVK db "Evgeney Victorovich Kupin 27 April 1982",0
.code
start:
invoke CreateCurrentTickDirectoryLoc
exit
GetStringLengthLoc proc lpStr:DWORD
push edi
pushf
cld
xor eax,eax
mov ecx, 65536
mov edi, lpStr
repne scasb
mov eax,65536-1
sub eax, ecx
popf
pop edi
ret
GetStringLengthLoc endp
CatStringsLoc: ; [esp+0] ret, [esp]
push ebp
mov ebp, esp
push edi
push esi
pushf
cld
mov eax, 12
mov edx,[ebp+8]
dec edx
mov edi, [ebp+12]
CatStringsLoc_cat_strings:
add eax,4
mov esi, [ebp+eax]
push eax
invoke GetStringLengthLoc, [ebp+eax]
mov ecx, eax
pop eax
rep movsb
dec edx
jnz CatStringsLoc_cat_strings
popf
pop esi
pop edi
mov ecx, [ebp+8]
mov edx,[esp+4]
pop ebp
inc ecx
shl ecx, 2
add esp, ecx ; CatStringsLoc_clear_stack:
; pop eax
; loop CatStringsLoc_clear_stack
mov [esp], edx
ret
IntToString proc lpBuff:DWORD, Val:DWORD, Zero:DWORD
push ebx
push edi
push esi
dec Zero
mov ebx,10
mov edi, lpBuff
mov esi, edi
mov eax, Val
IntToString_div:
mov esi,edi
add esi,10
dec esi
mov ecx,10
IntToString_div_shift:
mov dl,BYTE PTR[esi]
mov BYTE PTR [esi+1],dl
dec esi
loop IntToString_div_shift
xor edx,edx
div ebx
add dl,"0"
mov [edi],dl
dec Zero
test eax,eax
jnz IntToString_div
cmp Zero, 0
jnl IntToString_div
pop esi
pop edi
pop ebx
ret
IntToString endp
SetMemoryLoc proc lpMem:DWORD, Val:DWORD, Count:DWORD
pushf
push edi
cld
mov edi, lpMem
mov eax, Val
mov ecx, Count
rep stosb
pop edi
popf
ret
SetMemoryLoc endp
FloatIntAndRemToString proc flString:DWORD, flNum:DWORD
LOCAL FlagCr:WORD
LOCAL IntPart:DWORD
LOCAL IntStr[100]:BYTE
invoke SetMemoryLoc, addr IntStr, 0, 100
finit
fstcw FlagCr
or FlagCr, 0111000000000b
fldcw FlagCr
fld flNum
fist IntPart
invoke IntToString, addr IntStr,IntPart, 0
fild IntPart
fsubr st(0),st(1)
mov IntPart, 1000000
fild IntPart
fmul st(0),st(1)
fist IntPart
invoke IntToString, addr IntStr[50], IntPart, 0
lea eax,IntStr[50]
push eax
mov IntStr[30],"."
lea eax, IntStr[30]
push eax
lea eax, IntStr
push eax
push flString
push 4
call CatStringsLoc
ret
FloatIntAndRemToString endp
CreateCurrentTickDirectoryLoc proc
LOCAL cBuffer[100]:BYTE
LOCAL pTick:DWORD
invoke GetTickCount
mov pTick, eax
finit
fldpi
fild pTick
fdiv st(0), st(1)
fstp pTick
invoke SetMemoryLoc, addr cBuffer, 0, 100
invoke FloatIntAndRemToString, addr cBuffer, pTick
invoke CreateDirectory, addr cBuffer,0
ret
CreateCurrentTickDirectoryLoc endp
end start