Subversion Repositories Kolibri OS

Rev

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

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