Subversion Repositories Kolibri OS

Rev

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