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