Rev 109 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 143 | ||
---|---|---|---|
Line 6... | Line 6... | ||
6 | 6 | ||
Line 7... | Line 7... | ||
7 | use32 |
7 | use32 |
Line 8... | Line 8... | ||
8 | 8 | ||
9 | org 0x0 |
9 | org 0x0 |
10 | 10 | ||
11 | db 'MENUET00' ; 8 byte id |
11 | db 'MENUET01' ; 8 byte id |
12 | dd 56 ; required os |
12 | dd 1 ; required os |
13 | dd START ; program start |
13 | dd START ; program start |
14 | dd I_END ; program image size |
14 | dd I_END ; program image size |
Line 15... | Line -... | ||
15 | dd 0x1000 ; required amount of memory |
- | |
16 | dd 0x1000 ; esp = 0x7FFF0 |
15 | dd 0x1000 ; required amount of memory |
Line 17... | Line 16... | ||
17 | dd 0x00000000 ; reserved=no extended header |
16 | dd 0x1000 ; esp = 0x7FFF0 |
Line -... | Line 17... | ||
- | 17 | dd 0, 0 |
|
- | 18 | ||
- | 19 | ||
- | 20 | include 'macros.inc' |
|
- | 21 | ||
- | 22 | START: ; start of execution |
|
- | 23 | ||
- | 24 | set_variables: |
|
- | 25 | ||
- | 26 | mov eax,46 ; reserve ports 0x3f0 - 0x3ff |
|
- | 27 | mov ebx,0 |
|
- | 28 | mov ecx,0x3f0 |
|
- | 29 | mov edx,0x3ff |
|
18 | 30 | int 0x40 |
|
- | 31 | ||
- | 32 | mov eax,45 ; reserve irq 4 |
|
- | 33 | mov ebx,0 |
|
- | 34 | mov ecx,4 |
|
- | 35 | int 0x40 |
|
- | 36 | ||
- | 37 | mov eax,44 ; set read ports for irq 4 |
|
- | 38 | mov ebx,irqtable |
|
- | 39 | ; mov ecx,4 |
|
- | 40 | int 0x40 |
|
- | 41 | ||
- | 42 | mov dh, 3 ; all ports have number 3xx hex |
|
- | 43 | ||
- | 44 | mov dl, 0xf3+8 |
|
- | 45 | mov al, 0x80 |
|
- | 46 | out dx, al |
|
- | 47 | ||
- | 48 | mov dl, 0xf1+8 |
|
- | 49 | mov al, 0 |
|
- | 50 | out dx, al |
|
- | 51 | ||
- | 52 | mov dl, 0xf0+8 |
|
- | 53 | mov al, 0x30 / 4 |
|
- | 54 | out dx, al |
|
- | 55 | ||
Line -... | Line 56... | ||
- | 56 | mov dl, 0xf3+8 |
|
- | 57 | mov al, 3 |
|
- | 58 | out dx, al |
|
- | 59 | ||
- | 60 | mov dl, 0xf4+8 |
|
- | 61 | mov al, 0xB |
|
- | 62 | out dx, al |
|
- | 63 | ||
- | 64 | mov dl, 0xf1+8 |
|
- | 65 | mov al, 1 |
|
- | 66 | out dx, al |
|
- | 67 | ||
- | 68 | mov eax,5 |
|
- | 69 | mov ebx,100 |
|
- | 70 | int 0x40 |
|
- | 71 | ||
- | 72 | mov dl, 0xf8 |
|
- | 73 | mov al, 'I' |
|
- | 74 | out dx, al |
|
- | 75 | ||
- | 76 | mov eax,5 |
|
- | 77 | mov ebx,10 |
|
- | 78 | int 0x40 |
|
- | 79 | ||
19 | 80 | mov al, 'R' |
|
Line 20... | Line 81... | ||
20 | include 'lang.inc' |
81 | out dx, al |
Line 21... | Line 82... | ||
21 | include 'macros.inc' |
82 | |
22 | 83 | mov eax,40 ; get com 1 data with irq 4 |
|
- | 84 | mov ebx,0000000000010000b shl 16 + 101b |
|
- | 85 | int 0x40 |
|
- | 86 | ||
- | 87 | red: |
|
- | 88 | call draw_window |
|
Line 23... | Line 89... | ||
23 | START: ; start of execution |
89 | |
24 | - | ||
25 | call draw_window ; at first, draw the window |
90 | still: |
26 | 91 | ||
27 | call set_variables |
- | |
28 | - | ||
29 | still: |
- | |
30 | - | ||
Line -... | Line 92... | ||
- | 92 | mov eax,10 ; wait here for event |
|
- | 93 | int 0x40 |
|
- | 94 | dec eax |
|
31 | mov eax,10 ; wait here for event |
95 | jz red |
- | 96 | dec eax |
|
- | 97 | dec eax |
|
- | 98 | jnz readir |
|
- | 99 | ||
- | 100 | button: ; button |
|
- | 101 | mov al,17 ; get id |
|
- | 102 | int 0x40 |
|
- | 103 | ||
- | 104 | ; we have only one button, close |
|
- | 105 | ||
- | 106 | mov eax,45 ; free irq |
|
Line 32... | Line 107... | ||
32 | int 0x40 |
107 | mov ebx,1 |
Line -... | Line 108... | ||
- | 108 | mov ecx,4 |
|
- | 109 | int 0x40 |
|
- | 110 | ||
- | 111 | mov eax,46 ; free ports 0x3f0-0x3ff |
|
- | 112 | mov ebx,1 |
|
33 | 113 | mov ecx,0x3f0 |
|
- | 114 | mov edx,0x3ff |
|
Line 34... | Line 115... | ||
34 | cmp eax,1 ; redraw request ? |
115 | int 0x40 |
35 | je red |
116 | |
36 | cmp eax,2 ; key in buffer ? |
117 | or eax,-1 ; close this program |
37 | je key |
118 | int 0x40 |
Line 38... | Line 119... | ||
38 | cmp eax,3 ; button in buffer ? |
119 | |
39 | je button |
120 | pos dd 0x0 |
Line 40... | Line 121... | ||
40 | cmp eax,16+4 |
121 | |
41 | je readir |
122 | cdplayer: |
42 | - | ||
43 | jmp still |
123 | dd 7 |
Line 44... | Line 124... | ||
44 | 124 | dd 0 |
|
Line 83... | Line 163... | ||
83 | pop ebx |
163 | pop ebx |
84 | and ebx,0xff |
164 | and ebx,0xff |
85 | call draw_data |
165 | call draw_data |
86 | jmp still |
166 | jmp still |
Line 87... | Line -... | ||
87 | - | ||
88 | red: ; redraw |
- | |
89 | call draw_window |
- | |
90 | jmp still |
- | |
91 | - | ||
92 | key: ; key |
- | |
93 | mov eax,2 ; just read it and ignore |
- | |
94 | int 0x40 |
- | |
95 | jmp still |
- | |
96 | - | ||
97 | button: ; button |
- | |
98 | mov eax,17 ; get id |
- | |
99 | int 0x40 |
- | |
100 | - | ||
101 | cmp ah,1 ; button id=1 ? |
- | |
102 | jne noclose |
- | |
103 | - | ||
104 | mov eax,45 ; free irq |
- | |
105 | mov ebx,1 |
- | |
106 | mov ecx,4 |
- | |
107 | int 0x40 |
- | |
108 | - | ||
109 | mov eax,46 ; free ports 0x3f0-0x3ff |
- | |
110 | mov ebx,1 |
- | |
111 | mov ecx,0x3f0 |
- | |
112 | mov edx,0x3ff |
- | |
113 | int 0x40 |
- | |
114 | - | ||
115 | mov eax,-1 ; close this program |
- | |
116 | int 0x40 |
- | |
117 | noclose: |
- | |
118 | - | ||
Line 119... | Line 167... | ||
119 | jmp still |
167 | |
Line 147... | Line 195... | ||
147 | 195 | ||
Line 148... | Line 196... | ||
148 | irqtable: |
196 | irqtable: |
149 | 197 | ||
150 | dd 0x3f8+0x01000000 ; + 01 = read byte, 02 read word |
- | |
151 | dd 0 |
- | |
152 | dd 0 |
- | |
153 | dd 0 |
- | |
154 | dd 0 |
- | |
155 | dd 0 |
- | |
156 | dd 0 |
- | |
157 | dd 0 |
- | |
158 | dd 0 |
- | |
159 | dd 0 |
- | |
160 | dd 0 |
- | |
161 | dd 0 |
- | |
162 | dd 0 |
- | |
163 | dd 0 |
- | |
164 | dd 0 |
- | |
165 | dd 0 |
- | |
166 | - | ||
167 | - | ||
168 | - | ||
169 | set_variables: |
- | |
170 | - | ||
171 | - | ||
172 | pusha |
- | |
173 | - | ||
174 | mov eax,46 ; reserve ports 0x3f0 - 0x3ff |
- | |
175 | mov ebx,0 |
- | |
176 | mov ecx,0x3f0 |
- | |
177 | mov edx,0x3ff |
- | |
178 | int 0x40 |
- | |
179 | - | ||
180 | mov eax,45 ; reserve irq 4 |
- | |
181 | mov ebx,0 |
- | |
182 | mov ecx,4 |
- | |
183 | int 0x40 |
- | |
184 | - | ||
185 | mov eax,46 ; reserve ports 0x3f0-0x3ff |
- | |
186 | mov ebx,0 |
- | |
187 | mov ecx,0x3f0 |
- | |
188 | mov edx,0x3ff |
- | |
189 | int 0x40 |
- | |
190 | - | ||
191 | mov eax,44 ; set read ports for irq 4 |
- | |
192 | mov ebx,irqtable |
- | |
Line 193... | Line -... | ||
193 | mov ecx,4 |
- | |
194 | int 0x40 |
- | |
195 | - | ||
196 | mov cx,0x3f3+8 |
- | |
197 | mov bl,0x80 |
- | |
198 | mov eax,43 |
- | |
199 | int 0x40 |
- | |
200 | - | ||
201 | mov cx,0x3f1+8 |
- | |
202 | mov bl,0 |
- | |
203 | mov eax,43 |
- | |
204 | int 0x40 |
- | |
205 | - | ||
206 | mov cx,0x3f0+8 |
- | |
207 | mov bl,0x30 / 4 |
- | |
208 | mov eax,43 |
- | |
209 | int 0x40 |
- | |
210 | - | ||
211 | mov cx,0x3f3+8 |
- | |
212 | mov bl,3 |
- | |
213 | mov eax,43 |
- | |
214 | int 0x40 |
- | |
215 | - | ||
216 | mov cx,0x3f4+8 |
- | |
217 | mov bl,0xB |
- | |
218 | mov eax,43 |
- | |
219 | int 0x40 |
- | |
220 | - | ||
221 | mov cx,0x3f1+8 |
- | |
222 | mov bl,1 |
- | |
223 | mov eax,43 |
- | |
224 | int 0x40 |
- | |
225 | - | ||
226 | mov eax,5 |
- | |
227 | mov ebx,100 |
- | |
228 | int 0x40 |
- | |
229 | - | ||
230 | mov cx,0x3f8 |
- | |
231 | mov bl,'I' |
- | |
232 | mov eax,43 |
- | |
233 | int 0x40 |
- | |
234 | - | ||
235 | mov eax,5 |
- | |
236 | mov ebx,10 |
- | |
237 | int 0x40 |
- | |
238 | - | ||
239 | mov cx,0x3f8 |
- | |
240 | mov bl,'R' |
- | |
241 | mov eax,43 |
- | |
242 | int 0x40 |
- | |
243 | - | ||
244 | mov eax,40 ; get com 1 data with irq 4 |
- | |
245 | mov ebx,0000000000010000b shl 16 + 111b |
- | |
246 | int 0x40 |
- | |
247 | - | ||
Line 248... | Line 198... | ||
248 | popa |
198 | dd 0x3f8+0x01000000 ; + 01 = read byte, 02 read word |
249 | 199 | dd 0 |
|
250 | ret |
200 | |
Line 264... | Line 214... | ||
264 | ; DRAW WINDOW |
214 | ; DRAW WINDOW |
265 | mov eax,0 ; function 0 : define and draw window |
215 | mov eax,0 ; function 0 : define and draw window |
266 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
216 | mov ebx,100*65536+300 ; [x start] *65536 + [x size] |
267 | mov ecx,100*65536+250 ; [y start] *65536 + [y size] |
217 | mov ecx,100*65536+250 ; [y start] *65536 + [y size] |
268 | mov edx,[wcolor] ; color of work area RRGGBB,8->color |
218 | mov edx,[wcolor] ; color of work area RRGGBB,8->color |
269 | mov esi,0x8099bbff ; color of grab bar RRGGBB,8->color glide |
- | |
270 | mov edi,0x00ffffff ; color of frames RRGGBB |
219 | mov edi,labelt ; caption string |
271 | int 0x40 |
220 | int 0x40 |
Line 272... | Line 221... | ||
272 | 221 | ||
273 | ; WINDOW LABEL |
222 | ; ; WINDOW LABEL |
274 | mov eax,4 ; function 4 : write text to window |
223 | ; mov eax,4 ; function 4 : write text to window |
275 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
224 | ; mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
276 | mov ecx,0x00ffffff ; color of text RRGGBB |
225 | ; mov ecx,0x00ffffff ; color of text RRGGBB |
277 | mov edx,labelt ; pointer to text beginning |
226 | ; mov edx,labelt ; pointer to text beginning |
278 | mov esi,labellen-labelt ; text length |
227 | ; mov esi,labellen-labelt ; text length |
Line 279... | Line 228... | ||
279 | int 0x40 |
228 | ; int 0x40 |
280 | 229 | ||
281 | ; CLOSE BUTTON |
230 | ; CLOSE BUTTON |
282 | mov eax,8 ; function 8 : define and draw button |
231 | ; mov eax,8 ; function 8 : define and draw button |
283 | mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] |
232 | ; mov ebx,(300-19)*65536+12 ; [x start] *65536 + [x size] |
284 | mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
233 | ; mov ecx,5*65536+12 ; [y start] *65536 + [y size] |
285 | mov edx,1 ; button id |
234 | ; mov edx,1 ; button id |
Line 286... | Line -... | ||
286 | mov esi,0x5599cc ; button color RRGGBB |
- | |
287 | ; int 0x40 |
- | |
288 | - | ||
289 | call draw_text |
- | |
290 | - | ||
291 | mov eax,12 |
- | |
292 | mov ebx,2 |
- | |
293 | int 0x40 |
- | |
294 | 235 | ; mov esi,0x5599cc ; button color RRGGBB |
|
Line 295... | Line -... | ||
295 | ret |
- | |
296 | - | ||
297 | draw_text: |
236 | ; int 0x40 |
298 | 237 | ||
299 | pusha |
238 | draw_text: |
300 | 239 | ||
301 | mov ebx,25*65536+35 ; draw info text with function 4 |
240 | mov ebx,25*65536+35 ; draw info text with function 4 |
302 | mov ecx,0xffffff |
241 | mov ecx,0xffffff |
303 | mov edx,text |
242 | mov edx,text |
304 | mov esi,40 |
243 | mov esi,40 |
305 | mov edi,20 |
244 | mov edi,20 |
306 | newline: |
245 | newline: |
307 | mov eax,4 |
246 | mov eax,4 |
308 | int 0x40 |
247 | int 0x40 |
Line 309... | Line 248... | ||
309 | add ebx,10 |
248 | add ebx,10 |
- | 249 | add edx,esi |
|
- | 250 | dec edi |
|
Line 310... | Line 251... | ||
310 | add edx,40 |
251 | jne newline |
Line 311... | Line -... | ||
311 | dec edi |
- | |
312 | jne newline |
252 | |
Line 313... | Line 253... | ||
313 | 253 | mov eax,12 |
|
Line 314... | Line 254... | ||
314 | popa |
254 | mov ebx,2 |
315 | - | ||
Line 316... | Line 255... | ||
316 | ret |
255 | int 0x40 |
Line 317... | Line 256... | ||
317 | 256 | ||
318 | - | ||
319 | - | ||
320 | ; DATA AREA |
- | |
321 | - |