Rev 485 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ; |
2 | ; Vertical Refresh Rate programm |
||
3 | ; |
||
4 | ; Author: Trans <<< 13 >>> |
||
5 | ; Date: February-May 2003 (09.05.2003) |
||
6 | ; Version: 2.0 |
||
7 | ; Last Modification: 30.07.2003 |
||
8 | ; Compile with FASM for Menuet |
||
9 | ; |
||
10 | use32 |
||
11 | |||
12 | org 0x0 |
||
13 | |||
180 | heavyiron | 14 | db 'MENUET01' ; 8 byte id |
502 | heavyiron | 15 | dd 0x01 ; header version |
31 | halyavin | 16 | dd START ; start of code |
17 | dd I_END ; size of image |
||
180 | heavyiron | 18 | dd 0x5000 ; memory for app |
31 | halyavin | 19 | dd 0x4ff0 ; esp |
180 | heavyiron | 20 | dd 0x0 , 0x0 ; I_Param , I_Icon |
31 | halyavin | 21 | |
485 | heavyiron | 22 | include '..\..\..\macros.inc' |
31 | halyavin | 23 | START: ; start of execution |
24 | |||
25 | mov eax,14 |
||
485 | heavyiron | 26 | mcall |
31 | halyavin | 27 | mov ebx,eax |
28 | shr ebx,16 |
||
29 | mov [oldX],ebx |
||
30 | shl eax,16 |
||
31 | shr eax,16 |
||
32 | mov [oldY],eax |
||
33 | |||
34 | ; Test on installed video driver |
||
35 | mov eax,21 |
||
36 | mov ebx,13 |
||
37 | mov ecx,1 |
||
38 | mov edx,drvinfo |
||
485 | heavyiron | 39 | mcall |
31 | halyavin | 40 | cmp eax,0FFFFFFFFh ; = -1 - error or not installed |
41 | jne vrr_00 |
||
42 | call warning_info |
||
43 | retn |
||
44 | ; |
||
45 | |||
46 | vrr_00: |
||
47 | call get_vert_rate |
||
48 | mov eax,[currvm] |
||
49 | mov [oldvm],eax |
||
50 | call get_pid |
||
180 | heavyiron | 51 | red: |
31 | halyavin | 52 | call draw_window ; at first, draw the window |
53 | |||
54 | still: |
||
55 | |||
56 | mov eax,10 ; check here for event |
||
485 | heavyiron | 57 | mcall |
31 | halyavin | 58 | |
59 | cmp eax,1 ; redraw request ? |
||
60 | je red |
||
61 | cmp eax,2 ; key in buffer ? |
||
62 | je key |
||
63 | cmp eax,3 ; button in buffer ? |
||
64 | je button |
||
65 | call get_pid |
||
66 | jmp still |
||
180 | heavyiron | 67 | |
31 | halyavin | 68 | key: ; key |
180 | heavyiron | 69 | mov al,2 ; just read it |
485 | heavyiron | 70 | mcall |
31 | halyavin | 71 | cmp ah,'1' |
72 | jne key_loc_00 |
||
73 | call safekey |
||
74 | jmp still |
||
75 | key_loc_00: |
||
76 | cmp ah,'2' |
||
77 | jne key_loc_01 |
||
78 | call safekey |
||
79 | jmp still |
||
80 | key_loc_01: |
||
81 | cmp ah,'3' |
||
82 | jne key_loc_02 |
||
83 | call safekey |
||
84 | jmp still |
||
85 | key_loc_02: |
||
86 | cmp ah,'4' |
||
87 | jne key_loc_03 |
||
88 | call safekey |
||
89 | jmp still |
||
90 | key_loc_03: |
||
91 | cmp ah,'5' |
||
92 | jne key_loc_04 |
||
93 | call safekey |
||
94 | jmp still |
||
95 | key_loc_04: |
||
96 | cmp ah,'-' |
||
97 | jne key_loc_05 |
||
98 | xor eax,eax |
||
99 | call inc_dec_rate |
||
100 | jmp still |
||
101 | key_loc_05: |
||
102 | cmp ah,'+' |
||
103 | jne key_loc_06 |
||
104 | xor eax,eax |
||
105 | inc eax |
||
106 | call inc_dec_rate |
||
107 | jmp still |
||
108 | key_loc_06: |
||
109 | cmp ah,'r' ;Return in last stable mode |
||
110 | jne key_loc_07 |
||
111 | call restore_mode |
||
112 | jmp red |
||
113 | key_loc_07: |
||
114 | cmp ah,13 ;Apply select mode |
||
115 | jne still |
||
116 | xor eax,eax |
||
117 | mov ax,[vmselect] |
||
118 | cmp al,0 |
||
119 | je still |
||
120 | xor ebx,ebx |
||
121 | mov bl,al |
||
122 | dec bl |
||
123 | shl bx,1 ; ebx=(ebx-1)*2 |
||
124 | xor edx,edx |
||
125 | mov dx,[vidmode+ebx] |
||
126 | mov ecx,ebx |
||
127 | shl ebx,2 |
||
128 | add ebx,ecx ; ebx=ebx*5 |
||
129 | shr ax,8 |
||
130 | dec ax |
||
131 | shl ax,1 |
||
132 | add ebx,eax |
||
133 | ror edx,16 |
||
134 | mov dx,[_m1+ebx] |
||
135 | rol edx,16 |
||
136 | call set_my_mode |
||
137 | call protect_and_return |
||
138 | xor ax,ax |
||
139 | mov [vmselect],ax |
||
140 | jmp red |
||
141 | |||
142 | button: ; button |
||
180 | heavyiron | 143 | mov al,17 ; get id |
485 | heavyiron | 144 | mcall |
31 | halyavin | 145 | |
146 | cmp ah,1 ; button id=1 ? |
||
147 | jne noclose |
||
148 | mov eax,-1 ; close this program |
||
485 | heavyiron | 149 | mcall |
31 | halyavin | 150 | noclose: |
151 | cmp ah,2 ;'+' screen width |
||
152 | jne button_loc_01 |
||
153 | xor eax,eax |
||
154 | inc eax |
||
155 | call inc_dec_rate |
||
156 | jmp still |
||
157 | button_loc_01: |
||
158 | cmp ah,3 ;'-' screen width |
||
159 | jne button_loc_02 |
||
160 | xor eax,eax |
||
161 | call inc_dec_rate |
||
162 | jmp still |
||
163 | button_loc_02: |
||
164 | cmp ah,4 ; Ok |
||
165 | jne button_loc_03 |
||
166 | mov ah,13 |
||
167 | jmp key_loc_07 |
||
168 | button_loc_03: |
||
169 | cmp ah,5 ; Cancel |
||
170 | jne button_loc_04 |
||
171 | mov [vmselect],word 00h |
||
172 | jmp red |
||
173 | button_loc_04: |
||
174 | cmp ah,6 ; Return |
||
175 | jne button_loc_05 |
||
176 | mov ah,'r' |
||
177 | jmp key_loc_06 |
||
178 | button_loc_05: |
||
179 | cmp ah,7 ; Default |
||
180 | jne button_loc_06 |
||
181 | call restore_mode |
||
182 | button_loc_06: |
||
183 | jmp still |
||
184 | |||
185 | |||
186 | ; ********************************************* |
||
187 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
188 | ; ********************************************* |
||
189 | |||
190 | |||
191 | draw_window: |
||
192 | |||
193 | dw_continue: |
||
194 | |||
195 | mov eax,12 ; function 12:tell os about windowdraw |
||
196 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 197 | mcall |
31 | halyavin | 198 | |
199 | ; DRAW WINDOW |
||
200 | mov eax,0 ; function 0 : define and draw window |
||
201 | mov ebx,100*65536+400 ; [x start] *65536 + [x size] |
||
202 | mov ecx,100*65536+200 ; [y start] *65536 + [y size] |
||
180 | heavyiron | 203 | mov edx,0x130020C0;0x00000040 ; color of work area RRGGBB,8->color glide |
485 | heavyiron | 204 | mov edi,title |
205 | mcall |
||
31 | halyavin | 206 | |
207 | ; BUTTONS |
||
180 | heavyiron | 208 | mov eax,8 |
209 | mov edx,0 |
||
31 | halyavin | 210 | mov ebx,330*65536+20 |
211 | mov ecx,84*65536+48 |
||
212 | mov dl,2 |
||
180 | heavyiron | 213 | mov esi,0x5599cc ; button color RRGGBB |
485 | heavyiron | 214 | mcall ; Button '+'Width |
31 | halyavin | 215 | add ebx,30*65536 |
216 | mov dl,3 |
||
485 | heavyiron | 217 | mcall ; Button '-'Width |
31 | halyavin | 218 | mov ebx,22*65536+85 |
219 | mov ecx,170*65536+15 |
||
220 | inc dl ;dl=4 |
||
485 | heavyiron | 221 | mcall ; Button 'Ok' |
31 | halyavin | 222 | add ebx,90*65536 |
223 | inc dl ;dl=5 |
||
485 | heavyiron | 224 | mcall ; Button 'Cancel' |
31 | halyavin | 225 | add ebx,90*65536 |
226 | inc dl ;dl=6 |
||
485 | heavyiron | 227 | mcall ; Button 'Return' |
31 | halyavin | 228 | add ebx,90*65536 |
229 | inc dl ;dl=7 |
||
485 | heavyiron | 230 | mcall ; Button 'Default' |
31 | halyavin | 231 | |
232 | call draw_face |
||
233 | |||
234 | mov eax,12 ; function 12:tell os about windowdraw |
||
235 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 236 | mcall |
31 | halyavin | 237 | |
238 | ret |
||
239 | |||
240 | ;------------Subfunctions----------- |
||
241 | |||
242 | restore_mode: |
||
243 | push eax |
||
244 | push ebx |
||
245 | push edx |
||
246 | mov eax,21 |
||
247 | mov ebx,13 |
||
248 | mov ecx,4 |
||
485 | heavyiron | 249 | mcall |
31 | halyavin | 250 | pop edx |
251 | pop ecx |
||
252 | pop eax |
||
253 | retn |
||
254 | |||
255 | |||
256 | |||
257 | ; IN: edx = RefRate*65536+No.VideoMode |
||
258 | set_my_mode: |
||
259 | push ecx |
||
260 | push ebx |
||
261 | push edx |
||
262 | mov eax,[currvm] |
||
263 | mov [oldvm],eax |
||
264 | mov [currvm],edx |
||
265 | pop edx |
||
266 | push edx |
||
267 | mov eax,21 |
||
268 | mov ebx,13 |
||
269 | mov ecx,3 |
||
485 | heavyiron | 270 | mcall |
62 | mario79 | 271 | mcall 5,50 |
272 | mcall 15,3 |
||
31 | halyavin | 273 | pop edx |
274 | pop ebx |
||
275 | pop ecx |
||
276 | retn |
||
277 | |||
278 | ; IN: eax = 0/1 - -/+ 1Hz |
||
279 | inc_dec_rate: |
||
280 | push ebx |
||
281 | push ecx |
||
282 | push edx |
||
283 | mov edx,eax |
||
284 | mov eax,21 |
||
285 | mov ebx,13 |
||
286 | mov ecx,5 |
||
485 | heavyiron | 287 | mcall |
31 | halyavin | 288 | pop edx |
289 | pop ecx |
||
290 | pop ebx |
||
291 | retn |
||
292 | |||
293 | get_pid: |
||
294 | mov eax,9 |
||
295 | mov ebx,buffer |
||
296 | xor ecx,ecx |
||
297 | dec ecx |
||
485 | heavyiron | 298 | mcall |
31 | halyavin | 299 | mov [totp],eax |
300 | mov eax,[ebx+30] |
||
301 | mov [mypid],eax |
||
302 | mov ax,[ebx+4] |
||
303 | mov [mypno],ax |
||
304 | retn |
||
305 | |||
306 | get_vert_rate: |
||
307 | xor eax,eax |
||
308 | mov ebx,eax |
||
309 | mov ecx,eax |
||
310 | mov al,21 |
||
311 | mov bl,13 |
||
312 | mov cl,2 |
||
485 | heavyiron | 313 | mcall |
31 | halyavin | 314 | mov [initrr],ebx |
315 | mov [refrate],ebx |
||
316 | ror ecx,16 |
||
317 | mov cx,bx |
||
318 | rol ecx,16 |
||
319 | mov [currvm],ecx |
||
320 | retn |
||
321 | |||
322 | get_initial_videomode: |
||
323 | retn |
||
324 | |||
325 | |||
326 | draw_table: |
||
327 | mov eax,13 |
||
328 | mov ebx,9*65536+303 |
||
329 | mov ecx,59*65536+87 |
||
330 | xor edx,edx |
||
485 | heavyiron | 331 | mcall |
31 | halyavin | 332 | mov ebx,10*65536+300 |
333 | mov ecx,60*65536+24 |
||
334 | mov edx,00FF00FFh |
||
485 | heavyiron | 335 | mcall |
31 | halyavin | 336 | mov ebx,10*65536+36 |
337 | mov ecx,72*65536+72 |
||
338 | mov edx,0000FFFFh |
||
485 | heavyiron | 339 | mcall |
31 | halyavin | 340 | mov eax,38 |
341 | mov edx,00FFFFFFh |
||
342 | mov ebx,10*65536+310 |
||
343 | mov edi,60*65536+60 |
||
344 | mov esi,12*65536+12 |
||
345 | xor ecx,ecx |
||
346 | mov cl,8 |
||
347 | dt_loc_hor_line: |
||
348 | push ecx |
||
349 | mov ecx,edi |
||
485 | heavyiron | 350 | mcall |
31 | halyavin | 351 | add edi,esi |
352 | pop ecx |
||
353 | loop dt_loc_hor_line |
||
354 | mov ebx,10*65536+10 |
||
355 | mov edi,60*65536+144 |
||
356 | mov esi,66*65536+66 |
||
357 | mov ecx,edi |
||
485 | heavyiron | 358 | mcall |
31 | halyavin | 359 | add ebx,36*65536+36 |
360 | xor ecx,ecx |
||
361 | mov cl,5 |
||
362 | dt_loc_vert_line: |
||
363 | push ecx |
||
364 | mov ecx,edi |
||
485 | heavyiron | 365 | mcall |
31 | halyavin | 366 | add ebx,esi |
367 | pop ecx |
||
368 | loop dt_loc_vert_line |
||
369 | mov eax,4 |
||
370 | mov ebx,52*65536+75 |
||
371 | mov ecx,000000FFh |
||
372 | mov edx,_m1280x1024 |
||
373 | mov esi,9 |
||
485 | heavyiron | 374 | mcall |
31 | halyavin | 375 | add edx,9 |
376 | add ebx,66*65536 |
||
485 | heavyiron | 377 | mcall |
31 | halyavin | 378 | add edx,9 |
379 | add ebx,66*65536 |
||
485 | heavyiron | 380 | mcall |
31 | halyavin | 381 | add edx,9 |
382 | add ebx,66*65536 |
||
485 | heavyiron | 383 | mcall |
31 | halyavin | 384 | xor eax,eax |
385 | mov ebx,eax |
||
386 | mov ecx,eax |
||
387 | mov al,47 |
||
388 | inc ebx |
||
389 | shl ebx,16 |
||
390 | inc ecx |
||
391 | mov edi,ecx |
||
392 | mov edx,22*65536+86 |
||
393 | mov esi,00FF0000h |
||
394 | mov ecx,5 |
||
395 | dt_loc_00: |
||
396 | push ecx |
||
397 | mov ecx,edi |
||
485 | heavyiron | 398 | mcall |
31 | halyavin | 399 | inc edi |
400 | add dx,12 |
||
401 | pop ecx |
||
402 | loop dt_loc_00 |
||
403 | xor ecx,ecx |
||
404 | inc ecx |
||
405 | mov edi,ecx |
||
406 | mov edx,76*65536+63 |
||
407 | mov esi,000000FFh |
||
408 | mov ecx,4 |
||
409 | dt_loc_01: |
||
410 | push ecx |
||
411 | mov ecx,edi |
||
485 | heavyiron | 412 | mcall |
31 | halyavin | 413 | inc edi |
414 | add edx,66*65536 |
||
415 | pop ecx |
||
416 | loop dt_loc_01 |
||
417 | mov eax,4 |
||
418 | mov ebx,16*65536+63 |
||
419 | mov ecx,000000FFh |
||
420 | mov edx,_mk |
||
421 | mov esi,4 |
||
485 | heavyiron | 422 | mcall |
31 | halyavin | 423 | shl ecx,16 |
424 | add bx,12 |
||
425 | add edx,4 |
||
485 | heavyiron | 426 | mcall |
31 | halyavin | 427 | retn |
428 | |||
429 | ;IN: ah=keycode |
||
430 | safekey: |
||
431 | sub ah,30h |
||
432 | push bx |
||
433 | mov bx,word [vmselect] |
||
434 | cmp bx,0 |
||
435 | jnz sk_loc_00 |
||
436 | cmp ah,5 |
||
437 | je sk_loc_01 |
||
438 | mov bl,ah |
||
439 | mov [vmselect],bx |
||
440 | jmp sk_loc_01 |
||
441 | sk_loc_00: |
||
442 | push esi |
||
443 | push edx |
||
444 | push ecx |
||
445 | push eax |
||
446 | mov bh,ah |
||
447 | xor edx,edx |
||
448 | mov esi,_m1 |
||
449 | mov al,bl |
||
450 | dec al |
||
451 | xor ah,ah |
||
452 | mov cx,10 |
||
453 | mul cx |
||
454 | xor ecx,ecx |
||
455 | mov cx,ax |
||
456 | xor ax,ax |
||
457 | mov al,bh |
||
458 | dec al |
||
459 | shl ax,1 |
||
460 | add cx,ax |
||
461 | add esi,ecx |
||
462 | lodsw |
||
463 | cmp ax,0 |
||
464 | jnz sk_loc_02 |
||
465 | xor eax,eax |
||
466 | mov bh,ah |
||
467 | sk_loc_02: |
||
468 | mov [vmselect],bx |
||
469 | pop eax |
||
470 | pop ecx |
||
471 | pop edx |
||
472 | pop esi |
||
473 | sk_loc_01: |
||
474 | call draw_window |
||
475 | pop bx |
||
476 | retn |
||
477 | |||
478 | ; IN: ebx=Xstart*65536+Xend |
||
479 | ; ecx=Ystart*65536+Yend |
||
480 | ; edx=color |
||
481 | draw_rect: |
||
482 | push eax |
||
483 | push ebx |
||
484 | push ecx |
||
485 | push edx |
||
486 | push edi |
||
487 | xor eax,eax |
||
488 | mov al,38 |
||
489 | push ecx |
||
490 | mov edi,ecx |
||
491 | shr edi,16 |
||
492 | mov cx,di |
||
485 | heavyiron | 493 | mcall |
31 | halyavin | 494 | pop ecx |
495 | push ecx |
||
496 | mov edi,ecx |
||
497 | ror ecx,16 |
||
498 | mov cx,di |
||
485 | heavyiron | 499 | mcall |
31 | halyavin | 500 | pop ecx |
501 | push ebx |
||
502 | mov edi,ebx |
||
503 | shr edi,16 |
||
504 | mov bx,di |
||
485 | heavyiron | 505 | mcall |
31 | halyavin | 506 | pop ebx |
507 | mov edi,ebx |
||
508 | ror ebx,16 |
||
509 | mov bx,di |
||
485 | heavyiron | 510 | mcall |
31 | halyavin | 511 | pop edi |
512 | pop edx |
||
513 | pop ecx |
||
514 | pop ebx |
||
515 | pop eax |
||
516 | retn |
||
517 | |||
518 | ; |
||
519 | ; OUT: eax = 0 - no event |
||
520 | protect_and_return: |
||
521 | push ebx |
||
522 | push ecx |
||
523 | xor eax,eax |
||
524 | mov al,5 |
||
525 | xor ebx,ebx |
||
526 | mov bx,300 |
||
485 | heavyiron | 527 | mcall |
31 | halyavin | 528 | call get_pid |
529 | xor eax,eax |
||
530 | mov ebx,eax |
||
531 | mov ecx,eax |
||
532 | mov al,18 |
||
533 | mov ebx,3 |
||
534 | mov cx,[mypno] |
||
485 | heavyiron | 535 | mcall |
31 | halyavin | 536 | pop ecx |
537 | pusha |
||
538 | call draw_window |
||
539 | popa |
||
540 | xor eax,eax |
||
541 | mov al,5 |
||
542 | xor ebx,ebx |
||
543 | mov bx,300 |
||
485 | heavyiron | 544 | mcall |
31 | halyavin | 545 | xor eax,eax |
546 | mov al,11 |
||
485 | heavyiron | 547 | mcall |
31 | halyavin | 548 | cmp eax,1 |
549 | jne par_loc_00 |
||
550 | pusha |
||
551 | call draw_window |
||
552 | popa |
||
553 | par_loc_00: |
||
554 | xor eax,eax |
||
555 | mov ebx,eax |
||
556 | mov al,23 |
||
557 | mov bx,700 |
||
485 | heavyiron | 558 | mcall |
31 | halyavin | 559 | cmp eax,0 |
560 | jnz par_loc_02 |
||
561 | ; mov [ftr_eax],eax |
||
562 | mov edx,[oldvm] |
||
563 | call set_my_mode |
||
564 | par_loc_02: |
||
565 | pop ebx |
||
566 | retn |
||
567 | |||
568 | debug_ftr: |
||
569 | ; xor eax,eax |
||
570 | ; mov ebx,eax |
||
571 | ; mov al,47 |
||
572 | ; mov bl,8 |
||
573 | ; shl ebx,16 |
||
574 | ; mov bh,1 |
||
575 | ; mov ecx,[ftr_eax] |
||
576 | ; mov edx,20*65536+180 |
||
577 | ; mov esi,00FFFFFFh |
||
485 | heavyiron | 578 | ; mcall |
31 | halyavin | 579 | ; mov ecx,[ftr_ebx] |
580 | ; add edx,54*65536 |
||
485 | heavyiron | 581 | ; mcall |
31 | halyavin | 582 | retn |
583 | |||
584 | print_cur_vm: |
||
585 | mov eax,4 |
||
586 | mov ebx,20*65536+40 |
||
587 | mov ecx,0000FF00h |
||
588 | mov edx,curmode |
||
589 | mov esi,cmlen |
||
485 | heavyiron | 590 | mcall |
31 | halyavin | 591 | mov al,14 |
485 | heavyiron | 592 | mcall |
31 | halyavin | 593 | mov esi,00FFFFFFh |
594 | mov edi,eax |
||
595 | shr eax,16 |
||
596 | xor ecx,ecx |
||
597 | mov cx,ax |
||
598 | inc ecx |
||
599 | xor ebx,ebx |
||
600 | mov bl,4 |
||
601 | shl ebx,16 |
||
602 | mov edx,104*65536+40 |
||
603 | mov eax,47 |
||
485 | heavyiron | 604 | mcall |
31 | halyavin | 605 | add edx,30*65536 |
606 | mov cx,di |
||
607 | inc ecx |
||
485 | heavyiron | 608 | mcall |
31 | halyavin | 609 | add edx,30*65536 |
610 | mov ecx,[initrr] |
||
611 | sub ebx,1*65536 |
||
485 | heavyiron | 612 | mcall |
31 | halyavin | 613 | mov al,4 |
614 | mov ebx,200*65536+40 |
||
615 | mov ecx,0000FF00h |
||
616 | mov edx,selmode |
||
617 | mov esi,cmlen |
||
485 | heavyiron | 618 | mcall |
31 | halyavin | 619 | mov ax,[vmselect] |
620 | cmp ax,0 |
||
621 | jz pcv_loc_00 |
||
622 | push eax |
||
623 | xor eax,eax |
||
624 | mov al,13 |
||
625 | mov ebx,284*65536+54 |
||
626 | mov ecx,40*65536+10 |
||
627 | mov edx,000020C0h |
||
485 | heavyiron | 628 | mcall |
31 | halyavin | 629 | pop eax |
630 | push eax |
||
631 | xor ecx,ecx |
||
632 | dec al |
||
633 | mov cl,al |
||
634 | shl cx,3 |
||
635 | add cl,al ; cx=(al-1)*9 |
||
636 | mov edx,_m1280x1024 |
||
637 | add edx,ecx |
||
638 | xor eax,eax |
||
639 | mov al,4 |
||
640 | mov esi,9 |
||
641 | mov ebx,284*65536+40 |
||
642 | mov ecx,00ff0000h |
||
485 | heavyiron | 643 | mcall |
31 | halyavin | 644 | pop eax |
645 | cmp ah,0 |
||
646 | jz pcv_loc_00 |
||
647 | push esi |
||
648 | push edx |
||
649 | push ecx |
||
650 | push eax |
||
651 | xor eax,eax |
||
652 | mov al,13 |
||
653 | mov ebx,344*65536+18 |
||
654 | mov ecx,40*65536+10 |
||
655 | mov edx,000020C0h |
||
485 | heavyiron | 656 | mcall |
31 | halyavin | 657 | pop eax |
658 | push eax |
||
659 | mov bx,ax |
||
660 | xor edx,edx |
||
661 | mov esi,_m1 |
||
662 | mov al,bl |
||
663 | dec al |
||
664 | xor ah,ah |
||
665 | mov cx,10 |
||
666 | mul cx |
||
667 | xor ecx,ecx |
||
668 | mov cx,ax |
||
669 | xor ax,ax |
||
670 | mov al,bh |
||
671 | dec al |
||
672 | shl ax,1 |
||
673 | add cx,ax |
||
674 | add esi,ecx |
||
675 | lodsw |
||
676 | xor ecx,ecx |
||
677 | mov cx,ax |
||
678 | xor ebx,ebx |
||
679 | mov bl,3 |
||
680 | shl ebx,16 |
||
681 | mov edx,344*65536+40 |
||
682 | xor eax,eax |
||
683 | mov al,47 |
||
684 | mov esi,00ff0000h |
||
485 | heavyiron | 685 | mcall |
31 | halyavin | 686 | pop eax |
687 | pop ecx |
||
688 | pop edx |
||
689 | pop esi |
||
690 | pcv_loc_00: |
||
691 | retn |
||
692 | |||
693 | print_all_herz: |
||
694 | push esi |
||
695 | push edi |
||
696 | push eax |
||
697 | push ebx |
||
698 | push ecx |
||
699 | push edx |
||
700 | cld |
||
701 | mov esi,_m1 |
||
702 | mov ebx,(10+36+26)*65536+86 |
||
703 | mov edx,66*65536 |
||
704 | xor ecx,ecx |
||
705 | mov cl,4 |
||
706 | pah_loc_00: |
||
707 | push ecx |
||
708 | push edx |
||
709 | push ebx |
||
710 | mov cl,5 |
||
711 | xor edx,edx |
||
712 | mov dl,12 |
||
713 | pah_loc_01: |
||
714 | lodsw |
||
715 | cmp ax,00h |
||
716 | jnz pah_loc_02 |
||
717 | call print_noherz |
||
718 | jmp pah_loc_03 |
||
719 | pah_loc_02: |
||
720 | call print_herz |
||
721 | pah_loc_03: |
||
722 | add ebx,edx |
||
723 | loop pah_loc_01 |
||
724 | pop ebx |
||
725 | pop edx |
||
726 | add ebx,edx |
||
727 | pop ecx |
||
728 | loop pah_loc_00 |
||
729 | pop edx |
||
730 | pop ecx |
||
731 | pop ebx |
||
732 | pop eax |
||
733 | pop edi |
||
734 | pop esi |
||
735 | retn |
||
736 | |||
737 | ; IN: ebx=X*65536+Y - coordinate |
||
738 | print_noherz: |
||
739 | push eax |
||
740 | push ebx |
||
741 | push ecx |
||
742 | push edx |
||
743 | push esi |
||
744 | xor eax,eax |
||
745 | mov al,4 |
||
746 | mov ecx,00FFFFFFh |
||
747 | mov edx,noherz |
||
748 | xor esi,esi |
||
749 | mov si,3 |
||
485 | heavyiron | 750 | mcall |
31 | halyavin | 751 | pop esi |
752 | pop edx |
||
753 | pop ecx |
||
754 | pop ebx |
||
755 | pop eax |
||
756 | retn |
||
757 | |||
758 | ; IN: eax=numer_of_herz |
||
759 | ; ebx=X*65536+Y |
||
760 | print_herz: |
||
761 | push eax |
||
762 | push ebx |
||
763 | push ecx |
||
764 | push edx |
||
765 | push esi |
||
766 | mov edx,ebx |
||
767 | xor ebx,ebx |
||
768 | mov bl,3 |
||
769 | shl ebx,16 |
||
770 | mov ecx,eax |
||
771 | mov esi,00FFFFFFh |
||
772 | xor eax,eax |
||
773 | mov al,47 |
||
485 | heavyiron | 774 | mcall |
31 | halyavin | 775 | pop esi |
776 | pop edx |
||
777 | pop ecx |
||
778 | pop ebx |
||
779 | pop eax |
||
780 | retn |
||
781 | |||
782 | get_pixelclock: |
||
783 | retn |
||
784 | |||
785 | ; light version of function |
||
786 | calc_refrate: |
||
787 | retn |
||
788 | |||
789 | rect_select: |
||
790 | mov ax,[vmselect] |
||
791 | ; mov [ftr_ebx],eax |
||
792 | cmp ax,00h |
||
793 | je rs_loc_00 |
||
794 | cmp ah,0 |
||
795 | jne rs_loc_01 |
||
796 | dec al |
||
797 | mov cx,66 |
||
798 | mul cx |
||
799 | add ax,46 |
||
800 | mov bx,ax |
||
801 | shl ebx,16 |
||
802 | add ax,66 |
||
803 | mov bx,ax |
||
804 | mov ecx,60*65536+144 |
||
805 | mov edx,00ff0000h |
||
806 | call draw_rect |
||
807 | retn |
||
808 | rs_loc_01: |
||
809 | push ax |
||
810 | xor ah,ah |
||
811 | dec al |
||
812 | xor ebx,ebx |
||
813 | mov bx,66 |
||
814 | mul bx |
||
815 | add ax,46 |
||
816 | mov bx,ax |
||
817 | shl ebx,16 |
||
818 | add ax,66 |
||
819 | mov bx,ax |
||
820 | pop ax |
||
821 | xchg ah,al |
||
822 | xor ah,ah |
||
823 | dec al |
||
824 | xor ecx,ecx |
||
825 | mov cx,12 |
||
826 | mul cx |
||
827 | add ax,84 |
||
828 | mov cx,ax |
||
829 | shl ecx,16 |
||
830 | add ax,12 |
||
831 | mov cx,ax |
||
832 | mov edx,00ff0000h |
||
833 | call draw_rect |
||
834 | rs_loc_00: |
||
835 | retn |
||
836 | |||
837 | draw_face: |
||
838 | call draw_table |
||
839 | ; |
||
840 | ; |
||
841 | mov ebx,320*65536+390 |
||
842 | mov ecx,66*65536+144 |
||
843 | mov edx,0000FF00h |
||
844 | call draw_rect |
||
845 | mov ebx,10*65536+390 |
||
846 | mov ecx,27*65536+55 |
||
847 | call draw_rect |
||
848 | add ebx,2*65536 |
||
849 | sub bx,2 |
||
850 | add ecx,2*65536 |
||
851 | sub cx,2 |
||
852 | call draw_rect |
||
853 | mov ebx,10*65536+390 |
||
854 | mov ecx,155*65536+193 |
||
855 | call draw_rect |
||
856 | add ebx,2*65536 |
||
857 | sub bx,2 |
||
858 | add ecx,2*65536 |
||
859 | sub cx,2 |
||
860 | call draw_rect |
||
861 | xor eax,eax |
||
862 | mov al,13 |
||
863 | mov ebx,182*65536+36 |
||
864 | mov ecx,26*65536+5 |
||
865 | mov edx,000020C0h |
||
485 | heavyiron | 866 | mcall |
31 | halyavin | 867 | mov ebx,173*65536+54 |
868 | mov ecx,153*65536+7 |
||
485 | heavyiron | 869 | mcall |
31 | halyavin | 870 | mov ebx,337*65536+36 |
871 | mov ecx,62*65536+10 |
||
485 | heavyiron | 872 | mcall |
31 | halyavin | 873 | mov al,4 |
874 | shr ecx,16 |
||
875 | mov bx,cx |
||
876 | add ebx,3*65536 |
||
877 | mov ecx,00FF0000h |
||
878 | mov edx,width |
||
879 | mov esi,5 |
||
485 | heavyiron | 880 | mcall |
31 | halyavin | 881 | xor ecx,ecx |
882 | add edx,5 |
||
883 | xor esi,esi |
||
884 | inc esi |
||
885 | mov ebx,335*65536+104 |
||
485 | heavyiron | 886 | mcall |
31 | halyavin | 887 | add ebx,36*65536 |
888 | inc edx |
||
485 | heavyiron | 889 | mcall |
31 | halyavin | 890 | mov edx,tmode |
891 | mov ecx,00FF0000h |
||
892 | mov ebx,182*65536+24 |
||
893 | mov esi,6 |
||
485 | heavyiron | 894 | mcall |
31 | halyavin | 895 | mov edx,actions |
896 | mov ebx,173*65536+152 |
||
897 | mov esi,9 |
||
485 | heavyiron | 898 | mcall |
31 | halyavin | 899 | xor ecx,ecx |
900 | mov edx,button1 |
||
901 | mov ebx,59*65536+174 |
||
902 | mov esi,2 |
||
485 | heavyiron | 903 | mcall |
31 | halyavin | 904 | add edx,esi |
905 | mov esi,6 |
||
906 | add ebx,78*65536 |
||
485 | heavyiron | 907 | mcall |
31 | halyavin | 908 | add edx,esi |
909 | add ebx,90*65536 |
||
485 | heavyiron | 910 | mcall |
31 | halyavin | 911 | add edx,esi |
912 | mov esi,7 |
||
913 | add ebx,87*65536 |
||
485 | heavyiron | 914 | mcall |
31 | halyavin | 915 | call rect_select |
916 | ; call debug_ftr |
||
917 | call print_cur_vm |
||
918 | call print_all_herz |
||
919 | retn |
||
920 | |||
921 | warning_info: |
||
922 | call warning_window |
||
923 | call warning_loop |
||
924 | retn |
||
925 | |||
926 | warning_window: |
||
927 | mov eax,12 ; function 12:tell os about windowdraw |
||
928 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 929 | mcall |
31 | halyavin | 930 | ; DRAW WARNING WINDOW |
180 | heavyiron | 931 | xor eax,eax ; function 0 : define and draw window |
31 | halyavin | 932 | mov ebx,[oldX] |
933 | shr ebx,1 |
||
934 | sub ebx,200 |
||
935 | shl ebx,16 |
||
936 | mov bx,400 |
||
937 | ; mov ecx,100*65536+200 ; [y start] *65536 + [y size] |
||
938 | mov ecx,[oldY] |
||
939 | shr ecx,1 |
||
940 | sub ecx,100 |
||
941 | shl ecx,16 |
||
942 | mov cx,200 |
||
180 | heavyiron | 943 | mov edx,0x13808080 ; color of work area RRGGBB,8->color glide |
485 | heavyiron | 944 | mov edi,title |
945 | mcall |
||
180 | heavyiron | 946 | |
31 | halyavin | 947 | ; WARNING TEXT |
948 | mov eax,4 ; function 4 : write text to window |
||
180 | heavyiron | 949 | mov ebx,(200-(len_warn00/2)*6)*65536+60 ; [x start] *65536 + [y |
31 | halyavin | 950 | ;] |
951 | mov ecx,0xf0ff0000 ; color of text RRGGBB |
||
952 | mov edx,warn00 ; pointer to text beginning |
||
953 | mov esi,len_warn00 ; text length |
||
485 | heavyiron | 954 | ; mcall |
31 | halyavin | 955 | ; inc ebx |
485 | heavyiron | 956 | mcall |
31 | halyavin | 957 | add ebx,1*65536 |
485 | heavyiron | 958 | mcall |
31 | halyavin | 959 | mov ebx,(200-(len_warn01/2)*6)*65536+100 |
960 | mov edx,warn01 |
||
961 | mov esi,len_warn01 |
||
485 | heavyiron | 962 | mcall |
31 | halyavin | 963 | mov edx,button1 |
964 | add ecx,0ffffh |
||
965 | mov ebx,(200-6)*65536+(160-4) |
||
966 | mov esi,2 |
||
485 | heavyiron | 967 | mcall |
31 | halyavin | 968 | mov eax,12 ; function 12:tell os about windowdraw |
969 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 970 | mcall |
31 | halyavin | 971 | retn |
972 | |||
973 | warning_loop: |
||
974 | mov eax,5 |
||
131 | diamond | 975 | mov ebx,13 |
485 | heavyiron | 976 | mcall |
31 | halyavin | 977 | mov eax,11 |
485 | heavyiron | 978 | mcall |
31 | halyavin | 979 | cmp eax,1 ; redraw request ? |
980 | je warning_red |
||
981 | cmp eax,2 ; key in buffer ? |
||
982 | je warning_key |
||
983 | cmp eax,3 ; button in buffer ? |
||
984 | je warning_button |
||
985 | mov eax,4 |
||
986 | mov ebx,(200-(len_warn01/2)*6)*65536+100 |
||
987 | mov ecx,[blinkcol] |
||
988 | sub cl,12 |
||
989 | dec cl |
||
990 | dec cl |
||
991 | dec cl |
||
992 | dec cl |
||
993 | mov [blinkcol],ecx |
||
994 | mov ch,0f0h |
||
995 | shl ecx,16 |
||
996 | mov edx,warn01 |
||
997 | mov esi,len_warn01 |
||
485 | heavyiron | 998 | mcall |
31 | halyavin | 999 | sub ebx,1*65536 |
485 | heavyiron | 1000 | mcall |
31 | halyavin | 1001 | jmp warning_loop |
1002 | warning_red: ; redraw |
||
1003 | call warning_window |
||
1004 | jmp warning_loop |
||
1005 | warning_key: ; key |
||
1006 | mov eax,2 ; read key |
||
485 | heavyiron | 1007 | mcall |
31 | halyavin | 1008 | cmp ah,01h |
1009 | jne warning_loop |
||
1010 | xor eax,eax |
||
1011 | dec eax ; Terminate application |
||
485 | heavyiron | 1012 | mcall |
31 | halyavin | 1013 | jmp warning_loop |
1014 | warning_button: ; button |
||
1015 | mov eax,17 ; get id |
||
485 | heavyiron | 1016 | mcall |
31 | halyavin | 1017 | cmp ah,1 ; button id=1 ? |
1018 | jne warning_loop |
||
1019 | xor eax,eax |
||
1020 | dec eax ; close this program |
||
485 | heavyiron | 1021 | mcall |
31 | halyavin | 1022 | jmp warning_loop |
1023 | retn |
||
1024 | |||
1025 | ;------------DATA AREA--------------- |
||
1026 | |||
1027 | oldX dd ? |
||
1028 | oldY dd ? |
||
1029 | initvm dd ? |
||
1030 | currvm dd 0 |
||
1031 | oldvm dd 0 |
||
1032 | refrate dd 0 |
||
1033 | initrr dd 0 |
||
1034 | mypid dd ? |
||
1035 | mypno dw ? |
||
1036 | totp dd ? |
||
1037 | vmselect dw 0 |
||
1038 | ftr_eax dd ? |
||
1039 | ftr_ebx dd ? |
||
1040 | blinkcol dd 0ffh |
||
1041 | |||
1042 | ; db 0,0,0,0,0,0,0,0 |
||
1043 | ;_m1 dw 0,0,0,0,0 |
||
1044 | ;_m2 dw 0,0,0,0,0 |
||
1045 | ;_m3 dw 0,0,0,0,0 |
||
1046 | ;_m4 dw 0,0,0,0,0 |
||
1047 | |||
485 | heavyiron | 1048 | title db 'Vertical Refresh Rate v2.0 (C) 2003 TRANS',0 |
31 | halyavin | 1049 | |
1050 | _m1280x1024 db '1280x1024' |
||
1051 | _m1024x768 db '1024x768 ' |
||
1052 | _m800x600 db ' 800x600 ' |
||
1053 | _m640x480 db ' 640x480 ' |
||
1054 | _mk db 'Key1Key2' |
||
1055 | |||
1056 | curmode db 'Current mode: ' |
||
1057 | db ' x x Hz' |
||
1058 | cmlen=$-curmode |
||
1059 | selmode db ' Select mode: ' |
||
1060 | selcans db '----x----x---Hz' |
||
1061 | noherz db '---' |
||
1062 | width db 'Width',11h,10h |
||
1063 | tmode db ' Mode ' |
||
1064 | actions db ' Actions ' |
||
1065 | button1 db 'Ok' ;len=2 |
||
1066 | button2 db 'Cancel' ;len=6 |
||
1067 | button3 db 'Return' ;len=6 |
||
1068 | button4 db 'Default' ;len=7 |
||
1069 | |||
1070 | strt db 'LAUNCHER ' |
||
1071 | |||
1072 | warn00 db ' W A R N I N G ! ' |
||
1073 | len_warn00=$-warn00 |
||
1074 | warn01 db 'V i d e o D r i v e r N O T I n s t a l l e d' |
||
1075 | len_warn01=$-warn01 |
||
1076 | |||
1077 | |||
1078 | drvinfo: ; 512 bytes driver info area |
||
1079 | ; +0 - Full driver name |
||
1080 | ; +32 - Driver version |
||
1081 | ; +64 - Word List of support video modes (max 32 positions) |
||
1082 | ; +128 - 5 words list of support vertical rate to each present mode |
||
1083 | org $+32 |
||
1084 | drvver: |
||
1085 | org $+32 |
||
1086 | vidmode: |
||
1087 | org $+64 |
||
1088 | _m1: |
||
1089 | org drvinfo+200h |
||
1090 | |||
1091 | buffer: |
||
1092 | I_END:><><<> |
||
1093 |