Subversion Repositories Kolibri OS

Rev

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