Merge branch 'main' into flag-demo

This commit is contained in:
IgorA 2025-04-17 00:42:48 +03:00
commit 4bab16fbf1
48 changed files with 2401 additions and 1673 deletions

View File

@ -49,8 +49,6 @@ img_files = {
{"MEDIA/IMGF/INVSOL.OBJ", "common/media/ImgF/invSol.obj"},
{"MEDIA/PIXIESKN.PNG", SRC_PROGS .. "/cmm/pixie2/pixieskn.png"},
{"NETWORK/FTPC.INI", SRC_PROGS .. "/network/ftpc/ftpc.ini"},
{"NETWORK/FTPC_SYS.PNG", SRC_PROGS .. "/network/ftpc/ftpc_sys.png"},
{"NETWORK/FTPC_NOD.PNG", SRC_PROGS .. "/network/ftpc/ftpc_nod.png"},
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
{"NETWORK/KNMAP", "common/network/knmap"},
{"NETWORK/USERS.INI", "common/network/users.ini"},
@ -412,6 +410,7 @@ tup.append_table(img_files, {
{"ACLOCK", VAR_PROGS .. "/demos/aclock/aclock"},
{"APM", VAR_PROGS .. "/system/apm/apm"},
{"CALC", VAR_PROGS .. "/other/calc/trunk/calc"},
{"CALCPLUS", VAR_PROGS .. "/other/calcplus/calcplus"},
{"CALENDAR", VAR_PROGS .. "/system/calendar/trunk/calendar"},
{"COLRDIAL", VAR_PROGS .. "/system/colrdial/color_dialog"},
{"CROPFLAT", VAR_PROGS .. "/system/cropflat/cropflat"},
@ -629,7 +628,6 @@ tup.append_table(extra_files, {
{"kolibrios/media/zsea/plugins/rotate.obj", VAR_PROGS .. "/media/zsea/plugins/rotate/rotate.obj"},
{"kolibrios/media/zsea/plugins/scaling.obj", VAR_PROGS .. "/media/zsea/plugins/scaling/scaling.obj"},
{"kolibrios/utils/AMDtemp", VAR_PROGS .. "/system/amd_temp_view/AMDtemp"},
{"kolibrios/utils/calcplus", VAR_PROGS .. "/other/calcplus/calcplus"},
{"kolibrios/utils/kfm/kfm", VAR_PROGS .. "/fs/kfm/trunk/kfm"},
{"kolibrios/utils/tedit/t_edit", VAR_PROGS .. "/other/t_edit/t_edit"},
{"kolibrios/3D/blocks/block.bin", VAR_PROGS .. "/bcc32/games/blocks/block.bin"}

View File

@ -29,7 +29,6 @@ Dicty=/k/utils/DICTY.KEX,79
fNav=/k/utils/fNav/fNav,93
CncEditor=/k/utils/cnc_editor/cnc_editor,15
Life=/k/demos/life2,13
Calc+=/k/utils/calcplus,4
TinyBasic=/k/develop/TinyBasic/TinyBasic,91
THashView=/k/utils/thashview,124
Notes=/k/utils/notes,117

View File

@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC
path=CALC
name=CALC+
path=CALCPLUS
param=
ico=4
x=204

View File

@ -92,6 +92,7 @@
59 Screen keyboard |zkey
#10 **** DATA PROCESSING
16 Calculator |calc
16 Calculator+ |calcplus
03 Tinypad |tinypad
28 CodeEdit |develop/cedit
21 Table processor |table

View File

@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC
path=CALC
name=CALC+
path=CALCPLUS
param=
ico=4
x=204

View File

@ -96,6 +96,7 @@
24 NDN * |/kolibrios/utils/ndn/ndn
#11 **** PROCESO DE DATOS
16 Calculadora |calc
16 Calculadora+ |calcplus
16 Tinypad |tinypad
16 CodeEdit |develop/cedit
16 Procesador de tablas |table

View File

@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC
path=CALC
name=CALC+
path=CALCPLUS
param=
ico=4
x=204

View File

@ -80,6 +80,7 @@
65 NDN * |/kolibrios/utils/ndn/ndn
#11 **** DATA PROCESSING ****
16 Kalkulaator |calc
16 Kalkulaator+ |calcplus
16 Teksti redaktor |tinypad
16 CodeEdit |develop/cedit
16 Tabelarvutus |table

View File

@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC
path=CALC
name=CALC+
path=CALCPLUS
param=
ico=4
x=204

View File

@ -79,6 +79,7 @@
65 NDN * |/kolibrios/utils/ndn/ndn
#11 **** DATA PROCESSING
16 Calcolatrice |calc
16 Calcolatrice+ |calcplus
16 Tinypad |tinypad
16 CodeEdit |develop/cedit
16 Table Processor |table

View File

@ -235,8 +235,8 @@ ico=58
x=68
y=68
[21]
name=CALC
path=CALC
name=CALC+
path=CALCPLUS
param=
ico=4
x=204

View File

@ -90,6 +90,7 @@
59 <20>ªà ­­ ï ª« ¢¨ âãà  |zkey
#10 **** Žä¨á
16 Š «ìªã«ïâ®à |calc
16 Š «ìªã«ïâ®à+ |calcplus
03 <20>¥¤ ªâ®à Tinypad |tinypad
28 <20>¥¤ ªâ®à CodeEdit |develop/cedit
21 ’ ¡«¨ç­ë© ¯à®æ¥áá®à |table

View File

@ -1,2 +1,4 @@
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("charsets.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "charsets")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
tup.rule("charsets.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o" .. tup.getconfig("KPACK_CMD"), "%B")

View File

@ -31,3 +31,19 @@ Development history
- Renamed to Charsets Viewer/Charsets
- Symbol highlight UI tweaks
- Fixed rolled up bug
30.03.2025 - 0.4.0
- Localization for all system languages
- Display all character scales
- Abolity to copy character codes
- Block on charpage 00 for CP866
- New character code half markers
- Navigation using keys (see hotkeys.txt)
03.04.2025 - 0.4.1
- Fixed bug with codes color subscription
04.04.2025 - 0.4.2
- Fixed bug with resetting UTF charpage to zero on double charset swap to CP866
- Improved charpage blocking for CP866 UX
- Improved char codes copying UI

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
Control hotkeys
- Navigate inside charpage:
- Arrows
- Num2/4/6/8
- Navigation between charpages:
- PgDN, PgUP - previous/next page
- Num0, Home - reset page to zero
- Change symbol scale:
- Num- and Num+

View File

@ -1082,7 +1082,7 @@ l_libs_start:
lib_2 l_libs lib_name_2, file_name, system_dir_2, import_box_lib
lib_3 l_libs lib_name_3, file_name, system_dir_3, import_buf2d
lib_4 l_libs lib_name_4, file_name, system_dir_4, import_libkmenu
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_lib_tinygl
lib_5 l_libs lib_name_5, file_name, system_dir_5, import_tinygl
lib_6 l_libs lib_name_6, file_name, system_dir_6, import_libini
l_libs_end:
@ -1287,7 +1287,7 @@ dd 0,0
akmenuitem_draw db 'kmenuitem_draw',0
align 4
import_lib_tinygl:
import_tinygl:
macro E_LIB n
{
n dd sz_#n
@ -1343,7 +1343,7 @@ buf_1:
align 4
el_focus dd tree1
tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,35,195-16,250, 16,list_offs_text,0,\
16,16, 0xffffff,0xb0d0ff,0x10400040, 5,35,195-16,250, 16,list_offs_text,0,\
el_focus,w_scr_t1,0
align 4
@ -1362,9 +1362,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru_RU
capt db 'info 3ds ¢¥àá¨ï 29.09.20',0 ;¯®¤¯¨áì ®ª­ 
capt db 'info 3ds ¢¥àá¨ï 14.04.25',0 ;¯®¤¯¨áì ®ª­ 
else ; Default to en_US
capt db 'info 3ds version 29.09.20',0 ;window caption
capt db 'info 3ds version 14.04.25',0 ;window caption
end if
align 16

View File

@ -1408,7 +1408,7 @@ buf_1:
align 4
el_focus dd tree1
tree1 tree_list size_one_list,300+2, tl_key_no_edit+tl_draw_par_line,\
16,16, 0xffffff,0xb0d0ff,0x400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\
16,16, 0xffffff,0xb0d0ff,0x10400040, 5,47,195-16,250, 16,list_offs_text,0, el_focus,\
w_scr_t1,0
align 4
@ -1427,9 +1427,9 @@ white_light dd 0.8, 0.8, 0.8, 1.0 ;
lmodel_ambient dd 0.3, 0.3, 0.3, 1.0 ; <20> à ¬¥âàë ä®­®¢®£® ®á¢¥é¥­¨ï
if lang eq ru_RU
capt db 'info 3ds [user] ¢¥àá¨ï 29.09.20',0 ; ¯®¤¯¨áì ®ª­ 
capt db 'info 3ds [user] ¢¥àá¨ï 14.04.25',0 ; ¯®¤¯¨áì ®ª­ 
else ; Default to en_US
capt db 'info 3ds [user] version 29.09.20',0 ; Window caption
capt db 'info 3ds [user] version 14.04.25',0 ; Window caption
end if
align 16

View File

@ -812,9 +812,8 @@ proc draw_3d uses eax ebx ecx edi, o_data:dword
@@:
stdcall [glDisable],GL_LIGHTING
.end_l:
stdcall [glTranslatef], 0.0,0.0,0.5 ;correct for z
stdcall [glScalef], [edi+obj_3d.x_scale],[edi+obj_3d.y_scale],[edi+obj_3d.z_scale]
stdcall [glScalef], 1.0,1.0,0.7 ;correct for z
stdcall [glScalef], 1.0,1.0,1.4 ;correct for z
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_x],1.0,0.0,0.0

View File

@ -951,13 +951,12 @@ endl
endp
align 4
proc glClearDepth uses eax, depth:dword
proc glClearDepth uses eax, depth:qword
locals
p rd 2
endl
mov dword[p],OP_ClearDepth
mov eax,[depth]
fld qword[eax]
fld qword[depth]
fstp dword[p+4]
lea eax,[ebp-8] ;=sizeof(dd)*2

View File

@ -23,8 +23,7 @@ endl
imul ecx,ebx
shl ecx,2
add ecx,[eax+GLContext.color_array] ;ecx = &context.color_array[i]
mov ebx,ebp
sub ebx,20 ;=sizeof(dd)*5
lea ebx,[ebp-20] ;=sizeof(dd)*5
mov edx,[ecx]
mov [ebx+4],edx
mov edx,[ecx+4]
@ -48,8 +47,7 @@ endl
imul esi,ebx
shl esi,2
add esi,[eax+GLContext.normal_array] ;esi = &normal_array[ebx * (3 + c->normal_array_stride)]
mov edi,eax
add edi,GLContext.current_normal
lea edi,[eax+GLContext.current_normal]
mov ecx,3
rep movsd
mov dword[edi],0.0
@ -92,8 +90,7 @@ endl
imul ecx,ebx
shl ecx,2
add ecx,[eax+GLContext.vertex_array] ;ecx = &context.vertex_array[i]
mov ebx,ebp
sub ebx,20 ;=sizeof(dd)*5
lea ebx,[ebp-20] ;=sizeof(dd)*5
mov edx,[ecx]
mov [ebx+4],edx
mov edx,[ecx+4]
@ -130,8 +127,7 @@ endl
mov eax,[i]
mov dword[p+4],eax
mov eax,ebp
sub eax,8 ;=sizeof(dd)*2
lea eax,[ebp-8] ;=sizeof(dd)*2
stdcall gl_add_op,eax
ret
endp
@ -139,10 +135,9 @@ endp
align 4
proc glopDrawArrays, context:dword, param:dword
locals
vi dd ?
idx dd ?
states dd ?
size dd ?
a_size dd ?
p rd 8 ;функция glopColor требует 8 параметров, другие функции требуют меньше, берем по максимуму что-бы не портить стек
endl
pushad
@ -155,132 +150,19 @@ pushad
mov [idx],eax ;param[2].i
mov eax,[ebx+4]
mov [p+4],eax ;p[1].i = param[1].i
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
lea eax,[ebp-32] ;=sizeof(dd)*8
stdcall glopBegin, edx,eax
mov dword[vi],0
cmp ecx,1
jl @f
align 4
.cycle_0: ;for (int vi=0; vi<count; vi++)
cmp dword[vi],ecx
jge .cycle_0_end
bt dword[states],1 ;2^1=COLOR_ARRAY
jnc @f
mov esi,[edx+GLContext.color_array_size]
mov [size],esi
add esi,[edx+GLContext.color_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i]
mov edi,ebp
sub edi,28 ;edi = &p[1]
mov ebx,[esi+8]
mov [edi],ebx ;p[1].f = context.color_array[i+2]
mov ebx,[esi+4]
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
mov ebx,[esi]
mov [edi+8],ebx ;p[3].f = context.color_array[i]
add edi,12
cmp dword[size],3
jle .e1
add esi,12
movsd
jmp .e2
.e1:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
.e2:
mov edi,ebp
sub edi,32 ;edi = &p[0]
mov ebx,ebp
sub ebx,12 ;ebp-12 = &p[5]
push ebx
add ebx,4 ;ebp-8 = &p[6]
push ebx
add ebx,4 ;ebp-4 = &p[7]
push ebx
stdcall RGBFtoRGBI,[edi+12],[edi+8],[edi+4] ;call: r,g,b,&p[7],&p[6],&p[5]
stdcall glopColor, edx,edi ;(context, p(op,rf,gf,bf,af,ri,gi,bi))
@@:
bt dword[states],2 ;2^2=NORMAL_ARRAY
jnc @f
mov esi,[edx+GLContext.normal_array_stride]
add esi,3
imul esi,[idx]
shl esi,2
add esi,[edx+GLContext.normal_array] ;esi = &context.normal_array[ idx * (3 + context.normal_array_stride) ]
mov edi,edx
add edi,GLContext.current_normal
movsd ;context.current_normal.X = context.normal_array[i]
movsd
movsd
mov dword[edi],0.0 ;context.current_normal.W = 0.0f
@@:
bt dword[states],3 ;2^3=TEXCOORD_ARRAY
jnc @f
mov esi,[edx+GLContext.texcoord_array_size]
mov [size],esi
add esi,[edx+GLContext.texcoord_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i]
mov edi,edx
add edi,GLContext.current_tex_coord
movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i]
movsd
cmp dword[size],2
jle .e3
movsd
jmp .e4
.e3:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
.e4:
cmp dword[size],3
jle .e5
movsd
jmp @f
.e5:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
@@:
bt dword[states],0 ;2^0=VERTEX_ARRAY
jnc @f
mov esi,[edx+GLContext.vertex_array_size]
mov [size],esi
add esi,[edx+GLContext.vertex_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i]
mov edi,ebp
sub edi,28 ;edi = &p[1]
movsd ;p[1].f = context.vertex_array[i]
movsd
cmp dword[size],2
jle .e6
movsd
jmp .e7
.e6:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
jmp .e8 ;и 4-й тоже ставим по умолчанию
.e7:
cmp dword[size],3
jle .e8
movsd
sub edi,20 ;edi=&p[0]
jmp .e9
.e8:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
sub edi,16 ;edi=&p[0]
.e9:
stdcall glopVertex, edx,edi
@@:
call CopyArrayElementByIndex
inc dword[idx]
inc dword[vi]
jmp .cycle_0
.cycle_0_end:
loop .cycle_0
@@:
;mov eax,ebp
;sub eax,32 ;=sizeof(dd)*8
lea eax,[ebp-32] ;=sizeof(dd)*8
stdcall glopEnd, edx,eax
popad
ret
@ -299,8 +181,7 @@ endl
mov eax,[count]
mov dword[p+12],eax
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
lea eax,[ebp-16] ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp
@ -308,12 +189,12 @@ endp
align 4
proc glopDrawElements, context:dword, param:dword
locals
type dd ?
indices dd ? ;указатель на 16 или 32 битные индексы
ii dd ?
idx dd ?
states dd ?
type dd ?
size dd ?
indices dd ? ;указатель на 16 или 32 битные индексы
a_size dd ?
p rd 8
endl
pushad
@ -328,8 +209,7 @@ pushad
mov [type],eax ;type = param[3].i
mov eax,[ebx+16]
mov [indices],eax ;*indices = param[4].p
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
lea eax,[ebp-32] ;=sizeof(dd)*8
stdcall glopBegin, edx,eax
mov dword[ii],0
@ -351,127 +231,133 @@ align 4
.end_0:
mov [idx],esi
bt dword[states],1 ;2^1=COLOR_ARRAY
jnc @f
mov esi,[edx+GLContext.color_array_size]
mov [size],esi
add esi,[edx+GLContext.color_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i]
mov edi,ebp
sub edi,28 ;edi = &p[1]
mov ebx,[esi+8]
mov [edi],ebx ;p[1].f = context.color_array[i+2]
mov ebx,[esi+4]
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
mov ebx,[esi]
mov [edi+8],ebx ;p[3].f = context.color_array[i]
add edi,12
cmp dword[size],3
jle .e1
add esi,12
movsd
jmp .e2
.e1:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
.e2:
mov edi,ebp
sub edi,32 ;edi = &p[0]
mov ebx,ebp
sub ebx,12 ;ebp-12 = &p[5]
push ebx
add ebx,4 ;ebp-8 = &p[6]
push ebx
add ebx,4 ;ebp-4 = &p[7]
push ebx
stdcall RGBFtoRGBI,[edi+12],[edi+8],[edi+4] ;call: r,g,b,&p[7],&p[6],&p[5]
stdcall glopColor, edx,edi ;(context, p(op,rf,gf,bf,af,ri,gi,bi))
@@:
bt dword[states],2 ;2^2=NORMAL_ARRAY
jnc @f
mov esi,[edx+GLContext.normal_array_stride]
add esi,3
imul esi,[idx] ;esi = idx * (3 + context.normal_array_stride)
shl esi,2
add esi,[edx+GLContext.normal_array]
mov edi,edx
add edi,GLContext.current_normal
movsd ;context.current_normal.X = context.normal_array[i]
movsd
movsd
mov dword[edi],0.0 ;context.current_normal.W = 0.0f
@@:
bt dword[states],3 ;2^3=TEXCOORD_ARRAY
jnc @f
mov esi,[edx+GLContext.texcoord_array_size]
mov [size],esi
add esi,[edx+GLContext.texcoord_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i]
mov edi,edx
add edi,GLContext.current_tex_coord
movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i]
movsd
cmp dword[size],2
jle .e3
movsd
jmp .e4
.e3:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
.e4:
cmp dword[size],3
jle .e5
movsd
jmp @f
.e5:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
@@:
bt dword[states],0 ;2^0=VERTEX_ARRAY
jnc @f
mov esi,[edx+GLContext.vertex_array_size]
mov [size],esi
add esi,[edx+GLContext.vertex_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i]
mov edi,ebp
sub edi,28 ;edi = &p[1]
movsd ;p[1].f = context.vertex_array[i]
movsd
cmp dword[size],2
jle .e6
movsd
jmp .e7
.e6:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
jmp .e8 ;и 4-й тоже ставим по умолчанию
.e7:
cmp dword[size],3
jle .e8
movsd
sub edi,20 ;edi=&p[0]
jmp .e9
.e8:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
sub edi,16 ;edi=&p[0]
.e9:
stdcall glopVertex, edx,edi
@@:
call CopyArrayElementByIndex
inc dword[ii]
jmp .cycle_0
.cycle_0_end:
mov eax,ebp
sub eax,32 ;=sizeof(dd)*8
lea eax,[ebp-32] ;=sizeof(dd)*8
stdcall glopEnd, edx,eax
popad
ret
endp
;input:
; edx - GLContext
idx equ ebp-44
states equ ebp-40
a_size equ ebp-36
align 4
CopyArrayElementByIndex:
bt dword[states],1 ;2^1=COLOR_ARRAY
jnc @f
mov esi,[edx+GLContext.color_array_size]
mov [a_size],esi
add esi,[edx+GLContext.color_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.color_array] ;esi = &context.color_array[i]
lea edi,[ebp-28] ;edi = &p[1]
mov ebx,[esi+8]
mov [edi],ebx ;p[1].f = context.color_array[i+2]
mov ebx,[esi+4]
mov [edi+4],ebx ;p[2].f = context.color_array[i+1]
mov ebx,[esi]
mov [edi+8],ebx ;p[3].f = context.color_array[i]
add edi,12
cmp dword[a_size],3
jle .e1
add esi,12
movsd
jmp .e2
.e1:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
.e2:
lea edi,[ebp-32] ;edi = &p[0]
lea ebx,[ebp-12] ;ebp-12 = &p[5]
push ebx
add ebx,4 ;ebp-8 = &p[6]
push ebx
add ebx,4 ;ebp-4 = &p[7]
push ebx
stdcall RGBFtoRGBI,[edi+12],[edi+8],[edi+4] ;call: r,g,b,&p[7],&p[6],&p[5]
stdcall glopColor, edx,edi ;(context, p(op,rf,gf,bf,af,ri,gi,bi))
@@:
bt dword[states],2 ;2^2=NORMAL_ARRAY
jnc @f
mov esi,[edx+GLContext.normal_array_stride]
add esi,3
imul esi,[idx] ;esi = idx * (3 + context.normal_array_stride)
shl esi,2
add esi,[edx+GLContext.normal_array] ;esi = &context.normal_array[ idx * (3 + context.normal_array_stride) ]
lea edi,[edx+GLContext.current_normal]
movsd ;context.current_normal.X = context.normal_array[i]
movsd
movsd
mov dword[edi],0.0 ;context.current_normal.W = 0.0f
@@:
bt dword[states],3 ;2^3=TEXCOORD_ARRAY
jnc @f
mov esi,[edx+GLContext.texcoord_array_size]
mov [a_size],esi
add esi,[edx+GLContext.texcoord_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.texcoord_array] ;esi = &context.texcoord_array[i]
lea edi,[edx+GLContext.current_tex_coord]
movsd ;context.current_tex_coord.X = ccontext.texcoord_array[i]
movsd
cmp dword[a_size],2
jle .e3
movsd
jmp .e4
.e3:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
.e4:
cmp dword[a_size],3
jle .e5
movsd
jmp @f
.e5:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
@@:
bt dword[states],0 ;2^0=VERTEX_ARRAY
jnc @f
mov esi,[edx+GLContext.vertex_array_size]
mov [a_size],esi
add esi,[edx+GLContext.vertex_array_stride]
imul esi,[idx] ;esi = i
shl esi,2
add esi,[edx+GLContext.vertex_array] ;esi = &context.vertex_array[i]
lea edi,[ebp-28] ;edi = &p[1]
movsd ;p[1].f = context.vertex_array[i]
movsd
cmp dword[a_size],2
jle .e6
movsd
jmp .e7
.e6:
mov dword[edi],0.0 ;если задано 2 параметра, то 3-й ставим по умолчанию 0.0
add edi,4
jmp .e8 ;и 4-й тоже ставим по умолчанию
.e7:
cmp dword[a_size],3
jle .e8
movsd
sub edi,20 ;edi=&p[0]
jmp .e9
.e8:
mov dword[edi],1.0 ;если задано 3 параметра, то 4-й ставим по умолчанию 1.0
sub edi,16 ;edi=&p[0]
.e9:
stdcall glopVertex, edx,edi
@@:
ret
purge idx
purge states
purge a_size
align 4
proc glDrawElements uses eax, mode:dword, count:dword, type:dword, indices:dword
locals
@ -488,8 +374,7 @@ endl
mov eax,[indices]
mov dword[p+16],eax
mov eax,ebp
sub eax,20 ;=sizeof(dd)*5
lea eax,[ebp-20] ;=sizeof(dd)*5
stdcall gl_add_op,eax
ret
endp
@ -533,8 +418,7 @@ endl
;assert(0);
.end_f:
mov eax,ebp
sub eax,8 ;=sizeof(dd)*2
lea eax,[ebp-8] ;=sizeof(dd)*2
stdcall gl_add_op,eax
ret
endp
@ -578,8 +462,7 @@ endl
;assert(0);
.end_f:
mov eax,ebp
sub eax,8 ;=sizeof(dd)*2
lea eax,[ebp-8] ;=sizeof(dd)*2
stdcall gl_add_op,eax
ret
endp
@ -612,8 +495,7 @@ endl
mov eax,[pointer]
mov dword[p+12],eax
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
lea eax,[ebp-16] ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp
@ -646,8 +528,7 @@ endl
mov eax,[pointer]
mov dword[p+12],eax
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
lea eax,[ebp-16] ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp
@ -676,8 +557,7 @@ endl
mov eax,[pointer]
mov dword[p+8],eax
mov eax,ebp
sub eax,12 ;=sizeof(dd)*3
lea eax,[ebp-12] ;=sizeof(dd)*3
stdcall gl_add_op,eax
ret
endp
@ -710,8 +590,7 @@ endl
mov eax,[pointer]
mov dword[p+12],eax
mov eax,ebp
sub eax,16 ;=sizeof(dd)*4
lea eax,[ebp-16] ;=sizeof(dd)*4
stdcall gl_add_op,eax
ret
endp

View File

@ -12,6 +12,15 @@ include '../opengl_const.inc'
@use_library
;Constants describing the house.3ds file (obtained using the info_3ds program)
VERTICES_OFFSET = 0x33 ;offset along which the coordinates of the vertices go
FACES_COUNT = 0x162 ;number of faces
FACES_OFFSET = 0x96b ;offset along which information about the edges goes
HOUSE_FILE_SIZE = 5297
txt_error_file_size db '"House.3ds file size does not match" -tE',0
align 4
start:
load_library name_tgl, library_path, system_path, import_tinygl
@ -20,20 +29,20 @@ start:
mcall SF_SET_EVENTS_MASK,0x27
;заполняем массив индексов из файла house.3ds (который вшит внутрь данной программы)
;we fill the array of indices from the house.3ds file (which is embedded inside this program)
mov esi,house_3ds
add esi,0x1798 ;смещение по которому идет информация о гранях в файле 3ds (получено с использованием программы info_3ds)
add esi,FACES_OFFSET
mov edi,Indices
mov eax,0x1a6 ;число граней в файле 3ds (получено с использованием программы info_3ds)
mov eax,FACES_COUNT
@@:
movsd
movsw
add esi,2 ;пропускаем свойства грани
add esi,2 ;skip face properties
dec eax
or eax,eax
jnz @b
;первоначальные настройки контекста tinygl
;tinygl initial context settings
stdcall [kosglMakeCurrent], 10,10,400,350,ctx1
stdcall [glEnable], GL_DEPTH_TEST
stdcall [glClearColor], 0.0,0.0,0.0,0.0
@ -48,13 +57,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -140,29 +149,34 @@ caption db 'Test opengl 1.1 arrays, [Esc] - exit, [<-],[->],[Up],[Down] - rotate
align 4
draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;clear the color and depth buffer
mov eax,house_3ds.end-house_3ds
cmp eax,HOUSE_FILE_SIZE
je @f
notify_window_run txt_error_file_size
ret
@@:
call [glPushMatrix]
;масштаб и повороты
stdcall [glTranslatef], 0.0,0.0,0.5
;scale and rotations
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
;рисование через индексный массив
mov eax,house_3ds ;начало внедренного файла 3ds
add eax,0xeb ;смещение по которому идут координаты вершин (получено с использованием программы info_3ds)
stdcall [glVertexPointer], 3, GL_FLOAT, 0, eax ;задаем массив для вершин, 3 - число координат для одной вершины
stdcall [glEnableClientState], GL_VERTEX_ARRAY ;включаем режим рисования вершин
stdcall [glDrawElements], GL_TRIANGLES, 0x1a6*3, GL_UNSIGNED_SHORT, Indices ;mode, count, type, *indices
stdcall [glDisableClientState], GL_VERTEX_ARRAY ;отключаем режим рисования вершин
;drawing via index array
mov eax,house_3ds ;start of embedded 3ds file
add eax,VERTICES_OFFSET
stdcall [glVertexPointer], 3, GL_FLOAT, 0, eax ;we set an array for the vertices, 3 is the number of coordinates for one vertex
stdcall [glEnableClientState], GL_VERTEX_ARRAY ;turn on the vertex drawing mode
stdcall [glDrawElements], GL_TRIANGLES, FACES_COUNT*3, GL_UNSIGNED_SHORT, Indices ;mode, count, type, *indices
stdcall [glDisableClientState], GL_VERTEX_ARRAY ;disable vertex drawing mode
call [glPopMatrix]
ret
align 4
scale dd 0.0065 ;начальный масштаб (в идеальном случае должен вычислятся, но для даного примера подобран в ручную на глаз)
scale dd 0.07 ;initial scale (ideally should be calculated)
delt_sc dd 0.0005
angle_z dd 90.0
angle_y dd 90.0
@ -170,10 +184,11 @@ angle_x dd 0.0
delt_size dd 3.0
align 4
house_3ds: ;внедряем файл внутрь программы (в идеальном случае должен открыватся через окно диалога, но для облегчения примера вшит внутрь)
house_3ds: ;we embed the file inside the program (ideally it should open through a dialog box)
file '../../../../../demos/view3ds/3ds_objects/House.3ds'
.end:
align 4
Indices rb 0x1a6*6 ;0x1a6 - число граней, на каждую грань по 3 точки, индекс точки 2 байта
Indices rb FACES_COUNT*6 ;3 points per edge, point index 2 bytes
;--------------------------------------------------
align 4

View File

@ -36,13 +36,13 @@ red_win:
align 16
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -141,7 +141,6 @@ stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим б
stdcall [glColor3f], 1.0, 1.0, 0.0
call [glPushMatrix]
stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glRotatef], [angle_z],0.0,0.0,1.0

View File

@ -60,6 +60,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file 'toolb_1.png', image_data_toolbar
call SetLight
call draw_3d
align 4
@ -69,13 +70,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -303,11 +304,7 @@ draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
call [glPushMatrix]
call SetLight
stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glScalef], 1.0, 1.0, 0.5
stdcall [glColor3f], 1.0, 1.0, 0.0
stdcall [glRotatef], [angle_z],0.0,0.0,1.0

View File

@ -60,6 +60,7 @@ load_libraries l_libs_start,l_libs_end
stdcall [buf2d_convert_text_matrix], buf_1
load_image_file 'toolb_1.png', image_data_toolbar
call SetLight
call draw_3d
align 4
@ -69,13 +70,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -296,9 +297,6 @@ draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
call [glPushMatrix]
call SetLight
stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glColor3f], 1.0, 1.0, 0.0

View File

@ -88,13 +88,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -295,7 +295,6 @@ draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
call [glPushMatrix]
stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glRotatef], [angle_z],0.0,0.0,1.0
stdcall [glRotatef], [angle_y],0.0,1.0,0.0

