cleaning code;

resizing the buffer to fit the window;
changing the scale from scrolling the mouse

git-svn-id: svn://kolibrios.org@7524 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2018-11-03 20:59:00 +00:00
parent c7f696b50f
commit 4080229253

View File

@ -10,7 +10,7 @@ include '../../../load_img.inc'
include '../../../develop/libraries/box_lib/load_lib.mac' include '../../../develop/libraries/box_lib/load_lib.mac'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
hed db 'Life 31.10.18',0 ;¯®¤¯¨áì ®ª­  hed db 'Life 03.11.18',0 ;¯®¤¯¨áì ®ª­ 
run_file_70 FileInfoBlock run_file_70 FileInfoBlock
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
@ -150,22 +150,23 @@ proc pole_clear uses eax ecx edi
loop @b loop @b
ret ret
endp endp
align 4 align 4
proc pole_cell_creat, x:dword, y:dword, li:dword proc pole_cell_creat, x:dword, y:dword, li:dword
pushad ;eax ebx ecx edx edi pushad ;eax ebx ecx edx edi
; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­  ; *** ¥á«¨ ª«¥âª  㦥 ¡ë«  ᮧ¤ ­ 
stdcall pole_cell_find, [x],[y] stdcall pole_cell_find, [x],[y]
cmp eax,0 or eax,eax
je @f ;if(i){ jz @f ;if(i){
get_cell_offset ebx,eax get_cell_offset ebx,eax
cmp dword[li],0 cmp dword[li],0
jne .else_if ;if(!li) jne .else_if ;if(!li)
; ¥á«¨ ᮧ¤ ¥âáï ¯ãáâ ï ª«¥âª  ; ¥á«¨ ᮧ¤ ¥âáï ¯ãáâ ï ª«¥âª 
inc byte[ebx+13] ;+13 = .so inc byte[ebx+Cell.so]
jmp .fun_e jmp .fun_e
.else_if: ;else if(!(cell[i].liv&1) ){ .else_if: ;else if(!(cell[i].liv&1) ){
bt word[ebx+12],0 ;+12 = .liv bt word[ebx+Cell.liv],0
; ¥á«¨ ᮧ¤ ¥âáï ¦¨¢ ï ª«¥âª  ; ¥á«¨ ᮧ¤ ¥âáï ¦¨¢ ï ª«¥âª 
; ¨ à ­ìè¥ ª«¥âª  ¡ë«  ᮧ¤ ­  ­® ®ª § « áì ¯ãá⮩ ; ¨ à ­ìè¥ ª«¥âª  ¡ë«  ᮧ¤ ­  ­® ®ª § « áì ¯ãá⮩
jae .creat_border_cells jae .creat_border_cells
@ -193,21 +194,21 @@ proc pole_cell_creat, x:dword, y:dword, li:dword
mov ecx,[x] mov ecx,[x]
mov dword[ebx],ecx ;+0 = .x mov dword[ebx],ecx ;+0 = .x
mov edx,[y] mov edx,[y]
mov dword[ebx+4],edx ;+4 = .y mov dword[ebx+Cell.y],edx
mov eax,[tim] mov eax,[tim]
mov dword[ebx+8],eax ;+8 = .tc mov dword[ebx+Cell.tc],eax
mov byte[ebx+12],0 ;+12 = .liv mov byte[ebx+Cell.liv],0
cmp dword[li],0 cmp dword[li],0
jne @f jne @f
mov byte[ebx+13],1 ;+13 = .so mov byte[ebx+Cell.so],1
jmp .fun_e jmp .fun_e
@@: @@:
mov byte[ebx+13],0 ;+13 = .so mov byte[ebx+Cell.so],0
.creat_border_cells: .creat_border_cells:
inc dword[osob] inc dword[osob]
or byte[ebx+12],1 ;+12 = .liv or byte[ebx+Cell.liv],1
mov ecx,[x] mov ecx,[x]
dec ecx dec ecx
mov edx,[y] mov edx,[y]
@ -264,8 +265,7 @@ proc pole_cell_find, x:dword, y:dword
;edi -> cell[memCell[i]] ;edi -> cell[memCell[i]]
mov ecx,[memCell] mov ecx,[memCell]
mov ebx,[b_sort] mov ebx,[b_sort]
mov edx,ebx lea edx,[ebx*4]
shl edx,2
add edx,ecx add edx,ecx
mov ecx,[ecx] mov ecx,[ecx]
.cycle_b: ;for(i=b_sort+1;i<=fristC;i++) .cycle_b: ;for(i=b_sort+1;i<=fristC;i++)
@ -278,7 +278,7 @@ proc pole_cell_find, x:dword, y:dword
cmp dword[edi],esi ;+0 = .x cmp dword[edi],esi ;+0 = .x
jne .if_e jne .if_e
mov esi,[y] mov esi,[y]
cmp dword[edi+4],esi ;+4 = .y cmp dword[edi+Cell.y],esi
jne .if_e jne .if_e
;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){ ;if(cell[memCell[i]].x==x && cell[memCell[i]].y==y){
mov eax,[edx] ;fnd=memCell[i]; mov eax,[edx] ;fnd=memCell[i];
@ -316,8 +316,7 @@ proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword
.cycle_b: ;do{ .cycle_b: ;do{
shr ebx,1 ;por>>=1; shr ebx,1 ;por>>=1;
mov edi,ecx lea edi,[ecx*4]
shl edi,2
add edi,[mas] add edi,[mas]
;if(compare_cells_mb(mas[i],fx,fy)){ ;if(compare_cells_mb(mas[i],fx,fy)){
stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy] stdcall pole_compare_cells_mb_coords, dword[edi],[fx],[fy]
@ -352,6 +351,8 @@ proc pole_bin_find, mas:dword, fx:dword, fy:dword, k:dword
ret ret
endp endp
;description:
; ¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï ¤«ï á®àâ¨à®¢ª¨ ï祥ª¨ ¯® ª®®à¤¨­ â ¬
;output: ;output:
; dl ; dl
align 4 align 4
@ -366,7 +367,7 @@ proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword
jmp .fun_e jmp .fun_e
@@: @@:
mov ecx,[fy] mov ecx,[fy]
cmp dword[eax+4],ecx cmp dword[eax+Cell.y],ecx
jle @f jle @f
cmp dword[eax],ebx cmp dword[eax],ebx
jne @f jne @f
@ -379,6 +380,8 @@ proc pole_compare_cells_bm_coords, i0:dword, fx:dword, fy:dword
ret ret
endp endp
;description:
; ¢á¯®¬®£ â¥«ì­ ï äã­ªæ¨ï ¤«ï á®àâ¨à®¢ª¨ ï祥ª¨ ¯® ª®®à¤¨­ â ¬
;output: ;output:
; dl ; dl
align 4 align 4
@ -393,7 +396,7 @@ proc pole_compare_cells_mb_coords, i0:dword, fx:dword, fy:dword
jmp .fun_e jmp .fun_e
@@: @@:
mov ecx,[fy] mov ecx,[fy]
cmp dword[eax+4],ecx cmp dword[eax+Cell.y],ecx
jge @f jge @f
cmp dword[eax],ebx cmp dword[eax],ebx
jne @f jne @f
@ -420,8 +423,8 @@ proc pole_compare_cells_bm, i0:dword, i1:dword
jmp .fun_e jmp .fun_e
@@: @@:
jne @f ;x0==x1 jne @f ;x0==x1
mov ecx,[ebx+4] ;+4 = .y mov ecx,[ebx+Cell.y]
cmp dword[eax+4],ecx cmp dword[eax+Cell.y],ecx
jle @f ;y0>y1 jle @f ;y0>y1
mov dl,1 mov dl,1
jmp .fun_e jmp .fun_e
@ -452,8 +455,7 @@ pole_paint:
@@: ;while(i<b_sort && Cor_x+cell[memCell[i]].x<0) @@: ;while(i<b_sort && Cor_x+cell[memCell[i]].x<0)
cmp ebx,[b_sort] cmp ebx,[b_sort]
jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横«  jge @f ;¯¥à¥å®¤¨¬ ­  ­ ç «® ­¨¦­¥£® 横« 
mov ecx,ebx lea ecx,[ebx*4]
shl ecx,2
add ecx,[memCell] add ecx,[memCell]
get_cell_offset ecx,[ecx] get_cell_offset ecx,[ecx]
mov edx,[ecx] ;+0 = .x mov edx,[ecx] ;+0 = .x
@ -467,16 +469,15 @@ pole_paint:
cmp byte[zoom],2 cmp byte[zoom],2
jge .zoom2 jge .zoom2
@@: ;for(;i<=fristC;i++){ @@: ;for(;i<=fristC;i++){
mov ecx,ebx lea ecx,[ebx*4]
shl ecx,2
add ecx,[memCell] add ecx,[memCell]
get_cell_offset ecx,[ecx] get_cell_offset ecx,[ecx]
;... ;...
mov edi,[Cor_x] mov edi,[Cor_x]
add edi,[ecx] ;+0 = .x add edi,[ecx] ;+0 = .x
mov esi,[Cor_y] mov esi,[Cor_y]
add esi,[ecx+4] ;+4 = .y add esi,[ecx+Cell.y]
bt word[ecx+12],0 ;+12 = .liv bt word[ecx+Cell.liv],0
jc .cell_1 jc .cell_1
;­¥ ¦¨¢ ï ï祩ª  ;­¥ ¦¨¢ ï ï祩ª 
mov edx,[CellColors] mov edx,[CellColors]
@ -486,7 +487,7 @@ pole_paint:
;¦¨¢ ï ï祩ª  ;¦¨¢ ï ï祩ª 
mov edx,[tim] mov edx,[tim]
inc edx inc edx
sub edx,[ecx+8] ;+8 = .tc sub edx,[ecx+Cell.tc]
cmp edx,COL_MEM cmp edx,COL_MEM
jle .in_color jle .in_color
mov edx,COL_MEM mov edx,COL_MEM
@ -505,8 +506,7 @@ pole_paint:
.zoom2: .zoom2:
@@: ;for(;i<=fristC;i++){ @@: ;for(;i<=fristC;i++){
mov ecx,ebx lea ecx,[ebx*4]
shl ecx,2
add ecx,[memCell] add ecx,[memCell]
get_cell_offset ecx,[ecx] get_cell_offset ecx,[ecx]
@ -515,10 +515,10 @@ pole_paint:
mov edi,[ecx] ;+0 = .x mov edi,[ecx] ;+0 = .x
add edi,[Cor_x] add edi,[Cor_x]
imul edi,edx imul edi,edx
mov esi,[ecx+4] ;+4 = .y mov esi,[ecx+Cell.y]
add esi,[Cor_y] add esi,[Cor_y]
imul esi,edx imul esi,edx
bt word[ecx+12],0 ;+12 = .liv bt word[ecx+Cell.liv],0
jc .z2_cell_1 jc .z2_cell_1
;­¥ ¦¨¢ ï ï祩ª  ;­¥ ¦¨¢ ï ï祩ª 
mov edx,[CellColors] mov edx,[CellColors]
@ -528,7 +528,7 @@ pole_paint:
;¦¨¢ ï ï祩ª  ;¦¨¢ ï ï祩ª 
mov edx,[tim] mov edx,[tim]
inc edx inc edx
sub edx,[ecx+8] ;+8 = .tc sub edx,[ecx+Cell.tc]
cmp edx,COL_MEM cmp edx,COL_MEM
jle .z2_in_color jle .z2_in_color
mov edx,COL_MEM mov edx,COL_MEM
@ -567,31 +567,30 @@ pole_next_gen:
@@: ;for(i=1;i<=firstC;i++) @@: ;for(i=1;i<=firstC;i++)
add ecx,4 add ecx,4
get_cell_offset edx,[ecx] get_cell_offset edx,[ecx]
bt word[edx+12],0 ;+12 = .liv bt word[edx+Cell.liv],0
jae .if_0_e jae .if_0_e
; á®åà ­¥­¨¥ ï祩ª¨ (á®á¥¤¥© 2 ¨«¨ 3) ; á®åà ­¥­¨¥ ï祩ª¨ (á®á¥¤¥© 2 ¨«¨ 3)
cmp byte[edx+13],2 ;+13 = .so cmp byte[edx+Cell.so],2
je .if_2_e je .if_2_e
cmp byte[edx+13],3 ;+13 = .so cmp byte[edx+Cell.so],3
je .if_2_e je .if_2_e
jmp .change jmp .change
.if_0_e: .if_0_e:
; ᮧ¤ ­¨¥ ï祩ª¨ (á®á¥¤¥© 3) ; ᮧ¤ ­¨¥ ï祩ª¨ (á®á¥¤¥© 3)
cmp byte[edx+13],3 ;+13 = .so cmp byte[edx+Cell.so],3
jne .if_1_e jne .if_1_e
.change: .change:
or byte[edx+12],2 ;+12 = .liv or byte[edx+Cell.liv],2
jmp .if_2_e jmp .if_2_e
.if_1_e: .if_1_e:
; 㤠«¥­¨¥ ¯ãá⮩ ï祩ª¨ ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ï⨠; 㤠«¥­¨¥ ¯ãá⮩ ï祩ª¨ ¤«ï ®á¢®¡®¦¤¥­¨ï ¯ ¬ïâ¨
cmp byte[edx+13],0 ;+13 = .so cmp byte[edx+Cell.so],0
jne .if_2_e jne .if_2_e
mov edi,[edx+8] ;+8 = .tc mov edi,[edx+Cell.tc]
add edi,5 ; 5 - ¢à¥¬ï á®åà ­¥­¨ï ¯ãá⮩ ï祩ª¨, ¤® ¥ñ 㤠«¥­¨ï add edi,5 ; 5 - ¢à¥¬ï á®åà ­¥­¨ï ¯ãá⮩ ï祩ª¨, ¤® ¥ñ 㤠«¥­¨ï
cmp edi,[tim] cmp edi,[tim]
jge .if_2_e jge .if_2_e
mov edi,eax lea edi,[eax*4]
shl edi,2
add edi,[memCell] ;edi -> &memCell[fristC] add edi,[memCell] ;edi -> &memCell[fristC]
mov esi,[edi] ;swp=memCell[fristC]; mov esi,[edi] ;swp=memCell[fristC];
mov edx,[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì mov edx,[ecx] ;edx - 㦥 ­¥ ¨á¯®«ì§ã¥¬, ¯®â®¬ã ¬®¦¥¬ ¯®àâ¨âì
@ -616,58 +615,58 @@ pole_next_gen:
@@: ;for(i=1;i<=firstC;i++) @@: ;for(i=1;i<=firstC;i++)
add ecx,4 add ecx,4
get_cell_offset edx,[ecx] get_cell_offset edx,[ecx]
bt word[edx+12],1 ;+12 = .liv bt word[edx+Cell.liv],1
jae .no_change jae .no_change
xor byte[edx+12],3 ;+12 = .liv xor byte[edx+Cell.liv],3
mov edi,[tim] mov edi,[tim]
mov dword[edx+8],edi ;+8 = .tc mov dword[edx+Cell.tc],edi
bt word[edx+12],0 ;+12 = .liv bt word[edx+Cell.liv],0
jc .new_cell jc .new_cell
push eax push eax
mov edi,[edx] mov edi,[edx]
dec edi dec edi
mov esi,[edx+4] mov esi,[edx+Cell.y]
dec esi dec esi
dec dword[osob] dec dword[osob]
;¤ «ìè¥ §­ ç¥­¨¥ edx ¯®àâ¨âáï ;¤ «ìè¥ §­ ç¥­¨¥ edx ¯®àâ¨âáï
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
inc esi inc esi
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
inc esi inc esi
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
inc edi inc edi
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
sub esi,2 sub esi,2
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
inc edi inc edi
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
inc esi inc esi
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
inc esi inc esi
stdcall pole_cell_find,edi,esi stdcall pole_cell_find,edi,esi
get_cell_offset edx,eax get_cell_offset edx,eax
dec byte[edx+13] ;+13 = .so dec byte[edx+Cell.so]
pop eax pop eax
jmp .no_change jmp .no_change
.new_cell: ; ¯®ï¢¨« áì ­®¢ ï ï祩ª  .new_cell: ; ¯®ï¢¨« áì ­®¢ ï ï祩ª 
inc dword[osob] inc dword[osob]
mov edi,[edx] mov edi,[edx]
dec edi dec edi
mov esi,[edx+4] mov esi,[edx+Cell.y]
dec esi dec esi
stdcall pole_cell_creat,edi,esi,0 stdcall pole_cell_creat,edi,esi,0
inc esi inc esi
@ -710,8 +709,7 @@ proc pole_fl_sort, a:dword, n:dword
@@: ;for(i=n; i>=2; i--){ @@: ;for(i=n; i>=2; i--){
stdcall pole_fl_surface, ecx,1,eax ;(a,1,i) stdcall pole_fl_surface, ecx,1,eax ;(a,1,i)
;<3B>®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠ ;<3B>®¬¥áâ¨âì ­ ©¤¥­­ë© ¬ ªá¨¬ «ì­ë© í«¥¬¥­â ¢ ª®­¥æ ᯨ᪠
mov edi,eax lea edi,[eax*4]
shl edi,2
add edi,ecx ;edi -> &a[i] add edi,ecx ;edi -> &a[i]
mov esi,[edi] ;w=a[i]; mov esi,[edi] ;w=a[i];
mov edx,[ecx+4] mov edx,[ecx+4]
@ -739,8 +737,7 @@ endl
mov ebx,[i] mov ebx,[i]
mov ecx,[k] mov ecx,[k]
mov edx,ebx lea edx,[ebx*4]
shl edx,2
add edx,eax add edx,eax
mov edx,[edx] mov edx,[edx]
mov dword[copy],edx ;copy=a[i]; mov dword[copy],edx ;copy=a[i];
@ -753,8 +750,7 @@ endl
mov esi,edi mov esi,edi
jmp .else_e jmp .else_e
@@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m; @@: ;else if (pole_compare_cells_bm(a[m],a[m+1])) j=m;
mov edx,edi lea edx,[edi*4]
shl edx,2
add edx,eax add edx,eax
stdcall pole_compare_cells_bm, dword[edx],dword[edx+4] stdcall pole_compare_cells_bm, dword[edx],dword[edx+4]
cmp dl,0 cmp dl,0
@ -767,19 +763,16 @@ endl
.else_e: .else_e:
;if (pole_compare_cells_bm(a[j],copy)) { ;if (pole_compare_cells_bm(a[j],copy)) {
mov edx,esi lea edx,[esi*4]
shl edx,2
add edx,eax add edx,eax
stdcall pole_compare_cells_bm, dword[edx],dword[copy] stdcall pole_compare_cells_bm, dword[edx],dword[copy]
cmp dl,0 cmp dl,0
je .cycle_e ;} else break; //¢ë室 ¨§ 横«  je .cycle_e ;} else break; //¢ë室 ¨§ 横« 
mov edx,esi lea edx,[esi*4]
shl edx,2
add edx,eax add edx,eax
push dword[edx] ;push a[j]; push dword[edx] ;push a[j];
mov edx,ebx lea edx,[ebx*4]
shl edx,2
add edx,eax add edx,eax
pop dword[edx] ;a[i]=a[j]; pop dword[edx] ;a[i]=a[j];
mov ebx,esi ;i=j; mov ebx,esi ;i=j;
@ -805,7 +798,7 @@ align 4
start: start:
load_libraries l_libs_start,l_libs_end load_libraries l_libs_start,l_libs_end
;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡  ;¯à®¢¥àª  ­  ᪮«ìª® 㤠筮 § £ã§¨« áì ­ è  «¨¡ 
mov ebp,lib_7 mov ebp,lib2
cmp dword [ebp+ll_struc_size-4],0 cmp dword [ebp+ll_struc_size-4],0
jz @f jz @f
mcall SF_TERMINATE_PROCESS ;exit not correct mcall SF_TERMINATE_PROCESS ;exit not correct
@ -829,11 +822,6 @@ start:
call pole_clear call pole_clear
call pole_paint ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥) call pole_paint ;à¨á®¢ ­¨¥ ¯®«ï ¢ ¡ãä¥à¥ (­¥ ­  íªà ­¥)
;xor eax,eax
;mov edi,txt_zoom.zi
;mov al,byte[zoom]
;call tl_convert_to_str
mcall SF_SYSTEM_GET,SSF_TIME_COUNT mcall SF_SYSTEM_GET,SSF_TIME_COUNT
mov [last_time],eax mov [last_time],eax
@ -861,9 +849,92 @@ still:
jz key jz key
cmp al,3 cmp al,3
jz button jz button
cmp al,6
jne @f
mcall SF_THREAD_INFO,procinfo,-1
cmp ax,word[procinfo.window_stack_position]
jne @f ;®ª­® ­¥  ªâ¨¢­®
call mouse
@@:
jmp still jmp still
align 4
mouse:
push eax ebx ecx
mcall SF_MOUSE_GET,SSF_BUTTON_EXT
bt eax,8
jnc @f
;mouse l. but. press
;call mouse_left_d
;jmp .end_l
@@:
bt eax,16
jnc .end_l
;mouse l. but. up
;call mouse_left_u
;jmp .end_l
.end_l:
call buf_get_mouse_coord
cmp eax,-1
je .end0
shl eax,1
sub eax,[buf_0.w]
sar eax,1
;mov [mouse_prop_x],eax
shl ebx,1
sub ebx,[buf_0.h]
sar ebx,1
;mov [mouse_prop_y],ebx
mcall SF_MOUSE_GET,SSF_SCROLL_DATA
test ax,ax
jz .end0
test ax,0x8000
jnz .decr
;㢥«¨ç¥­¨¥ ¬ áèâ ¡ 
call but_zoom_p
jmp .end0
.decr:
;㬥­ì襭¨¥ ¬ áèâ ¡ 
call but_zoom_m
.end0:
pop ecx ebx eax
ret
;output:
; eax - buffer coord X (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
; ebx - buffer coord Y (¥á«¨ ªãàá®à §  ¡ãä¥à®¬ -1)
align 4
proc buf_get_mouse_coord
mcall SF_MOUSE_GET,SSF_WINDOW_POSITION
cmp ax,word[buf_0.t]
jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ y
mov ebx,eax
shr ebx,16
cmp bx,word[buf_0.l]
jl .no_buf ;­¥ ¯®¯ «¨ ¢ ®ª­® ¡ãä¥à  ¯® ®á¨ x
and eax,0xffff ;®áâ ¢«ï¥¬ ª®®à¤¨­ âã y
sub ax,word[buf_0.t]
cmp eax,[buf_0.h]
jg .no_buf
sub bx,word[buf_0.l]
cmp ebx,[buf_0.w]
jg .no_buf
xchg eax,ebx
jmp .end_f
.no_buf:
xor eax,eax
not eax
xor ebx,ebx
not ebx
.end_f:
ret
endp
align 4 align 4
timer_funct: timer_funct:
pushad pushad
@ -900,6 +971,30 @@ pushad
mov edi,hed mov edi,hed
mcall SF_CREATE_WINDOW,(20 shl 16)+485,(20 shl 16)+415 mcall SF_CREATE_WINDOW,(20 shl 16)+485,(20 shl 16)+415
mcall SF_THREAD_INFO,procinfo,-1
mov eax,[procinfo.box.height]
cmp eax,120
jge @f
mov eax,120 ;min size
@@:
sub eax,63
mov ebx,[procinfo.box.width]
cmp ebx,270
jge @f
mov ebx,270
@@:
sub ebx,9
cmp eax,[buf_0.h] ;ᬮâਬ à §¬¥à ¡ãä¥à 
jne @f
cmp ebx,[buf_0.w]
jne @f
jmp .end0
@@:
stdcall [buf2d_resize], buf_0, ebx,eax,1
stdcall [buf2d_clear], buf_0, [buf_0.color]
call pole_paint
.end0:
mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button] mcall SF_DEFINE_BUTTON,(5 shl 16)+20,(5 shl 16)+20,3, [sc.work_button]
mov ebx,(30 shl 16)+20 mov ebx,(30 shl 16)+20
@ -1004,8 +1099,7 @@ draw_pok:
int 0x40 int 0x40
mov eax,SF_DRAW_NUMBER mov eax,SF_DRAW_NUMBER
xor ecx,ecx movzx ecx,byte[zoom]
mov cl,byte[zoom]
mov ebx,(2 shl 16) mov ebx,(2 shl 16)
mov edx,(325+6*9)*65536+5 mov edx,(325+6*9)*65536+5
mov esi,[sc.work_button_text] mov esi,[sc.work_button_text]
@ -1181,7 +1275,7 @@ but_open_file:
xor ebx,ebx xor ebx,ebx
xor ecx,ecx xor ecx,ecx
mov eax,ebx mov eax,ebx
mov edx,[open_file_lif] mov edx,edi
add edx,[open_file_size] add edx,[open_file_size]
@@: @@:
cmp byte[edi],'*' cmp byte[edi],'*'
@ -1303,10 +1397,6 @@ but_zoom_p:
sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
inc byte[zoom] inc byte[zoom]
;xor eax,eax
;mov edi,txt_zoom.zi
;mov al,byte[zoom]
;call tl_convert_to_str
call draw_pok call draw_pok
popad popad
@ -1355,10 +1445,6 @@ but_zoom_m:
sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y sub dword[Cor_y],ebx ;ᤢ¨£ ¥¬ ¯®«¥ §à¥­¨ï ¯® ®á¨ y
dec byte[zoom] dec byte[zoom]
;xor eax,eax
;mov edi,txt_zoom.zi
;mov al,byte[zoom]
;call tl_convert_to_str
call draw_pok call draw_pok
popad popad
@ -1580,18 +1666,18 @@ lib_name_1 db 'libimg.obj',0
err_message_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0 err_message_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0 err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
system_dir_7 db '/sys/lib/' system_dir_2 db '/sys/lib/'
lib_name_7 db 'buf2d.obj',0 lib_name_2 db 'buf2d.obj',0
err_msg_found_lib_7 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0 err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
err_msg_import_7 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0 err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
l_libs_start: l_libs_start:
lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\ lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\ 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 err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
lib_7 l_libs lib_name_7, sys_path, library_path, system_dir_7,\ lib2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
err_msg_found_lib_7,head_f_l,import_buf2d,err_msg_import_7,head_f_i err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
l_libs_end: l_libs_end:
align 4 align 4
@ -1653,55 +1739,23 @@ align 4
import_buf2d: import_buf2d:
init dd sz_init init dd sz_init
buf2d_create dd sz_buf2d_create buf2d_create dd sz_buf2d_create
buf2d_create_f_img dd sz_buf2d_create_f_img
buf2d_clear dd sz_buf2d_clear buf2d_clear dd sz_buf2d_clear
buf2d_draw dd sz_buf2d_draw buf2d_draw dd sz_buf2d_draw
buf2d_delete dd sz_buf2d_delete buf2d_delete dd sz_buf2d_delete
buf2d_line dd sz_buf2d_line buf2d_resize dd sz_buf2d_resize
buf2d_rect_by_size dd sz_buf2d_rect_by_size
buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size buf2d_filled_rect_by_size dd sz_buf2d_filled_rect_by_size
buf2d_circle dd sz_buf2d_circle
buf2d_img_hdiv2 dd sz_buf2d_img_hdiv2
buf2d_img_wdiv2 dd sz_buf2d_img_wdiv2
buf2d_conv_24_to_8 dd sz_buf2d_conv_24_to_8
buf2d_conv_24_to_32 dd sz_buf2d_conv_24_to_32
buf2d_bit_blt dd sz_buf2d_bit_blt
buf2d_bit_blt_transp dd sz_buf2d_bit_blt_transp
buf2d_bit_blt_alpha dd sz_buf2d_bit_blt_alpha
buf2d_curve_bezier dd sz_buf2d_curve_bezier
buf2d_convert_text_matrix dd sz_buf2d_convert_text_matrix
buf2d_draw_text dd sz_buf2d_draw_text
buf2d_crop_color dd sz_buf2d_crop_color
buf2d_offset_h dd sz_buf2d_offset_h
buf2d_flood_fill dd sz_buf2d_flood_fill
buf2d_set_pixel dd sz_buf2d_set_pixel buf2d_set_pixel dd sz_buf2d_set_pixel
dd 0,0 dd 0,0
sz_init db 'lib_init',0 sz_init db 'lib_init',0
sz_buf2d_create db 'buf2d_create',0 sz_buf2d_create db 'buf2d_create',0
sz_buf2d_create_f_img db 'buf2d_create_f_img',0
sz_buf2d_clear db 'buf2d_clear',0 sz_buf2d_clear db 'buf2d_clear',0
sz_buf2d_draw db 'buf2d_draw',0 sz_buf2d_draw db 'buf2d_draw',0
sz_buf2d_delete db 'buf2d_delete',0 sz_buf2d_delete db 'buf2d_delete',0
sz_buf2d_line db 'buf2d_line',0 sz_buf2d_resize db 'buf2d_resize',0
sz_buf2d_rect_by_size db 'buf2d_rect_by_size',0
sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0 sz_buf2d_filled_rect_by_size db 'buf2d_filled_rect_by_size',0
sz_buf2d_circle db 'buf2d_circle',0
sz_buf2d_img_hdiv2 db 'buf2d_img_hdiv2',0
sz_buf2d_img_wdiv2 db 'buf2d_img_wdiv2',0
sz_buf2d_conv_24_to_8 db 'buf2d_conv_24_to_8',0
sz_buf2d_conv_24_to_32 db 'buf2d_conv_24_to_32',0
sz_buf2d_bit_blt db 'buf2d_bit_blt',0
sz_buf2d_bit_blt_transp db 'buf2d_bit_blt_transp',0
sz_buf2d_bit_blt_alpha db 'buf2d_bit_blt_alpha',0
sz_buf2d_curve_bezier db 'buf2d_curve_bezier',0
sz_buf2d_convert_text_matrix db 'buf2d_convert_text_matrix',0
sz_buf2d_draw_text db 'buf2d_draw_text',0
sz_buf2d_crop_color db 'buf2d_crop_color',0
sz_buf2d_offset_h db 'buf2d_offset_h',0
sz_buf2d_flood_fill db 'buf2d_flood_fill',0
sz_buf2d_set_pixel db 'buf2d_set_pixel',0 sz_buf2d_set_pixel db 'buf2d_set_pixel',0
mouse_dd dd 0x0 mouse_dd dd 0
sc system_colors sc system_colors
last_time dd 0 last_time dd 0
@ -1709,44 +1763,14 @@ align 16
procinfo process_information procinfo process_information
align 4 align 4
buf_0: dd 0 ;a? § a?«i ­  ?aa?a ?§®?a ¦?­?i buf_0: dd 0
dw 5 ;+4 left .l: dw 0 ;+4 left
dw 35 ;+6 top .t: dw 35 ;+6 top
.w: dd 460 ;+8 w .w: dd 476 ;+8 w
.h: dd 340 ;+12 h .h: dd 352 ;+12 h
.color: dd 0xffffd0 ;+16 color .color: dd 0xffffd0 ;+16 color
db 24 ;+20 bit in pixel db 24 ;+20 bit in pixel
;íâ®â ª®¤ ­¥ ¬®©, ®­ ¯à¥®¡à §ã¥â ç¨á«® ¢ áâபã
;input:
; eax = value
; edi = string buffer
;output:
align 4
tl_convert_to_str:
pushad
mov dword[edi+1],0
call .str
popad
ret
align 4
.str:
mov ecx,0x0a ;§ ¤ ¥âáï á¨á⥬  áç¨á«¥­¨ï ¨§¬¥­ïîâáï ॣ¨áâàë ebx,eax,ecx,edx ¢å®¤­ë¥ ¯ à ¬¥âàë eax - ç¨á«®
;¯à¥à¥¢®¤ ç¨á«  ¢ ASCII áâப㠢§®¤­ë¥ ¤ ­­ë¥ ecx=á¨á⥬  áç¨á«¥­ï edi  ¤à¥á ªã¤  § ¯¨á뢠âì, ¡ã¤¥¬ áâபã, ¯à¨ç¥¬ ª®­¥æ ¯¥à¥¬¥­­®©
cmp eax,ecx ;áà ¢­¨âì ¥á«¨ ¢ eax ¬¥­ìè¥ ç¥¬ ¢ ecx â® ¯¥à¥©â¨ ­  @@-1 â.¥. ­  pop eax
jb @f
xor edx,edx ;®ç¨áâ¨âì edx
div ecx ;à §¤¥«¨âì - ®áâ â®ª ¢ edx
push edx ;¯®«®¦¨âì ¢ á⥪
;dec edi ;ᬥ饭¨¥ ­¥®¡å®¤¨¬®¥ ¤«ï § ¯¨á¨ á ª®­æ  áâப¨
call .str ;¯¥à¥©â¨ ­  á ¬ã ᥡï â.¥. ¢ë§¢ âì á ¬ã á¥¡ï ¨ â ª ¤® ⮣® ¬®¬¥­â  ¯®ª  ¢ eax ­¥ áâ ­¥â ¬¥­ìè¥ ç¥¬ ¢ ecx
pop eax
@@: ;cmp al,10 ;¯à®¢¥à¨âì ­¥ ¬¥­ìè¥ «¨ §­ ç¥­¨¥ ¢ al 祬 10 (¤«ï á¨á⥬ë áç¨á«¥­ï 10 ¤ ­­ ï ª®¬ ­¤  - «¨è­ ï))
or al,0x30 ;¤ ­­ ï ª®¬ ­¤  ª®à®ç¥ 祬 ¤¢¥ ¢ëè¥
stosb ;§ ¯¨á âì í«¥¬¥­â ¨§ ॣ¨áâà  al ¢ ï祪㠯 ¬ï⨠es:edi
ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
i_end: i_end:
rb 1024 rb 1024
stacktop: stacktop: