Subversion Repositories Kolibri OS

Rev

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

  1. window_y=88
  2. ;window_x=320
  3. window_x=450
  4. include 'macros.inc'
  5.         meos_header par
  6.         use_edit_box
  7.         use_txt_button
  8.         app_start
  9.         cmp     [par],byte 0
  10.         jne     read_par
  11.         set_events_mask evm_mouse+evm_button+evm_key+evm_redraw
  12. red:
  13.         get_sys_colors sc
  14.         set_sys_colors_txt_button run_but,sc
  15.         push    dword [sc.work_graph]
  16.         pop     [input_fn.focus_border_color]
  17.         call    draw_window
  18. still:
  19.         wait_event red,key,button,mouse,,still
  20. key:
  21.         get_key
  22.         cmp     ah,13
  23.         je      run
  24.         key_edit_box input_fn
  25.         jmp     still
  26. button:
  27.         get_pressed_button
  28.         dec     ah
  29.         jz      close
  30.         dec     ah
  31.         jz      run
  32.         jmp     still
  33. mouse:
  34.         mouse_edit_box input_fn
  35.         jmp     still
  36.  
  37. read_par:
  38.         mov     esi,par
  39.         mov     edi,fn
  40.         mov     ecx,256
  41.         rep     movsb
  42. run:
  43.         xor     eax,eax
  44.         mov     edi,file_info.name
  45.         mov     ecx,512
  46.         rep     stosb
  47.         mov     edi,run_par
  48.         mov     ecx,256
  49.         rep     stosb
  50.  
  51.         mov     esi,fn
  52.         mov     edi,file_info.name
  53.         cmp     [esi],byte '"'
  54.         je      copy_fn_with_spaces
  55. copy_fn:
  56.         cmp     [esi],byte ' '
  57.         je      .stop
  58.         cmp     [esi],byte 0
  59.         je      .stop
  60.         mov     al,[esi]
  61.         mov     [edi],al
  62.         inc     esi
  63.         inc     edi
  64.         jmp     copy_fn
  65. .stop:
  66.  
  67.         jmp     copy_par
  68.  
  69. copy_fn_with_spaces:
  70.         inc     esi
  71. @@:
  72.         cmp     [esi],byte '"'
  73.         je      .stop
  74.         cmp     [esi],byte 0
  75.         je      .stop
  76.         mov     al,[esi]
  77.         mov     [edi],al
  78.         inc     esi
  79.         inc     edi
  80.         jmp     @b
  81. .stop:
  82.  
  83. copy_par:
  84. @@:
  85.         inc     esi
  86.         cmp     [esi],byte ' '
  87.         je      @b
  88.         mov     edi,run_par
  89. @@:
  90.         cmp     [esi],byte 0
  91.         je      .stop
  92.         mov     al,[esi]
  93.         mov     [edi],al
  94.         inc     esi
  95.         inc     edi
  96.         jmp     @b
  97. .stop:
  98.  
  99.         mov     eax,70
  100.         mov     ebx,file_info
  101.         int     0x40
  102.  
  103.         ;cmp     eax,0
  104.         ;jg      error
  105.         bt      eax,31
  106.         je      error
  107.         jmp     still
  108. close:
  109.         app_close
  110.  
  111. error:
  112.  
  113. macro cmp_err code,text_ptr
  114. {
  115.         cmp     al,code
  116.         jne     @f
  117.         mov     [status],text_ptr
  118.         ;jmp     .draw_status
  119. @@:
  120. }
  121.         neg     eax
  122.  
  123.         ;test    al,al
  124.         ;jz      close
  125.  
  126.         cmp_err 3,bad_file_sys
  127.  
  128.         cmp_err 5,file_not_find
  129.  
  130.         cmp_err 9,bad_fat_table
  131.  
  132.         cmp_err 10,acces_denyied
  133.  
  134.         cmp_err 11,device_error
  135.  
  136.         cmp_err 30,out_of_memory
  137.  
  138.         cmp_err 31,file_not_executable
  139.  
  140.         cmp_err 32,many_processes
  141.  
  142. .draw_status:
  143.         call    draw_status
  144.         jmp     still
  145.  
  146. draw_window:
  147.         start_draw_window
  148.         get_screen_size
  149.         mov     cx,ax
  150.         sub     cx,window_y+20
  151.         shl     ecx,16
  152.         mov     cx,window_y
  153.         shr     eax,16
  154.         mov     bx,ax
  155.         sub     bx,window_x
  156.         shl     ebx,15
  157.         mov     bx,window_x
  158.         mov     edx,[sc.work]
  159.         or      edx,0xb3000000
  160.         xor     eax,eax
  161.         mov     esi,[sc.grab_text]
  162.         mov     edi,hed
  163.         int     0x40
  164.  
  165.         get_procinfo app
  166.  
  167.         mov     ax,[app.width]
  168.         sub     ax,20
  169.         mov     [input_fn.width],eax
  170.         mov     [run_but.width],ax
  171.  
  172.         mov     ebx,10000
  173.         mov     bx,ax
  174.         add     bx,10
  175.         mov     cx,47
  176.         push    cx
  177.         shl     ecx,16
  178.         pop     cx
  179.         mov     edx,[sc.work_graph]
  180.         mov     eax,38
  181.         int     0x40
  182.  
  183.         draw_edit_box input_fn
  184.         draw_txt_button run_but
  185.  
  186.         call    draw_status_text
  187.  
  188.         stop_draw_window
  189. ret
  190.  
  191. draw_status:
  192.         mov     ebx,5*65536+(window_x-5-10)
  193.         mov     ecx,(window_y-39)*65536+12
  194.         mov     edx,[sc.work]
  195.         mov     eax,13
  196.         int     0x40
  197. draw_status_text:
  198.         mov     edx,[status]
  199.         xor     esi,esi
  200. @@:
  201.         cmp     [edx+esi],byte 0
  202.         je      @f
  203.         inc     esi
  204.         jmp     @b
  205. @@:
  206.         mov     eax,4
  207.         mov     ebx,6*65536+(window_y-37)
  208.         mov     ecx,[sc.work_text]
  209.         int     0x40
  210. ret
  211.  
  212. run_but txt_button 0,5,15,30,2,0,0,run_but_text,
  213. if lang eq ru
  214. run_but_text db '‡€“‘’ˆ’œ',0
  215. else
  216. run_but_text db 'RUN',0
  217. end if
  218. input_fn edit_box 0,5,10,0xffffff,0,0xaaaaaa,0,511,fn,ed_focus+\
  219. ed_always_focus
  220.  
  221. if lang eq ru
  222. hello db '‚¢¥¤¨â¥ ¯®«­ë© ¯ãâì ª ä ©«ã ¨ ­ ¦¬¨â¥ Enter',0
  223. bad_file_sys db '¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ',0 ; 3
  224. file_not_find db '” ©« ­¥ ­ ©¤¥­',0              ; 5
  225. bad_fat_table db '’ ¡«¨æ  FAT à §àã襭 ',0       ; 9
  226. acces_denyied db '„®áâ㯠§ ¯à¥é¥­',0             ; 10
  227. device_error db 'Žè¨¡ª  ãáâனá⢠',0            ; 11
  228. out_of_memory db '¥¤®áâ â®ç­® ¯ ¬ïâ¨',0         ; 30
  229. file_not_executable db '” ©« ­¥ ï¥âáï ¨á¯®«­ï¥¬ë¬',0 ; 31
  230. many_processes db '‘«¨èª®¬ ¬­®£® ¯à®æ¥áᮢ',0    ; 32
  231. else
  232. hello db 'Enter full path to file and press <Enter>',0
  233. bad_file_sys db 'Unknown file system',0                ; 3
  234. file_not_find db 'File not found',0                    ; 5
  235. bad_fat_table db 'FAT table corrupted',0               ; 9
  236. acces_denyied db 'Access denied',0                     ; 10
  237. device_error db 'Device error',0                       ; 11
  238. out_of_memory db 'Out of memory',0                     ; 30
  239. file_not_executable db 'File is not executable',0      ; 31
  240. many_processes db 'Too many processes',0               ; 32
  241. end if
  242.  
  243. if lang eq ru
  244. hed db 'RUN ®â ¯¥à¢®£® ”¥¢à «ï 2007 £®¤ ',0
  245. else
  246. hed db 'RUN of the first of FEBRUARY 2007 year',0
  247. end if
  248. status dd hello
  249.  
  250. file_info:
  251. .mode dd 7
  252. .flags dd 0
  253. .par dd run_par
  254. dd 0,0
  255. .name rb 512
  256.  
  257. flags dw ?
  258.  
  259. fn rb 512
  260.  
  261. sc sys_color_table
  262. app procinfo
  263. run_par rb 256
  264. par rb 256
  265.         app_end