Subversion Repositories Kolibri OS

Rev

Rev 957 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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