t_edit: fix 2 icons, fix exit function

t_edit_synt: update program, clean code

git-svn-id: svn://kolibrios.org@7575 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2019-01-15 12:24:51 +00:00
parent 03104b5bad
commit 3810c9cbc8
7 changed files with 283 additions and 330 deletions

View File

@ -163,20 +163,25 @@ button:
@@: @@:
cmp ah,1 cmp ah,1
je .exit jne @f
call ted_Exit
jmp still
@@:
cmp ah,199 cmp ah,199
je .exit jne still
call ted_Exit
jmp still jmp still
.exit:
align 4
ted_Exit:
cmp dword[wnd_k_words_run],0 cmp dword[wnd_k_words_run],0
je @f je @f
push ebx ecx push ebx ecx
mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID,[wnd_k_words_run] mcall SF_SYSTEM, SSF_TERMINATE_THREAD_ID,[wnd_k_words_run]
pop ecx ebx pop ecx ebx
test eax,eax mov dword[wnd_k_words_run],0
jnz still ;test eax,eax
@@: @@:
cmp dword[exit_code],1 cmp dword[exit_code],1
je @f je @f
@ -185,17 +190,17 @@ button:
jne @f jne @f
stdcall [mb_create],msgbox_2,thread ;message: save buf in file? stdcall [mb_create],msgbox_2,thread ;message: save buf in file?
stdcall [mb_setfunctions],msgbox_2E_funct stdcall [mb_setfunctions],msgbox_2E_funct
jmp still ret
@@: @@:
stdcall mem.Free,[bmp_icon] stdcall mem.Free,[bmp_icon]
cmp dword[unpac_mem],0 cmp dword[unpac_mem],0
je @f je @f
stdcall mem.Free,[unpac_mem] stdcall mem.Free,[unpac_mem]
@@: @@:
stdcall [ted_delete], tedit0 stdcall [ted_delete], tedit0
stdcall [tl_data_clear], tree1 stdcall [tl_data_clear], tree1
mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë
;ret
;input: ;input:
; al = ª®¤ ®è¨¡ª¨ ; al = ª®¤ ®è¨¡ª¨

View File

@ -39,7 +39,9 @@ start:
mcall SF_SYS_MISC,SSF_HEAP_INIT mcall SF_SYS_MISC,SSF_HEAP_INIT
or eax,eax or eax,eax
jz button.exit jnz @f
call ted_Exit
@@:
mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
mcall SF_SET_EVENTS_MASK,0xC0000027 mcall SF_SET_EVENTS_MASK,0xC0000027
@ -200,7 +202,10 @@ align 16
still: still:
mcall SF_WAIT_EVENT mcall SF_WAIT_EVENT
cmp dword[exit_code],1 cmp dword[exit_code],1
je button.exit jne @f
call ted_Exit
jmp still
@@:
cmp al,1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­  cmp al,1 ;¨§¬¥­¨«®áì ¯®«®¦¥­¨¥ ®ª­ 
jz red_win jz red_win
@ -210,7 +215,7 @@ still:
jz button jz button
cmp al,6 ;¬ëèì cmp al,6 ;¬ëèì
jne @f jne @f
jmp mouse call mouse
@@: @@:
jmp still jmp still
@ -228,7 +233,7 @@ mouse:
bt eax,24 ;¤¢®©­®© 饫çñª «¥¢®© ª­®¯ª®© bt eax,24 ;¤¢®©­®© 饫çñª «¥¢®© ª­®¯ª®©
jnc @f jnc @f
stdcall [ted_but_select_word], tedit0 stdcall [ted_but_select_word], tedit0
jmp still ret
@@: @@:
stdcall [ted_mouse], tedit0 stdcall [ted_mouse], tedit0
.no_edit: .no_edit:
@ -241,7 +246,7 @@ mouse:
jne @f jne @f
stdcall [tl_mouse], tree1 stdcall [tl_mouse], tree1
@@: @@:
jmp still ret
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;output: ;output:

View File

