Subversion Repositories Kolibri OS

Rev

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