fix for calling tl_on_enter function, stack fix
All checks were successful
Build system / Check kernel codestyle (pull_request) Successful in 21s
Build system / Build (pull_request) Successful in 8m44s

This commit is contained in:
2025-04-03 22:01:25 +03:00
parent a617d45245
commit 70b05aaa86
4 changed files with 96 additions and 41 deletions

View File

@@ -1,7 +1,6 @@
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> TreeList <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> box_lib.obj ; SPDX-License-Identifier: GPL-2.0-only
; <EFBFBD><EFBFBD> <20><><EFBFBD> <20><EFBFBD><E0A8AC><EFBFBD><EFBFBD><EFBFBD> GPL2 <20><><EFBFBD><E6A5AD><EFBFBD> ; TreeList: used as a ListBox or Tree control (determined by settings)
; <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><E4A8AA><EFBFBD><EFBFBD> 12.01.2021 IgorA ; Copyright (C) 2009-2025 IgorA <aie85playm@gmail.com>
struct TreeNode struct TreeNode
type dw ? ;+ 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><> type dw ? ;+ 0 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><>
@@ -14,6 +13,52 @@ struct TreeNode
ends ends
;input:
; ecx - 0xXX...... font options
;output:
; eax - font height in pixels
align 4
proc get_font_h uses ebx
mov eax,ecx
shr eax,24
bt eax,4
jc @f
bt eax,5
jc @f
mov ebx,9
jmp .siz0
@@:
mov ebx,16
.siz0:
and eax,7
inc eax
imul eax,ebx
ret
endp
;input:
; ecx - 0xXX...... font options
;output:
; eax - font width in pixels
align 4
proc get_font_w uses ebx
mov eax,ecx
shr eax,24
bt eax,4
jc @f
bt eax,5
jc @f
mov ebx,6
jmp .siz0
@@:
mov ebx,8
.siz0:
and eax,7
inc eax
imul eax,ebx
ret
endp
;<3B><EFBFBD><EBA4A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᪠ <20> <20><EFBFBD><E1ADAE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>樨 (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) ;<3B><EFBFBD><EBA4A5><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᯨ᪠ <20> <20><EFBFBD><E1ADAE><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>樨 (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
align 16 align 16
proc tl_data_init uses eax ecx edi, tlist:dword proc tl_data_init uses eax ecx edi, tlist:dword
@@ -125,6 +170,7 @@ proc tl_key uses ebx ecx edi, tlist:dword
cmp tl_on_press,0 cmp tl_on_press,0
je @f je @f
call tl_on_press call tl_on_press
jmp .no_edit
@@: @@:
cmp ah,byte[ecx+1] ;Space cmp ah,byte[ecx+1] ;Space
jne @f jne @f
@@ -463,34 +509,24 @@ proc tl_draw, tlist:dword
cmp tl_capt_cy,9 ;9 - minimum caption height cmp tl_capt_cy,9 ;9 - minimum caption height
jl @f jl @f
mov ebx,edi ;calculate cursor position call tl_draw_caption_cur_pos
mov eax,tl_cur_pos
inc eax
lea edi,[txt_capt_cur.v]
stdcall tl_convert_to_str, 5
mov edi,ebx
mov eax,tl_tim_undo mov eax,tl_tim_undo
or eax,eax
jz @f
mov ebx,edi ;save edi
lea edi,[txt_capt_otm.v] lea edi,[txt_capt_otm.v]
stdcall tl_convert_to_str, 5 stdcall tl_convert_to_str, 5
mov edi,ebx ;restore edi mov edi,ebx ;restore edi
mov eax,SF_DRAW_TEXT ;captions
mov ebx,tl_box_left
shl ebx,16
add ebx,5*65536+3
add ebx,tl_box_top
mov ecx,tl_col_txt
or ecx,0x80000000
lea edx,[txt_capt_cur]
int 0x40
mov ebx,tl_box_left mov ebx,tl_box_left
shl ebx,16 shl ebx,16
add ebx,100*65536+3 add ebx,100*65536+3
mov ecx,tl_col_txt
and ecx,0x00ffffff
or ecx,0x80000000
add ebx,tl_box_top add ebx,tl_box_top
lea edx,[txt_capt_otm] lea edx,[txt_capt_otm]
int 0x40 mcall SF_DRAW_TEXT ;undo
@@: @@:
;cycle to nodes ;cycle to nodes
@@ -1163,10 +1199,11 @@ proc tl_draw_node_caption uses ebx ecx edx esi
ror ecx,16 ror ecx,16
mov ebx,ecx mov ebx,ecx
add bx,tl_img_cy ;<3B><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> add bx,tl_img_cy ;<3B><><EFBFBD><E0A0A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><EFBFBD><E0A0AD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
sub bx,9 ;<3B><EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD>
mov ecx,tl_col_txt mov ecx,tl_col_txt
and ecx,0xffffff call get_font_h
mcall SF_DRAW_TEXT sub bx,ax ;<3B><EFBFBD><E2ADA8><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><E2A5AA><EFBFBD>
and ecx,0x37ffffff
mcall SF_DRAW_TEXT ;node text
@@: @@:
ret ret
endp endp
@@ -1179,13 +1216,15 @@ endp
align 4 align 4
proc tl_get_draw_text_len uses eax ecx edx proc tl_get_draw_text_len uses eax ecx edx
mov esi,eax ;<3B><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> mov esi,eax ;<3B><><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
mov ecx,tl_col_txt
call get_font_w
mov ecx,eax
mov eax,tl_box_left mov eax,tl_box_left
add eax,tl_box_width add eax,tl_box_width
cmp eax,ebx cmp eax,ebx
jle .text_null ;<3B><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><E0A0AD> jle .text_null ;<3B><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><E0A0AD>
sub eax,ebx sub eax,ebx
xor edx,edx xor edx,edx
mov ecx,6 ;<3B><><EFBFBD> <20><><EFBFBD><EFBFBD><E2A5AC><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
div ecx ;ᬮ<>ਬ ᪮<>쪮 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> div ecx ;ᬮ<>ਬ ᪮<>쪮 ᨬ<><E1A8AC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD>
cmp esi,eax cmp esi,eax
jl @f jl @f
@@ -1858,10 +1897,8 @@ pushad
.po8: .po8:
call tl_node_move_po8 ;㧫<> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>塞 8 <20><><EFBFBD> call tl_node_move_po8 ;㧫<> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>塞 8 <20><><EFBFBD>
.cur_mov: .cur_mov:
push dword edi stdcall tl_cur_perv, edi
call tl_cur_perv stdcall tl_draw, edi
push dword edi
call tl_draw
@@: @@:
popad popad
ret ret
@@ -1981,10 +2018,11 @@ tl_draw_caption_cur_pos:
add ebx,5*65536+3 add ebx,5*65536+3
add ebx,tl_box_top add ebx,tl_box_top
mov ecx,tl_col_txt mov ecx,tl_col_txt
and ecx,0x00ffffff
or ecx,0xc0000000 ;0x40000000 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A8A2><EFBFBD> 䮭 梥⮬ edi or ecx,0xc0000000 ;0x40000000 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E8A8A2><EFBFBD> 䮭 梥⮬ edi
lea edx,[txt_capt_cur] lea edx,[txt_capt_cur]
mov edi,tl_col_zag mov edi,tl_col_zag
mcall SF_DRAW_TEXT ;captions mcall SF_DRAW_TEXT ;row number
popad popad
@@: @@:
ret ret
@@ -2253,6 +2291,6 @@ align 4
jge @f jge @f
or al,0x30 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塞 ᨬ<><E1A8AC><EFBFBD> '0' or al,0x30 ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塞 ᨬ<><E1A8AC><EFBFBD> '0'
stosb ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> al <20> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [edi] stosb ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> al <20> <20><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> [edi]
mov byte[edi],0 mov word[edi],' ' ;add space symbol and 0
@@: @@:
ret ret

View File

@@ -36,8 +36,8 @@ use32
dd 1 ; header version dd 1 ; header version
dd start ; entry point dd start ; entry point
dd i_end ; initialized size dd i_end ; initialized size
dd mem+0x1000 ; required memory dd mem ; required memory
dd mem+0x1000 ; stack pointer dd stacktop ; stack pointer
dd buf_cmd ; parameters dd buf_cmd ; parameters
dd path ; path dd path ; path
@@ -971,6 +971,7 @@ param_path rb 1024
param_port rb 6 param_port rb 6
sc system_colors sc system_colors
rb 2048 align 16
rb 4096
stacktop:
mem: mem:

View File

@@ -7,6 +7,7 @@ include '../../load_lib.mac'
icon_tl_sys dd 0 icon_tl_sys dd 0
icon_tl_nod dd 0 icon_tl_nod dd 0
lbl_after_enter dd 0
show_log db 0 ; 0 - hide log, 1 - show log show_log db 0 ; 0 - hide log, 1 - show log
TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar
@@ -266,8 +267,13 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jmp .still jmp .still
.no_edit: .no_edit:
mov [lbl_after_enter], 0
stdcall [tl_mouse], tree1 stdcall [tl_mouse], tree1
stdcall [tl_mouse], tree2 stdcall [tl_mouse], tree2
cmp [lbl_after_enter], 0
jz @f
jmp [lbl_after_enter]
@@:
stdcall [edit_box_mouse], edit_mkd stdcall [edit_box_mouse], edit_mkd
stdcall [edit_box_mouse], edit_volume stdcall [edit_box_mouse], edit_volume
stdcall [edit_box_mouse], edit_search stdcall [edit_box_mouse], edit_search
@@ -276,8 +282,13 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16 align 16
.key: .key:
mcall SF_GET_KEY mcall SF_GET_KEY
mov [lbl_after_enter], 0
stdcall [tl_key], tree1 stdcall [tl_key], tree1
stdcall [tl_key], tree2 stdcall [tl_key], tree2
cmp [lbl_after_enter], 0
jz @f
jmp [lbl_after_enter]
@@:
stdcall [edit_box_key], edit_mkd stdcall [edit_box_key], edit_mkd
stdcall [edit_box_key], edit_volume stdcall [edit_box_key], edit_volume
stdcall [edit_box_key], edit_search stdcall [edit_box_key], edit_search
@@ -335,7 +346,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
@@: @@:
cmp ah, 1 cmp ah, 1
je .exit je .exit
jmp .still jmp .still
.print: .print:
@@ -610,7 +621,8 @@ fun_on_enter:
cmp byte[esi], 0 cmp byte[esi], 0
jne @b jne @b
mov word[edi], 0x000a mov word[edi], 0x000a
jmp cmd_stor mov [lbl_after_enter], cmd_stor
ret
; Function to call when you press [Enter] ; Function to call when you press [Enter]
@@ -623,7 +635,8 @@ fun_on_enter2:
cmp dword[esi], 0x2E2E cmp dword[esi], 0x2E2E
jne @f jne @f
mov [auto_list], 1 mov [auto_list], 1
jmp cmd_cdup mov [lbl_after_enter], cmd_cdup
ret
@@: @@:
cmp word[eax], 'fo' cmp word[eax], 'fo'
@@ -642,12 +655,14 @@ fun_on_enter2:
; newline in console code ; newline in console code
cmp word[eax], 'fo' cmp word[eax], 'fo'
je @f je @f
jmp cmd_retr mov [lbl_after_enter], cmd_retr
ret
@@: @@:
stdcall [tl_info_clear], tree2 stdcall [tl_info_clear], tree2
mov [auto_list], 1 mov [auto_list], 1
jmp cmd_cwd mov [lbl_after_enter], cmd_cwd
ret
;;================================================================================================;; ;;================================================================================================;;

View File

@@ -194,6 +194,7 @@ data_loop:
test eax, eax test eax, eax
jz @f jz @f
call error_fs call error_fs
add esp, 4 ; fix stack
jmp close_datacon jmp close_datacon
@@: @@:
pop eax pop eax