@ -27,7 +27,7 @@ pushad
mov edi,tedit0 mov edi,tedit0
mov edx,ted_key_words_count mov edx,ted_key_words_count
add dword[tree3.info_max_count],edx ;áâ ¢¨¬ ç¨á«® 㧫®¢, à ¢­®¥ ª®««¨ç¥áâ¢ã ª«î祢ëå á«®¢ ¢ ä ©«¥ ¯®¤á¢¥âª¨ (+2 ­  ­ ç «® ¨ ª®­¥æ ᯨ᪠) add dword[tree3.info_max_count],edx ;áâ ¢¨¬ ç¨á«® 㧫®¢, à ¢­®¥ ª®««¨ç¥áâ¢ã ª«î祢ëå á«®¢ ¢ ä ©«¥ ¯®¤á¢¥âª¨ (+2 ­  ­ ç «® ¨ ª®­¥æ ᯨ᪠)
stdcall dword[tl_data_init], tree3 stdcall [tl_data_init], tree3
mov eax,dword[icon_tl_sys] mov eax,dword[icon_tl_sys]
mov dword[tree3.data_img],eax mov dword[tree3.data_img],eax
mov eax,dword[tree1.data_img_sys] mov eax,dword[tree1.data_img_sys]
@ -56,13 +56,27 @@ pushad
mcall ,,,4 mcall ,,,4
mov ebx,[bmp_icon] mov ebx,[bmp_icon]
add ebx,7*IMAGE_TOOLBAR_ICON_SIZE add ebx,(ID_BUT_FIND-ID_BUT_0)*IMAGE_TOOLBAR_ICON_SIZE
mcall SF_PUT_IMAGE,,(20 shl 16)+20,(5 shl 16)+5 ;­ ©â¨ mcall SF_PUT_IMAGE,,(20 shl 16)+20,(5 shl 16)+5 ;­ ©â¨
sub ebx,2*IMAGE_TOOLBAR_ICON_SIZE sub ebx,2*IMAGE_TOOLBAR_ICON_SIZE
mov edx,(30 shl 16)+5 ;ª®¯¨à®¢ âì mov edx,(30 shl 16)+5 ;ª®¯¨à®¢ âì
int 0x40 int 0x40
mcall SF_THREAD_INFO,procinfo,-1
mov eax,[procinfo.box.height]
cmp eax,90
jge @f
mov eax,90 ;min size
@@:
sub eax,58
cmp [tree3.box_height],eax
je @f
mov [tree3.box_height],eax
mov word[w_scr_t3.y_size],ax
;need call tb_scrol_resize
@@:
mov dword[w_scr_t3.all_redraw],1 mov dword[w_scr_t3.all_redraw],1
stdcall [scrollbar_ver_draw], w_scr_t3 stdcall [scrollbar_ver_draw], w_scr_t3
stdcall [tl_draw], tree3 stdcall [tl_draw], tree3
@ -93,7 +107,7 @@ prop_still:
.exit: .exit:
mov dword[tree3.data_img],0 ;ç¨á⨬ 㪠§ â¥«¨ ­  ¨ª®­ª¨ çâ®-¡ë ¨å ­¥ 㤠«¨« ¤¥áâàãªâ®à mov dword[tree3.data_img],0 ;ç¨á⨬ 㪠§ â¥«¨ ­  ¨ª®­ª¨ çâ®-¡ë ¨å ­¥ 㤠«¨« ¤¥áâàãªâ®à
mov dword[tree3.data_img_sys],0 ;â. ª. ®­¨ ¥é¥ ¨á¯®«ì§ãîâìáï ¢ ¤à㣨å í«¥¬¥­â å mov dword[tree3.data_img_sys],0 ;â. ª. ®­¨ ¥é¥ ¨á¯®«ì§ãîâìáï ¢ ¤à㣨å í«¥¬¥­â å
stdcall dword[tl_data_clear], tree3 stdcall [tl_data_clear], tree3
mov dword[wnd_k_words_run],0 ;®¡­ã«ï¥¬ ID ®ª­  mov dword[wnd_k_words_run],0 ;®¡­ã«ï¥¬ ID ®ª­ 
mcall SF_TERMINATE_PROCESS mcall SF_TERMINATE_PROCESS
@ -128,7 +142,8 @@ prop_button:
mov edi,tedit0 mov edi,tedit0
cmp ted_syntax_file,0 cmp ted_syntax_file,0
je @f je @f
stdcall dword[tl_info_clear], tree3 stdcall [tl_info_clear], tree3
and dword[tree3.style], not tl_cursor_pos_limited
mov ebx,ted_key_words_data mov ebx,ted_key_words_data
mov ecx,ted_key_words_count mov ecx,ted_key_words_count
@ -138,21 +153,22 @@ prop_button:
test al,al test al,al
jnz .end_add jnz .end_add
;ª«î祢®¥ á«®¢® ;ª«î祢®¥ á«®¢®
stdcall dword[tl_node_add], tree3, (1 shl 16), ebx stdcall [tl_node_add], tree3, (1 shl 16), ebx
stdcall dword[tl_cur_next], tree3 stdcall [tl_cur_next], tree3
mov edx,[ebx+MAX_COLOR_WORD_LEN] mov edx,[ebx+MAX_COLOR_WORD_LEN]
or edx,edx or edx,edx
jz .end_add jz .end_add
;á¯à ¢ª  ¯® ª«î祢®¬ã á«®¢ã ;á¯à ¢ª  ¯® ª«î祢®¬ã á«®¢ã
add edx,ted_help_text_f1 add edx,ted_help_text_f1
stdcall dword[tl_node_add], tree3, 1, edx stdcall [tl_node_add], tree3, 1, edx
stdcall dword[tl_cur_next], tree3 stdcall [tl_cur_next], tree3
.end_add: .end_add:
add ebx,MAX_COLOR_WORD_LEN+8 ;sizeof.TexColViv add ebx,MAX_COLOR_WORD_LEN+8 ;sizeof.TexColViv
loop .cycle_0 loop .cycle_0
stdcall dword[tl_cur_beg], tree3 stdcall [tl_cur_beg], tree3
stdcall dword[tl_draw], tree3 or dword[tree3.style], tl_cursor_pos_limited ;®£à ­¨ç¨¢ ¥¬ ¤¢¨¦¥­¨¥ ªãàá®à  ¢ ¯à¥¤¥« å ᯨ᪠
stdcall [tl_draw], tree3
jmp .no_select_0 jmp .no_select_0
@@: @@:
cmp ah,4 cmp ah,4

View File

@ -1,6 +1,4 @@
if not exist bin mkdir bin if not exist bin mkdir bin
if not exist bin\tl_sys_16.png @copy ..\..\media\log_el\trunk\tl_sys_16.png bin\tl_sys_16.png
if not exist bin\tl_nod_16.png @copy ..\t_edit\tl_nod_16.png bin\tl_nod_16.png
@fasm.exe -m 16384 te_syntax.asm bin\te_syntax.kex @fasm.exe -m 16384 te_syntax.asm bin\te_syntax.kex
@kpack bin\te_syntax.kex @kpack bin\te_syntax.kex

View File