View File

@ -88,13 +88,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -297,9 +297,8 @@ draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
call [glPushMatrix]
stdcall [glTranslatef], 0.0,0.0,0.5
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glScalef], 1.0, 1.0, 0.2 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_x],1.0,0.0,0.0

View File

@ -89,13 +89,13 @@ red_win:
align 4
still:
mcall SF_WAIT_EVENT
cmp al,1
jz red_win
cmp al,2
jz key
cmp al,3
jz button
jmp still
cmp al,EV_REDRAW
jz red_win
cmp al,EV_KEY
jz key
cmp al,EV_BUTTON
jz button
jmp still
align 4
draw_window:
@ -268,8 +268,9 @@ draw_3d:
stdcall [glClear], GL_COLOR_BUFFER_BIT + GL_DEPTH_BUFFER_BIT ;очистим буфер цвета и глубины
call [glPushMatrix]
stdcall [glTranslatef], 0.0,0.0,-1.0 ;двигаем сферу на себя, что-бы отсечь переднюю часть
stdcall [glScalef], [scale], [scale], [scale]
stdcall [glScalef], 1.0, 1.0, 0.1 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glScalef], 1.0, 1.0, 0.2 ;прижимаем сферу, что-бы сразу не вылазила при увеличении
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_x],1.0,0.0,0.0

