Subversion Repositories Kolibri OS

Rev

Rev 4284 | Rev 6190 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ; END
  3. ; KolibriOS Team 2005-2015
  4.  
  5. fade equ 0
  6.  
  7. use32        ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
  8. org 0x0      ;  ¤à¥á æ¨ï á ­ã«ï
  9.  
  10. db 'MENUET01'    ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
  11. dd 0x01          ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
  12. dd START         ;  ¤à¥á ¯¥à¢®© ª®¬ ­¤ë
  13. dd IM_END        ; à §¬¥à ¯à®£à ¬¬ë
  14. dd I_END         ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
  15. dd stacktop      ;  ¤à¥á ¢¥à設ë á⥪ 
  16. dd 0x0           ;  ¤à¥á ¡ãä¥à  ¤«ï ¯ à ¬¥â஢
  17. dd cur_dir_path
  18.  
  19. include 'lang.inc'
  20. include '../../../macros.inc'
  21. include '../../../proc32.inc'
  22. include '../../../dll.inc'
  23. include '../../../develop/libraries/box_lib/load_lib.mac'
  24. include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
  25.  
  26.         @use_library
  27.  
  28. align 4
  29. START:
  30.  
  31. load_libraries l_libs_start,end_l_libs
  32.         inc     eax
  33.         test    eax,eax
  34.         jz      close
  35.  
  36. push    dword check1
  37. call    [init_checkbox2]
  38.  
  39. stdcall dll.Init,[init_lib]
  40.  
  41. invoke  ini_get_int,ini_file,asettings,aautosave,0
  42.         mov   [autosave],eax
  43.         dec   eax
  44.         jnz   @f
  45.         bts   dword [check1.flags],1
  46. @@:
  47.         mcall   40,0x80000027
  48. redraw:
  49.     call draw_window
  50. still:
  51.     mov  al,10
  52.     mcall                                    ;wait here for event
  53.     dec  eax
  54.     jz   redraw
  55.     dec  eax
  56.     jz   key
  57.     dec  eax
  58.     jz   button
  59.  
  60.     push dword check1
  61.     call [check_box_mouse2]
  62.     bt   dword [check1.flags],1
  63.     jnc  @f
  64.     mov  [autosave],1
  65.     jmp  still
  66. @@:
  67.     mov  [autosave],0
  68.     jmp  still
  69.  
  70. key:
  71.     mov  al,2
  72.     mcall                                    ;eax=2 - get key code
  73.     mov  al,ah
  74.      cmp  al,13
  75.      je   restart
  76.      cmp  al,19
  77.      je   checkbox
  78.      cmp  al,180
  79.      je   restart_kernel
  80.      cmp  al,181
  81.      je   power_off
  82.      cmp  al,27
  83.      jne   still
  84.  
  85. close:
  86.     mcall -1
  87.  
  88. button:
  89.     mcall 17                                 ;eax=17 - get pressed button id
  90.     xchg al,ah
  91.     dec  eax
  92.     jz   close
  93.     dec  eax
  94.     jz   restart_kernel
  95.     dec  eax
  96.     jz   restart
  97.     dec  eax
  98.     jnz  checkbox
  99.  
  100. power_off:
  101.     push 2
  102.     jmp  mcall_and_close
  103.  
  104. restart:
  105.     push 3
  106.     jmp  mcall_and_close
  107.  
  108. restart_kernel:
  109.     push 4
  110.  
  111. mcall_and_close:
  112. if fade=1
  113.  ; === FADE IN ===
  114.     mov eax, color1
  115.   @@:
  116.     mov ebx, [eax + 32]
  117.     mov [eax], ebx
  118.     add eax, 4
  119.     cmp eax, color21
  120.     jne @b
  121.  
  122.     call    draw_window
  123. end if
  124.  
  125.     invoke  ini_set_int,ini_file,asettings,aautosave,[autosave]
  126.     cmp  [autosave],1
  127.     jne   no_save
  128.  
  129. if fade=0
  130.     mov   al,4
  131.     mcall   ,<50,120> ,0x800000cc,label7        ;eax=4 - write text
  132. end if
  133.  
  134.     mcall 70,rdsave
  135.     test  eax,eax
  136.     js    no_save
  137.     mov   ecx,eax
  138.     mcall 18,21
  139.     mov   ecx,eax
  140. @@:
  141.     push ecx
  142.     mcall 23,100
  143.     dec   eax
  144.     jnz   no_red
  145.     call draw_window
  146. no_red:
  147.     pop   ecx
  148.     mcall 9,proc_info
  149.     cmp   [proc_info+50],9
  150.     je    no_save
  151.     jmp   @b
  152. no_save:
  153.     pop  ecx
  154.   mcall 18,9
  155. ret
  156.  
  157. checkbox:
  158.     btc   dword [check1.flags],1
  159.     jc    .1
  160.     mov   [autosave],1
  161.     jmp   .draw
  162. .1:
  163.     mov   [autosave],0
  164. .draw:
  165.     push  dword check1
  166.     call  [check_box_draw2]
  167.     jmp    still
  168.  
  169. draw_window:
  170.     mov   al,12
  171.     mcall   ,1
  172.  
  173.     mov   al,14
  174.     mcall                                    ;eax=14 - get screen max x & max y
  175.     movzx ecx,ax
  176.     shr   eax,17
  177.     shl   eax,16
  178.     lea   ebx,[eax-165 shl 16+332]
  179.     shr   ecx,1
  180.     shl   ecx,16
  181.     lea   ecx,[ecx-70 shl 16+132]
  182.  
  183.     xor   eax,eax
  184.     mcall  , , ,[color1],0x01000000        ;define and draw window
  185.  
  186.     mov   al,13
  187.     mcall   ,<0,333> ,<0,133>
  188.     mcall   ,<1,331>,<1,131>,[color2]
  189.     mcall   ,<2,330>,<2,130>, [color3]
  190.  
  191.     mov   al,8
  192.     mcall   ,<16,144> ,<16,36>,4,[color4]     ;eax=8 - draw buttons
  193.     mcall   ,<170,144>,       ,2,[color5]
  194.     mcall   ,         ,<62,36>,1,[color6]
  195.     mcall   ,<16,144> ,       ,3,[color7]
  196.  
  197.     mov   al,4
  198.     mcall   ,<28,19> ,[color8],label2        ;eax=4 - write text
  199.     mcall   ,<28,65> ,        ,label3
  200.     mcall   ,<64,40> ,[color9],label5
  201.     mcall   ,<64,86> ,       ,label6
  202.  
  203.     push  dword check1
  204.     call  [check_box_draw2]
  205.  
  206.     mov   al,12
  207.     mcall   ,2
  208.     ret
  209. ;---------------------------------------------------------------------
  210. ;data
  211. include 'data.inc'
  212. ;---------------------------------------------------------------------
  213. IM_END:
  214. ;---------------------------------------------------------------------
  215. align 4
  216.  
  217. proc_info  rb 1024
  218.  
  219. autosave rd 1
  220. ;---------------------------------------------------------------------
  221. cur_dir_path:
  222.         rb 4096
  223. ;---------------------------------------------------------------------
  224. library_path:
  225.         rb 4096
  226. ;---------------------------------------------------------------------
  227. align 32
  228.         rb 4096
  229. stacktop:
  230. I_END:  ; ¬¥âª  ª®­æ  ¯à®£à ¬¬ë