@ -255,52 +255,13 @@ tedit0: ;
.fun_save_err dd 0 ;+238 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¥á«¨ á®åà ­¥­¨¥ ä ©«  § ª®­ç¨«®áì ­¥ã¤ ç­® .fun_save_err dd 0 ;+238 㪠§ â¥«ì ­  äã­ªæ¨î ¢ë§ë¢ ¥¬ãî ¥á«¨ á®åà ­¥­¨¥ ä ©«  § ª®­ç¨«®áì ­¥ã¤ ç­®
.increase_size dd 1000 ;+242 ç¨á«® ᨬ¢®«®¢ ­  ª®â®àë¥ ¡ã¤¥â 㢥稢 âìáï ¯ ¬ïâì ¯à¨ ­¥å¢ âª¥ .increase_size dd 1000 ;+242 ç¨á«® ᨬ¢®«®¢ ­  ª®â®àë¥ ¡ã¤¥â 㢥稢 âìáï ¯ ¬ïâì ¯à¨ ­¥å¢ âª¥
.ptr_free_symb dd ? ;+246 㪠§ â¥«ì ­  ᢮¡®¤­ãî ¯ ¬ïâì, ¢ ª®â®àãî ¬®¦­® ¤®¡ ¢«ïâì ᨬ¢®« (¨á¯®«ì§ã¥âáï ¢­ãâà¨ í«¥¬¥­â  ¤«ï ã᪮७¨ï ¢áâ ¢ª¨ ⥪áâ ) .ptr_free_symb dd ? ;+246 㪠§ â¥«ì ­  ᢮¡®¤­ãî ¯ ¬ïâì, ¢ ª®â®àãî ¬®¦­® ¤®¡ ¢«ïâì ᨬ¢®« (¨á¯®«ì§ã¥âáï ¢­ãâà¨ í«¥¬¥­â  ¤«ï ã᪮७¨ï ¢áâ ¢ª¨ ⥪áâ )
.font_size dd 0 ;+250 ¬­®¦¨â¥«ì ¤«ï à §¬¥à  èà¨äâ 
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
scrol_w1: scrol_w1 scrollbar 16,85, 100,15, 15, 100,0,0, 0xeeeeee,0xbbddff,0x808080, 1
.x:
.size_x dw 16 ;+0
.start_x dw 85 ;+2
.y:
.size_y dw 100 ; +4
.start_y dw 15 ; +6
.btn_high dd 15 ; +8
.type dd 1 ;+12
.max_area dd 100 ;+16
rb 4+4
.bckg_col dd 0xeeeeee ;+28
.frnt_col dd 0xbbddff ;+32
.line_col dd 0x808080 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
rb 2*4+4*6
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
;---------------------------------------------------------------------
align 4 align 4
scrol_h1: scrol_h1 scrollbar 85,30, 16,100, 15, 100,0,0, 0xeeeeee,0xbbddff,0x808080, 1
.x:
.size_x dw 85 ;+0
.start_x dw 30 ;+2
.y:
.size_y dw 16 ;+4
.start_y dw 100 ;+6
.btn_high dd 15 ;+8
.type dd 1 ;+12
.max_area dd 100 ;+16
rb 4+4
.bckg_col dd 0xeeeeee ;+28
.frnt_col dd 0xbbddff ;+32
.line_col dd 0x808080 ;+36
.redraw dd 0 ;+40
.delta dw 0 ;+44
.delta2 dw 0 ;+46
.run_x:
rb 2*4+4*6
.all_redraw dd 0 ;+80
.ar_offset dd 1 ;+84
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
PathShow_data_1: PathShow_data_1:
.type dd 0 ;+0 .type dd 0 ;+0

View File

