mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-27 00:39:41 +03:00
f2647d013c
git-svn-id: svn://kolibrios.org@316 a494cfbc-eb01-0410-851d-a64ba20cac60
151 lines
2.7 KiB
NASM
151 lines
2.7 KiB
NASM
;
|
||
; TIMER (show how much system works)
|
||
;
|
||
; Compile with flat assembler
|
||
;
|
||
|
||
use32
|
||
|
||
org 0x0
|
||
|
||
db 'MENUET01' ; 8 byte id
|
||
dd 0x01 ; header version
|
||
dd START ; start of code
|
||
dd I_END ; size of image
|
||
dd 0x1000 ; memory for app
|
||
dd 0x1000 ; esp
|
||
dd 0x0 , 0x0 ; I_Param , I_Icon
|
||
|
||
include 'lang.inc'
|
||
include 'macros.inc'
|
||
|
||
START: ; start of execution
|
||
mov eax, 40
|
||
mov ebx, 101b
|
||
int 0x40
|
||
|
||
red:
|
||
call draw_window
|
||
|
||
still:
|
||
|
||
mov eax,23 ; wait here for event
|
||
mov ebx,50
|
||
int 0x40
|
||
|
||
cmp eax,1 ; redraw request ?
|
||
je red
|
||
cmp eax,3 ; button in buffer ?
|
||
je button
|
||
|
||
call draw_clock
|
||
|
||
jmp still
|
||
|
||
|
||
button: ; button
|
||
or eax,-1 ; close this program
|
||
int 0x40
|
||
|
||
|
||
; *********************************************
|
||
; ******* WINDOW DEFINITIONS AND DRAW ********
|
||
; *********************************************
|
||
|
||
draw_clock:
|
||
|
||
mov eax, 26 ; get system counter
|
||
mov ebx, 9
|
||
int 0x40
|
||
|
||
cdq ;xor edx,edx
|
||
mov ebx,100
|
||
div ebx
|
||
|
||
push eax
|
||
|
||
xor edx,edx
|
||
mov ebx,60
|
||
div ebx
|
||
mov ecx,eax
|
||
|
||
push ecx
|
||
push ecx
|
||
|
||
xor edx,edx
|
||
mov ebx,60
|
||
div ebx
|
||
mov ecx,eax
|
||
|
||
mov eax,47 ; HH
|
||
mov esi,[sc.work_text]
|
||
or esi,0x50000000
|
||
mov edi,[sc.work]
|
||
mov ebx,0x00020000
|
||
mov edx,15*65536+5
|
||
int 0x40
|
||
|
||
pop eax ; MM
|
||
imul ecx,ecx,60
|
||
sub eax,ecx
|
||
mov ecx,eax
|
||
mov eax,47
|
||
add edx,20*65536
|
||
int 0x40
|
||
|
||
pop ecx
|
||
pop eax
|
||
|
||
imul ecx,ecx,60
|
||
sub eax,ecx
|
||
|
||
mov ecx,eax ; SS
|
||
mov eax,47
|
||
add edx,20*65536
|
||
int 0x40
|
||
|
||
ret
|
||
|
||
draw_window:
|
||
mov eax,48
|
||
mov ebx,3
|
||
mov ecx,sc
|
||
mov edx,sizeof.system_colors
|
||
int 0x40
|
||
|
||
mov eax,12 ; function 12:tell os about windowdraw
|
||
mov ebx,1 ; 1, start of draw
|
||
int 0x40
|
||
|
||
; DRAW WINDOW
|
||
xor eax,eax ; function 0 : define and draw window
|
||
mov ebx,100*65536+100 ; [x start] *65536 + [x size]
|
||
mov ecx,100*65536+40 ; [y start] *65536 + [y size]
|
||
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
||
or edx,0x33000000
|
||
mov edi,header
|
||
int 0x40
|
||
|
||
call draw_clock
|
||
|
||
mov eax,12 ; function 12:tell os about windowdraw
|
||
mov ebx,2 ; 2, end of draw
|
||
int 0x40
|
||
|
||
ret
|
||
|
||
|
||
; DATA AREA
|
||
|
||
if lang eq ru
|
||
header db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0
|
||
else
|
||
header db 'TIMER',0
|
||
end if
|
||
|
||
|
||
I_END:
|
||
|
||
temp dd ?
|
||
sc system_colors
|