View File

@ -185,7 +185,7 @@ align 4
cmp ecx,GL_SPOT_EXPONENT
jne @f
mov ecx,[ebx+12]
mov [edi+GLLight.spot_exponent],ecx ;l.spot_exponent=p[3]
mov [edx+GLLight.spot_exponent],ecx ;l.spot_exponent=p[3]
jmp .end_f
align 4
@@:
@ -193,7 +193,7 @@ align 4
jne .end_spot_c
fld dword[ebp+12] ;float a=v.v[0]
; assert(a == 180 || (a>=0 && a<=90));
fst dword[edi+GLLight.spot_cutoff] ;l.spot_cutoff=a
fst dword[edx+GLLight.spot_cutoff] ;l.spot_cutoff=a
fcom dword[an180f] ;if (a != 180)
fstsw ax
sahf
@ -202,7 +202,7 @@ align 4
fmulp
fdiv dword[an180f]
fcos
fstp dword[edi+GLLight.cos_spot_cutoff] ;l.cos_spot_cutoff=cos(a * M_PI / 180.0)
fstp dword[edx+GLLight.cos_spot_cutoff] ;l.cos_spot_cutoff=cos(a * M_PI / 180.0)
jmp .end_f
@@:
ffree st0
@ -213,21 +213,21 @@ align 4
cmp ecx,GL_CONSTANT_ATTENUATION
jne @f
mov ecx,[ebx+12]
mov [edi+GLLight.attenuation],ecx ;l->attenuation[0]=p[3]
mov [edx+GLLight.attenuation],ecx ;l->attenuation[0]=p[3]
jmp .end_f
align 4
@@:
cmp ecx,GL_LINEAR_ATTENUATION
jne @f
mov ecx,[ebx+12]
mov [edi+GLLight.attenuation+4],ecx ;l->attenuation[1]=p[3]
mov [edx+GLLight.attenuation+4],ecx ;l->attenuation[1]=p[3]
jmp .end_f
align 4
@@:
cmp ecx,GL_QUADRATIC_ATTENUATION
jne @f
mov ecx,[ebx+12]
mov [edi+GLLight.attenuation+8],ecx ;l->attenuation[2]=p[3]
mov [edx+GLLight.attenuation+8],ecx ;l->attenuation[2]=p[3]
jmp .end_f
align 4
@@: ;default:
@ -363,15 +363,14 @@ fl_1e_3 dd 1.0e-3
align 16
proc gl_shade_vertex, context:dword, v:dword
locals
R dd ? ;float ebp-96
G dd ? ;float ebp-92
B dd ? ;float ebp-88
A dd ? ;float ebp-84
s V3 ;ebp-80
d V3 ;ebp-68
tmp dd ? ;float ebp-56
att dd ? ;float ebp-52
dot_spot dd ? ;float ebp-48
R dd ? ;float ebp-92
G dd ? ;float ebp-88
B dd ? ;float ebp-84
A dd ? ;float ebp-80
s V3 ;ebp-76
d V3 ;ebp-64
tmp dd ? ;float ebp-52
att dd ? ;float ebp-48
lR dd ? ;float ebp-44
lB dd ? ;float ebp-40
lG dd ? ;float ebp-36
@ -563,7 +562,6 @@ align 4
fmul dword[d+offs_Z]
faddp
fchs
fst dword[dot_spot]
cmp dword[twoside],0 ;if (twoside && dot_spot < 0)
je @f
ftst ;if (dot_spot<0)