@ -1,135 +1,77 @@
use32 use32
org 0x0 org 0
db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â db 'MENUET01' ;¨¤¥­â¨ä. ¨á¯®«­ï¥¬®£® ä ©«  ¢á¥£¤  8 ¡ ©â
dd 0x01 dd 1, start, i_end, mem, stacktop, file_name, sys_path
dd start
dd i_end ; à §¬¥à ¯à¨«®¦¥­¨ï
dd mem
dd stacktop
dd file_name
dd sys_path
MAX_COLOR_WORD_LEN equ 40 MAX_COLOR_WORD_LEN equ 40
BUF_SIZE equ 4096 ;buffer for copy|paste BUF_SIZE equ 4096 ;buffer for copy|paste
maxSyntaxFileSize equ 310000
CAPT_PATH_WIDTH equ 50 ;è¨à¨­  ¯®¤¯¨á¨ ¯¥à¥¤ ⥪áâ®¢ë¬ ¯®«¥¬ CAPT_PATH_WIDTH equ 50 ;è¨à¨­  ¯®¤¯¨á¨ ¯¥à¥¤ ⥪áâ®¢ë¬ ¯®«¥¬
include '../../macros.inc' include '../../macros.inc'
include '../../proc32.inc' include '../../proc32.inc'
include '../../develop/libraries/box_lib/load_lib.mac' include '../../KOSfuncs.inc'
include '../../load_img.inc'
include '../../develop/libraries/box_lib/trunk/box_lib.mac' include '../../develop/libraries/box_lib/trunk/box_lib.mac'
include '../../dll.inc' include '../../system/skincfg/trunk/kglobals.inc'
include '../../system/skincfg/trunk/unpacker.inc'
include 'te_data.inc' include 'te_data.inc'
include 'te_work.inc' ;text work functions include 'te_work.inc' ;text work functions
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
;Œ ªà®á ¤«ï § £à㧪¨ ¨§®¡à ¦¥­¨© á ¨á¯®«ì§®¢ ­¨¥¬ ¡¨¡«¨®â¥ª¨ libimg.obj
;¤«ï ¨á¯®«ì§®¢ ­¨ï ¬ ªà®á  ­ã¦­ë ¯¥à¥¬¥­­ë¥:
; - run_file_70 FileInfoBlock
; - image_data dd 0
macro load_image_file path,buf,size
{
;path - ¬®¦¥â ¡ëâì ¯¥à¥¬¥­­®© ¨«¨ áâப®¢ë¬ ¯ à ¬¥â஬
if path eqtype '' ;¯à®¢¥à塞 § ¤ ­ «¨ áâப®© ¯ à ¬¥âà path
jmp @f
local .path_str
.path_str db path ;ä®à¬¨à㥬 «®ª «ì­ãî ¯¥à¥¬¥­­ãî
db 0
@@:
;32 - áâ ­¤ àâ­ë©  ¤à¥á ¯® ª®â®à®¬ã ¤®«¦¥­ ¡ëâì ¡ãä¥à á á¨á⥬­ë¬ ¯ã⥬
copy_path .path_str,[32],file_name,0
else
copy_path path,[32],file_name,0 ;ä®à¬¨à㥬 ¯®«­ë© ¯ãâì ª ä ©«ã ¨§®¡à ¦¥­¨ï, ¯®¤à §ã¬¥¢ ¥¬ çâ® ®­ ¢ ®¤­®© ¯ ¯ª¥ á ¯à®£à ¬¬®©
end if
stdcall mem.Alloc, dword size ;¢ë¤¥«ï¥¬ ¯ ¬ïâì ¤«ï ¨§®¡à ¦¥­¨ï
mov [buf],eax
mov [run_file_70.Function], 0
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], dword size
mov [run_file_70.Buffer], eax
mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name
mcall 70,run_file_70 ;§ £à㦠¥¬ ä ©« ¨§®¡à ¦¥­¨ï
cmp ebx,0xffffffff
je @f
;®¯à¥¤¥«ï¥¬ ¢¨¤ ¨§®¡à ¦¥­¨ï ¨ ¯¥à¥¢®¤¨¬ ¥£® ¢® ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_decode], dword[buf],ebx,0
mov dword[image_data],eax
;¯à¥®¡à §ã¥¬ ¨§®¡à ¦¥­¨¥ ª ä®à¬ âã rgb
stdcall dword[img_to_rgb2], dword[image_data],dword[buf]
;㤠«ï¥¬ ¢à¥¬¥­­ë© ¡ãä¥à image_data
stdcall dword[img_destroy], dword[image_data]
@@:
}
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª icon_tl_sys dd 0 ;㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï åà ­¥­¨ï á¨á⥬­ëå ¨ª®­®ª
align 4 align 4
start: start:
mcall 48,3,sc,sizeof.system_colors mcall SF_STYLE_SETTINGS,SSF_GET_COLORS,sc,sizeof.system_colors
mcall 68,11 mcall SF_SYS_MISC,SSF_HEAP_INIT
or eax,eax or eax,eax
jz button.exit jz button.exit
mcall 66,1,1 ;scan code mcall SF_KEYBOARD,SSF_SET_INPUT_MODE,1 ;scan code
mcall 40,0x27 mcall SF_SET_EVENTS_MASK,0xC0000027
;------------------------------------------------- load_libraries l_libs_start,load_lib_end
mov ecx,maxSyntaxFileSize
stdcall mem.Alloc,ecx
mov [options_file],eax
mov [options_file_end],eax
add [options_file_end],ecx
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
load_libraries l_libs_start,load_lib_end cmp dword[lib0+ll_struc_size-4],0
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ¡¨¡«¨®â¥ª 
cmp dword [lib0+ll_struc_size-4],0
jz @f jz @f
mcall -1 ;exit not correct mcall -1 ;exit not correct
@@: @@:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
stdcall dword[tl_data_init],dword tree1 stdcall [tl_data_init], tree1
; ç¨â ¥¬ ä ©« á ªãàá®à ¬¨ ¨ «¨­¨ï¬¨ ; ç¨â ¥¬ ä ©« á ªãàá®à ¬¨ ¨ «¨­¨ï¬¨
load_image_file 'tl_sys_16.png', icon_tl_sys,54+3*256*13 include_image_file '..\..\media\log_el\trunk\tl_sys_16.png', icon_tl_sys
mov eax,dword[icon_tl_sys] mov eax,[icon_tl_sys]
mov dword[tree1.data_img_sys],eax mov [tree1.data_img_sys],eax
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; ç¨â ¥¬ bmp ä ©« á ¨ª®­ª ¬¨ 㧫®¢ ; ç¨â ¥¬ bmp ä ©« á ¨ª®­ª ¬¨ 㧫®¢
load_image_file 'tl_nod_16.png', icon_tl_sys,54+3*256*2 include_image_file '..\t_edit\tl_nod_16.png', icon_tl_sys
mov eax,dword[icon_tl_sys] mov eax,[icon_tl_sys]
mov dword[tree1.data_img],eax mov [tree1.data_img],eax
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á  copy_path fn_syntax_dir,sys_path,file_name,0 ;¡¥à¥¬ ¯ãâì ª ¯ ¯ª¥ á ä ©« ¬¨ ᨭ⠪á¨á 
mov eax,70 mcall SF_FILE,tree_file_struct
mov ebx,tree_file_struct
int 0x40
cmp ebx,-1 cmp ebx,-1
je .end_dir_init je .end_dir_init
mov eax,dir_mem
mov eax,dir_mem add eax,32+4+1+3+4*6+8
add eax,32+4+1+3+4*6+8 mov ecx,ebx
mov ecx,ebx @@:
@@: cmp byte[eax],'.' ;䨫ìâà㥬 ä ©«ë á ¨¬¥­ ¬¨ '.' ¨ '..'
cmp byte[eax],'.' ;䨫ìâà㥬 ä ©«ë á ¨¬¥­ ¬¨ '.' ¨ '..' je .filter
je .filter stdcall [tl_node_add],tree1,0x10000,eax ;1*2^16 - £¤¥ 1 ­®¬¥à ¨ª®­ª¨ á ª­¨£®©
stdcall dword[tl_node_add],tree1,0x10000,eax ;1*2^16 - £¤¥ 1 ­®¬¥à ¨ª®­ª¨ á ª­¨£®© stdcall [tl_cur_next],tree1
stdcall dword[tl_cur_next],tree1 .filter:
.filter: add eax,304
add eax,304 loop @b
loop @b stdcall [tl_cur_beg],tree1 ;áâ ¢¨¬ ªãàá®à ­  ­ ç «® ᯨ᪠
stdcall dword[tl_cur_beg],tree1 ;áâ ¢¨¬ ªãàá®à ­  ­ ç «® ᯨ᪠ or dword[tree1.style], tl_cursor_pos_limited ;®£à ­¨ç¨¢ ¥¬ ¤¢¨¦¥­¨¥ ªãàá®à  ¢ ¯à¥¤¥« å ᯨ᪠
.end_dir_init: .end_dir_init:
;--- load color option file --- ;--- load color option file ---
stdcall [ted_init], tedit0 stdcall [ted_init], tedit0
@ -141,7 +83,7 @@ red_win:
align 4 align 4
still: still:
mcall 10 mcall SF_WAIT_EVENT
cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­  cmp al,1 ;¨§¬. ¯®«®¦¥­¨¥ ®ª­ 
jz red_win jz red_win
@ -158,47 +100,37 @@ still:
align 4 align 4
draw_window: draw_window:
pushad pushad
mcall 12,1 mcall SF_REDRAW,SSF_BEGIN_DRAW
mov edx,[sc.work] mov edx,[sc.work]
or edx,0x33000000 or edx,0x33000000
mov edi,hed mov edi,hed
mcall 0,<10,555>,<10,333> mcall SF_CREATE_WINDOW,<10,555>,<10,333>
mcall 9,procinfo,-1 mcall SF_THREAD_INFO,procinfo,-1
mov edi,tedit0 ;§­ ç¥­¨¥ edi ­ã¦­® ¤«ï EvSize ¨ ted_wnd_t
call EvSize
mov eax,8 ;ª­®¯ª 
mov ebx,5*65536+90
mov ecx,195*65536+20
mov edx,200
mov esi,[sc.work_button];0xd0 mov esi,[sc.work_button];0xd0
mcall mcall SF_DEFINE_BUTTON,5*65536+90,195*65536+20,200
;mov eax,8
mov ebx,100*65536+85 mov ebx,100*65536+85
mov ecx,195*65536+20 mov ecx,195*65536+20
mov edx,201 mov edx,201
mov esi,0xd00000 mov esi,0xd00000
mcall mcall
mov eax,4 ;à¨á®¢ ­¨¥ ⥪áâ 
mov ebx,10*65536+200
mov ecx,[sc.work_button_text] mov ecx,[sc.work_button_text]
or ecx,0x80000000 or ecx,0x80000000
mov edx,txt122 mcall SF_DRAW_TEXT,10*65536+200,,txt_load_f
mcall
mov ebx,105*65536+200
mov ecx,0xffff00 mov ecx,0xffff00
or ecx,0x80000000 or ecx,0x80000000
mov edx,txt148 mcall ,105*65536+200,,txt_save_f
mcall
mov ebx,195*65536+10
mov ecx,[sc.work_text] mov ecx,[sc.work_text]
or ecx,0x80000000 or ecx,0x80000000
mov edx,txt_inp_file mcall ,195*65536+10,,txt_inp_file
int 0x40
add ebx,20 add ebx,20
mov edx,txt_out_file mov edx,txt_out_file
@ -215,7 +147,37 @@ draw_window:
stdcall [scrollbar_ver_draw],dword ws_dir_lbox stdcall [scrollbar_ver_draw],dword ws_dir_lbox
stdcall [ted_draw], tedit0 stdcall [ted_draw], tedit0
mcall 12,2 mcall SF_REDRAW,SSF_END_DRAW
popad
ret
MIN_M_WND_H equ 100 ;¬¨­¨¬ «ì­ ï ¢ëá®â  £« ¢­®£® ®ª­ 
;input:
; edi = pointer to tedit struct
align 4
EvSize:
pushad
mov ebx,ted_scr_h
mov esi,ted_scr_w
m2m ted_wnd_w,[procinfo.client_box.width] ;áâ ¢¨¬ è¨à¨­ã ®ª­  । ªâ®à  à ¢­®© è¨à¨­¥ ¢á¥£® ®ª­ 
mov eax,ted_wnd_l
sub ted_wnd_w,eax ;®â­¨¬ ¥¬ ®âáâ㯠᫥¢ 
movzx eax,word[esi+sb_offs_size_x]
sub ted_wnd_w,eax ;®â­¨¬ ¥¬ è¨à¨­ã ¢¥àâ. áªà®««¨­£ 
m2m ted_wnd_h,[procinfo.client_box.height] ;áâ ¢¨¬ ¢ëá®âã ®ª­  । ªâ®à  à ¢­®© ¢ëá®â¥ ¢á¥£® ®ª­ 
cmp ted_wnd_h,MIN_M_WND_H
jg @f
mov ted_wnd_h,MIN_M_WND_H
@@:
movzx eax,word[ebx+sb_offs_size_y]
sub ted_wnd_h,eax ;®â­¨¬ ¥¬ ¢ëá®âã £®à¨§. áªà®««¨­£ 
mov eax,ted_wnd_t
sub ted_wnd_h,eax ;®â­¨¬ ¥¬ ®âáâ㯠ᢥàåã
stdcall [ted_init_scroll_bars], tedit0,2
popad popad
ret ret
@ -242,10 +204,10 @@ endp
align 4 align 4
key: key:
mcall 66,3 ;66.3 ¯®«ãç¨âì á®áâ®ï­¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è mcall SF_KEYBOARD,SSF_GET_CONTROL_KEYS ;66.3 ¯®«ãç¨âì á®áâ®ï­¨¥ ã¯à ¢«ïîé¨å ª« ¢¨è
xor esi,esi xor esi,esi
mov ecx,1 mov ecx,1
test al,0x03 ;[Shift] test al,3 ;[Shift]
jz @f jz @f
mov cl,2 mov cl,2
or esi,KM_SHIFT or esi,KM_SHIFT
@ -264,8 +226,8 @@ key:
or esi,KM_NUMLOCK or esi,KM_NUMLOCK
@@: @@:
mcall 26,2,,conv_tabl ;26.2 ¯®«ãç¨âì à áª« ¤ªã ª« ¢¨ âãàë mcall SF_SYSTEM_GET,SSF_KEYBOARD_LAYOUT,,conv_tabl ;26.2 ¯®«ãç¨âì à áª« ¤ªã ª« ¢¨ âãàë
mcall 2 mcall SF_GET_KEY
stdcall [tl_key],tree1 stdcall [tl_key],tree1
test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬ test word [edit1.flags],10b;ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
@ -283,7 +245,7 @@ key:
cmp ah,69 ;[Pause Break] cmp ah,69 ;[Pause Break]
je still je still
stdcall KeyConvertToASCII, dword conv_tabl stdcall KeyConvertToASCII, conv_tabl
stdcall [edit_box_key],edit1 stdcall [edit_box_key],edit1
jmp still jmp still
@@: @@:
@ -293,33 +255,26 @@ key:
align 4 align 4
button: button:
; cmp [menu_active],1 ;¥á«¨ ­ ¦ «¨ ¬¥­î, â® á­ ç «  ॠªæ¨ï ­  ¬¥­î mcall SF_GET_BUTTON
; jne @f ;mouse.menu_bar_1
; mov [menu_active],0
; jmp still
; @@:
mcall 17 ;¯®«ãç¨âì ª®¤ ­ ¦ â®© ª­®¯ª¨ cmp ah,200
jne @f
call but_OpenSyntax
@@:
cmp ah,201
jne @f
call but_SaveSyntax
@@:
cmp ah,200 cmp ah,1
jne @f jne still
call but_OpenSyntax
@@:
cmp ah,201
jne @f
call but_SaveSyntax
@@:
cmp ah,1
jne still
.exit: .exit:
;push eax stdcall mem.Free,[options_file]
stdcall mem.Free,[unpac_mem]
stdcall mem.Free,[options_file] stdcall [tl_data_clear], tree1
stdcall [ted_delete], tedit0
stdcall [tl_data_clear], tree1 mcall SF_TERMINATE_PROCESS ;¢ë室 ¨§ ¯à®£à ¬¬ë
stdcall [ted_delete], tedit0
mcall -1 ;¢ë室 ¨§ ¯à®£à ¬¬ë
align 4 align 4
but_OpenSyntax: but_OpenSyntax:
@ -373,16 +328,14 @@ get_wnd_in_focus:
;@@: ;@@:
ret ret
hed db 'TextEditor syntax file converter 10.11.15',0 ;¯®¤¯¨áì ®ª­  hed db 'TextEditor syntax file converter 15.01.19',0 ;¯®¤¯¨áì ®ª­ 
conv_tabl rb 128 ; â ¡«¨æ  ¤«ï ª®­¢¥àâ¨à®¢ ­¨ï scan-ª®¤  ¢ ascii-ª®¤ conv_tabl rb 128 ; â ¡«¨æ  ¤«ï ª®­¢¥àâ¨à®¢ ­¨ï scan-ª®¤  ¢ ascii-ª®¤
txt122 db '‡ £à. ä ©«',0 txt_load_f db '‡ £à. ä ©«',0
txt148 db '‘®åà. ä ©«',0 txt_save_f db '‘®åà. ä ©«',0
txt_inp_file db 'ˆáå. ä ©«:',0 txt_inp_file db 'ˆáå. ä ©«:',0
txt_out_file db '‚ëå. ä ©«:',0 txt_out_file db '‚ëå. ä ©«:',0
txt_no_kpack db 'Žâªà뢠¥¬ë© ä ©« ᦠâ Kpack-®¬.',13,10,'„«ï à ¡®âë á ä ©«®¬ à á¯ ªã©â¥ ¥£® ¨á¯®«ì§ãï á¨á⥬­ãî ¯à®£à ¬¬ã Kpack.',13,10,'<27> ¡®â  ᮠᦠâ묨 ä ©« ¬¨ ¯®ª  ­¥ ¯®¤¤¥à¦¨¢ ¥âáï.',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db 'System error',0
err_message_found_lib_0 db 'Sorry I cannot found library ',39,'box_lib.obj',39,0 err_message_found_lib_0 db 'Sorry I cannot found library ',39,'box_lib.obj',39,0
@ -396,9 +349,11 @@ l_libs_start:
lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1, err_message_found_lib_1, head_f_l, import_libimg,err_message_import_1, head_f_i lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1, err_message_found_lib_1, head_f_l, import_libimg,err_message_import_1, head_f_i
load_lib_end: load_lib_end:
IncludeIGlobals
align 16 align 16
i_end: i_end:
IncludeUGlobals
procinfo process_information procinfo process_information
rb 1024 rb 1024
thread: thread:

