mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-11-25 02:09:36 +03:00
3eda462807
Programs: fasm updated to 1.67.14, small fixes in desktop, stackcfg, calc, board, pipes, freecell, big cleanup of unused programs, added some applications from 0.6.3.0 distr... git-svn-id: svn://kolibrios.org@205 a494cfbc-eb01-0410-851d-a64ba20cac60
261 lines
4.0 KiB
NASM
261 lines
4.0 KiB
NASM
window_y=88
|
||
;window_x=320
|
||
window_x=450
|
||
include 'macros.inc'
|
||
meos_header par
|
||
use_edit_box
|
||
use_txt_button
|
||
app_start
|
||
cmp [par],byte 0
|
||
jne read_par
|
||
set_events_mask evm_mouse+evm_button+evm_key+evm_redraw
|
||
red:
|
||
get_sys_colors sc
|
||
set_sys_colors_txt_button run_but,sc
|
||
push dword [sc.work_graph]
|
||
pop [input_fn.focus_border_color]
|
||
call draw_window
|
||
still:
|
||
wait_event red,key,button,mouse,,still
|
||
key:
|
||
get_key
|
||
cmp ah,13
|
||
je run
|
||
key_edit_box input_fn
|
||
jmp still
|
||
button:
|
||
get_pressed_button
|
||
dec ah
|
||
jz close
|
||
dec ah
|
||
jz run
|
||
jmp still
|
||
mouse:
|
||
mouse_edit_box input_fn
|
||
jmp still
|
||
|
||
read_par:
|
||
mov esi,par
|
||
mov edi,fn
|
||
mov ecx,256
|
||
rep movsb
|
||
run:
|
||
xor eax,eax
|
||
mov edi,file_info.name
|
||
mov ecx,512
|
||
rep stosb
|
||
mov edi,run_par
|
||
mov ecx,256
|
||
rep stosb
|
||
|
||
mov esi,fn
|
||
mov edi,file_info.name
|
||
cmp [esi],byte '"'
|
||
je copy_fn_with_spaces
|
||
copy_fn:
|
||
cmp [esi],byte ' '
|
||
je .stop
|
||
cmp [esi],byte 0
|
||
je .stop
|
||
mov al,[esi]
|
||
mov [edi],al
|
||
inc esi
|
||
inc edi
|
||
jmp copy_fn
|
||
.stop:
|
||
|
||
jmp copy_par
|
||
|
||
copy_fn_with_spaces:
|
||
inc esi
|
||
@@:
|
||
cmp [esi],byte '"'
|
||
je .stop
|
||
cmp [esi],byte 0
|
||
je .stop
|
||
mov al,[esi]
|
||
mov [edi],al
|
||
inc esi
|
||
inc edi
|
||
jmp @b
|
||
.stop:
|
||
|
||
copy_par:
|
||
@@:
|
||
inc esi
|
||
cmp [esi],byte ' '
|
||
je @b
|
||
mov edi,run_par
|
||
@@:
|
||
cmp [esi],byte 0
|
||
je .stop
|
||
mov al,[esi]
|
||
mov [edi],al
|
||
inc esi
|
||
inc edi
|
||
jmp @b
|
||
.stop:
|
||
|
||
mov eax,70
|
||
mov ebx,file_info
|
||
int 0x40
|
||
|
||
;cmp eax,0
|
||
;jg error
|
||
bt eax,31
|
||
je error
|
||
jmp still
|
||
close:
|
||
app_close
|
||
|
||
error:
|
||
|
||
macro cmp_err code,text_ptr
|
||
{
|
||
cmp al,code
|
||
jne @f
|
||
mov [status],text_ptr
|
||
;jmp .draw_status
|
||
@@:
|
||
}
|
||
neg eax
|
||
|
||
;test al,al
|
||
;jz close
|
||
|
||
cmp_err 3,bad_file_sys
|
||
|
||
cmp_err 5,file_not_find
|
||
|
||
cmp_err 9,bad_fat_table
|
||
|
||
cmp_err 10,acces_denyied
|
||
|
||
cmp_err 11,device_error
|
||
|
||
cmp_err 30,out_of_memory
|
||
|
||
cmp_err 31,file_not_executable
|
||
|
||
cmp_err 32,many_processes
|
||
|
||
.draw_status:
|
||
call draw_status
|
||
jmp still
|
||
|
||
draw_window:
|
||
start_draw_window
|
||
get_screen_size
|
||
mov cx,ax
|
||
sub cx,window_y+20
|
||
shl ecx,16
|
||
mov cx,window_y
|
||
shr eax,16
|
||
mov bx,ax
|
||
sub bx,window_x
|
||
shl ebx,15
|
||
mov bx,window_x
|
||
mov edx,[sc.work]
|
||
or edx,0x03000000
|
||
xor eax,eax
|
||
xor esi,esi
|
||
xor edi,edi
|
||
int 0x40
|
||
|
||
get_procinfo app
|
||
|
||
mov ax,[app.width]
|
||
sub ax,20
|
||
mov [input_fn.width],ax
|
||
mov [run_but.width],ax
|
||
|
||
mov bx,5
|
||
shl ebx,16
|
||
mov bx,ax
|
||
add bx,15
|
||
mov cx,70
|
||
push cx
|
||
shl ecx,16
|
||
pop cx
|
||
mov edx,[sc.work_graph]
|
||
mov eax,38
|
||
int 0x40
|
||
|
||
draw_edit_box input_fn
|
||
draw_txt_button run_but
|
||
|
||
call draw_status_text
|
||
|
||
stop_draw_window
|
||
ret
|
||
|
||
draw_status:
|
||
mov ebx,5*65536+(window_x-5-5)
|
||
mov ecx,(window_y-16)*65536+12
|
||
mov edx,[sc.work]
|
||
mov eax,13
|
||
int 0x40
|
||
draw_status_text:
|
||
mov edx,[status]
|
||
xor esi,esi
|
||
@@:
|
||
cmp [edx+esi],byte 0
|
||
je @f
|
||
inc esi
|
||
jmp @b
|
||
@@:
|
||
mov eax,4
|
||
mov ebx,10*65536+(window_y-14)
|
||
mov ecx,[sc.work_text]
|
||
int 0x40
|
||
ret
|
||
|
||
run_but txt_button 0,10,15,50,2,0,0,run_but_text,
|
||
if lang eq ru
|
||
run_but_text db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0
|
||
else
|
||
run_but_text db 'RUN',0
|
||
end if
|
||
input_fn edit_box 0,10,30,0xffffff,0,0xaaaaaa,0,511,fn,ed_focus+\
|
||
ed_always_focus
|
||
|
||
if lang eq ru
|
||
hello db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20> 䠩<><E4A0A9> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Enter',0
|
||
bad_file_sys db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⭠<EFBFBD> 䠩<><E4A0A9><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>⥬<EFBFBD>',0 ; 3
|
||
file_not_find db '<27><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0 ; 5
|
||
bad_fat_table db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FAT ࠧ<><E0A0A7>襭<EFBFBD>',0 ; 9
|
||
acces_denyied db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>饭',0 ; 10
|
||
device_error db '<27>訡<EFBFBD><E8A8A1> <20><><EFBFBD>ன<EFBFBD>⢠',0 ; 11
|
||
out_of_memory db '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>筮 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',0 ; 30
|
||
file_not_executable db '<27><><EFBFBD><EFBFBD> <20><> <><EFA2AB><EFBFBD><EFBFBD><EFBFBD> <20>ᯮ<EFBFBD><E1AFAE>塞<EFBFBD><EFA5AC>',0 ; 31
|
||
many_processes db '<27><><EFBFBD>誮<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮢ',0 ; 32
|
||
else
|
||
hello db 'Enter full path to file and press <Enter>',0
|
||
bad_file_sys db 'Unknown file system',0 ; 3
|
||
file_not_find db 'File not found',0 ; 5
|
||
bad_fat_table db 'FAT table corrupted',0 ; 9
|
||
acces_denyied db 'Access denied',0 ; 10
|
||
device_error db 'Device error',0 ; 11
|
||
out_of_memory db 'Out of memory',0 ; 30
|
||
file_not_executable db 'File is not executable',0 ; 31
|
||
many_processes db 'Too many processes',0 ; 32
|
||
end if
|
||
|
||
status dd hello
|
||
|
||
file_info:
|
||
.mode dd 7
|
||
.flags dd 0
|
||
.par dd run_par
|
||
dd 0,0
|
||
.name rb 512
|
||
|
||
flags dw ?
|
||
|
||
fn rb 512
|
||
|
||
sc sys_color_table
|
||
app procinfo
|
||
run_par rb 256
|
||
par rb 256
|
||
app_end |