View File

@ -197,21 +197,24 @@ push edi esi
add ebx,4
inc esi
cmp byte[esi],'f'
cmp byte[esi],'f' ;float
jne @f
fld dword[ebx]
fstp qword[Data_Double]
call DoubleFloat_to_String
stdcall str_cat, edi,Data_String
@@:
cmp byte[esi],'d'
jne @f
cmp byte[esi],'C' ;const
je @f
cmp byte[esi],'d' ;integer
je @f
jmp .no_param
@@:
stdcall str_len,edi
add edi,eax
sub ecx,eax
mov eax,dword[ebx]
stdcall convert_int_to_str,ecx
@@:
.no_param:
inc esi
cmp byte[esi],0

View File

@ -134,7 +134,7 @@ endl
cmp dword[edx+GLContext.lighting_enabled],0 ;if(context.lighting_enabled)
jne .if_0
cmp dword[eax+GLContext.texture_2d_enabled],0
cmp dword[edx+GLContext.texture_2d_enabled],0
jne .if_0
jmp @f
align 4

View File

@ -17,7 +17,7 @@ proc ZB_plot uses eax ebx ecx edx edi, zb:dword, p:dword
mov edi,[ebx+ZBufferPoint.z]
shr edi,ZB_POINT_Z_FRAC_BITS
cmp di,word[ecx]
jl .end_f
jb .end_f
if TGL_FEATURE_RENDER_BITS eq 24
mov eax,[ebx+ZBufferPoint.r]
mov byte[edx],ah