View File

@ -1,12 +1,3 @@
struct FileInfoBlock
Function dd ?
Position dd ?
Flags dd ?
Count dd ?
Buffer dd ?
db ?
FileName dd ?
ends
struct TexColViv struct TexColViv
Text rb MAX_COLOR_WORD_LEN ; ñëîâî äëÿ ïîäñâåòêè Text rb MAX_COLOR_WORD_LEN ; ñëîâî äëÿ ïîäñâåòêè
@ -28,7 +19,8 @@ color_cur_text dd ?
color_wnd_text dd ? color_wnd_text dd ?
options_file dd 0 options_file dd 0
options_file_end dd 0 open_file_size dd 0
unpac_mem dd 0
tex_colors dd 0 tex_colors dd 0
tex_help_f1 dd 0 tex_help_f1 dd 0
@ -46,67 +38,91 @@ align 4
InitColText: InitColText:
pushad pushad
mov ebx,dword[fn_col_option] mov ebx,[fn_col_option]
copy_path ebx,fn_syntax_dir,file_name_rez,0 copy_path ebx,fn_syntax_dir,file_name_rez,0
copy_path file_name_rez,sys_path,file_name,0 copy_path file_name_rez,sys_path,file_name,0
mov eax,70 ;[fn_col_option] = '*.syn'
mov [run_file_70.Function], 0 ;fn_syntax_dir = 'info/'
;file_name_rez = 'info/*.syn'
mov [run_file_70.Function], SSF_GET_INFO
mov [run_file_70.Position], 0 mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0 mov [run_file_70.Flags], 0
mov ebx,[options_file_end] mov dword[run_file_70.Count], 0
sub ebx,[options_file] mov dword[run_file_70.Buffer], open_b
mov [run_file_70.Count], ebx
m2m [run_file_70.Buffer], [options_file]
mov byte[run_file_70+20], 0 mov byte[run_file_70+20], 0
mov [run_file_70.FileName], file_name mov dword[run_file_70.FileName], file_name
mov ebx,run_file_70 mcall SF_FILE,run_file_70
int 0x40
mov ecx,dword[open_b+32] ;+32 qword: ðàçìåð ôàéëà â áàéòàõ
stdcall mem.ReAlloc,[options_file],ecx
mov [options_file],eax
mov [open_file_size],ecx
mov [run_file_70.Function], SSF_READ_FILE
mov [run_file_70.Position], 0
mov [run_file_70.Flags], 0
mov [run_file_70.Count], ecx
m2m dword[run_file_70.Buffer], dword[options_file]
mov byte[run_file_70+20], 0
mov dword[run_file_70.FileName], file_name
mcall SF_FILE,run_file_70 ;çàãðóæàåì ôàéë èçîáðàæåíèß
test eax,eax
jnz .no_colors
cmp ebx,0xffffffff
je .no_colors
mcall SF_SET_CAPTION,1,file_name
;init: count_colors_text, ColWords, ... ;init: count_colors_text, ColWords, ...
mov dword[count_colors_text],1 mov dword[count_colors_text],1
mov dword[ColWords],0 mov dword[ColWords],0
mov dword[tex_help_f1],0 mov dword[tex_help_f1],0
cmp eax,6 mov edi,[options_file]
je @f cmp dword[edi],'KPCK'
cmp eax,0 jne .end_unpack
je @f ;notify_window_run ...
cmp ax,10 mov ecx,[edi+4]
jl .zifra_0_9 cmp [open_file_size],ecx
mov al,'?' jge @f
sub ax,48 ;åñëè äëß ðàñïàêîâàíîãî ôàéëà íå õâàòàåò âûäåëåííîé ïàìßòè
.zifra_0_9: stdcall mem.ReAlloc,edi,ecx
add ax,48 mov [options_file],eax
jmp .no_colors mov [open_file_size],ecx
@@: @@:
;âûäåëåíèå ïàìßòè äëß ðàñïàêîâêè ôàéëà
stdcall mem.ReAlloc,[unpac_mem],ecx
mov [unpac_mem],eax
stdcall unpack,[options_file],eax
mov edi,[options_file]
mov esi,[unpac_mem]
mov ecx,[edi+4]
cld
rep movsb
.end_unpack:
mov esi,[options_file] mov esi,[options_file]
cmp dword[esi],'KPCK'
jne @f
notify_window_run txt_no_kpack ; ñîçäàåì îêíî @notify
jmp .no_colors
@@:
mov edi,count_colors_text mov edi,count_colors_text
mov ecx,9*4 mov ecx,9
rep movsb rep movsd
mov eax,[options_file] mov eax,[options_file]
add eax,32 add eax,32
mov dword[tex_colors],eax mov [tex_colors],eax
mov eax,dword[count_colors_text] ;init: Col (offset to key words) mov eax,[count_colors_text] ;init: Col (offset to key words)
add eax,8 add eax,8
shl eax,2 shl eax,2
add eax,[options_file] add eax,[options_file]
mov dword[Col],eax mov [Col],eax
;init: tex_help_f1 ;init: tex_help_f1
mov ecx,dword[ColWords] mov ecx,[ColWords]
imul ecx,sizeof.TexColViv imul ecx,sizeof.TexColViv
add ecx,dword[Col] add ecx,[Col]
mov dword[tex_help_f1],ecx mov [tex_help_f1],ecx
;ôîðìèðîâàíèå òåêñòà â îêíå òåêñòîâîãî ðåäàêòîðà ;ôîðìèðîâàíèå òåêñòà â îêíå òåêñòîâîãî ðåäàêòîðà
stdcall [ted_clear], tedit0,1 stdcall [ted_clear], tedit0,1
@ -136,28 +152,27 @@ InitColText:
loop @b loop @b
stdcall print_capt,capt_lbl_wo stdcall print_capt,capt_lbl_wo
mov ecx,dword[ColWords] mov ecx,[ColWords]
mov eax,[Col] mov eax,[Col]
xor ebx,ebx xor ebx,ebx
@@: @@: ;öèêë ïî ïîäñâå÷èâàåìûì ñëîâàì
inc ebx inc ebx
stdcall print_word,eax,ebx stdcall print_word,eax,ebx
add eax,sizeof.TexColViv add eax,sizeof.TexColViv
loop @b loop @b
stdcall print_capt,capt_lbl_f1 stdcall print_capt,capt_lbl_f1
mov ecx,dword[ColWords] mov ecx,[ColWords]
mov eax,[Col] mov eax,[Col]
xor ebx,ebx xor ebx,ebx
@@: @@: ;öèêë ïî ñïðàâêàì ê ïîäñâ. ñëîâàì
inc ebx inc ebx
stdcall print_word_f1,eax,ebx stdcall print_word_f1,eax,ebx
add eax,sizeof.TexColViv add eax,sizeof.TexColViv
loop @b loop @b
; ïîäãîòîâêà äëÿ PathShow ; ïîäãîòîâêà äëß PathShow
push dword PathShow_data_1 stdcall [PathShow_prepare], PathShow_data_1
call [PathShow_prepare]
call draw_window call draw_window
.no_colors: .no_colors:
@ -209,7 +224,7 @@ endp
align 4 align 4
proc print_capt, capt:dword proc print_capt, capt:dword
pushad pushad
mov esi,dword[capt] mov esi,[capt]
stdcall str_len,esi stdcall str_len,esi
stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor
popad popad
@ -219,63 +234,53 @@ endp
align 4 align 4
proc print_word, text:dword, index:dword proc print_word, text:dword, index:dword
pushad pushad
mov esi,text_buffer mov edi,text_buffer
mov byte[esi],0 mov byte[edi],0
stdcall str_cat,esi,capt_beg_word stdcall str_cat,edi,capt_beg_word
stdcall str_len,esi stdcall str_len,edi
add esi,eax add edi,eax
mov edi,dword[text] mov ecx,[text]
stdcall code_string,edi,esi ;êîäèðóåì ñòðîêó ñ êëþ÷åâûì ñëîâîì stdcall code_string,ecx,edi ;êîäèðóåì ñòðîêó ñ êëþ÷åâûì ñëîâîì
stdcall str_cat,esi,capt_end_word stdcall str_cat,edi,capt_end_word
cmp dword[edi+MAX_COLOR_WORD_LEN],0 ;f1 cmp dword[ecx+TexColViv.f1],0
je @f je @f
stdcall str_cat,esi,capt_calc_f1 stdcall str_cat,edi,capt_calc_f1
stdcall str_cat_value,esi,[index] stdcall str_cat_value,edi,[index]
stdcall str_cat,esi,capt_lbl_f1_use stdcall str_cat,edi,capt_lbl_f1_use
@@: @@:
mov esi,text_buffer stdcall str_len,edi
stdcall str_len,esi ;óçíàåì äëèííó âñåé ñòðîêè add edi,eax
stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor mov word[edi],','
inc edi
mov ecx,edi movzx eax,byte[ecx+TexColViv.flags]
mov edi,text_buffer
mov byte[edi],','
inc edi
mov byte[edi],0
xor eax,eax
mov al,byte[ecx+MAX_COLOR_WORD_LEN+4] ;wwo
stdcall str_cat_value,edi,eax stdcall str_cat_value,edi,eax
stdcall str_len,edi stdcall str_len,edi
add edi,eax add edi,eax
mov byte[edi],',' mov word[edi],','
inc edi inc edi
xor eax,eax movzx eax,word[ecx+TexColViv.endc] ;(escc shl 8)+endc
mov ax,word[ecx+MAX_COLOR_WORD_LEN+4+1] ;(escc shl 8)+endc or eax,eax ;ïðîâåðßåì åñòü ëè çàâåðøàþùèé è ýêðàíèíóþùèé ñèìâîë
cmp ax,0 ;ïðîâåðÿåì åñòü ëè çàâåðøàþùèé è ýêðàíèíóþùèé ñèìâîë jz @f
je @f
stdcall str_cat_value,edi,eax stdcall str_cat_value,edi,eax
stdcall str_len,edi stdcall str_len,edi
add edi,eax add edi,eax
@@: @@:
mov byte[edi],',' mov word[edi],','
inc edi inc edi
xor eax,eax movzx eax,byte[ecx+TexColViv.color]
mov al,byte[ecx+MAX_COLOR_WORD_LEN+4+3] ;color
stdcall str_cat_value,edi,eax stdcall str_cat_value,edi,eax
stdcall str_len,edi stdcall str_len,edi
add edi,eax add edi,eax
mov byte[edi],13 mov word[edi],13
inc edi
mov byte[edi],0
mov esi,text_buffer mov esi,text_buffer
stdcall str_len,esi stdcall str_len,esi
stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_move_cursor stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor
popad popad
ret ret
@ -284,8 +289,8 @@ endp
align 4 align 4
proc print_word_f1, text:dword, index:dword proc print_word_f1, text:dword, index:dword
pushad pushad
mov edi,dword[text] mov edi,[text]
mov esi,dword[edi+MAX_COLOR_WORD_LEN] ;f1 mov esi,[edi+TexColViv.f1]
cmp esi,0 cmp esi,0
je @f je @f
mov ebx,text_buffer mov ebx,text_buffer
@ -296,7 +301,7 @@ proc print_word_f1, text:dword, index:dword
stdcall str_len,ebx stdcall str_len,ebx
add ebx,eax add ebx,eax
add esi,dword[tex_help_f1] add esi,[tex_help_f1]
stdcall code_string,esi,ebx ;êîäèðóåì ñòðîêó stdcall code_string,esi,ebx ;êîäèðóåì ñòðîêó
stdcall str_cat,ebx,capt_end_word_f1 stdcall str_cat,ebx,capt_end_word_f1
@ -308,13 +313,15 @@ proc print_word_f1, text:dword, index:dword
ret ret
endp endp
;description:
; êîäèðîâêà ñòðîêè, çàìåíà íåïå÷àòàåìûõ ñèìâîëîâ íà ÷èñëîâûå êîäû
align 4 align 4
proc code_string, text:dword, out_text:dword proc code_string, text:dword, out_text:dword
pushad pushad
mov esi,dword[text] mov esi,[text]
stdcall str_len,esi stdcall str_len,esi
mov ecx,eax mov ecx,eax
mov edi,dword[out_text] mov edi,[out_text]
.copy: .copy:
mov al,byte[esi] mov al,byte[esi]
@ -335,7 +342,7 @@ proc code_string, text:dword, out_text:dword
add edi,2 add edi,2
and eax,0xff and eax,0xff
mov dword[edi],0 mov dword[edi],0
call tl_convert_to_str stdcall convert_int_to_str,4
stdcall str_len,edi stdcall str_len,edi
add edi,eax add edi,eax
mov byte[edi],',' mov byte[edi],','
@ -383,7 +390,7 @@ proc str_cat_value, str1:dword, value:dword
stdcall str_len,edi stdcall str_len,edi
add edi,eax add edi,eax
mov eax,[value] mov eax,[value]
call tl_convert_to_str stdcall convert_int_to_str,12
popad popad
ret ret
endp endp
@ -404,29 +411,35 @@ proc str_len, str1:dword
endp endp
;input: ;input:
; eax = value ; eax - ÷èñëî
; edi = string buffer ; edi - áóôåð äëß ñòðîêè
; len - äëèííà áóôåðà
;output:
align 4 align 4
tl_convert_to_str: proc convert_int_to_str uses eax ecx edx edi esi, len:dword
pushad mov esi,[len]
stdcall mem_clear,edi,12 add esi,edi
dec esi
call .str call .str
popad
ret ret
endp
align 4 align 4
.str: .str:
mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî mov ecx,10
;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âõîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé cmp eax,ecx
cmp eax,ecx ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
jb @f jb @f
xor edx,edx ;î÷èñòèòü edx xor edx,edx
div ecx ;ðàçäåëèòü - îñòàòîê â edx div ecx
push edx ;ïîëîæèòü â ñòåê push edx
;dec edi ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè ;dec edi ;ñìåùåíèå íåîáõîäèìîå äëß çàïèñè ñ êîíöà ñòðîêè
call .str ;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx call .str
pop eax pop eax
@@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ)) @@:
or al,0x30 ;äàííàÿ êîìàíäà êîðî÷å ÷åì äâå âûøå cmp edi,esi
stosb ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi jge @f
or al,0x30
stosb
mov byte[edi],0 ;â êîíåö ñòðîêè ñòàâèì 0, ÷òî-áû íå âûëàçèë ìóñîð
@@:
ret ret