Subversion Repositories Kolibri OS

Rev

Rev 532 | Blame | Last modification | View Log | Download | RSS feed

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;                                                   ;
  3. ;    MENUBAR for KolibriOS  - Compile with fasm     ;
  4. ;                                                   ;
  5. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  6.  
  7. use32
  8.   org  0x0
  9.   db   'MENUET01'   ; 8 byte id
  10.   dd   0x01         ; header version
  11.   dd   START        ; program start
  12.   dd   I_END        ; program image size
  13.   dd   0xA000       ; reguired amount of memory - 10 Kb
  14.   dd   0xA000       ; esp
  15.   dd   0x0,0x0      ; param, icon
  16.  
  17. include 'lang.inc'
  18. include '..\..\..\macros.inc'
  19.  
  20. width           dd  305
  21. buttons         dd    1  ;  0 no frames  ; 1 frames
  22. soften_up       dd    1  ;  0 no         ; 1 yes
  23. soften_down     dd    0  ;  0 no         ; 1 yes
  24. minimize_left   dd    1
  25. minimize_right  dd    1
  26. icons_position  dd   95
  27. menu_enable     dd    1
  28. setup_enable    dd    0
  29. graph_text      dd    1
  30. soften_middle   dd    1  ;  0 no         ; 1 yes
  31. icons           dd    1  ;  0 defaults   ; 1 activate
  32.  
  33. PANEL_HEIGHT = 18
  34.  
  35. handle_key:
  36.  
  37.     mcall 18, 7
  38.     mov  [active_process],eax
  39.  
  40.         mcall 2
  41.         cmp     al, 2
  42.         jnz     begin_1.ret
  43.         mov     ebx, exec_fileinfo
  44.         shr     eax, 8
  45.         cmp     al, 15
  46.         jz      alt_tab_pressed
  47.         cmp     al, 88
  48.         jz      start_end_application
  49.         cmp     al, 91
  50.         jz      start_menu_application
  51.         cmp     al, 92
  52.         jz      start_menu_application
  53.         cmp     al, 62
  54.         jz      kill_active_application
  55.         cmp     al, 71
  56.         jz      page_list_next
  57.         cmp     al, 72
  58.         jz      page_list_prev
  59.         cmp     [current_alt_tab_app], -1
  60.         jz      @f
  61.         test    ah, 0x30
  62.         jz      alt_tab_released
  63. @@:
  64. ; this is hotkey Ctrl+Shift ;or LShift+RShift
  65.         mov     ebx, setup_exec
  66. ;        test    ah, 001100b
  67. ;        jz      change_sys_lang
  68. change_key_lang:
  69.         mov     dword [ebx+8], chlang
  70.         mcall   70
  71.         call    chlang_music
  72. ;       mcall   5, 25
  73. begin_1:
  74.     mov  ecx,[active_process]
  75.     mcall 18, 3
  76.     mcall 5, 25
  77. .ret:
  78.         ret
  79.  
  80. ;change_sys_lang:
  81. ;        mov     dword [ebx+8], syslang
  82. ;        mcall   70
  83. ;        call    syslang_music
  84. ;;       mcall   5, 25
  85. ;        jmp     begin_1
  86.  
  87.   start_end_application:
  88.         mov     dword [ebx+21], end_name
  89.         mcall   70
  90.      mcall 5 ,50
  91.      jmp   begin_1.ret
  92.  
  93.    kill_active_application:
  94.      mcall  18, 7
  95.      mov    ecx,eax
  96.      
  97.      ;//{SPraid.simba do not kill panel and icon
  98.      push eax
  99.      mov eax,9
  100.      mov ebx, process_info_buffer
  101.      int 0x40
  102.      mov eax,process_info_buffer
  103.      add eax,10
  104.      mov ebx,[eax]
  105.      cmp ebx,'ICON'
  106.      je  no_kill
  107.      cmp ebx,'@PAN'
  108.      jne  kill_app
  109.      add eax,4
  110.      mov ebx,[eax]
  111.      and ebx,0x0000FFFF
  112.      cmp ebx,'EL'
  113.      je  no_kill
  114.    kill_app:  
  115.      pop ecx
  116.      mcall  18, 2
  117.      jmp if_kill
  118.    no_kill:
  119.      pop eax
  120.    if_kill:
  121.      ;// }SPraid.simba
  122.      
  123.      jmp    begin_1.ret
  124.  
  125.    start_menu_application:
  126.         mov     [draw_window_1], 1
  127.         mov     dword [ebx+21], menu_name
  128.         mcall   70
  129.         call    menu_music
  130.      mcall 5,50
  131.      jmp   begin_1.ret
  132.  
  133. page_list_next:
  134.     cmp  [page_list],15
  135.     je     @f
  136.     inc  [page_list]
  137.     mov  [draw_window_1],1
  138.   @@:
  139.     jmp  begin_1.ret
  140.  
  141. page_list_prev:
  142.     cmp  [page_list],0
  143.     je     @f
  144.     dec  [page_list]
  145.     mov  [draw_window_1],1
  146.   @@:
  147.     jmp  begin_1.ret
  148.  
  149. alt_tab_pressed:
  150. ; handle Alt+Tab and Alt+Shift+Tab
  151.         mov     ebp, eax
  152.         cmp     [current_alt_tab_app], -1
  153.         jnz     has_alt_tab_app
  154. ; § ¯®«­ï¥¬ â ¡«¨æ㠯ਫ®¦¥­¨©, ¯®¤«¥¦ é¨å ¯¥à¥ª«î祭¨î
  155.         xor     edx, edx
  156.         mov     ebx, 0x8000
  157.         mov     ecx, 1
  158.         mov     eax, 9
  159. .fill:
  160.         inc     ecx
  161.         int     0x40
  162.         call    need_window_tab
  163.         jz      @f
  164.         cmp     edx, 256
  165.         jz      @f
  166.         mov     [alt_tab_list+edx*8], ecx
  167.         movzx   esi, word [ebx+4]
  168.         mov     [alt_tab_list+edx*8+4], esi
  169.         inc     edx
  170. @@:
  171.         cmp     ecx, eax
  172.         mov     eax, 9
  173.         jb      .fill
  174.         mov     [alt_tab_list_size], edx
  175.         test    edx, edx
  176.         jz      begin_1.ret
  177.         mcall   66,4,0,0        ; «®¢¨¬ ¬®¬¥­â ®â¯ã᪠­¨ï ¢á¥å ã¯à ¢«ïîé¨å ª« ¢¨è
  178.         test    eax, eax
  179.         jnz     begin_1.ret
  180.         xor     edx, edx
  181.         mov     eax, [alt_tab_list+4]
  182.         xor     ecx, ecx
  183.         inc     ecx
  184. .findmax:
  185.         cmp     [alt_tab_list+ecx*8+4], eax
  186.         jb      @f
  187.         mov     edx, ecx
  188.         mov     eax, [alt_tab_list+ecx*8+4]
  189. @@:
  190.         inc     ecx
  191.         cmp     ecx, [alt_tab_list_size]
  192.         jb      .findmax
  193.         mov     [current_alt_tab_app], edx
  194. has_alt_tab_app:
  195.         mov     eax, [current_alt_tab_app]
  196.         mov     edx, [alt_tab_list+eax*8+4]     ; slot
  197.         xor     ecx, ecx
  198.         or      eax, -1
  199.         test    ebp, 300h
  200.         jz      .notshift
  201.         or      esi, -1
  202. .loop1:
  203.         cmp     [alt_tab_list+ecx*8+4], edx
  204.         jbe     @f
  205.         cmp     [alt_tab_list+ecx*8+4], esi
  206.         jae     @f
  207.         mov     eax, ecx
  208.         mov     esi, [alt_tab_list+ecx*8+4]
  209. @@:
  210.         inc     ecx
  211.         cmp     ecx, [alt_tab_list_size]
  212.         jb      .loop1
  213.         cmp     eax, -1
  214.         jnz     .found
  215.         xor     edx, edx
  216.         xor     ecx, ecx
  217.         jmp     .loop1
  218. .notshift:
  219.         xor     esi, esi
  220. .loop2:
  221.         cmp     [alt_tab_list+ecx*8+4], edx
  222.         jae     @f
  223.         cmp     [alt_tab_list+ecx*8+4], esi
  224.         jbe     @f
  225.         mov     eax, ecx
  226.         mov     esi, [alt_tab_list+ecx*8+4]
  227. @@:
  228.         inc     ecx
  229.         cmp     ecx, [alt_tab_list_size]
  230.         jb      .loop2
  231.         cmp     eax, -1
  232.         jnz     .found
  233.         or      edx, -1
  234.         xor     ecx, ecx
  235.         jmp     .loop2
  236. .found:
  237.         mov     [current_alt_tab_app], eax
  238.         push    eax
  239.         xor     edx, edx
  240.         div     [max_applications]
  241.         mov     [page_list], eax
  242.         mov     [draw_window_1], 1
  243.         mov     edi, app_list
  244.         push    edi
  245.         mov     ecx, 20
  246.         or      eax, -1
  247.         rep     stosd
  248.         pop     edi
  249.         pop     ecx
  250.         sub     ecx, edx
  251. @@:
  252.         cmp     ecx, [alt_tab_list_size]
  253.         jae     redraw_window_tabs
  254.         mov     eax, [alt_tab_list+ecx*8]
  255.         stosd
  256.         inc     ecx
  257.         jmp     @b
  258.  
  259. alt_tab_released:
  260.         mcall   66,5,0,0        ; 㦥 ¯®©¬ «¨, 墠â¨â :)
  261.         or      eax, -1
  262.         xchg    eax, [current_alt_tab_app]
  263.         mov     ecx, [alt_tab_list+eax*8]
  264.         mov     eax, 18
  265.         mov     ebx, 3
  266.         int     0x40
  267.         jmp     redraw_window_tabs
  268.  
  269. active_process  dd 0
  270.  
  271. calendar_music:
  272.     mcall 55, eax, , , calendarmusic
  273.     ret
  274. setup_music:
  275.     mcall 55,eax, , ,setupmusic
  276.     ret
  277. sysmeter_music:
  278.     mcall 55,eax, , ,sysmetermusic
  279.     ret
  280. button_music:
  281.     mcall 55,eax, , ,buttonmusic
  282.     ret
  283. ;syslang_music:
  284. ;    mcall 55, eax, , , syslangmusic
  285. ;    ret
  286. chlang_music:
  287.     mcall 55, eax, , , chlangmusic
  288.     ret
  289. menu_music:
  290.     mcall 55,eax, , ,menumusic
  291.     ret
  292.  
  293. chlangmusic:    db 0x82,0x60,0x83,0x65,0x82,0x60,0
  294.  
  295. ;syslangmusic:   db 0x82,0x65,0x83,0x70,0x82,0x65,0
  296.  
  297. menumusic:      db 0x82,0x50,0x84,0x48,0x82,0x50,0x84,0x53,0x82,0x51,0
  298.  
  299. activatemusic:  db 0x83,0x30,0x85,0x60,0
  300.  
  301. buttonmusic:    db 0x85,0x25,0x85,0x40,0
  302.  
  303. sysmetermusic:  db 0x85,0x35,0x85,0x45,0
  304.  
  305. setupmusic:     db 0x85,0x40,0x85,0x50,0
  306.  
  307. calendarmusic:  db 0x85,0x37,0x85,0x48,0
  308.  
  309. ;  .exit: mcall -1
  310.  
  311.  
  312. START:
  313.         mov     eax, 51
  314.         mov     ebx, 1
  315.         mov     ecx, detect_start
  316.         mov     edx, detect_stack
  317.         int     0x40
  318.         mcall 66,4,0,2          ; LShift+RShift
  319.         mcall 66, , ,11h        ; Ctrl+Shift
  320.         mcall 66,,88,110h       ; Alt+Ctrl+F12
  321.         mcall 66,,91,100h       ; Alt+LWin
  322.         mcall 66,,92            ; Alt+RWin
  323.         mcall 66,,62            ; Alt+F4
  324.         mcall 66,,71            ; Alt+Home
  325.         mcall 66,,72            ; Alt+Up
  326.         mcall 66,,15            ; Alt+Tab
  327.         mcall 66,,,101h         ; Alt+Shift+Tab
  328.     mcall 18, 8, 1
  329.     test eax, eax
  330.     jne  @f
  331.     mcall 18, 8, 2
  332.   @@:
  333.         mov     eax, 70
  334.         mov     ebx, dat_fileinfo
  335.         int     0x40
  336.  
  337.     mov  edi,width
  338.     mov  esi,I_END
  339.     xor  eax,eax
  340.   new_number:
  341.     cmp  [esi],byte ';'
  342.     je   number_ready
  343.     imul eax,10
  344.     movzx ebx,byte [esi]
  345.     sub  ebx,'0'
  346.     add  eax,ebx
  347.     inc  esi
  348.     jmp  new_number
  349.   number_ready:
  350.     stosd
  351.     xor  eax,eax
  352.     inc  esi
  353.     cmp  [esi],byte 'x'
  354.     jne  new_number
  355.  
  356.         mcall   14
  357.         mov     [screen_size],eax
  358.  
  359.         mcall   48,5
  360.         mov     ecx,eax
  361.         lea     edx,[ebx-PANEL_HEIGHT-1]
  362.         mcall   48,6
  363.  
  364.     call set_variables
  365.  
  366. start_after_minimize:
  367.  
  368.     call draw_window
  369.     call draw_info
  370.     call draw_running_applications
  371.  
  372.     mov  eax, 23
  373.     mov  ebx, 30
  374.     int  0x40
  375.  
  376. still:
  377. ;     mcall  13,<390,70>,<3,11>,0xffffff
  378. ;     mov    ecx,[button_presssed_alt]
  379. ;     mcall  47,0x80100,ecx ,400 shl 16+5,0
  380.  
  381.     call draw_info
  382.     call draw_running_applications
  383.  
  384.     mov  eax, 23
  385.     mov  ebx, 20
  386.     int  0x40
  387.  
  388.     cmp  eax,1          ; redraw ?
  389.     jz   red
  390.     cmp  eax,3          ; button ?
  391.     jz   button
  392.         call    handle_key
  393.         jmp     still
  394.  
  395.   red:                   ; redraw window
  396.  
  397.         mcall   14
  398.         movzx   ecx,ax
  399.         mov     edx,eax
  400.         shr     edx,16
  401.         cmp     [screen_size.height],ax
  402.         jne     @f
  403.         rol     eax,16
  404.         cmp     [screen_size.width],ax
  405.         je      .lp1
  406.         rol     eax,16
  407.     @@: mov     [screen_size],eax
  408.         sub     ecx,PANEL_HEIGHT
  409.         mcall   67,0,,,PANEL_HEIGHT
  410.  
  411.   .lp1:
  412.     call draw_window
  413.     call draw_info
  414.     jmp  still
  415.  
  416.   button:                ; button
  417.     mov  eax,17
  418.     int  0x40
  419.  
  420.     cmp  ah,50
  421.     jb   no_activate
  422.     cmp  ah,70
  423.     jg   no_activate
  424.  
  425.     movzx ecx,byte ah
  426.     sub  ecx,52
  427.     shl  ecx,2
  428.  
  429.     mov  eax,18
  430.     mov  ebx,3
  431.     mov  ecx,[app_list+ecx]
  432.     int  0x40
  433. ;    cmp  [music_type],0
  434. ;    je   still
  435.     mcall 55,eax, , ,activatemusic
  436.     jmp  still
  437.   no_activate:
  438.  
  439.  
  440.     cmp  ah,101           ; minimize to left
  441.     je   left_button
  442.  
  443.     cmp  ah,102           ; minimize to right
  444.     je   right_button
  445.  
  446.     cmp  ah,byte 1        ; start/terminate menu
  447.     jnz  noselect
  448.     call menu_handler
  449. ;    cmp  [music_type],0
  450. ;    je   still
  451.     call menu_music
  452.     jmp  still
  453.   noselect:
  454.  
  455.         mov     ebx, exec_fileinfo
  456.     cmp  ah,byte 2             ; start calendar
  457.     jnz  noid15  ;noclock
  458.         mov     dword [ebx+21], calendar_name
  459.         mov     eax, 70
  460.         int     0x40
  461.     call calendar_music
  462.     jmp  still
  463.  
  464.   noid15:
  465.     cmp  ah,16
  466.     jne  noid16
  467.         mov     ebx, setup_exec
  468.         mov     dword [ebx+8], chlang
  469.         mov     eax, 70
  470.         int     0x40
  471.     call chlang_music
  472.     mcall 5, 25
  473.     jmp  still
  474.  
  475.   noid16:
  476. ;    cmp  ah,17
  477. ;    jne  noid17
  478. ;        mov     ebx, setup_exec
  479. ;        mov     dword [ebx+8], syslang
  480. ;        mov     eax, 70
  481. ;        int     0x40
  482. ;    call syslang_music
  483. ;    mcall 5, 25
  484. ;    jmp  still
  485. ;
  486. ;  noid17:
  487.     cmp  ah,18
  488.     jne  noid18
  489.         mov     dword [ebx+21], sysmeter_name
  490.         mov     eax, 70
  491.         int     0x40
  492.     call sysmeter_music
  493.     jmp  still
  494.  
  495.   noid18:
  496.     cmp  ah,19
  497.     jne  noid19
  498. ;    inc  [music_type]
  499. ;    and  [music_type],1
  500.     mcall 18,8,2
  501. ;    mcall 18,8
  502. ;    mov [sound_flag],al
  503.  
  504. ;    mcall 15,4,2
  505.     mcall 15,3
  506.     jmp  red
  507.  
  508.   noid19:
  509.     cmp  ah,20             ; start system setup
  510.     jnz  noid20
  511.         mov     ebx, setup_exec
  512.         and     dword [ebx+8], 0
  513.         mov     eax, 70
  514.         int     0x40
  515.     call setup_music
  516.     jmp still
  517.  
  518.  noid20:
  519.     cmp  ah,21
  520.     jnz  noid21
  521.     cmp  [page_list],15
  522.     je     @f
  523.     inc  [page_list]
  524.     jmp  red
  525.   @@:
  526.     jmp still
  527.  
  528.  noid21:
  529.     cmp  ah,22
  530.     jnz  noid22
  531.     cmp  [page_list],0
  532.     je     @f
  533.     dec  [page_list]
  534.     jmp  red
  535.   @@:
  536.     jmp  still
  537.  
  538.  noid22:
  539.  
  540.     jmp  still
  541.  
  542.  
  543.  
  544. draw_running_applications:
  545.  
  546.     pusha
  547.  
  548.     cmp  [icons],1
  549.     jne  dr_ret
  550.  
  551.     call calculate_applications
  552.  
  553.     cmp  edi,[running_applications]
  554.     jne  noret
  555.     popa
  556.     ret
  557.   noret:
  558.  
  559. ;    cmp  edi,[running_applications]
  560. ;    jge  no_application_decrease
  561.     call draw_window
  562. ;  no_application_decrease:
  563.  
  564.     mov  [running_applications],edi
  565.  
  566.         call    redraw_window_tabs
  567.  
  568.   dr_ret:
  569.  
  570.     popa
  571.  
  572.     ret
  573.  
  574. need_window_tab:
  575. ; in: ebx->process info
  576. ; out: ZF set <=> do not draw
  577.         cmp     byte [ebx+10], '@'
  578.         jz      .nodraw
  579. ; \begin{diamond}[29.03.2007]
  580. ; do not draw undefined (zero-sized) windows
  581.         cmp     dword [ebx+42], 0
  582.         jnz     @f
  583.         cmp     dword [ebx+46], 0
  584.         jz      .nodraw
  585. @@:
  586. ; \end{diamond}[29.03.2007]
  587.         cmp     dword [ebx+10], 'ICON'
  588.         jnz     @f
  589.         cmp     [ebx+42], dword 51
  590.         jnz     @f
  591.         cmp     [ebx+46], dword 51
  592.         jz      .nodraw
  593. @@:
  594.         cmp     [ebx+10], dword '    '
  595. .nodraw:
  596.         ret
  597.  
  598. redraw_window_tabs:
  599.         xor     edi, edi
  600.         mov     [contrast], 0
  601. .loop:
  602.         mov     ecx, [app_list+edi*4]
  603.         cmp     ecx, -1
  604.         jz      .done
  605.  
  606.         push    ecx
  607.         mov     eax, 9
  608.         mov     ebx, 0x8000
  609.         int     0x40
  610.  
  611.         mov     eax, 13
  612.         imul    ebx, edi, 6*10*10000h
  613.         add     ebx, 6*10*10000h + 7*10000h + 54
  614.         mov     ecx, 3*10000h + 14
  615.         xor     edx, edx
  616.         int     0x40
  617.         sub     ebx, 10000h + 53
  618.         mov     ecx, 4*10000h + 12
  619.         int     0x40
  620.         sub     ebx, 10000h
  621.         mov     ecx, 5*10000h + 10
  622.         int     0x40
  623.         add     ebx, 56*10000h
  624.         mov     ecx, 4*10000h + 12
  625.         int     0x40
  626.         add     ebx, 10000h
  627.         mov     ecx, 5*10000h + 10
  628.         int     0x40
  629.  
  630.         mov     edx, 0x88FF
  631.         xor     [contrast], 1
  632.         jz      @f
  633.         mov     dh, 0x55
  634. @@:
  635.         pop     ecx
  636.         mov     esi, [current_alt_tab_app]
  637.         cmp     esi, -1
  638.         jz      @f
  639.         cmp     ecx, [alt_tab_list+esi*8]
  640.         jnz     @f
  641. ;        xor     edx, 0xFFFFFF
  642.         mov     edx, 0xFF8000
  643. @@:
  644.         sub     ebx, 55*10000h - 53
  645.         mov     ecx, 4*10000h + 12
  646.         int     0x40
  647.         sub     ebx, 10000h + 53
  648.         mov     ecx, 5*10000h + 10
  649.         int     0x40
  650.         add     ebx, 55*10000h
  651.         int     0x40
  652.  
  653.         mov     eax, 4
  654.         sub     ebx, 51*10000h - 6
  655.         mov     ecx, 0xffffff   ;[wcolor]
  656.         mov     edx, 0x8000+10
  657.         mov     esi, 11
  658.         int     0x40
  659.  
  660.         inc     edi
  661.         cmp     edi, [max_applications]
  662.         jb      .loop
  663. .done:
  664.         ret
  665.  
  666. calculate_applications:
  667.  
  668.     mov  eax,[max_applications]
  669.     mul  [page_list]
  670.     test eax,eax
  671.     je    @f
  672.     inc  eax
  673.   @@:
  674.     mov  [draw_start_position],eax
  675.  
  676.     mov  edi,app_list
  677.     mov  ecx,20
  678.     mov  eax,-1
  679.     cld
  680.     rep  stosd
  681.  
  682.     mov  edi,0
  683.     mov  ecx,2
  684.  
  685.   cnewpr:
  686.  
  687.     mov  eax,9
  688.     mov  ebx,0x8000
  689.     int  0x40
  690.  
  691.         call    need_window_tab
  692.         jz      cnorpl
  693.         sub     [draw_start_position], 1
  694.         jg      cnorpl
  695.  
  696.     mov  [app_list+edi*4],ecx
  697.  
  698.     inc  edi
  699.  
  700.   cnorpl:
  701.     inc  ecx
  702.  
  703.     cmp  eax,ecx
  704.     jge  cnewpr
  705.  
  706.     ret
  707.  
  708.  
  709. draw_application_buttons:
  710.  
  711.     pusha
  712.  
  713.     cmp [icons],1
  714.     jne da_ret
  715.  
  716.     mov  eax,14
  717.     int  0x40
  718.  
  719.     shr  eax,16
  720.  
  721.     cmp  eax,639
  722.     jne  now1
  723.     mov  [max_applications],7   ;6
  724.   now1:
  725.     cmp  eax,799
  726.     jne  now2
  727.     mov  [max_applications],9 ;10    ;8
  728.   now2:
  729.     cmp  eax,1023
  730.     jne  now3
  731.     mov  [max_applications],12 ;13   ;8
  732.   now3:
  733.     cmp  eax,1279
  734.     jne  now4
  735.     mov  [max_applications],17 ;18    ;8
  736.   now4:
  737.     mov  edi,1
  738.  
  739.   nb:
  740.  
  741.     mov  eax,8
  742.     mov  ebx,edi
  743.     shl  ebx,16
  744.     imul ebx,6*10            ;13
  745.     add  ebx,15*65536+10*6-1  ;13
  746.     mov  ecx,1*65536+17
  747.     mov  edx,edi
  748.     add  edx,51
  749.     cmp  [buttons],1
  750.     je   bufr
  751.     or   edx,0x60000000
  752.   bufr:
  753.     mov  esi,[wcolor]
  754.     sub  ebx,11 shl 16
  755.     int  0x40
  756.  
  757.     inc  edi
  758.     cmp  edi,[max_applications]
  759.     jbe  nb
  760.  
  761.   da_ret:
  762.  
  763.     popa
  764.  
  765.     ret
  766.  
  767.  
  768. menu_handler:
  769.         mov     eax, 70
  770.         mov     ebx, exec_fileinfo
  771.         mov     dword [ebx+21], menu_name
  772.         int     0x40
  773.         ret
  774.  
  775. draw_small_right:
  776.  
  777.     pusha
  778.  
  779.     mov  eax,12
  780.     mov  ebx,1
  781.     int  0x40
  782.  
  783.     mov  eax,0
  784.     mov  edx,[wcolor]
  785.     mov  esi,edx
  786.     mov  edi,edx
  787.     or   edx, 0x01000000
  788.     int  0x40
  789.  
  790.     mov  eax,8
  791.     mov  ebx,0*65536+9
  792.     mov  ecx,0*65536
  793.     mov  cx,[b_size_y]
  794.     mov  edx,1
  795.     mov  esi,[wcolor]
  796.     int  0x40
  797.  
  798.     mov  eax,4
  799.     mov  ebx,2*65536+16
  800.     cmp  [graph_text],1
  801.     jne  nos3
  802.     mov  ebx,2*65536+7
  803.   nos3:
  804.     mov  ecx,[wcolor]
  805.     add  ecx,0x303030
  806.     mov  edx,hidetext
  807.     mov  esi,1
  808.     int  0x40
  809.  
  810.     mov  eax,12
  811.     mov  ebx,2
  812.     int  0x40
  813.  
  814.     popa
  815.  
  816.     ret
  817.  
  818.  
  819.  
  820. draw_small_left:
  821.  
  822.     pusha
  823.  
  824.     mov  eax,12
  825.     mov  ebx,1
  826.     int  0x40
  827.  
  828.     mov  eax,0
  829.     mov  edx,[wcolor]
  830.     mov  esi,edx
  831.     mov  edi,edx
  832.     or   edx, 0x01000000
  833.     int  0x40
  834.  
  835.     cmp  [graph_text],1
  836.     je   nos4
  837.  
  838.     mov  eax,8
  839.     mov  ebx,0*65536+9
  840.     mov  ecx,0*65536+18-6
  841.     mov  edx,2
  842.     mov  esi,[wcolor]
  843.     int  0x40
  844.  
  845.     mov  eax,4
  846.     mov  ebx,2*65536+4
  847.     mov  ecx,[wcolor]
  848.     add  ecx,0x303030
  849.     mov  edx,hidetext+2
  850.     mov  esi,1
  851.     int  0x40
  852.  
  853.   nos4:
  854.  
  855.     mov  eax,8
  856.     mov  ebx,0*65536+9
  857.     mov  ecx,13*65536+25
  858.     cmp  [graph_text],1
  859.     jne  nos6
  860.     mov  ecx,0*65536
  861.     mov  cx,word [b_size_y]
  862.   nos6:
  863.     mov  edx,1
  864.     mov  esi,[wcolor]
  865.     int  0x40
  866.  
  867.     mov  eax,4
  868.     mov  ebx,3*65536+22
  869.     cmp  [graph_text],1
  870.     jne  nos7
  871.     mov  ebx,3*65536+7
  872.   nos7:
  873.     mov  ecx,[wcolor]
  874.     add  ecx,0x303030
  875.     mov  edx,hidetext+1
  876.     mov  esi,1
  877.     int  0x40
  878.  
  879.     mov  eax,12
  880.     mov  ebx,2
  881.     int  0x40
  882.  
  883.     popa
  884.     ret
  885.  
  886.  
  887. ;-------------------------------------------------
  888.  
  889. right_button:
  890.  
  891.     call button_music
  892.  
  893.     mov  [small_draw],dword draw_small_right
  894.  
  895.     mcall 14
  896.     shr eax, 16
  897.     mov ebx, eax
  898.     mov ecx, -1
  899.     mov edx, 9
  900.     sub ebx, edx
  901.     mov esi, -1
  902.     mcall 67
  903.  
  904.     call draw_small_right
  905.  
  906.     jmp  small_wait
  907.  
  908. ;-------------------------------------------------
  909.  
  910. left_button:
  911.  
  912.     call  button_music
  913.  
  914.     mov  [small_draw],dword draw_small_left
  915.  
  916.     mov   ebx, 0
  917.     mov   edx, 9
  918.     mov   ecx, -1
  919.     mov   esi, -1
  920.     mcall 67
  921.  
  922.     call draw_small_left
  923.  
  924. ;-------------------------------------------------
  925.  
  926.   small_wait:
  927.  
  928.     mov  eax, 10
  929.     int  0x40
  930.  
  931.     cmp  eax,1
  932.     jne  no_win
  933.     call [small_draw]
  934.     jmp  small_wait
  935.   no_win:
  936.     cmp  eax,2
  937.     jne  no_key
  938.     call handle_key
  939.     jmp  small_wait
  940. no_key:
  941.  
  942.     mov  eax,17
  943.     int  0x40
  944.  
  945.     cmp  ah,1
  946.     jne  no_full
  947.  
  948.     mov   eax, 14                   ; get screen max x & max y
  949.     int   0x40
  950.     mov   edx, eax
  951.     shr   edx, 16
  952.     xor   ebx, ebx
  953.     mov   ecx, -1
  954.     mov   esi, -1
  955.     mcall 67 ; x0 y0 xs ys
  956.  
  957.     call  button_music
  958.  
  959.     jmp   still
  960.  
  961.  
  962.   no_full:
  963.  
  964.     call menu_handler
  965.  
  966.     jmp  small_wait
  967.  
  968.  
  969.  
  970. set_variables:
  971.  
  972.      pusha
  973.  
  974.      mov  [b_size_y],dword 38
  975.      cmp  [graph_text],1
  976.      jne  noy2
  977.      mov  [b_size_y],dword 18
  978.    noy2:
  979.  
  980.      mov  [button_frames],0x0
  981.      cmp  [buttons],0
  982.      jne  no_frames
  983.      mov  [button_frames],0x40000000
  984.    no_frames:
  985.  
  986.  
  987.      mov  eax,48           ; 3d button look
  988.      mov  ebx,1
  989.      mov  ecx,1
  990.      int  0x40
  991.  
  992.      mov  eax,0x40404040   ; dividers for processes
  993.      mov  edi,pros
  994.      mov  ecx,10
  995.      cld
  996.      rep  stosd
  997.  
  998.      popa
  999.      ret
  1000.  
  1001.  
  1002.  
  1003. ; eax = number (1 or 2)
  1004. ; ebx = language id
  1005. draw_flag:
  1006.     pusha
  1007.  
  1008. ;    cmp  [graph_text],0
  1009. ;    je   mini_flag
  1010.  
  1011. ; eax = 2 BIG
  1012. ; eax = 1 small
  1013.  
  1014.     mov  edx,ebx
  1015.  
  1016.     mov  ebx,[maxx]
  1017.     and  eax,1
  1018.     imul eax,17  ;17
  1019.     sub  ebx,eax
  1020.     sub  ebx,76 ;79 ;28
  1021.  
  1022.     pushad
  1023. ;    dec  ebx
  1024.     sub  ebx,2
  1025.     shl  ebx, 16
  1026.     add  ebx, 15 ;25
  1027.     mov  ecx, 4*65536+13
  1028.     mov  edx,0
  1029.     mov  eax,13
  1030.     int  0x40
  1031.     add  ebx,1 shl 16
  1032.     sub  ebx,2
  1033.     mov  ecx, 5 shl 16+11
  1034.     cmp  [type_lang],1
  1035.     je  label_1
  1036.     mov  edx,0xff ;[wcolor]
  1037.     jmp  label_2
  1038. label_1:
  1039.     mov  edx,0x7700
  1040. label_2:
  1041.     mov  eax, 13
  1042.     int  0x40
  1043.     popad
  1044.  
  1045.     shl  ebx,16
  1046.     add  ebx,7  ;24
  1047.  
  1048.     mov  ecx,[bte] ; color
  1049.  
  1050.     dec  edx
  1051.     shl  edx,1
  1052.     add  edx,flag_text
  1053.     mov  esi,2
  1054.     mov  eax,4
  1055.     int  0x40
  1056.  
  1057.     mov  ebx,[maxx]
  1058.     sub  ebx,48
  1059.     shl  ebx,16
  1060.     mov  bx,34
  1061.     mov  ecx,3 shl 16+14
  1062.     xor  edx,edx
  1063.     mov  eax,13
  1064.     int  0x40
  1065.     add  ebx,1 shl 16
  1066.     sub  ebx,2
  1067.     mov  ecx,4 shl 16+12
  1068.     mov  edx,0x66cc
  1069.     int  0x40
  1070.  
  1071.     popa
  1072.     ret
  1073.  
  1074. ;mini_flag:
  1075. ;    popa
  1076. ;    ret
  1077.  
  1078.  
  1079.  
  1080.  
  1081. ; ***************************************************
  1082. ; ********* WINDOW DEFINITIONS AND DRAW *************
  1083. ; ***************************************************
  1084.  
  1085.  
  1086. draw_window:
  1087.  
  1088.     pusha
  1089.  
  1090.     mov  [running_applications],-1
  1091.     mov  [checks],-1
  1092.  
  1093.     mov  eax, 12                   ; tell os about redraw
  1094.     mov  ebx, 1
  1095.     int  0x40
  1096.  
  1097.     mov  eax, 48
  1098.     mov  ebx, 3
  1099.     mov  ecx, system_colours
  1100.     mov  edx, 10*4
  1101.     int  0x40
  1102.  
  1103.     mov  eax, [system_colours+4*6]
  1104.     sub  eax, 0x101010
  1105.     mov  [wcolor], eax
  1106.  
  1107.     mov  eax,14                    ; get screen max x & max y
  1108.     int  0x40
  1109.  
  1110.     cmp  [width],0
  1111.     je   no_def_width
  1112.     and  eax,0xffff
  1113.     mov  ebx,[width]
  1114.     shl  ebx,16
  1115.     add  eax,ebx
  1116.   no_def_width:
  1117.  
  1118.     mov  ebx,eax
  1119.     mov  [screenxy],ebx
  1120.     shr  ebx,16
  1121.     sub  ax,38
  1122.     shl  eax,16
  1123.     mov  ecx,eax
  1124.     add  ecx,0*65536+38
  1125.     cmp  [graph_text],1
  1126.     jne  no_text_1
  1127.     mov  cx,PANEL_HEIGHT
  1128.     add  ecx,20*65536
  1129.   no_text_1:
  1130.     mov  eax, 0                     ; DEFINE AND DRAW WINDOW
  1131.     mov  edx, [wcolor]
  1132.     or   edx, 0x01000000 ; do not draw the window
  1133.     mov  esi, [wcolor]
  1134.     or   esi, 0x01000000 ; unmovable window
  1135.     mov  edi, [wcolor]
  1136.  
  1137.     mov  [panel_x_pos], ebx
  1138.     mov  [panel_y_pos], ecx      ; Ïîêà ÷òî òàê.
  1139.  
  1140.     int  0x40
  1141.  
  1142.     movzx ebx,word [screenxy+2]
  1143.     mov  ecx,0*65536+0
  1144.     mov  edx,[wcolor]
  1145.     add  edx,0x161616
  1146.   newline:
  1147.     sub  edx,0x040404
  1148.     mov  eax,38
  1149.     cmp  [soften_up],1
  1150.     jne  no_su
  1151.     and  edx,0x00FFFFFF
  1152.     int  0x40
  1153.   no_su:
  1154.  
  1155.     pusha
  1156.     cmp  [soften_down],1
  1157.     jne  no_sd
  1158.     sub  edx,0x141414
  1159.     mov  edi,[b_size_y]
  1160.     shl  edi,16
  1161.     add  edi,[b_size_y]
  1162.     add  ecx,edi
  1163.     sub  ecx,3*65536+3
  1164.     and  edx,0x00FFFFFF
  1165.     int  0x40
  1166.   no_sd:
  1167.     popa
  1168.  
  1169.     add  ecx,1*65536+1
  1170.     cmp  cx,5
  1171.     jb   newline
  1172.  
  1173.     cmp   [soften_middle],1
  1174.     jne   no_sm
  1175.  
  1176.     movzx ebx,word [screenxy+2]
  1177.     mov   ecx,5*65536+5
  1178.     mov   esi,stripe
  1179.     mov   edx,[wcolor]
  1180.   newline3:
  1181.     add  edx,[esi]
  1182.     add  esi,4
  1183.  
  1184.     mov  eax,38
  1185.     and  edx,0x00FFFFFF
  1186.     int  0x40
  1187.     add  ecx,1*65536+1
  1188.     cmp  cx,15
  1189.     jb   newline3
  1190.  
  1191.   no_sm:
  1192.  
  1193.     cmp  [minimize_left],1
  1194.     jne  no_mleft
  1195.     mov  eax,8                               ; ABS LEFT
  1196.     mov  ebx,0 *65536+9
  1197.     mov  ecx,1 *65536
  1198.     add  ecx,[b_size_y]
  1199.     dec  ecx
  1200.     mov  edx,101
  1201.     add  edx,[button_frames]
  1202.     mov  esi,[wcolor]
  1203.     int  0x40
  1204.     mov  eax,4                               ; HIDE TEXT
  1205.     mov  ebx,2*65536+17
  1206.     cmp  [graph_text],1
  1207.     jne  no_y1
  1208.     mov  bx,7
  1209.   no_y1:
  1210.     mov  ecx,[wcolor]
  1211.     add  ecx,0x303030
  1212.     mov  edx,hidetext
  1213.     mov  esi,1
  1214.     int  0x40
  1215.   no_mleft:
  1216.  
  1217.     movzx eax,word [screenxy+2]
  1218.     mov  [maxx],eax
  1219.  
  1220.     cmp  [minimize_right],1
  1221.     jne  no_mright
  1222.     mov  eax,[maxx]
  1223.     sub  eax,77
  1224.     shl  eax,16
  1225.     mov  ebx,eax
  1226.     add  ebx,67
  1227.     mov  eax,8                               ; ABS RIGHT
  1228.     mov  ecx,1 *65536
  1229.     add  ecx,[b_size_y]
  1230.     dec  ecx
  1231.     add  ebx,68*65536
  1232.     mov  bx,9
  1233.     mov  edx,102
  1234.     add  edx,[button_frames]
  1235.     mov  esi,[wcolor]
  1236.     int  0x40
  1237.     mov  edx,hidetext+1
  1238.     mov  eax,4
  1239.     mov  ebx,[maxx]
  1240.     sub  ebx,6
  1241.     shl  ebx,16
  1242.     mov  bx,17
  1243.     cmp  [graph_text],1
  1244.     jne  no_y2
  1245.     mov  bx,7
  1246.   no_y2:
  1247.     mov  ecx,[wcolor]
  1248.     add  ecx,0x303030
  1249.     mov  esi,1
  1250.     int  0x40
  1251.   no_mright:
  1252.  
  1253.     call draw_menuet_icon
  1254.  
  1255.     call draw_program_icons
  1256.  
  1257.     mov  [ptime],0
  1258.     call draw_info
  1259.  
  1260.     call draw_application_buttons
  1261.  
  1262. ;     mov    ecx,[button_presssed_alt]
  1263. ;     mcall  47,0x80100,ecx ,400 shl 16+5,0
  1264.  
  1265.     mov  eax,12
  1266.     mov  ebx,2
  1267.     int  0x40
  1268.  
  1269.     popa
  1270.     ret
  1271.  
  1272.  
  1273.  
  1274. draw_menuet_icon:
  1275.  
  1276.     pusha
  1277.  
  1278.     cmp  [menu_enable],1
  1279.     jne  no_menu
  1280.  
  1281.  
  1282.     mov  eax, 8                               ; M BUTTON
  1283.     mov  ebx, 10*65536 + 47
  1284.     cmp  [minimize_left], 0
  1285.     jne  @f
  1286.     sub  ebx, 10*65536
  1287.   @@:
  1288.     mov  ecx, 1*65536
  1289.     add  ecx, [b_size_y]
  1290.     dec  ecx
  1291.     mov  edx, 0x20000001
  1292.     add  edx, [button_frames]
  1293.     mov  esi, [wcolor]
  1294.     int  0x40
  1295.  
  1296.     cmp  [graph_text], 1
  1297.     jne  no_mtext
  1298.  
  1299.     push ebx
  1300.     mov  eax,13
  1301.     mov  ebx,12 shl 16+44  ;51
  1302.     mov  ecx,1 shl 16+17
  1303.     xor  edx,edx
  1304.     int  0x40
  1305. ;    mov  ebx,63 shl 16+1
  1306.     mov  ebx,56 shl 16+1
  1307.     mov  ecx,2 shl 16+15
  1308.     int  0x40
  1309.     mov  ebx,57 shl 16+1
  1310.     mov  ecx,4 shl 16+11
  1311.     int  0x40
  1312.     mov  ebx,58 shl 16+1
  1313.     mov  ecx,6  shl 16+7
  1314.     int  0x40
  1315. ;    mov  ebx,66  shl 16+1
  1316. ;    mov  ecx,9 shl 16+1
  1317. ;    int  0x40
  1318.     mov  ebx,13 shl 16+43 ;50
  1319.     mov  ecx,2 shl 16+15
  1320.     mov  edx,0x7700
  1321.     int  0x40
  1322. ;    mov  ebx,62 shl 16+1
  1323. ;    mov  ecx,3 shl 16+14
  1324. ;    int  0x40
  1325.     mov  ebx,56 shl 16+1
  1326.     mov  ecx,4 shl 16+11
  1327.     int  0x40
  1328.     mov  ebx,57 shl 16+1
  1329.     mov  ecx,6 shl 16+7
  1330.     int  0x40
  1331.     pop  ebx
  1332.  
  1333.     mov  eax, 4
  1334.     mov  bx,  7
  1335.     add  ebx, 8*65536
  1336.     mov  ecx, 0x10ffffff
  1337.     mov  edx, m_text
  1338.     mov  esi, 4
  1339.     int  0x40
  1340.  
  1341.     popa
  1342.     ret
  1343.  
  1344.   no_mtext:
  1345.  
  1346.  
  1347.  
  1348.     mov  eax,[wcolor]
  1349.     mov  [m_icon+4],eax
  1350.  
  1351. ; load & display menuet.bmp
  1352.         mov     eax, 70
  1353.         mov     ebx, m_bmp_fileinfo
  1354.         int     0x40
  1355.  
  1356.     mov  eax,40
  1357.     mov  ebx,0
  1358.     mov  edi,image+53
  1359.  
  1360.    new_m_pix:
  1361.  
  1362. ;    movzx ecx,byte [edi]
  1363. ;    shr  ecx,5
  1364.  
  1365.     cmp    byte [edi], 10
  1366.     jb     nopix
  1367.     cmp    byte [edi+1], 10
  1368.     jb     nopix
  1369.     cmp    byte [edi+2], 10
  1370.     jb     nopix
  1371.  
  1372.     pusha
  1373.     cmp  [minimize_left],0
  1374.     jne  no_m_s2
  1375.     sub  ebx,10
  1376.   no_m_s2:
  1377. ;    mov  edx,[ecx*4+m_icon]
  1378.     mov  edx,[edi+1]
  1379.  
  1380.     mov  ecx,eax
  1381.     mov  eax,1
  1382.     add  ebx,12
  1383.     int  0x40
  1384.     popa
  1385.  
  1386.    nopix:
  1387.  
  1388.     add  edi,3
  1389.     add  ebx,1
  1390.     cmp  ebx,40
  1391.     jnz  new_m_pix
  1392.  
  1393.     mov  ebx,0
  1394.     dec  eax
  1395.     jnz  new_m_pix
  1396.  
  1397.   no_menu:
  1398.  
  1399.     popa
  1400.     ret
  1401.  
  1402.  
  1403. draw_program_icons:
  1404.  
  1405.     pusha
  1406.  
  1407.     cmp  [icons],0
  1408.     jne  dp_ret
  1409.  
  1410.     mov  edi,1
  1411.     push edi
  1412.  
  1413.   new_icon_file:
  1414.  
  1415.     pusha
  1416.     mov  edx,[esp+32]
  1417.     add  edx,10
  1418.     push edx
  1419.     mov  esi,[wcolor]
  1420.     mov  ecx,1*65536
  1421.     add  ecx,[b_size_y]
  1422.     dec  ecx
  1423.     mov  eax,edi
  1424.     dec  eax
  1425.     imul eax,40
  1426.     mov  ebx,eax
  1427.     add  ebx,[icons_position]
  1428.     shl  ebx,16
  1429.     mov  bx,39
  1430.     pop  edx
  1431.     add  edx,[button_frames]
  1432.     or   edx, 0x20000000
  1433.     mov  eax,8
  1434.     int  0x40
  1435.     popa
  1436.  
  1437.     mov  ecx,[esp]
  1438.     add  ecx,48
  1439.     mov  [iconf+6],cl
  1440.  
  1441.         mov     eax, 70
  1442.         mov     ebx, iconf_fileinfo
  1443.         int     0x40
  1444.  
  1445.     mov  eax,0
  1446.     mov  ebx,32
  1447.     mov  edi,image+51+32*33*3
  1448.  
  1449.    np2:                             ; new pixel of file
  1450.  
  1451.     mov  edx,[edi]
  1452.     and  edx,0xffffff
  1453.  
  1454.     cmp  eax,3                      ; Y draw limits
  1455.     jb   nopix2
  1456.     cmp  eax,36
  1457.     jg   nopix2
  1458.     cmp  ebx,38                     ; X draw limits
  1459.     jg   nopix2
  1460.     cmp  ebx,2
  1461.     jb   nopix2
  1462.  
  1463.     cmp  edx,0
  1464.     jz   nopix2
  1465.  
  1466.     cmp  [graph_text],1
  1467.     jne  no_icon_text
  1468.  
  1469.     pusha
  1470.  
  1471.     mov  ebx,[esp+32]
  1472.     dec  ebx
  1473.     imul ebx,40
  1474.     add  ebx,8
  1475.     add  ebx,[icons_position]
  1476.     shl  ebx,16
  1477.     mov  bx,7
  1478.  
  1479.     mov  eax,4
  1480.     mov  ecx,0xffffff
  1481.     mov  edx,[esp+32]
  1482.     dec  edx
  1483.     imul edx,4
  1484.     add  edx,mi_text
  1485.     mov  esi,4
  1486.     int  0x40
  1487.  
  1488.     popa
  1489.  
  1490.     jmp  nopix2
  1491.  
  1492.   no_icon_text:
  1493.  
  1494.     mov  esi,[esp]
  1495.     pusha
  1496.     push edx
  1497.     mov  ecx,eax
  1498.     add  ecx,2
  1499.     mov  eax,esi
  1500.     dec  eax
  1501.     imul eax,40
  1502.     add  ebx,eax
  1503.     add  ebx,3
  1504.     add  ebx,[icons_position]
  1505.     pop  edx
  1506.     mov  eax,1
  1507.     int  0x40
  1508.     popa
  1509.  
  1510.   nopix2:
  1511.  
  1512.     sub  edi,3
  1513.     dec  ebx
  1514.     jnz  np2
  1515.  
  1516.     mov  ebx,32
  1517.     add  eax,1
  1518.     cmp  eax,32
  1519.     jnz  np2
  1520.  
  1521.     add  dword [esp],1
  1522.     mov  edi,[esp]
  1523.     cmp  dword [esp],4
  1524.     jbe  new_icon_file
  1525.     add  esp,4
  1526.  
  1527.     mov  eax,4
  1528.     mov  ebx,40
  1529.     imul ebx,3
  1530.     add  ebx,[icons_position]
  1531.     add  ebx,10
  1532.     shl  ebx,16
  1533.     mov  bx,23
  1534.     mov  ecx,[wcolor]
  1535.     mov  edx,gpl
  1536.     mov  esi,3
  1537.     int  0x40
  1538.  
  1539.   dp_ret:
  1540.  
  1541.     popa
  1542.     ret
  1543.  
  1544.  
  1545.  
  1546. draw_info:    ; draw cpu usage, time, date
  1547.  
  1548.     pusha
  1549.  
  1550.     cmp  [setup_enable],1
  1551.     jne  no_setup
  1552.  
  1553.     cmp  [minimize_right],0
  1554.     jne  no_m_r
  1555.     add  [maxx],10
  1556.  
  1557.    no_m_r:
  1558.  
  1559.     mov  eax,3
  1560.     int  0x40
  1561.     cmp  eax,[ptime]
  1562.     jz   _ret
  1563.     mov  [ptime],eax
  1564.  
  1565.     call draw_cpu_usage
  1566.  
  1567.     mov  eax,[maxx]   ; blink sec
  1568.     sub  eax,33
  1569.     shl  eax,16
  1570.     mov  ebx,eax
  1571.     add  ebx,9
  1572.     mov  eax,3
  1573.     int  0x40
  1574.     cmp  [graph_text],1
  1575.     jne  no_y4
  1576.     sub  bx,2
  1577.   no_y4:
  1578.     mov  ecx,eax
  1579.     shr  ecx,16
  1580.     and  ecx,1
  1581.     mov  edx,[bte]
  1582.     sub  edx,[wcolor]
  1583.     imul ecx,edx
  1584.     add  ecx,[wcolor]
  1585.     mov  edx,sec
  1586.     mov  eax,4
  1587.     mov  esi,1
  1588.     int  0x40
  1589.  
  1590.  
  1591. ;    mov  eax,26          ; check for change in time or country
  1592. ;    mov  ebx,5
  1593. ;    int  0x40
  1594. ;    mov  edx,eax
  1595.     mov  eax,26
  1596.     mov  ebx,2
  1597.     mov  ecx,9
  1598.     int  0x40
  1599. ;    add  edx,eax
  1600.     mov  edx,eax
  1601.     mov  eax,3
  1602.     int  0x40
  1603.     and  eax,0xffff
  1604.     add  edx,eax
  1605.     cmp  edx,[checks]
  1606.     je   _ret
  1607.     mov  [checks],edx
  1608.  
  1609.     mov  ebx,[maxx]
  1610.     sub  ebx,48 ;;94 ;;74
  1611.     shl  ebx,16
  1612.     add  ebx,33 ;;84 ;;64
  1613.  
  1614.     mov  eax,8               ; time/date button
  1615.     mov  ecx,3 *65536
  1616.     add  ecx,[b_size_y]
  1617. ;    dec  ecx
  1618.     sub  cx,5
  1619.     mov  edx,2+0x20000000
  1620.     mov  esi,[wcolor]
  1621.     int  0x40
  1622.     pusha
  1623.     mov  eax,13
  1624.     add  ebx,10*65536-16
  1625.     add  ecx,5*65536-8
  1626.     mov  edx,[wcolor]
  1627.     int  0x40
  1628.     popa
  1629.     and  edx,0xffff
  1630.     add  edx,[button_frames]
  1631.     int  0x40
  1632.  
  1633.     mov  eax,8
  1634.     mov  ebx,[maxx]
  1635.     sub  ebx,77 ;80
  1636.     shl  ebx,16
  1637.     add  ebx,12
  1638.     mov  ecx,5 shl 16+10
  1639.     mov  edx,16+0x20000000  ;button 16
  1640.     mov  esi,[wcolor]
  1641.     int  0x40
  1642.     sub  ebx,17 shl 16
  1643.     inc  edx                ;button 17
  1644. ;    int  0x40
  1645.     add  ebx,33 shl 16
  1646.     mov  bx,8
  1647.     inc  edx                ;button 18
  1648.     int  0x40
  1649.     sub  ebx,30 shl 16
  1650.     mov  bx,10
  1651.     inc  edx                ;button 19
  1652.     int  0x40
  1653.     sub  ebx,14 shl 16
  1654.     inc  edx                ;button 20
  1655.     int  0x40
  1656.     sub  ebx,12 shl 16
  1657.     mov  bx,8
  1658.     mov  ecx,6 shl 16+10
  1659.     inc  edx        ;button 21
  1660.     int  0x40
  1661.     sub  ebx,18 shl 16
  1662.     inc  edx        ;button 22
  1663.     int  0x40
  1664.  
  1665.     ; flags
  1666.  
  1667. ;    mov  eax,26
  1668. ;    mov  ebx,5
  1669. ;    int  0x40
  1670. ;    mov  ebx,eax
  1671. ;
  1672. ;    mov  eax,1
  1673. ;    mov  [type_lang],al
  1674. ;    call draw_flag
  1675.  
  1676.     mov  eax,26
  1677.     mov  ebx,2
  1678.     mov  ecx,9
  1679.     int  0x40
  1680.     mov  ebx,eax
  1681.  
  1682.     mov  eax,2
  1683.     mov  [type_lang],al
  1684.     call draw_flag
  1685.  
  1686.     mcall 18,8,1
  1687.     mov  [sound_flag],al
  1688.  
  1689.     mov  ebx,[maxx]
  1690.     sub  ebx,92 ;109 ;112 ;28
  1691.     shl  ebx,16
  1692.     mov  bx,12
  1693.     mov  ecx, 4*65536+13
  1694.     mov  edx,0
  1695.     mov  eax,13
  1696.     int  0x40
  1697.     add  ebx,1 shl 16
  1698.     sub  bx,2
  1699.     mov  ecx,5 shl 16+11
  1700.     mov  edx,0xcc
  1701.     int  0x40
  1702.     add  ebx,1 shl 16
  1703.     mov  bx,5
  1704.     mov  ecx,8 shl 16+5
  1705.     mov  edx,0xdddd00
  1706.     int  0x40
  1707.     add  ebx,5 shl 16
  1708.     mov  bx,1
  1709.     mov  ecx,7 shl 16+7
  1710.     int  0x40
  1711.     add  ebx,1 shl 16
  1712.     mov  ecx,6 shl 16+9
  1713.     int  0x40
  1714.     add  ebx,1 shl 16
  1715.     mov  ecx,5 shl 16+11
  1716.     int  0x40
  1717.  
  1718. ;    cmp  [music_type],0
  1719. ;    jne   dalshe
  1720.     cmp  [sound_flag],0
  1721.     je   dalshe
  1722.  
  1723.     sub  ebx,8 shl 16
  1724.     ror  ebx,16
  1725.     mov  cx,bx
  1726.     rol  ebx,16
  1727.     mov  bx,cx
  1728.     add  bx,8
  1729.     mov  ecx,5 shl 16+15
  1730.     mov  edx,0xff0000
  1731.     mov  eax,38
  1732.     int  0x40
  1733.     add  ebx,1 shl 16
  1734.     inc  bx
  1735.     int  0x40
  1736.     rol  ecx,16
  1737.     int  0x40
  1738.     sub  ebx,1 shl 16
  1739.     dec  bx
  1740.     int  0x40
  1741.  
  1742. dalshe:
  1743.  
  1744.     mov  ebx,[maxx]
  1745.     sub  ebx,106;123
  1746.     shl  ebx,16
  1747.     mov  bx,12
  1748.     mov  ecx, 4*65536+13
  1749.     mov  edx,0
  1750.     mov  eax,13
  1751.     int  0x40
  1752.     add  ebx,1 shl 16
  1753.     sub  bx,2
  1754.     mov  ecx,5 shl 16+11
  1755.     mov  edx,0xffcc00
  1756.     int  0x40
  1757.     mov  eax,4
  1758.     mov  ebx,[maxx]
  1759.     sub  ebx,104;121
  1760.     shl  ebx,16
  1761.     mov  bx,7
  1762.     mov  ecx,0x10000000
  1763.     mov  edx,file_sys
  1764.     mov  esi,1
  1765.     int  0x40
  1766.     add  ebx,1 shl 16
  1767.     int  0x40
  1768.  
  1769.     mov  edx,0
  1770.     mov  eax,13
  1771.     mov  ebx,[maxx]
  1772.     sub  ebx,117;134
  1773.     shl  ebx,16
  1774.     mov  bx,9
  1775.     mov  ecx,6 shl 16+11
  1776.     int  0x40
  1777.     sub  ebx,18 shl 16
  1778.     int  0x40
  1779.     add  ebx,19 shl 16
  1780.     sub  bx,2
  1781.     mov  ecx,7 shl 16+9
  1782.     mov  edx,0xffffff
  1783.     int  0x40
  1784.     sub  ebx,18 shl 16
  1785.     int  0x40
  1786.  
  1787.     mov  eax,4
  1788.     mov  edx,page_a1
  1789.     mov  ebx,[maxx]
  1790.     sub  ebx,133;150
  1791.     shl  ebx,16
  1792.     mov  bx,8
  1793.     mov  esi,4
  1794.     int  0x40
  1795.     add  ebx,1 shl 16
  1796.     int  0x40
  1797.  
  1798.     mov  eax,47
  1799.     mov  ebx,0x10100
  1800.     mov  ecx,[page_list]
  1801.     mov  edx,[maxx]
  1802.     sub  edx,124;141
  1803.     shl  edx,16
  1804.     mov  dx,7
  1805.     mov  esi,0xffffff
  1806.     int  0x40
  1807.  
  1808. ;    sub  ebx,14 shl 16
  1809. ;    mov  bx,7
  1810. ;    mov  edx,turn_text
  1811. ;    mov  esi,1
  1812.  
  1813. ;    mov  ecx,0x60a060 ;[wcolor]
  1814. ;    add  ecx,0x303030
  1815. ;    mov  eax,4
  1816. ;    int  0x40
  1817. ;    add  ebx,1 shl 16
  1818. ;    int  0x40
  1819. ;    add  ebx,1 shl 16
  1820. ;    int  0x40
  1821. ;    add  ebx,1 shl 16
  1822. ;    int  0x40
  1823.  
  1824. ;    add  ebx,1 shl 16
  1825. ;    mov  ecx,0x60a060 ;[wcolor]
  1826. ;    int  0x40
  1827. ;    add  ebx,1 shl 16
  1828. ;    int  0x40
  1829. ;    add  ebx,1 shl 16
  1830. ;    sub  ecx,0x303030
  1831. ;    int  0x40
  1832.  
  1833. ;    sub  ebx,6 shl 16
  1834. ;    mov  bx,1
  1835. ;    mov  ecx,2 shl 16+15
  1836. ;    mov  edx,0x60a060  ;[wcolor]
  1837. ;    add  edx,0x303030
  1838. ;    mov  eax,13
  1839. ;    int  0x40
  1840. ;    add  ebx,1 shl 16
  1841. ;    mov  bx,1
  1842. ;    mov  edx,0x60a060  ;[wcolor]
  1843. ;    int  0x40
  1844. ;    add  ebx,1 shl 16
  1845. ;    mov  bx,1
  1846. ;    sub  edx,0x303030
  1847. ;    int  0x40
  1848. ;    add  ebx,1 shl 16
  1849. ;    mov  edx,[wcolor]
  1850. ;    int  0x40
  1851.  
  1852.     mov  eax,3                  ; get time
  1853.     int  0x40
  1854.  
  1855.     movzx ebx,al
  1856.     shr   eax,8
  1857.     movzx ecx,al
  1858.     shr   eax,8
  1859.     movzx edx,al
  1860.  
  1861.     ; ebx ecx edx h m s
  1862.  
  1863.     push ebx
  1864.     push ecx
  1865.  
  1866.     mov  eax,[maxx]
  1867.     sub  eax,32
  1868.     shl  eax,16
  1869.     mov  ebx,eax
  1870.     add  ebx,9
  1871.  
  1872.     mov  ecx,[bte]
  1873.  
  1874.     cmp  [graph_text],1
  1875.     jne  no_y3
  1876.     sub  bx,2
  1877.     mov  ecx,0xffffff
  1878.   no_y3:
  1879.  
  1880.  
  1881.     mov  edx,[esp]             ; __:_X
  1882.     and  edx,15
  1883.     mov  eax,4
  1884.     add  ebx,10*65536
  1885.     add  edx,text
  1886.     mov  esi,1
  1887.     int  0x40
  1888.  
  1889.     pop  edx                    ; __:X_
  1890.     shr  edx,4
  1891.     and  edx,15
  1892.     mov  eax,4
  1893.     sub  ebx,6*65536
  1894.     add  edx,text
  1895.     mov  esi,1
  1896.     int  0x40
  1897.  
  1898.     mov  edx,[esp]             ; _X:__
  1899.     and  edx,15
  1900.     mov  eax,4
  1901.     sub  ebx,11*65536
  1902.     add  edx,text
  1903.     mov  esi,1
  1904.     int  0x40
  1905.  
  1906.     pop  edx                    ; X_:__
  1907.     shr  edx,4
  1908.     and  edx,15
  1909.     mov  eax,4
  1910.     sub  ebx,6*65536
  1911.     add  edx,text
  1912.     mov  esi,1
  1913.     int  0x40
  1914.  
  1915.     call draw_cpu_usage
  1916.  
  1917.   _ret:
  1918.  
  1919.     cmp  [minimize_right],0
  1920.     jne  no_m_r2
  1921.     sub  [maxx],10
  1922.    no_m_r2:
  1923.  
  1924.    no_setup:
  1925.  
  1926.     popa
  1927.     ret
  1928.  
  1929.  
  1930.  
  1931. draw_cpu_usage:
  1932.  
  1933.     pushad
  1934.  
  1935.     mov  [ysi],30
  1936.     cmp  [graph_text],1
  1937.     jne  @f
  1938.     mov  [ysi],12
  1939.   @@:
  1940.  
  1941.  
  1942.     mov  eax,18    ; TSC / SEC
  1943.     mov  ebx,5
  1944.     int  0x40
  1945.     shr  eax,20
  1946.     push eax
  1947.     mov  eax,18    ; IDLE / SEC
  1948.     mov  ebx,4
  1949.     int  0x40
  1950.     shr  eax,20
  1951.     xor  edx,edx
  1952.     imul eax,[ysi]
  1953.  
  1954.     cdq
  1955.     pop  ebx
  1956.     inc  ebx
  1957.     div  ebx
  1958.     cmp  eax,[ysi]
  1959.     jng  no_bug
  1960.     mov  eax,[ysi]
  1961. no_bug:
  1962.     push eax
  1963.  
  1964.     mov  eax,13
  1965.     mov  ebx,[maxx]
  1966.     sub  ebx,60
  1967.     shl  ebx,16
  1968.     add  ebx,8
  1969.     mov  ecx,5 shl 16
  1970.     add  ecx,[ysi]
  1971.     mov  edx,0xdd2222
  1972.     int  0x40
  1973.  
  1974.     pop  eax
  1975.     mov  ecx,5 shl 16
  1976.     add  ecx,eax
  1977.     mov  eax,13
  1978.     mov  edx,0x44aa44
  1979.     int  0x40
  1980.  
  1981.     popad
  1982.     ret
  1983.  
  1984. include 'detect.asm'
  1985. include 'ctx_menu.asm'
  1986.  
  1987. ; DATA
  1988.  
  1989. stripe:
  1990.     dd  -0x010101
  1991.     dd  -0x010101
  1992.     dd  -0x020202
  1993.     dd  -0x010101
  1994.     dd  -0x000000
  1995.  
  1996.     dd   0x000000
  1997.     dd   0x010101
  1998.     dd   0x020202
  1999.     dd   0x010101
  2000.     dd   0x010101
  2001.  
  2002. m_icon:
  2003.     dd  0x0
  2004.     dd  0x808080
  2005.     dd  0x000000
  2006.     dd  0x000000
  2007.     dd  0xffffff
  2008.  
  2009.  
  2010. lsz m_text,\
  2011.   ru, "Œ…ž",\
  2012.   en, "MENU",\
  2013.   et, "MENÜÜ"
  2014.  
  2015. mi_text   db   'WAVETETRBGRDGPL '
  2016.  
  2017. flag_text db 'EnFiGeRuFrEt'
  2018.  
  2019. type_lang db 0
  2020. ;music_type db 1
  2021. sound_flag db 0
  2022. button_frames  dd  0x0
  2023.  
  2024. checks    dd -1
  2025. hidetext  db 0x11,0x10,0x1e
  2026.  
  2027. turn_text db  '><'
  2028. gpl       db  'GPL'
  2029.  
  2030. chlang db 'LANG',0
  2031. ;syslang db 'SLAN',0
  2032.  
  2033. contrast  db 0
  2034.  
  2035. running_applications  dd  0x100
  2036. max_applications      dd  11
  2037.  
  2038. current_alt_tab_app     dd      -1
  2039.  
  2040. page_list  dd 0
  2041. draw_start_position dd 0
  2042. draw_window_1 db 0
  2043.  
  2044. b_size_y:  dd  0x0
  2045. ysi  dd  0
  2046. small_draw dd 0x0
  2047.  
  2048. ptime   dd 0x0
  2049. maxx    dd 0x0
  2050. text    db '0123456789'
  2051. page_a1 db '<  >'
  2052. bte     dd 0xccddee
  2053.  
  2054. wcolor  dd 0x506070
  2055.  
  2056. sec     db ': '
  2057. pros    db '                                                  '
  2058.         db '                                                  '
  2059.  
  2060. screenxy    dd  0x0
  2061. stcount     dd  0x0
  2062.  
  2063. setup_exec:
  2064.         dd      7
  2065.         dd      0
  2066. .cmdline dd     ?
  2067.         dd      0
  2068.         dd      0
  2069.         db      '/sys/'
  2070. file_sys db     'SETUP',0
  2071.  
  2072. exec_fileinfo:
  2073.         dd      7
  2074.         dd      0
  2075.         dd      0
  2076.         dd      0
  2077.         dd      0
  2078.         db      0
  2079. .name   dd      ?
  2080.  
  2081. end_name        db      '/sys/END',0
  2082. menu_name       db      '/sys/@MENU',0
  2083. calendar_name   db      '/sys/CALENDAR',0
  2084. sysmeter_name   db      '/sys/GMON',0
  2085.  
  2086. dat_fileinfo:
  2087.         dd      0
  2088.         dd      0
  2089.         dd      0
  2090.         dd      1024
  2091.         dd      I_END
  2092.         db      '/sys/PANEL.DAT',0
  2093.  
  2094. m_bmp_fileinfo:
  2095.         dd      0
  2096.         dd      0
  2097.         dd      0
  2098.         dd      8192
  2099.         dd      image
  2100.         db      '/sys/MENUET.BMP',0
  2101.  
  2102. iconf_fileinfo:
  2103.         dd      0
  2104.         dd      0
  2105.         dd      0
  2106.         dd      8192
  2107.         dd      image
  2108.         db      '/sys/'
  2109. iconf   db      'MBAR_IX.BMP',0
  2110.  
  2111. I_END:
  2112.  
  2113. screen_size:
  2114.   .height dw ?
  2115.   .width  dw ?
  2116.  
  2117. system_colours rd 10
  2118. app_list rd 50
  2119. alt_tab_list    rd      256*2
  2120. alt_tab_list_size dd    ?
  2121. process_info_buffer  rb 1024
  2122. tictable:
  2123.   rd 256
  2124.  
  2125.         rb      256
  2126. detect_stack:
  2127.         rb      256
  2128. ctx_menu_stack:
  2129.  
  2130. panel_x_pos     rd      1
  2131. panel_y_pos     rd      1
  2132. image:
  2133.