Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; END |
||
3 | ; |
||
4 | |||
5 | include "lang.inc" |
||
6 | include "macros.inc" |
||
7 | |||
8 | meos_app_start |
||
9 | code |
||
10 | |||
11 | mov eax,40 |
||
12 | mov ebx,0111b |
||
13 | int 0x40 |
||
14 | |||
15 | call draw_window |
||
16 | |||
17 | still: |
||
18 | |||
19 | mov eax,10 ; wait here for event |
||
20 | ; mov ebx,100 |
||
21 | int 0x40 |
||
22 | |||
23 | cmp eax,1 |
||
24 | jz red |
||
25 | cmp eax,2 |
||
26 | jz key |
||
27 | cmp eax,3 |
||
28 | jz button |
||
29 | |||
30 | jmp still |
||
31 | |||
32 | red: |
||
33 | call draw_window |
||
34 | jmp still |
||
35 | |||
36 | key: |
||
37 | mcall 2 |
||
38 | cmp ah,13 |
||
39 | jz restart |
||
40 | cmp ah,27 |
||
41 | jz close_1 |
||
42 | cmp ah,180 |
||
43 | jz restart_kernel |
||
44 | cmp ah,181 |
||
45 | jz power_off |
||
46 | jmp red |
||
47 | |||
48 | button: |
||
49 | mov eax,17 |
||
50 | int 0x40 |
||
51 | |||
52 | cmp ah,1 |
||
53 | jne no_1 |
||
54 | power_off: |
||
55 | mcall 18,9,2 |
||
56 | jmp close_1 |
||
57 | |||
58 | no_1: |
||
59 | cmp ah,3 |
||
60 | jne no_2 |
||
61 | restart: |
||
62 | mcall 18,9,3 |
||
63 | jmp close_1 |
||
64 | |||
65 | no_2: |
||
66 | cmp ah,2 |
||
67 | jne no_4 |
||
68 | |||
69 | restart_kernel: |
||
70 | mcall 18,9,4 |
||
71 | |||
72 | no_4: |
||
73 | cmp ah,4 |
||
74 | jne still |
||
75 | |||
76 | close_1: |
||
77 | or eax,-1 ; close this program |
||
78 | int 0x40 |
||
79 | |||
80 | |||
81 | draw_window: |
||
82 | |||
83 | pusha |
||
84 | |||
85 | mov eax,48 |
||
86 | mov ebx,3 |
||
87 | mov ecx,sc |
||
88 | mov edx,sizeof.system_colors |
||
89 | int 0x40 |
||
90 | |||
91 | mov eax,12 ; tell os about redraw start |
||
92 | mov ebx,1 |
||
93 | int 0x40 |
||
94 | |||
95 | mov eax,14 ; get screen max x & max y |
||
96 | int 0x40 |
||
97 | |||
98 | xor ecx,ecx |
||
99 | mov cx,ax |
||
100 | |||
101 | shr eax,17 |
||
102 | sub eax,110 |
||
103 | shl eax,16 |
||
104 | mov ebx,eax |
||
105 | add ebx,220 |
||
106 | |||
107 | shr ecx,1 |
||
108 | sub ecx,50 |
||
109 | shl ecx,16 |
||
110 | add ecx,100 |
||
111 | |||
112 | mov eax,0 ; define and draw window |
||
113 | mov edx,[sc.work_button] |
||
114 | mov esi,edx ;[sc.work_button] |
||
115 | xor edi,edi |
||
116 | int 0x40 |
||
117 | |||
118 | xor edx,edx |
||
119 | mcall 13,14 shl 16+90,25 shl 16+27 |
||
120 | mcall 13,117 shl 16+90, |
||
121 | mcall 13,14 shl 16+90,59 shl 16+27 |
||
122 | mcall 13,117 shl 16+90, |
||
123 | |||
124 | mcall 8,15 shl 16+87,26 shl 16+24,1,0xdd7700 |
||
125 | inc dl |
||
126 | mcall 8,118 shl 16+87,,,0xbbbb ;cccc |
||
127 | inc dl |
||
128 | mcall 8,15 shl 16+87,60 shl 16+24,,0xbb00 |
||
129 | inc dl |
||
130 | mcall 8,118 shl 16+87,,,0xbbbbbb ;cccccc |
||
131 | |||
132 | mov eax,4 ; 0x00000004 = write text |
||
133 | mov ebx,75*65536+10 |
||
134 | mov ecx,[sc.work_button_text] ; 8b window nro - RR GG BB color |
||
135 | or ecx,0x10000000 |
||
136 | mov edx,label1 ; pointer to text beginning |
||
137 | mov esi,label1_len ; text length |
||
138 | int 0x40 |
||
139 | |||
140 | mov ecx,0x10ffffff |
||
141 | mov ebx,25*65536+30 |
||
142 | mov edx,label2 ; pointer to text beginning |
||
143 | mov esi,label2_len ; text length |
||
144 | int 0x40 |
||
145 | |||
146 | mov ebx,20*65536+64 |
||
147 | mov edx,label3 ; pointer to text beginning |
||
148 | mov esi,label3_len ; text length |
||
149 | int 0x40 |
||
150 | |||
151 | mov ecx,0xffffff |
||
152 | mov ebx,45*65536+41 |
||
153 | mov edx,label4 ; pointer to text beginning |
||
154 | mov esi,label4_len ; text length |
||
155 | int 0x40 |
||
156 | |||
157 | mov ebx,40*65536+75 |
||
158 | mov edx,label5 ; pointer to text beginning |
||
159 | mov esi,label5_len ; text length |
||
160 | int 0x40 |
||
161 | |||
162 | mov eax,12 ; tell os about redraw end |
||
163 | mov ebx,2 |
||
164 | int 0x40 |
||
165 | |||
166 | popa |
||
167 | |||
168 | ret |
||
169 | |||
170 | |||
171 | |||
172 | data |
||
173 | |||
174 | if lang eq ru |
||
175 | |||
176 | label1: |
||
177 | db ' :' |
||
178 | label1_len = $ - label1 |
||
179 | |||
180 | label2: |
||
181 | db ' ' |
||
182 | label2_len = $ - label2 |
||
183 | |||
184 | label3: |
||
185 | db ' ' |
||
186 | label3_len = $ - label3 |
||
187 | |||
188 | label4: |
||
189 | db '(End) (Home)' |
||
190 | label4_len = $ - label4 |
||
191 | |||
192 | label5: |
||
193 | db '(Enter) (Esc)' |
||
194 | label5_len = $ - label5 |
||
195 | |||
196 | else |
||
197 | |||
198 | label1: |
||
199 | db ' SELECT:' |
||
200 | label1_len = $ - label1 |
||
201 | |||
202 | label2: |
||
203 | db 'POWER OFF KERNEL' |
||
204 | label2_len = $ - label2 |
||
205 | |||
206 | label3: |
||
207 | db ' RESTART CANCEL' |
||
208 | label3_len = $ - label3 |
||
209 | |||
210 | label4: |
||
211 | db '(End) (Home)' |
||
212 | label4_len = $ - label4 |
||
213 | |||
214 | label5: |
||
215 | db '(Enter) (Esc)' |
||
216 | label5_len = $ - label5 |
||
217 | |||
218 | end if |
||
219 | |||
220 | |||
221 | udata |
||
222 | sc system_colors |
||
223 | |||
224 | meos_app_end |