kolibrios/programs/develop/libraries/TinyGL/asm_fork/examples/fps.inc
IgorA 09b80753fe update 'gears' example
git-svn-id: svn://kolibrios.org@6120 a494cfbc-eb01-0410-851d-a64ba20cac60
2016-02-01 19:03:43 +00:00

61 lines
1.1 KiB
PHP

;include '../../../../../KOSfuncs.inc'
;x,y - êîîðäèíàòû âûâîäà FPS íà îêíî
;âîçâðàùàåò âðåìß â ñîòûõ äîëßõ ñåêóíäû çàòðà÷èâàåìîå íà 1 öèêë
time1 dd 0 ;int
time2 dd 0 ;int
fps1 dd 0 ;int
timerend dd 0 ;int
;ôóíêöèß îïðåäåëåíèß FPS
proc Fps uses ebx ecx edx esi, x:dword, y:dword
locals
tr dd ?
endl
;îïðåäåëßåì âðåìß ïðîøåäøåå ñ ìîìåíòà çàïóñêà ñèñòåìû
mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [time1],eax
cmp dword[timerend],0
jne @f
mov eax,[time1]
mov [time2],eax
mov [timerend],eax
@@:
mov eax,[time1]
sub eax,[timerend]
mov [tr],eax
mov eax,[time1]
sub eax,[time2]
cmp eax,100 ;åñëè ïðîøëî ìåíåå 1 ñåêóíäû
jge .else
inc dword[fps1] ;óâåëè÷èâàåì ñ÷åò÷èê fps
jmp @f
.else:
;âûâîäèì ÷èñëî fps
mov ebx,[x]
shl ebx,16
add ebx,23
mov ecx,[y]
shl ecx,16
add ecx,7
mcall SF_DRAW_RECT,,,0x00555555
mov edx,[x]
shl edx,16
add edx,[y]
mcall SF_DRAW_NUMBER,4 shl 16,[fps1],,0xfafafa
mov dword[fps1],0
mov eax,[time1]
mov [time2],eax
@@:
mov eax,[time1]
mov [timerend],eax
mov eax,[tr]
ret
endp