2006-01-03 10:43:31 +01:00
|
|
|
|
;
|
2007-02-04 01:42:14 +01:00
|
|
|
|
; TIMER (show how much system works)
|
2006-01-03 10:43:31 +01:00
|
|
|
|
;
|
|
|
|
|
; 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
|
|
|
|
|
|
2024-06-14 10:35:46 +02:00
|
|
|
|
include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
|
2007-05-10 15:48:35 +02:00
|
|
|
|
include '..\..\..\macros.inc'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
START: ; start of execution
|
|
|
|
|
mov eax, 40
|
|
|
|
|
mov ebx, 101b
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
red:
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
still:
|
|
|
|
|
|
|
|
|
|
mov eax,23 ; wait here for event
|
|
|
|
|
mov ebx,50
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
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
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
draw_clock:
|
|
|
|
|
|
|
|
|
|
mov eax, 26 ; get system counter
|
|
|
|
|
mov ebx, 9
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
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]
|
2007-02-04 01:42:14 +01:00
|
|
|
|
or esi,0x50000000
|
|
|
|
|
mov edi,[sc.work]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov ebx,0x00020000
|
2007-02-04 01:42:14 +01:00
|
|
|
|
mov edx,15*65536+5
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
pop eax ; MM
|
|
|
|
|
imul ecx,ecx,60
|
|
|
|
|
sub eax,ecx
|
|
|
|
|
mov ecx,eax
|
|
|
|
|
mov eax,47
|
|
|
|
|
add edx,20*65536
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
pop ecx
|
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
|
|
imul ecx,ecx,60
|
|
|
|
|
sub eax,ecx
|
|
|
|
|
|
|
|
|
|
mov ecx,eax ; SS
|
|
|
|
|
mov eax,47
|
|
|
|
|
add edx,20*65536
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
mov eax,48
|
|
|
|
|
mov ebx,3
|
|
|
|
|
mov ecx,sc
|
|
|
|
|
mov edx,sizeof.system_colors
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx,1 ; 1, start of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
; DRAW WINDOW
|
2007-02-04 01:42:14 +01:00
|
|
|
|
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]
|
2006-01-03 10:43:31 +01:00
|
|
|
|
mov edx,[sc.work] ; color of work area RRGGBB,8->color gl
|
2007-06-22 22:24:06 +02:00
|
|
|
|
or edx,0x34000000
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mov edi,title
|
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
call draw_clock
|
|
|
|
|
|
|
|
|
|
mov eax,12 ; function 12:tell os about windowdraw
|
|
|
|
|
mov ebx,2 ; 2, end of draw
|
2007-05-10 15:48:35 +02:00
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
|
2024-06-03 01:34:02 +02:00
|
|
|
|
if lang eq ru_RU
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0
|
2024-06-14 10:35:46 +02:00
|
|
|
|
else ; Default to en_US
|
2007-05-10 15:48:35 +02:00
|
|
|
|
title db 'TIMER',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
end if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I_END:
|
|
|
|
|
|
|
|
|
|
temp dd ?
|
|
|
|
|
sc system_colors
|