View File

@ -101,7 +101,7 @@ local .end_0
mov [zz],eax
mov ebx,[pz]
cmp ax,word[ebx]
jl .end_0
jb .end_0
RGBPIXEL
mov eax,dword[zz]
mov ebx,[pz]

View File

@ -102,7 +102,7 @@ local .end_0
mov [zz],eax
mov ebx,[pz]
cmp ax,word[ebx]
jl .end_0
jb .end_0
RGBPIXEL
mov eax,dword[zz]
mov ebx,[pz]

View File

@ -58,7 +58,7 @@ end if
mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
jl .end_0
jb .end_0
;edi = pp
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24
@ -103,7 +103,7 @@ local .end_0
mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
jl .end_0
jb .end_0
;edi = pp
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24
@ -171,7 +171,7 @@ local .end_0
mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
jl .end_0
jb .end_0
;edi = pp
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24
@ -251,7 +251,7 @@ local .end_0
mov eax,[z]
shr eax,ZB_POINT_Z_FRAC_BITS
cmp ax,word[esi+2*_a] ;if (zz >= pz[_a])
jl .end_0
jb .end_0
;edi = pp
mov word[esi+2*_a],ax ;пишем в буфер глубины новое значение
if TGL_FEATURE_RENDER_BITS eq 24

View File

@ -170,6 +170,7 @@ proc tl_key uses ebx ecx edi, tlist:dword
cmp tl_on_press,0
je @f
call tl_on_press
jmp .no_edit
@@:
cmp ah,byte[ecx+1] ;Space
jne @f

View File

@ -16,9 +16,9 @@ include 'lang.inc' ; Language support for locales: ru_RU (CP866), en_US.
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
if lang eq ru_RU
caption db '<27>à®á¬®âà ¢®ªá¥«¥© 11.11.20',0 ;¯®¤¯¨áì ®ª­ 
caption db '<27>à®á¬®âà ¢®ªá¥«¥© 14.04.25',0 ;¯®¤¯¨áì ®ª­ 
else ; Default to en_US
caption db 'Voxel viewer 11.11.20',0
caption db 'Voxel viewer 14.04.25',0
end if
3d_wnd_l equ 5 ;®âáâ㯠¤«ï tinygl ¡ãä¥à  á«¥¢ 
@ -750,12 +750,8 @@ draw_3d:
je @f
call SetLight
@@:
stdcall [glTranslatef], 0.0,0.0,0.5 ;ª®®à¤¨­ âë ¯® ®á¨ z ¤®«¦­ë ¡ëâì ¢ ¯à¥¤¥« å ®â 0.0 ¤® 1.0, ¨­ ç¥ ¨§®¡à ¦¥­¨¥ ¡ã¤¥â ®âᥪ âìáï
;¢®ªá¥«ì­ë© ®¡ê¥ªâ ¨¬¥¥â ª®®à¤¨­ âë ¯® ®áï¬ ®â -0.5 ¤® 0.5, ¯®â®¬ã ¥£® ¤¢¨£ ¥¬ ­  +0.5
;­® ¢á¥ ¦¥ ¯à¨ ¯®¢®à®â å ¡ã¤ãâ ®âᥪ âáï ªà ï, ª®â®àë¥ ¢ë«¥§ãâ §  ¯à¥¤¥«ë ¯«®áª®á⥩ ®âá¥ç¥­¨ï
;¢ ¢¥àᨨ opengl ¯®¤ Win ª®®à¤¨­ âë ¨¤ãâ ®â -1.0 ¤® 1.0 ¯®â®¬ã â ¬ í⮣® ¤¥« âì ­¥ ­ã¦­®
stdcall [glScalef], [scale], [scale], [scale] ;㢥«¨ç¨¢ ¥¬ ¢®ªá¥«ì­ë© ®¡ê¥ªâ, çâ®-¡ë ­¥ ¡ë« ®ç¥­ì ¬ «¥­ìª¨¬
stdcall [glScalef], 1.0, 1.0, 0.25 ;çâ®-¡ë ªà ï ®¡ê¥ªâ  ­¥ ¢ë« §¨«¨ §  £à ­¨ ®âá¥ç¥­¨ï
stdcall [glScalef], 1.0, 1.0, 0.5 ;çâ®-¡ë ªà ï ®¡ê¥ªâ  ­¥ ¢ë« §¨«¨ §  £à ­¨ ®âá¥ç¥­¨ï
stdcall [glRotatef], [angle_x],1.0,0.0,0.0
stdcall [glRotatef], [angle_y],0.0,1.0,0.0
stdcall [glRotatef], [angle_z],0.0,0.0,1.0

View File

