Subversion Repositories Kolibri OS

Rev

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