Subversion Repositories Kolibri OS

Rev

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