@ -105,7 +105,6 @@ console: ;//////////////////////////////////////////////////////////////////////
mov eax, [esp+36]
call write_to_file
@@:
popad
ret 4

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2013-2021. All rights reserved. ;;
;; Copyright (C) KolibriOS team 2013-2025. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; ftpc.asm - FTP client for KolibriOS ;;
@ -36,8 +36,8 @@ use32
dd 1 ; header version
dd start ; entry point
dd i_end ; initialized size
dd mem+0x1000 ; required memory
dd mem+0x1000 ; stack pointer
dd mem ; required memory
dd stacktop ; stack pointer
dd buf_cmd ; parameters
dd path ; path
@ -83,12 +83,12 @@ start: ;////////////////////////////////////////////////////////////////////////
;< none ;;
;;================================================================================================;;
; initialize heap for using dynamic blocks
mcall 68, 11
mcall SF_SYS_MISC, SSF_HEAP_INIT
test eax, eax
je exit2
; disable all events except network event
mcall 40, EV_STACK
mcall SF_SET_EVENTS_MASK, EV_STACK
; load libraries
stdcall dll.Load, @IMPORT
test eax, eax
@ -125,16 +125,16 @@ start: ;////////////////////////////////////////////////////////////////////////
mov [acti_port_stop], ax
invoke ini.get_str, path, str_general, str_dir, buf_buffer1, BUFFERSIZE, 0
mcall 30, 1, buf_buffer1 ; set working directory
mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_buffer1 ; set working directory
; initialize log file
invoke ini.get_str, path, str_general, str_logfile, log_file, 512, 0
mov [filestruct2.subfn], 2
mov [filestruct2.subfn], SSF_CREATE_FILE
mov [filestruct2.offset], 0
mov [filestruct2.size], 0
mov [filestruct2.ptr], 0
mov [filestruct2.name], log_file
mcall 70, filestruct2
mcall SF_FILE, filestruct2
; Usage: ftpc [-cli] [ftp://username:password@server:port/path]
@ -355,7 +355,7 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
; receive socket data with timeout
.receive:
mcall 26, 9
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
add eax, TIMEOUT*100
mov [timeout], eax
.again:
@ -365,11 +365,11 @@ wait_for_servercommand: ;///////////////////////////////////////////////////////
je .closed
cmp ebx, EWOULDBLOCK
jne .sock_err
mcall 26, 9
mcall SF_SYSTEM_GET, SSF_TIME_COUNT
mov ebx, [timeout]
sub ebx, eax
jle .timeout
mcall 23 ; Wait for event with timeout
mcall SF_WAIT_EVENT_TIMEOUT ; Wait for event with timeout
jmp .again
.sock_err:
@ -524,7 +524,7 @@ transfer_queued:
; Error occured, we reached the end of the buffer before [queued] reached 0
mov [queued], 0
mcall 68, 13, [ptr_fname] ; free buffer
mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
test eax, eax
jz error_heap
jmp wait_for_usercommand
@ -535,7 +535,7 @@ transfer_queued:
dec [queued]
jnz cmd_retr
mcall 68, 13, [ptr_fname] ; free buffer
mcall SF_SYS_MISC, SSF_MEM_FREE, [ptr_fname] ; free buffer
test eax, eax
jz error_heap
jmp cmd_retr
@ -655,12 +655,12 @@ write_to_file: ;////////////////////////////////////////////////////////////////
mov eax, 0
ret
@@:
mov [filestruct2.subfn], 3
mov [filestruct2.subfn], SSF_WRITE_FILE
m2m [filestruct2.offset], [logfile_offset]
mov [filestruct2.size], ecx
mov [filestruct2.ptr], eax
mov [filestruct2.name], log_file
mcall 70, filestruct2
mcall SF_FILE, filestruct2
test eax, eax
jz @f
mov [logfile_offset], -1 ; disable logging
@ -754,13 +754,13 @@ wait_for_keypress:
exit:
mcall close, [controlsocket]
exit2:
mcall -1
mcall SF_TERMINATE_PROCESS
; data
str_title db 'FTP client for KolibriOS',0
str_welcome db 'FTP client for KolibriOS v0.16',10
str_welcome db 'FTP client for KolibriOS v0.18',10
db 10,0
str_srv_addr db 'Please enter ftp server address.',10,0
@ -971,6 +971,7 @@ param_path rb 1024
param_port rb 6
sc system_colors
rb 1024
align 16
rb 4096
stacktop:
mem:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 640 B

View File

@ -7,6 +7,9 @@ include '../../load_lib.mac'
icon_tl_sys dd 0
icon_tl_nod dd 0
icon_buttons dd 0
lbl_after_enter dd 0
show_log db 0 ; 0 - hide log, 1 - show log
TLIST_SZ = 325+16 ;=341. 16 is x-size of scroll bar
TLIST1_X = 50
@ -15,6 +18,9 @@ BT_SZ_X = 40
SYS_COL = 0xe6e6e6
BT_COL = 0xcccccc
STR_COL = 0x595959 ;0x000000
ICON_TOP_B = 2 ; top border
ICON_LEFT_B = 2 ; left border
ICON_SIZE = (18+ICON_LEFT_B)*(18+ICON_TOP_B)*3
; TODO: automatic resizing of GUI elements on window resizing
@ -45,8 +51,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
test eax, eax
jnz .exit
mcall 48, 3, sc, sizeof.system_colors
mcall 40, 0xC0000027 ; set event mask
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, sizeof.system_colors
mcall SF_SET_EVENTS_MASK, 0xC0000027 ; set event mask
ret
.server_addr:
@ -73,37 +79,42 @@ gui: ;//////////////////////////////////////////////////////////////////////////
; initialize tree list elements
stdcall [tl_data_init], tree1
stdcall [tl_data_init], tree2
or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
or dword[tree2.style], 8 ;tl_cursor_pos_limited
; read icons
load_image_file 'ftpc_sys.png', icon_tl_sys
mov [filestruct.ptr], eax
mov [filestruct.subfn], 0
mov [filestruct.offset], 54
mov [filestruct.size], ecx
mcall 70, filestruct
cmp ebx, 0
jl @f
or dword[tree1.style], 8 ;tl_cursor_pos_limited - restrict cursor move to existing nodes
or dword[tree2.style], 8 ;tl_cursor_pos_limited
; read icons
mcall SF_SYS_MISC, SSF_MEM_OPEN, str_icon_18,, 0
or eax, eax
jz @f
mov esi, eax
mov ecx, ICON_SIZE*11
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov ecx, eax
mov [icon_tl_sys], eax
stdcall copy_icon, eax,esi,31 ;active cursor
add eax, ICON_SIZE*3 ;skip not used icons
stdcall img_to_gray, ecx, eax, ICON_SIZE/3 ;not active cursor
m2m dword[tree1.data_img_sys], dword[icon_tl_sys]
m2m dword[tree2.data_img_sys], dword[icon_tl_sys]
@@:
; read nodes icon file
load_image_file 'ftpc_nod.png', icon_tl_nod
mov ecx, ICON_SIZE*2
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov [icon_tl_nod], eax
stdcall copy_icon, eax,esi,2
stdcall copy_icon, eax,esi,0
mov [filestruct.ptr], eax
;mov [filestruct.subfn], 0
;mov [filestruct.offset], 54
mov [filestruct.size], ecx
mcall 70, filestruct
cmp ebx, 0
jl @f
m2m dword[tree1.data_img], dword[icon_tl_nod]
m2m dword[tree2.data_img], dword[icon_tl_nod]
; initialize icon buttons
mov ecx, 18*18*4*2
mcall SF_SYS_MISC, SSF_MEM_ALLOC
mov [icon_buttons], eax
stdcall copy_icon_w, eax,esi, 4 ;disconnect
stdcall copy_icon_w, eax,esi,49 ;search
@@:
call .draw
; create initial tree list for root_dir
@ -117,11 +128,11 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jmp cmd_list
.redraw:
call .draw
call .draw
align 4
.still:
mcall 10
mcall SF_WAIT_EVENT
dec eax
jz .redraw
@ -146,65 +157,86 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 4
.draw:
mcall 12, 1
mcall SF_REDRAW, SSF_BEGIN_DRAW
; main window
mcall 0, <35,830>, <20,555>, 0x34000000+SYS_COL, 0x805080DD, str_title
mcall SF_CREATE_WINDOW, <35,830>, <20,555-160>, 0x34000000+SYS_COL, 0x805080DD, str_title
;-------------------------
; textedit components
;-------------------------
mcall 9, procinfo, -1
mcall SF_THREAD_INFO, procinfo, -1
mov edi, tedit0
call EvSize
movzx ebx,word[procinfo.client_box.width]
inc bx
mcall 13, , ted_wnd_t
stdcall [ted_draw], tedit0
mcall SF_DRAW_RECT, , ted_wnd_t
; draw "disconnect" button
mcall 8, <50,95>, <25,25>, 3, BT_COL
mcall SF_DEFINE_BUTTON, <50,114>, <25,25>, 3, BT_COL
; icon
mcall SF_PUT_IMAGE_EXT, [icon_buttons], <18, 18>, <54, 29>, 32,, 0
; string "disconnect"
mcall 4, <50+5,25+5>, 0xb0000000+STR_COL, str_disconnect
mcall SF_DRAW_TEXT, <50+18+10,25+5>, 0xb0000000+STR_COL, str_disconnect
; draw "Show|Hide log" button
mcall SF_DEFINE_BUTTON, <50,79>, <326,25>, 10, BT_COL
; string "Show|Hide log"
cmp [show_log],0
je @f
stdcall [ted_draw], tedit0
mov edx, str_hide_log
jmp .end_log_1
@@:
mov edx, str_show_log
.end_log_1:
mcall SF_DRAW_TEXT, <50+5,326+5>, 0xb0000000+STR_COL
cmp [show_log],0
je @f
; draw "Copy" button
mcall 8, <50,40>, <326,25>, 4, BT_COL
mcall SF_DEFINE_BUTTON, <129+5,40>, <326,25>, 4, BT_COL
; string "copy"
mcall 4, <50+5,326+5>, 0xb0000000+STR_COL, str_copy
mcall SF_DRAW_TEXT, <129+10,326+5>, 0xb0000000+STR_COL, str_copy
@@:
; draw "Search" button
mcall 8, <TLIST2_X+TLIST_SZ-55,55>, <20,25>, 5, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-25,25>, <20,25>, 5, BT_COL
; icon
mov ebx, [icon_buttons]
add ebx, 18*18*4
mcall SF_PUT_IMAGE_EXT,, <18, 18>, <730, 24>, 32,, 0
; string "Search"
mcall 4, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
;mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-55+5,20+5>, 0xb0000000+STR_COL, str_search
; draw "LIST" button
mcall 8, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15,BT_SZ_X>, <50,25>, 12, BT_COL
; string "LIST"
mcall 4, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-4*BT_SZ_X-15+5,50+5>, 0xb0000000+STR_COL, str_list
; draw "DELE" button
mcall 8, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10,BT_SZ_X>, <50,25>, 7, BT_COL
; string "DELE"
mcall 4, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-3*BT_SZ_X-10+5,50+5>, 0xb0000000+STR_COL, str_dele
; draw "RDIR" button
mcall 8, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5,BT_SZ_X>, <50,25>, 8, BT_COL
; string "RDIR"
mcall 4, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-2*BT_SZ_X-5+5,50+5>, 0xb0000000+STR_COL, str_rdir
; draw "RMD" button
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <50,25>, 9, BT_COL
; string "RMD"
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,50+5>, 0xb0000000+STR_COL, str_rmd
; draw "mkd" button
mcall 8, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST2_X+TLIST_SZ-BT_SZ_X,BT_SZ_X>, <80,20>, 6, BT_COL
; string "mkd"
mcall 4, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
mcall SF_DRAW_TEXT, <TLIST2_X+TLIST_SZ-BT_SZ_X+5,80+5>, 0xb0000000+STR_COL, str_mkd
; draw "cancel" button
;mcall 8, <555,55>, <308,25>, 10, BT_COL
;mcall SF_DEFINE_BUTTON, <555,55>, <308,25>, 10, BT_COL
; string "Cancel"
;mcall 4, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
;mcall SF_DRAW_TEXT, <555+5,308+5>, 0xb0000000+STR_COL, str_abort
; draw "change volume" button
mcall 8, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
mcall SF_DEFINE_BUTTON, <TLIST1_X+TLIST_SZ-55,55>, <100-20,22>, 11, BT_COL
; string "Change"
mcall 4, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
mcall SF_DRAW_TEXT, <TLIST1_X+TLIST_SZ-55+5,100-20+5>, 0xb0000000+STR_COL, str_change
;--------------------------
; tree list components
@ -222,12 +254,12 @@ gui: ;//////////////////////////////////////////////////////////////////////////
stdcall [edit_box_draw], edit_volume
stdcall [edit_box_draw], edit_search
mcall 12,2
mcall SF_REDRAW, SSF_END_DRAW
ret
align 16
.mouse:
mcall 37, 1
mcall SF_MOUSE_GET, SSF_WINDOW_POSITION
cmp word[tedit0.wnd.top], ax
jg .no_edit
@ -235,7 +267,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
cmp word[tedit0.wnd.left], ax
jg .no_edit
mcall 37, 3
mcall SF_MOUSE_GET, SSF_BUTTON_EXT
bt eax, 24
jnc @f
@ -243,12 +275,19 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jmp .still
@@:
cmp [show_log],0
je .still
stdcall [ted_mouse], tedit0
jmp .still
.no_edit:
mov [lbl_after_enter], 0
stdcall [tl_mouse], tree1
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_volume
stdcall [edit_box_mouse], edit_search
@ -256,9 +295,14 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16
.key:
mcall 2
mcall SF_GET_KEY
mov [lbl_after_enter], 0
stdcall [tl_key], tree1
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_volume
stdcall [edit_box_key], edit_search
@ -266,13 +310,19 @@ gui: ;//////////////////////////////////////////////////////////////////////////
align 16
.button:
mcall 17
mcall SF_GET_BUTTON
cmp ah, 3
jne @f
ijmp eax, interface_addr, interface.server_addr
jmp .still
@@:
cmp ah, 10
jne @f
call show_hide_log
jmp .still
@@:
cmp ah, 4
jne @f
@ -310,7 +360,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
@@:
cmp ah, 1
je .exit
jmp .still
.print:
@ -327,13 +377,15 @@ gui: ;//////////////////////////////////////////////////////////////////////////
cmp byte[esi], 0
jne @b
stdcall [ted_text_add], tedit0, tedit_buffer, ecx, ebx
cmp [show_log],0
je .end_log_2
stdcall [ted_draw], tedit0
.end_log_2:
; write to log file
mov eax, [esp+36]
sub ecx, 2 ; 0a0d is not included
call write_to_file
@@:
popad
ret 4
@ -353,13 +405,16 @@ gui: ;//////////////////////////////////////////////////////////////////////////
;< none ;;
;;================================================================================================;;
push edx
push eax
cmp eax, 1
jl data_loop
push edx eax
; check if any incomplete entry to be parsed
cmp byte[remote_list_buf], 0
je .no_backlog
; find end of remote_list_buf
mov edi, remote_list_buf
mov ecx, 1024 ;buffer size
mov al, 0
repne scasb
; copy rest of the incomplete entry to remote_list_buf
@ -424,6 +479,8 @@ gui: ;//////////////////////////////////////////////////////////////////////////
mov byte[edi], 0
; add node to tree list
and dword[tree2.style], not 8
stdcall [tl_cur_next], tree2
cmp word[node_entry2], 'fi'
jne @f
stdcall [tl_node_add], tree2, 0, node_entry2
@ -453,9 +510,9 @@ gui: ;//////////////////////////////////////////////////////////////////////////
.store_last_entry:
; find index of the last incomplete entry
mov ecx, -1
mov eax, [esp]
lea edi, [buf_buffer2+eax-2]
mov ecx, eax
mov al, 0x0a
std
repne scasb
@ -470,9 +527,10 @@ gui: ;//////////////////////////////////////////////////////////////////////////
jne @b
.done_parsing:
stdcall [tl_cur_beg], tree2
or dword[tree2.style], 8
call .draw ; to update tree list immediately in case of "auto_list"
pop eax
pop edx
pop eax edx
jmp data_loop
; clear tree list and add ".." node before executing "LIST"
@ -494,7 +552,7 @@ gui: ;//////////////////////////////////////////////////////////////////////////
;;================================================================================================;;
; detect abort
mcall 17
mcall SF_GET_BUTTON
cmp ah, 10
je cmd_abor
@ -578,7 +636,8 @@ fun_on_enter:
cmp byte[esi], 0
jne @b
mov word[edi], 0x000a
jmp cmd_stor
mov [lbl_after_enter], cmd_stor
ret
; Function to call when you press [Enter]
@ -591,7 +650,8 @@ fun_on_enter2:
cmp dword[esi], 0x2E2E
jne @f
mov [auto_list], 1
jmp cmd_cdup
mov [lbl_after_enter], cmd_cdup
ret
@@:
cmp word[eax], 'fo'
@ -610,12 +670,14 @@ fun_on_enter2:
; newline in console code
cmp word[eax], 'fo'
je @f
jmp cmd_retr
mov [lbl_after_enter], cmd_retr
ret
@@:
stdcall [tl_info_clear], tree2
mov [auto_list], 1
jmp cmd_cwd
mov [lbl_after_enter], cmd_cwd
ret
;;================================================================================================;;
@ -641,7 +703,7 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
jne @f
; removes last file name from filestruct.name
mcall 30, 2, filestruct.name,1024 ; get absolute path for cwd
mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name,1024 ; get absolute path for cwd
lea edi, [filestruct.name+eax] ; edi = pointer to the tail of file name
mov al, '/'
mov ecx, -1
@ -652,15 +714,15 @@ populate_local_tree_list: ;/////////////////////////////////////////////////////
mov ecx, filestruct.name
@@:
mcall 30, 1, ; set cwd
mcall 30, 2, filestruct.name, 1024 ; get absolute path for cwd
mcall SF_CURRENT_FOLDER, SSF_SET_CF ; set cwd
mcall SF_CURRENT_FOLDER, SSF_GET_CF, filestruct.name, 1024 ; get absolute path for cwd
; clear all nodes in tree list
stdcall [tl_info_clear], tree1
mov [filestruct.offset], 0
; read 32 blocks
.outer:
mcall 70, filestruct
mcall SF_FILE, filestruct
;int3
test eax, eax
jz @f
@ -746,6 +808,16 @@ EvSize:
ret
;
show_hide_log:
mov esi, 555
xor [show_log],1
jnz @f
sub esi, 160
@@:
mcall SF_CHANGE_WINDOW, -1, -1, -1
ret
;;================================================================================================;;
filter_remote_list: ;/////////////////////////////////////////////////////////////////////////////;;
;;------------------------------------------------------------------------------------------------;;
@ -861,30 +933,133 @@ search: ;///////////////////////////////////////////////////////////////////////
pop edi esi edx ecx ebx
ret
align 4
proc copy_icon uses ebx ecx esi edi, buf_d:dword, buf_s:dword, ind:dword
;;------------------------------------------------------------------------------------------------;;
;> buf_d = pointer to destination buffer 24-bit
;> buf_s = pointer to source buffer 32-bit (with icons)
;> ind = icon index
;;------------------------------------------------------------------------------------------------;;
;< eax = pointer to destination buffer + icon size
;;------------------------------------------------------------------------------------------------;;
mov edi, [buf_d]
mov ecx, (18+ICON_LEFT_B)*ICON_TOP_B*3
mov al, 0xff
rep stosb ; make top border
; copy icon
mov esi, [ind]
imul esi, 18*18*4
add esi, [buf_s]
mov ebx, 18
.cycle0:
mov ecx, ICON_LEFT_B*3
rep stosb ; make left border
mov ecx, 18
@@:
movsw
movsb
inc esi ; skip transparent byte
loop @b
dec ebx
jnz .cycle0
mov eax, edi
ret
endp
align 4
proc img_to_gray, buf_rgb:dword, buf_g24:dword, pixels:dword
;;------------------------------------------------------------------------------------------------;;
; function for generating gray icons
;;------------------------------------------------------------------------------------------------;;
;> buf_rgb - buffer with input 24-bit color image
;> buf_g24 - buffer with output 24-bit gray image
;> pixels - number of pixels in the image
;;------------------------------------------------------------------------------------------------;;
pushad
mov esi, [buf_rgb]
mov edi, [buf_g24]
mov ecx, [pixels]
mov ebx, 3
@@:
movzx eax, byte[esi]
movzx edx, byte[esi+1]
add eax, edx
movzx edx, byte[esi+2]
add eax, edx
xor edx, edx
div ebx
mov ah, al
mov word[edi], ax
mov byte[edi+2], al
add esi, 3
add edi, 3
loop @b
popad
ret
endp
align 4
proc copy_icon_w uses ecx esi edi, buf_d:dword, buf_s:dword, ind:dword
;;------------------------------------------------------------------------------------------------;;
;> buf_d = pointer to destination buffer 32-bit
;> buf_s = pointer to source buffer 32-bit (with icons)
;> ind = icon index
;;------------------------------------------------------------------------------------------------;;
;< eax = pointer to destination buffer + icon size
;;------------------------------------------------------------------------------------------------;;
mov edi, [buf_d]
mov ecx, 18*18
mov esi, [ind]
imul esi, ecx
shl esi, 2
add esi, [buf_s]
rep movsd
mov eax, edi
mov ecx, 18*18
mov edi, [buf_d]
mov esi, [edi] ;copy transparent color
.cycle0:
cmp [edi], esi
jne @f
mov dword[edi], BT_COL
@@:
add edi, 4
loop .cycle0
ret
endp
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;hed db 'FTP Client for KolibriOS',0
str_change db 'Change',0
str_disconnect db 'Disconnect',0
str_show_log db 'Show log',0
str_hide_log db 'Hide log',0
str_copy db 'Copy',0
str_mkd db 'MKD',0
str_dele db 'DELE',0
str_rdir db 'RDIR',0
str_rmd db 'RMD',0
str_abort db 'Cancel',0
str_search db 'Search',0
;str_search db 'Search',0
str_list db 'LIST',0
str_null db 0
str_icon_18 db 'ICONS18',0
;----------------------
; tree list elements
;----------------------
tree1 tree_list 64, 500, tl_list_box_mode, 16, 16, \
0xffffff, BT_COL, 0x000000, TLIST1_X, 105, TLIST_SZ-16, 185, 14, 4,\
tree1 tree_list 64, 500, tl_list_box_mode, 18+ICON_LEFT_B, 18+ICON_TOP_B, \
0xffffff, BT_COL, 0x10000000, TLIST1_X, 105, TLIST_SZ-16, 185, 15, 4,\
0, el_focus, wScr, fun_on_enter
tree2 tree_list 64, 500, tl_list_box_mode, 16, 16, \
0xffffff, BT_COL, 0x000000, TLIST2_X, 105, TLIST_SZ-16, 185, 14, 4, \
tree2 tree_list 64, 500, tl_list_box_mode, 18+ICON_LEFT_B, 18+ICON_TOP_B, \
0xffffff, BT_COL, 0x10000000, TLIST2_X, 105, TLIST_SZ-16, 185, 15, 4, \
0, el_focus, wScr2, fun_on_enter2
; editbox for mkd
@ -896,7 +1071,7 @@ edit_volume edit_box TLIST_SZ-60, TLIST1_X, 80, 0xffffff, 0x94AECE, 0, \
0xAABBCC, 0x10000000, 99, root_dir, mouse_dd, 0
; editbox for search
edit_search edit_box TLIST_SZ-60, TLIST2_X, 22, 0xffffff, 0x94AECE, 0, \
edit_search edit_box TLIST_SZ-30, TLIST2_X, 22, 0xffffff, 0x94AECE, 0, \
0xAABBCC, 0x10000000, 99, filter,mouse_dd, 0
; A subsidiary structure for scrolling

View File

@ -27,7 +27,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
.get_username:
; in case of error when either login_gui.server_addr or
; login_gui.get_username is called, should resize window
mcall 67, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
mcall SF_CHANGE_WINDOW, WIN_X, WIN_Y, WIN_W, WIN_H ; resize to login gui window size
.redraw:
call .draw
@ -44,22 +44,22 @@ login_gui: ;////////////////////////////////////////////////////////////////////
align 4
.draw:
mcall 12, 1
mcall 48, 3, sc, 40
mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc, 40
edit_boxes_set_sys_color edit_usr,editboxes_end,sc
mov edx, 0x34000000
or edx, [sc.work]
mcall 0, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
mcall SF_CREATE_WINDOW, <WIN_X,WIN_W>, <WIN_Y,WIN_H>, , 0x805080DD, str_title
call .draw_editboxes
; draw "connect" button
mcall 8, <162,65>, <150,25>, 2, [sc.work_button]
mcall SF_DEFINE_BUTTON, <162,65>, <150,25>, 2, [sc.work_button]
; draw strings
mov ecx, 0x90000000
or ecx, [sc.work_text]
mcall 4, <3, 8>, , gui_str_usr
mcall SF_DRAW_TEXT, <3, 8>, , gui_str_usr
mcall , <3,PAD*1+8>, , gui_str_pass
mcall , <3,PAD*2+8>, , gui_str_server
mcall , <3,PAD*3+8>, , gui_str_port
@ -74,12 +74,12 @@ login_gui: ;////////////////////////////////////////////////////////////////////
mcall
mov [str_error_addr], gui_str_null ; reset error string address
mcall 12, 2
mcall SF_REDRAW, SSF_END_DRAW
ret
align 4
.still:
mcall 10 ; wait for event
mcall SF_WAIT_EVENT
dec eax
jz .redraw
dec eax
@ -96,7 +96,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
jmp .still
.button:
mcall 17
mcall SF_GET_BUTTON
dec ah
jz .exit
@ -107,7 +107,7 @@ login_gui: ;////////////////////////////////////////////////////////////////////
jmp .still
.key:
mcall 2
mcall SF_GET_KEY
cmp ah,13
je .connect
@ -122,12 +122,17 @@ login_gui: ;////////////////////////////////////////////////////////////////////
stdcall [edit_box_key], edit_path
jmp .still
.connect:
mcall 67, 35, 20, 830, 555 ; resize to main gui window's coordinates
mov esi, 555
or [show_log],0
jnz @f
sub esi, 160
@@:
mcall SF_CHANGE_WINDOW, 35, 20, 830 ; resize to main gui window's coordinates
cmp [param_server_addr], 0
jne gui.main
jne gui.main
mov [str_error_addr], gui_str_no_srvr
jmp .redraw

View File

@ -190,10 +190,11 @@ data_loop:
mov [filestruct.ptr], buf_buffer2
mov [filestruct.size], eax
push eax
mcall 70, filestruct
mcall SF_FILE, filestruct
test eax, eax
jz @f
call error_fs
add esp, 4 ; fix stack
jmp close_datacon
@@:
pop eax
@ -204,7 +205,7 @@ data_loop:
; storing, send all data
.stor:
mcall 70, filestruct
mcall SF_FILE, filestruct
cmp eax, 6 ; end of file
je .last_call
test eax, eax ; error
@ -244,7 +245,7 @@ data_loop:
mov ecx, eax ; eax is size of buffer received
inc ecx
add ecx, [size_fname] ; added old size to form new required size
mcall 68, 20, , [ptr_fname] ; realloc
mcall SF_SYS_MISC, SSF_MEM_REALLOC, , [ptr_fname]
test eax, eax
je error_heap
mov [ptr_fname], eax ; eax contains the new block now

View File

@ -82,13 +82,13 @@ cmd_retr:
mov ecx, 256-5
call set_filename
mov [filestruct.subfn], 2 ; create/rewrite file
mov [filestruct.subfn], SSF_CREATE_FILE ; create/rewrite file
mov [filestruct.offset], 0
mov [filestruct.offset+4], 0
mov [filestruct.size], 0
mov [filestruct.ptr], 0
mcall 70, filestruct
mcall SF_FILE, filestruct
test eax, eax
jz @f
call error_fs
@ -96,7 +96,7 @@ cmd_retr:
@@:
; Prepare to write to the file
mov [filestruct.subfn], 3 ; write to file
mov [filestruct.subfn], SSF_WRITE_FILE
mov [operation], OPERATION_RETR
; Request the file from server
@ -138,7 +138,7 @@ cmd_stor:
mov [operation], OPERATION_STOR
; get file size
mov [filestruct.subfn], 5
mov [filestruct.subfn], SSF_GET_INFO
mov [filestruct.offset], 0
mov [filestruct.offset+4], 0
mov [filestruct.size], 0
@ -148,12 +148,12 @@ cmd_stor:
mov ecx, 256-5
call set_filename
mcall 70, filestruct
mcall SF_FILE, filestruct
mov eax, dword[folder_buf+32] ; supports file size upto 4GB
mov [file_size], eax
mov [filestruct.subfn], 0 ; read file
mov [filestruct.subfn], SSF_READ_FILE
; mov [filestruct.offset], 0
; mov [filestruct.offset+4], 0
mov [filestruct.size], BUFFERSIZE
@ -191,12 +191,12 @@ cmd_lcwd:
mov byte[esi-1], 0
; check whether entered path is valid (folder exists)
mov [filestruct2.subfn], 5
mov [filestruct2.subfn], SSF_GET_INFO
mov [filestruct2.offset], 0
mov [filestruct2.size], 0
mov [filestruct2.ptr], folder_buf
mov [filestruct2.name], buf_cmd+5
mcall 70, filestruct2
mcall SF_FILE, filestruct2
test eax, eax
jz @f
cmp eax, 2
@ -205,10 +205,10 @@ cmd_lcwd:
jmp wait_for_usercommand
@@:
mcall 30, 1, buf_cmd+5 ; set working directory
mcall SF_CURRENT_FOLDER, SSF_SET_CF, buf_cmd+5 ; set working directory
.print:
mcall 30, 2, buf_cmd, 256 ; and read it again
mcall SF_CURRENT_FOLDER, SSF_GET_CF, buf_cmd, 256 ; and read it again
icall eax, interface_addr, interface.print, str_lcwd, buf_cmd, str_newline
jmp wait_for_usercommand

View File

@ -1,2 +1,5 @@
if tup.getconfig("NO_FASM") ~= "" then return end
tup.rule("calcplus.asm", "fasm %f %o " .. tup.getconfig("KPACK_CMD"), "calcplus")
HELPERDIR = (tup.getconfig("HELPERDIR") == "") and "../.." or tup.getconfig("HELPERDIR")
tup.include(HELPERDIR .. "/use_fasm.lua")
tup.rule("calcplus.asm", FASM .. " -dlang=" .. tup.getconfig("LANG") .. " %f %o" .. tup.getconfig("KPACK_CMD"), "%B")

View File

@ -1,2 +0,0 @@
@fasm calcplus.asm calc+
@pause

File diff suppressed because it is too large Load Diff