Rev 109 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 316 | ||
---|---|---|---|
1 | ; |
1 | ; |
2 | ; TIMER |
2 | ; TIMER (show how much system works) |
3 | ; |
3 | ; |
4 | ; Compile with flat assembler |
4 | ; Compile with flat assembler |
5 | ; |
5 | ; |
6 | 6 | ||
7 | use32 |
7 | use32 |
8 | 8 | ||
9 | org 0x0 |
9 | org 0x0 |
10 | 10 | ||
11 | db 'MENUET01' ; 8 byte id |
11 | db 'MENUET01' ; 8 byte id |
12 | dd 0x01 ; header version |
12 | dd 0x01 ; header version |
13 | dd START ; start of code |
13 | dd START ; start of code |
14 | dd I_END ; size of image |
14 | dd I_END ; size of image |
15 | dd 0x1000 ; memory for app |
15 | dd 0x1000 ; memory for app |
16 | dd 0x1000 ; esp |
16 | dd 0x1000 ; esp |
17 | dd 0x0 , 0x0 ; I_Param , I_Icon |
17 | dd 0x0 , 0x0 ; I_Param , I_Icon |
18 | 18 | ||
19 | include 'lang.inc' |
19 | include 'lang.inc' |
20 | include 'macros.inc' |
20 | include 'macros.inc' |
21 | 21 | ||
22 | START: ; start of execution |
22 | START: ; start of execution |
23 | mov eax, 40 |
23 | mov eax, 40 |
24 | mov ebx, 101b |
24 | mov ebx, 101b |
25 | int 0x40 |
25 | int 0x40 |
26 | 26 | ||
27 | red: |
27 | red: |
28 | call draw_window |
28 | call draw_window |
29 | 29 | ||
30 | still: |
30 | still: |
31 | 31 | ||
32 | mov eax,23 ; wait here for event |
32 | mov eax,23 ; wait here for event |
33 | mov ebx,50 |
33 | mov ebx,50 |
34 | int 0x40 |
34 | int 0x40 |
35 | 35 | ||
36 | cmp eax,1 ; redraw request ? |
36 | cmp eax,1 ; redraw request ? |
37 | je red |
37 | je red |
38 | cmp eax,3 ; button in buffer ? |
38 | cmp eax,3 ; button in buffer ? |
39 | je button |
39 | je button |
40 | 40 | ||
41 | call draw_clock |
41 | call draw_clock |
42 | 42 | ||
43 | jmp still |
43 | jmp still |
44 | 44 | ||
45 | 45 | ||
46 | button: ; button |
46 | button: ; button |
47 | or eax,-1 ; close this program |
47 | or eax,-1 ; close this program |
48 | int 0x40 |
48 | int 0x40 |
49 | 49 | ||
50 | 50 | ||
51 | ; ********************************************* |
51 | ; ********************************************* |
52 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
52 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
53 | ; ********************************************* |
53 | ; ********************************************* |
54 | 54 | ||
55 | draw_clock: |
55 | draw_clock: |
56 | mov eax, 13 ; clear area |
- | |
57 | mov ebx, 10*65536+55 |
- | |
58 | mov ecx, 30*65536+10 |
- | |
59 | mov edx, [sc.work] |
- | |
60 | int 0x40 |
- | |
61 | 56 | ||
62 | mov eax, 26 ; get system counter |
57 | mov eax, 26 ; get system counter |
63 | mov ebx, 9 |
58 | mov ebx, 9 |
64 | int 0x40 |
59 | int 0x40 |
65 | 60 | ||
66 | cdq ;xor edx,edx |
61 | cdq ;xor edx,edx |
67 | mov ebx,100 |
62 | mov ebx,100 |
68 | div ebx |
63 | div ebx |
69 | 64 | ||
70 | push eax |
65 | push eax |
71 | 66 | ||
72 | xor edx,edx |
67 | xor edx,edx |
73 | mov ebx,60 |
68 | mov ebx,60 |
74 | div ebx |
69 | div ebx |
75 | mov ecx,eax |
70 | mov ecx,eax |
76 | 71 | ||
77 | push ecx |
72 | push ecx |
78 | push ecx |
73 | push ecx |
79 | 74 | ||
80 | xor edx,edx |
75 | xor edx,edx |
81 | mov ebx,60 |
76 | mov ebx,60 |
82 | div ebx |
77 | div ebx |
83 | mov ecx,eax |
78 | mov ecx,eax |
84 | 79 | ||
85 | mov eax,47 ; HH |
80 | mov eax,47 ; HH |
86 | mov esi,[sc.work_text] |
81 | mov esi,[sc.work_text] |
87 | or esi,0x10000000 |
82 | or esi,0x50000000 |
- | 83 | mov edi,[sc.work] |
|
88 | mov ebx,0x00020000 |
84 | mov ebx,0x00020000 |
89 | mov edx,10*65536+30 |
85 | mov edx,15*65536+5 |
90 | int 0x40 |
86 | int 0x40 |
91 | 87 | ||
92 | pop eax ; MM |
88 | pop eax ; MM |
93 | imul ecx,ecx,60 |
89 | imul ecx,ecx,60 |
94 | sub eax,ecx |
90 | sub eax,ecx |
95 | mov ecx,eax |
91 | mov ecx,eax |
96 | mov eax,47 |
92 | mov eax,47 |
97 | add edx,20*65536 |
93 | add edx,20*65536 |
98 | int 0x40 |
94 | int 0x40 |
99 | 95 | ||
100 | pop ecx |
96 | pop ecx |
101 | pop eax |
97 | pop eax |
102 | 98 | ||
103 | imul ecx,ecx,60 |
99 | imul ecx,ecx,60 |
104 | sub eax,ecx |
100 | sub eax,ecx |
105 | 101 | ||
106 | mov ecx,eax ; SS |
102 | mov ecx,eax ; SS |
107 | mov eax,47 |
103 | mov eax,47 |
108 | add edx,20*65536 |
104 | add edx,20*65536 |
109 | int 0x40 |
105 | int 0x40 |
110 | 106 | ||
111 | ret |
107 | ret |
112 | 108 | ||
113 | draw_window: |
109 | draw_window: |
114 | mov eax,48 |
110 | mov eax,48 |
115 | mov ebx,3 |
111 | mov ebx,3 |
116 | mov ecx,sc |
112 | mov ecx,sc |
117 | mov edx,sizeof.system_colors |
113 | mov edx,sizeof.system_colors |
118 | int 0x40 |
114 | int 0x40 |
119 | 115 | ||
120 | mov eax,12 ; function 12:tell os about windowdraw |
116 | mov eax,12 ; function 12:tell os about windowdraw |
121 | mov ebx,1 ; 1, start of draw |
117 | mov ebx,1 ; 1, start of draw |
122 | int 0x40 |
118 | int 0x40 |
123 | 119 | ||
124 | ; DRAW WINDOW |
120 | ; DRAW WINDOW |
125 | mov eax,0 ; function 0 : define and draw window |
121 | xor eax,eax ; function 0 : define and draw window |
126 | mov ebx,100*65536+75 ; [x start] *65536 + [x size] |
122 | mov ebx,100*65536+100 ; [x start] *65536 + [x size] |
127 | mov ecx,100*65536+45 ; [y start] *65536 + [y size] |
123 | mov ecx,100*65536+40 ; [y start] *65536 + [y size] |
128 | mov edx,[sc.work] ; color of work area RRGGBB,8->color gl |
124 | mov edx,[sc.work] ; color of work area RRGGBB,8->color gl |
129 | mov esi,[sc.grab] ; color of grab bar RRGGBB,8->color gl |
- | |
130 | or esi,0x80000000 |
125 | or edx,0x33000000 |
131 | mov edi,[sc.frame] ; color of frames RRGGBB |
- | |
132 | int 0x40 |
- | |
133 | - | ||
134 | ; WINDOW LABEL |
- | |
135 | mov eax,4 ; function 4 : write text to window |
- | |
136 | mov ebx,6*65536+7 ; [x start] *65536 + [y start] |
- | |
137 | mov ecx,[sc.grab_text] ; font 1 & color ( 0xF0RRGGBB ) |
- | |
138 | or ecx,0x10000000 |
126 | mov edi,header |
139 | mov edx,header ; pointer to text beginning |
- | |
140 | mov esi,header.len ; text length |
- | |
141 | int 0x40 |
- | |
142 | - | ||
143 | ; CLOSE BUTTON |
- | |
144 | mov eax,8 ; function 8 : define and draw button |
- | |
145 | mov ebx,(75-16)*65536+12 ; [x start] *65536 + [x size] |
- | |
146 | mov ecx,4*65536+12 ; [y start] *65536 + [y size] |
- | |
147 | mov edx,1 ; button id |
- | |
148 | mov esi,[sc.grab_button] ; button color RRGGBB |
- | |
149 | int 0x40 |
127 | int 0x40 |
150 | 128 | ||
151 | call draw_clock |
129 | call draw_clock |
152 | 130 | ||
153 | mov eax,12 ; function 12:tell os about windowdraw |
131 | mov eax,12 ; function 12:tell os about windowdraw |
154 | mov ebx,2 ; 2, end of draw |
132 | mov ebx,2 ; 2, end of draw |
155 | int 0x40 |
133 | int 0x40 |
156 | 134 | ||
157 | ret |
135 | ret |
158 | 136 | ||
159 | 137 | ||
160 | ; DATA AREA |
138 | ; DATA AREA |
161 | 139 | ||
162 | if lang eq ru |
140 | if lang eq ru |
163 | header: |
- | |
164 | db ' ' |
141 | header db ' ',0 |
165 | .len = $ - header |
- | |
166 | else |
142 | else |
167 | header: |
- | |
168 | db 'TIMER' |
143 | header db 'TIMER',0 |
169 | .len = $ - header |
- | |
170 | end if |
144 | end if |
171 | 145 | ||
172 | 146 | ||
173 | I_END: |
147 | I_END: |
174 | 148 | ||
175 | temp dd ? |
149 | temp dd ? |
176 | sc system_colors |
150 | sc system_colors |