Animage v1.3

1) Fixed window flicker when redrawing
2) Fixed memory leak for stack

git-svn-id: svn://kolibrios.org@1643 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2010-10-04 20:40:19 +00:00
parent 74199525db
commit bab525b2cf
12 changed files with 2070 additions and 2409 deletions

View File

@ -1,6 +1,12 @@
;******************************************************* ;*******************************************************
;**************GRAPHICS EDITOR ANIMAGE ***************** ;**************GRAPHICS EDITOR ANIMAGE *****************
;******************************************************* ;*******************************************************
; version: 1.3
; last update: 05/10/2010
; written by: Marat Zakiyanov aka Mario79, aka Mario
; changes: Fixed window flicker when redrawing,
; Fixed memory leak for stack
;--------------------------------------------------------
; version: 1.2 ; version: 1.2
; last update: 30/09/2010 ; last update: 30/09/2010
; written by: Marat Zakiyanov aka Mario79, aka Mario ; written by: Marat Zakiyanov aka Mario79, aka Mario
@ -69,7 +75,7 @@ include 'init_data.inc'
call drawwin call drawwin
;--------------------------------------------------------- ;---------------------------------------------------------
;---------Check loading of file from psrsmeters----------- ;---------Check loading of file from parameters-----------
;--------------------------------------------------------- ;---------------------------------------------------------
; mov eax,parameters ; mov eax,parameters
; mov ebx,file_path ; mov ebx,file_path
@ -98,15 +104,14 @@ include 'init_data.inc'
;---------------------------------------------------------- ;----------------------------------------------------------
;---------------------MAIN LOOP---------------------------- ;---------------------MAIN LOOP----------------------------
;---------------------------------------------------------- ;----------------------------------------------------------
red:
call drawwin
still: still:
call event call event
cmp eax,1 cmp eax,1
jne no_redraw_window je red
call drawwin
jmp still
no_redraw_window:
cmp eax,2 cmp eax,2
je keys je keys
@ -139,7 +144,7 @@ include 'events_of_buttons.inc'
include 'events_of_mouse.inc' include 'events_of_mouse.inc'
include 'panel_engen.inc' include 'panel_engen.inc'
include 'screen.inc' include 'screen.inc'
include 'menu_instruments.inc' include 'menu_instruments.inc'
include 'icons_instruments.inc' include 'icons_instruments.inc'
include 'icons.inc' include 'icons.inc'
include 'sprites.inc' include 'sprites.inc'
@ -152,6 +157,7 @@ include 'memory.inc'
;------------variables and data of program------------------ ;------------variables and data of program------------------
;----------------------------------------------------------- ;-----------------------------------------------------------
sound_havent_memory db 150,64,0 sound_havent_memory db 150,64,0
include 'lib_data.inc' include 'lib_data.inc'
include 'panel_data.inc' include 'panel_data.inc'
include 'palitra256.inc' include 'palitra256.inc'
@ -306,13 +312,9 @@ IncludeUGlobals
align 4 align 4
CursorsID rd 10 CursorsID rd 10
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;align 4
;parameters
; rb 257
;---------------------------------------------------------------------
align 4 align 4
file_path: file_path:
rb 4096 ;rb 1024+16 rb 4096
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
filename_area: filename_area:
@ -334,9 +336,6 @@ align 4
procinfo: procinfo:
rb 1024 rb 1024
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4
IPC_table rd 256
;---------------------------------------------------------------------
align 4 align 4
rb 4096 rb 4096
stacktop: stacktop:

View File

@ -1,334 +1,314 @@
;----------------------------------------------------- ;----------------------------------------------------------
draw_volume_rectangle: draw_volume_rectangle:
mov [line_x],eax
mov [line_y],ebx
mov [line_size_x],ecx
mov [line_size_y],edx
cmp esi,1
jne no_volume_light_rectangle
mov [line_x],eax mov [color_rectangle],0xc7cbcf
mov [line_y],ebx mov [color_line1],0xaeabae
mov [line_size_x],ecx mov [color_line2],0xffffff
mov [line_size_y],edx mov [color_line3],0xc7cbcf
jmp exit_colors
;----------------------------------------------------------
no_volume_light_rectangle:
cmp esi,2
jne no_pressed_rectangle
cmp esi,1 mov [color_rectangle],0x666666
jne no_volume_light_rectangle mov [color_line1],0xaeabae
mov [color_line2],0x666666
mov [color_line3],0x666666
jmp exit_colors
;----------------------------------------------------------
no_pressed_rectangle:
cmp esi,3
jne no_pressed_panel
mov [color_rectangle],0xc7cbcf mov [color_rectangle],0xc7cbcf
mov [color_line1],0xaeabae mov [color_line1],0xaeabae
mov [color_line2],0xffffff mov [color_line2],7000
mov [color_line3],0xc7cbcf mov [color_line3],0xffffff
jmp exit_colors jmp exit_colors
;----------------------------------------------------------
no_pressed_panel:
cmp esi,4
jne no_pressed_light_panel
no_volume_light_rectangle: mov [color_rectangle],0xffffff
mov [color_line1],0xaeabae
mov [color_line2],7000
mov [color_line3],0xffffff
jmp exit_colors
;----------------------------------------------------------
no_pressed_light_panel:
cmp esi,5
jne no_light_pressed_rectangle
cmp esi,2 mov [color_rectangle],0x666666
jne no_pressed_rectangle mov [color_line1],0xaeabae
mov [color_line2],0x666666
mov [color_line3],0x666666
jmp exit_colors
;----------------------------------------------------------
no_light_pressed_rectangle:
cmp esi,6
jne no_work_rectangle
mov [color_rectangle],0x666666 mov [color_rectangle],0xc7cbcf
mov [color_line1],0xaeabae mov [color_line1],0xaeabae
mov [color_line2],0x666666 mov [color_line2],0xc7cbcf
mov [color_line3],0x666666 mov [color_line3],0xc7cbcf
jmp exit_colors
;----------------------------------------------------------
no_work_rectangle:
cmp esi,7
jne no_work_rectangle_2
jmp exit_colors mov [color_rectangle],0xc7cbcf
mov [color_line1],0xc7cbcf
no_pressed_rectangle: mov [color_line2],0xc7cbcf
mov [color_line3],0xc7cbcf
cmp esi,3 jmp exit_colors
jne no_pressed_panel ;----------------------------------------------------------
no_work_rectangle_2:
mov [color_rectangle],0xc7cbcf exit_colors:
mov [color_line1],0xaeabae ;draw rectangle
mov [color_line2],7000 mov ebx,[line_x]
mov [color_line3],0xffffff mov ecx,[line_y]
jmp exit_colors shl ebx,16
shl ecx,16
no_pressed_panel: add ebx,[line_size_x]
add ecx,[line_size_y]
cmp esi,4 mov edx,[color_rectangle]
jne no_pressed_light_panel call draw_rectangle
;line 1
mov [color_rectangle],0xffffff mov edx,[color_line1]
mov [color_line1],0xaeabae mov ebx,[line_x]
mov [color_line2],7000 mov ecx,[line_y]
mov [color_line3],0xffffff shl ebx,16
jmp exit_colors shl ecx,16
add ebx,[line_x]
no_pressed_light_panel: add ecx,[line_y]
add ebx,[line_size_x]
cmp esi,5 call draw_line
jne no_light_pressed_rectangle ;line 2
mov edx,[color_line1]
mov [color_rectangle],0x666666 mov ebx,[line_x]
mov [color_line1],0xaeabae mov ecx,[line_y]
mov [color_line2],0x666666 shl ebx,16
mov [color_line3],0x666666 shl ecx,16
add ebx,[line_x]
jmp exit_colors add ecx,[line_y]
add ecx,[line_size_y]
no_light_pressed_rectangle: call draw_line
;line 3
cmp esi,6 mov edx,[color_line1]
jne no_work_rectangle mov ebx,[line_x]
mov ecx,[line_y]
mov [color_rectangle],0xc7cbcf add ecx,[line_size_y]
mov [color_line1],0xaeabae shl ebx,16
mov [color_line2],0xc7cbcf shl ecx,16
mov [color_line3],0xc7cbcf add ebx,[line_x]
jmp exit_colors add ecx,[line_y]
add ebx,[line_size_x]
no_work_rectangle: add ecx,[line_size_y]
call draw_line
cmp esi,7 ;line 4
jne no_work_rectangle_2 mov edx,[color_line1]
mov ebx,[line_x]
mov [color_rectangle],0xc7cbcf mov ecx,[line_y]
mov [color_line1],0xc7cbcf add ebx,[line_size_x]
mov [color_line2],0xc7cbcf shl ebx,16
mov [color_line3],0xc7cbcf shl ecx,16
jmp exit_colors add ebx,[line_x]
add ecx,[line_y]
no_work_rectangle_2: add ebx,[line_size_x]
add ecx,[line_size_y]
exit_colors: call draw_line
;draw rectangle ;light line 1
mov ebx,[line_x] mov edx,[color_line2]
mov ecx,[line_y] mov ebx,[line_x]
shl ebx,16 mov ecx,[line_y]
shl ecx,16 inc ebx
add ebx,[line_size_x] inc ecx
add ecx,[line_size_y] shl ebx,16
mov edx,[color_rectangle] shl ecx,16
call draw_rectangle add ebx,[line_x]
;line 1 add ecx,[line_y]
mov edx,[color_line1] add ebx,[line_size_x]
mov ebx,[line_x] dec ebx
mov ecx,[line_y] inc ecx
shl ebx,16 call draw_line
shl ecx,16 ;light line 2
add ebx,[line_x] mov edx,[color_line2]
add ecx,[line_y] mov ebx,[line_x]
add ebx,[line_size_x] mov ecx,[line_y]
call draw_line inc ebx
;line 2 inc ecx
mov edx,[color_line1] shl ebx,16
mov ebx,[line_x] shl ecx,16
mov ecx,[line_y] add ebx,[line_x]
shl ebx,16 add ecx,[line_y]
shl ecx,16 add ecx,[line_size_y]
add ebx,[line_x] dec ecx
add ecx,[line_y] inc ebx
add ecx,[line_size_y] call draw_line
call draw_line ;light line 3
;line 3 mov edx,[color_line3]
mov edx,[color_line1] mov ebx,[line_x]
mov ebx,[line_x] mov ecx,[line_y]
mov ecx,[line_y] add ebx,[line_size_x]
add ecx,[line_size_y] dec ebx
shl ebx,16 inc ecx
shl ecx,16 shl ebx,16
add ebx,[line_x] shl ecx,16
add ecx,[line_y] add ebx,[line_x]
add ebx,[line_size_x] add ecx,[line_y]
add ecx,[line_size_y] add ebx,[line_size_x]
call draw_line add ecx,[line_size_y]
;line 4 dec ebx
mov edx,[color_line1] dec ecx
mov ebx,[line_x] call draw_line
mov ecx,[line_y] ;light line 4
add ebx,[line_size_x] mov edx,[color_line3]
shl ebx,16 mov ebx,[line_x]
shl ecx,16 mov ecx,[line_y]
add ebx,[line_x] add ecx,[line_size_y]
add ecx,[line_y] inc ebx
add ebx,[line_size_x] dec ecx
add ecx,[line_size_y] shl ebx,16
call draw_line shl ecx,16
;light line 1 add ebx,[line_x]
mov edx,[color_line2] add ecx,[line_y]
mov ebx,[line_x] add ecx,[line_size_y]
mov ecx,[line_y] add ebx,[line_size_x]
inc ebx dec ecx
inc ecx dec ebx
shl ebx,16 call draw_line
shl ecx,16 ret
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
dec ebx
inc ecx
call draw_line
;light line 2
mov edx,[color_line2]
mov ebx,[line_x]
mov ecx,[line_y]
inc ebx
inc ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ecx,[line_size_y]
dec ecx
inc ebx
call draw_line
;light line 3
mov edx,[color_line3]
mov ebx,[line_x]
mov ecx,[line_y]
add ebx,[line_size_x]
dec ebx
inc ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ebx,[line_size_x]
add ecx,[line_size_y]
dec ebx
dec ecx
call draw_line
;light line 4
mov edx,[color_line3]
mov ebx,[line_x]
mov ecx,[line_y]
add ecx,[line_size_y]
inc ebx
dec ecx
shl ebx,16
shl ecx,16
add ebx,[line_x]
add ecx,[line_y]
add ecx,[line_size_y]
add ebx,[line_size_x]
dec ecx
dec ebx
call draw_line
ret
;---------------------------------------------------------- ;----------------------------------------------------------
rectangle: rectangle:
no_light_rectangle:
no_light_rectangle: mov [line_x],eax
mov [line_x],eax mov [line_y],ebx
mov [line_y],ebx mov [line_size_x],ecx
mov [line_size_x],ecx mov [line_size_y],edx
mov [line_size_y],edx mov edx,esi
mov edx,esi mov eax,13
mov eax,13 mov ebx,[line_x]
mov ebx,[line_x] mov ecx,[line_y]
mov ecx,[line_y] shl ebx,16
shl ebx,16 shl ecx,16
shl ecx,16 add ebx,[line_size_x]
add ebx,[line_size_x] add ecx,[line_size_y]
add ecx,[line_size_y] mcall
mcall ret
ret
;---------------------------------------------------------- ;----------------------------------------------------------
draw_conture: draw_conture:
mov [line_x],eax
mov [line_x],eax mov [line_y],ebx
mov [line_y],ebx mov [line_size_x],ecx
mov [line_size_x],ecx mov [line_size_y],edx
mov [line_size_y],edx mov [color_line1],0xaeabae
;line 1
mov [color_line1],0xaeabae mov edx,[color_line1]
mov ebx,[line_x]
mov ecx,[line_y]
;line 1 shl ebx,16
mov edx,[color_line1] shl ecx,16
mov ebx,[line_x] add ebx,[line_x]
mov ecx,[line_y] add ecx,[line_y]
shl ebx,16 add ebx,[line_size_x]
shl ecx,16 call draw_line
add ebx,[line_x] ;line 2
add ecx,[line_y] mov edx,[color_line1]
add ebx,[line_size_x] mov ebx,[line_x]
call draw_line mov ecx,[line_y]
;line 2 shl ebx,16
mov edx,[color_line1] shl ecx,16
mov ebx,[line_x] add ebx,[line_x]
mov ecx,[line_y] add ecx,[line_y]
shl ebx,16 add ecx,[line_size_y]
shl ecx,16 call draw_line
add ebx,[line_x] ;line 3
add ecx,[line_y] mov edx,[color_line1]
add ecx,[line_size_y] mov ebx,[line_x]
call draw_line mov ecx,[line_y]
;line 3 add ecx,[line_size_y]
mov edx,[color_line1] shl ebx,16
mov ebx,[line_x] shl ecx,16
mov ecx,[line_y] add ebx,[line_x]
add ecx,[line_size_y] add ecx,[line_y]
shl ebx,16 add ebx,[line_size_x]
shl ecx,16 add ecx,[line_size_y]
add ebx,[line_x] call draw_line
add ecx,[line_y] ;line 4
add ebx,[line_size_x] mov edx,[color_line1]
add ecx,[line_size_y] mov ebx,[line_x]
call draw_line mov ecx,[line_y]
;line 4 add ebx,[line_size_x]
mov edx,[color_line1] shl ebx,16
mov ebx,[line_x] shl ecx,16
mov ecx,[line_y] add ebx,[line_x]
add ebx,[line_size_x] add ecx,[line_y]
shl ebx,16 add ebx,[line_size_x]
shl ecx,16 add ecx,[line_size_y]
add ebx,[line_x] call draw_line
add ecx,[line_y] ret
add ebx,[line_size_x]
add ecx,[line_size_y]
call draw_line
ret
;---------------------------------------------------------- ;----------------------------------------------------------
columnus: columnus:
sub eax,ecx
sub eax,ecx jns no_columnus
jns no_columnus neg eax
neg eax cmp eax,esi
cmp eax,esi ja no_columnus
ja no_columnus sub ebx,edx
sub ebx,edx jns no_columnus
jns no_columnus neg ebx
neg ebx cmp ebx,edi
cmp ebx,edi ja no_columnus
ja no_columnus mov eax,1
mov eax,1 jmp columnus_true
jmp columnus_true no_columnus:
no_columnus: xor eax,eax
xor eax,eax columnus_true:
columnus_true: ret
ret
;---------------------------------------------------------- ;----------------------------------------------------------
print_text: print_text:
mov [text_x],eax mov [text_x],eax
mov [text_y],ebx mov [text_y],ebx
mov eax,4 mov eax,4
mov ebx,[text_x] mov ebx,[text_x]
shl ebx,16 shl ebx,16
add ebx,[text_y] add ebx,[text_y]
mcall mcall
ret ret
;---------------------------------------------------------- ;----------------------------------------------------------
draw_rectangle: draw_rectangle:
mov eax,13 mcall 13
mcall ret
ret
;------------------------ ;------------------------
draw_line: draw_line:
mov eax,38 mov eax,38
mcall mcall
ret ret
;---------------------------------------------------------- ;----------------------------------------------------------
;lightlin 12508927 ;lightlin 12508927
;lines 5669590 ;lines 5669590
;workpan 9350879 ;workpan 9350879
;btnpress 9089258 ;btnpress 9089258
line_x dd 0 line_x dd 0
line_y dd 0 line_y dd 0
line_size_x dd 0 line_size_x dd 0
line_size_y dd 0 line_size_y dd 0
color_line1 dd 0 color_line1 dd 0
color_line2 dd 0 color_line2 dd 0
color_line3 dd 0 color_line3 dd 0
color_rectangle dd 0 color_rectangle dd 0
;-------------------- ;--------------------
text_x dd 0 text_x dd 0
text_y dd 0 text_y dd 0
;-------------------- ;--------------------

View File

@ -2,317 +2,270 @@
;-------------interraction MOUSE-------------- ;-------------interraction MOUSE--------------
;--------------------------------------------- ;---------------------------------------------
mouse: mouse:
call GetMouseCoordinats
;panel
mov edx,[Window_SizeX]
sub edx,5
call GetMouseCoordinats cmp ebx,20
jle no_panel
;panel cmp ebx,20+15
mov edx,[Window_SizeX] jae no_panel
sub edx,5
cmp ebx,20 cmp eax,5
jle no_panel jle no_panel
cmp ebx,20+15 cmp eax,edx ;585
jae no_panel jae no_panel
cmp eax,5 call GetMouseCoordinats
jle no_panel mov [counter],7
mov edi,panel_text
jmp panel_interraction
cmp eax,edx ;585 no_panel:
jae no_panel cmp [Panel_flag],0
jz no_redraw_panel
call GetMouseCoordinats mov [counter],7
mov edi,panel_text
jmp panel_interraction
mov [counter],7 no_redraw_panel:
mov edi,panel_text call GetMouseCoordinats
call panel_interraction mov eax,[MouseX]
mov ebx,[MouseY]
mov ecx,[WorkScreen_SizeX]
mov edx,[WorkScreen_SizeY]
add ecx,9
add edx,89
jmp still cmp eax,ecx
no_panel: jae mouse_scroll
cmp [Panel_flag],0 cmp ebx,edx
jz no_redraw_panel jae mouse_scroll
jmp no_scrollers
mov [counter],7 mouse_scroll:
mov edi,panel_text mov [exit_from_work_arrea],1 ;mouse situated after work arrea
call panel_interraction ;scrollers
call GetMouseClick
cmp eax,1
jne no_click
no_redraw_panel: call GetMouseCoordinats
;interraction with horizontal scroller
mov eax,[Scroll1CoordinatX]
mov ebx,[Scroll1CoordinatY]
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[Scroll1MaxSizeX]
mov edi,[Scroll1MaxSizeY]
call columnus
test eax,eax
jz no_horizontal
call GetMouseCoordinats mov eax,9
mov eax,[MouseX] mov ebx,[Scroll1CoordinatY]
mov ebx,[MouseY] mov ecx,[Scroll1MaxSizeX]
mov ecx,[WorkScreen_SizeX] mov edx,14+10
mov edx,[WorkScreen_SizeY] mov esi,7
add ecx,9 inc ecx
add edx,89 call draw_volume_rectangle
cmp eax,ecx mov eax,[MouseX]
jae mouse_scroll mov ebx,[Scroll1SizeX]
shr ebx,1
sub eax,ebx
mov ecx,[MouseX]
add ecx,ebx
mov edx,8+1
add edx,[Scroll1MaxSizeX]
mov [Scroll1CoordinatX],eax
sub eax,9
jns no_min_scroll
cmp ebx,edx mov [Scroll1CoordinatX],9
jae mouse_scroll
jmp no_scrollers no_min_scroll:
cmp ecx,edx
jl no_max_scroll
mouse_scroll: sub edx,ebx
sub edx,ebx
mov [Scroll1CoordinatX],edx
mov [exit_from_work_arrea],1 ;mouse situated after work arrea no_max_scroll:
mov eax,[Scroll1CoordinatX]
;scrollers sub eax,9
call GetMouseClick mov ebx,[Picture_SizeX]
imul eax,ebx
cmp eax,1 mov ebx,[Scroll1MaxSizeX]
jne no_click
call GetMouseCoordinats
;interraction with horizontal scroller
mov eax,[Scroll1CoordinatX]
mov ebx,[Scroll1CoordinatY]
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[Scroll1MaxSizeX]
mov edi,[Scroll1MaxSizeY]
call columnus
test eax,eax
jz no_horizontal
mov eax,9
mov ebx,[Scroll1CoordinatY]
mov ecx,[Scroll1MaxSizeX]
mov edx,14+10
mov esi,7
inc ecx
call draw_volume_rectangle
mov eax,[MouseX]
mov ebx,[Scroll1SizeX]
shr ebx,1
sub eax,ebx
mov ecx,[MouseX]
add ecx,ebx
mov edx,8+1
add edx,[Scroll1MaxSizeX]
mov [Scroll1CoordinatX],eax
sub eax,9
jns no_min_scroll
mov [Scroll1CoordinatX],9
no_min_scroll:
cmp ecx,edx
jl no_max_scroll
sub edx,ebx
sub edx,ebx
mov [Scroll1CoordinatX],edx
no_max_scroll:
;
mov eax,[Scroll1CoordinatX]
sub eax,9
mov ebx,[Picture_SizeX]
imul eax,ebx
mov ebx,[Scroll1MaxSizeX]
cdq cdq
idiv ebx idiv ebx
mov [PosX],eax mov [PosX],eax
jmp no_vertical
jmp no_vertical no_horizontal:
mov eax,[Scroll2CoordinatX]
mov ebx,[Scroll2CoordinatY]
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[Scroll2MaxSizeX]
mov edi,[Scroll2MaxSizeY]
call columnus
test eax,eax
jz no_vertical
no_horizontal: mov eax,[Scroll2CoordinatX]
mov ebx,89
mov ecx,14+10
mov edx,[Scroll2MaxSizeY]
mov esi,7
inc edx
call draw_volume_rectangle
mov eax,[Scroll2CoordinatX] mov eax,[MouseY]
mov ebx,[Scroll2CoordinatY] mov ebx,[Scroll2SizeY]
mov ecx,[MouseX] shr ebx,1
mov edx,[MouseY] sub eax,ebx
mov esi,[Scroll2MaxSizeX] mov ecx,[MouseY]
mov edi,[Scroll2MaxSizeY] add ecx,ebx
call columnus mov edx,89
add edx,[Scroll2MaxSizeY]
mov [Scroll2CoordinatY],eax
test eax,eax sub eax,89
jz no_vertical jns no_min_scroll2
mov eax,[Scroll2CoordinatX] mov [Scroll2CoordinatY],89
mov ebx,89
mov ecx,14+10
mov edx,[Scroll2MaxSizeY]
mov esi,7
inc edx
call draw_volume_rectangle
mov eax,[MouseY] no_min_scroll2:
mov ebx,[Scroll2SizeY] cmp ecx,edx
shr ebx,1 jl no_max_scroll2
sub eax,ebx
mov ecx,[MouseY]
add ecx,ebx
mov edx,89
add edx,[Scroll2MaxSizeY]
mov [Scroll2CoordinatY],eax
sub eax,89 sub edx,ebx
jns no_min_scroll2 sub edx,ebx
mov [Scroll2CoordinatY],edx
mov [Scroll2CoordinatY],89 no_max_scroll2:
mov eax,[Scroll2CoordinatY]
no_min_scroll2: sub eax,89
mov ebx,[Picture_SizeY]
cmp ecx,edx imul eax,ebx
jl no_max_scroll2 mov ebx,[Scroll2MaxSizeY]
sub edx,ebx
sub edx,ebx
mov [Scroll2CoordinatY],edx
no_max_scroll2:
;
mov eax,[Scroll2CoordinatY]
sub eax,89
mov ebx,[Picture_SizeY]
imul eax,ebx
mov ebx,[Scroll2MaxSizeY]
cdq cdq
idiv ebx idiv ebx
mov [PosY],eax mov [PosY],eax
no_vertical: no_vertical:
call CalculatePositionScreen
call draw_scrollers
call MovePictureToWorkScreen
call CalculatePositionScreen no_click:
jmp still
call draw_scrollers no_scrollers:
call MovePictureToWorkScreen mov eax,[MouseX]
mov ebx,[MouseY]
mov ecx,[Window_SizeX]
mov edx,[Window_SizeY]
sub ecx,36
sub edx,35
no_click: cmp eax,9
jle not_work_arrea
jmp still cmp eax,ecx
no_scrollers: jae not_work_arrea
cmp ebx,20+15+1+50
jle not_work_arrea
mov eax,[MouseX] cmp ebx,edx
mov ebx,[MouseY] jae not_work_arrea
mov ecx,[Window_SizeX] jmp mouse_in_work_arrea
mov edx,[Window_SizeY]
sub ecx,36
sub edx,35
cmp eax,9 not_work_arrea:
jle not_work_arrea mov [exit_from_work_arrea],1
jmp still
cmp eax,ecx mouse_in_work_arrea:
jae not_work_arrea call GetScreenCordinats
call PrintMousePos
call GetMouseClick
test eax,eax
jz no_use_instruments
cmp ebx,20+15+1+50 cmp [Activate_instrument],0
jle not_work_arrea jnz no_undo___
;------------begin copy for undo-------------
inc [number_undo]
cmp [number_undo],1
jne no_one__
cmp ebx,edx mov edi,[PointerToCopyPicture]
jae not_work_arrea
jmp mouse_in_work_arrea no_one__:
cmp [number_undo],2
jne no_two__
not_work_arrea: mov edi,[PointerToCopyPicture2]
mov [exit_from_work_arrea],1 no_two__:
cmp [number_undo],3
jne no_three__
jmp still ;copy bufer number two to bufer number one
mov esi,[PointerToCopyPicture2]
mouse_in_work_arrea: mov edi,[PointerToCopyPicture]
mov ecx,[Picture_SizeX]
call GetScreenCordinats imul ecx,[Picture_SizeY]
call PrintMousePos lea ecx,[ecx+ecx*2]
call GetMouseClick add ecx,4
shr ecx,2
inc ecx
test eax,eax
jz no_use_instruments
cmp [Activate_instrument],0
jnz no_undo___
;------------begin copy for undo-------------
inc [number_undo]
cmp [number_undo],1
jne no_one__
mov edi,[PointerToCopyPicture]
no_one__:
cmp [number_undo],2
jne no_two__
mov edi,[PointerToCopyPicture2]
no_two__:
cmp [number_undo],3
jne no_three__
;copy bufer number two to bufer number one
mov esi,[PointerToCopyPicture2]
mov edi,[PointerToCopyPicture]
mov ecx,[Picture_SizeX]
imul ecx,[Picture_SizeY]
lea ecx,[ecx+ecx*2]
add ecx,4
shr ecx,2
inc ecx
cld cld
rep movsd rep movsd
;end copy ;end copy
dec [number_undo] dec [number_undo]
mov edi,[PointerToCopyPicture2] mov edi,[PointerToCopyPicture2]
no_three__: no_three__:
mov esi,[PointerToPicture]
mov esi,[PointerToPicture] mov ecx,[Picture_SizeX]
mov ecx,[Picture_SizeX] imul ecx,[Picture_SizeY]
imul ecx,[Picture_SizeY] lea ecx,[ecx+ecx*2]
lea ecx,[ecx+ecx*2] add ecx,4
add ecx,4 shr ecx,2
shr ecx,2 inc ecx
inc ecx
cld cld
rep movsd rep movsd
;--------------end copy for undo------------- ;--------------end copy for undo-------------
no_undo___: no_undo___:
call TakeButtonInstruments
call TakeButtonInstruments no_use_instruments:
no_use_instruments: mov eax,[Current_instrument]
and [Activate_instrument],0
mov eax,[Current_instrument] jmp still
and [Activate_instrument],0
jmp still
;----------------------------------------------- ;-----------------------------------------------
;---------get mouse cordinats------------------- ;---------get mouse cordinats-------------------
;----------------------------------------------- ;-----------------------------------------------
GetMouseCoordinats: GetMouseCoordinats:
mcall 37,1
mov eax,37 mov ebx,eax
mov ebx,1 shr eax,16
mcall and ebx,0xffff
mov [MouseX],eax
mov ebx,eax mov [MouseY],ebx
shr eax,16
and ebx,0xffff
mov [MouseX],eax
mov [MouseY],ebx
ret ret
;------------------------------------------------ ;------------------------------------------------
;-------get mouse attributs---------------------- ;-------get mouse attributs----------------------
;------------------------------------------------ ;------------------------------------------------
GetMouseClick: GetMouseClick:
mov eax,37 mcall 37,2
mov ebx,2 ret
mcall
ret

View File

@ -2,103 +2,166 @@
;-------------draw window of program----------------------- ;-------------draw window of program-----------------------
;---------------------------------------------------------- ;----------------------------------------------------------
drawwin: drawwin:
or ecx,-1
mcall 9,procinfo
mov esi,procinfo
mov eax,9 mov eax,[esi+34]
mov ebx,IPC_table mov ebx,[esi+38]
or ecx,-1 mov ecx,[esi+42]
mcall mov edx,[esi+46]
mov [Window_CordinatX],eax
mov [Window_CordinatY],ebx
mov [Window_SizeX],ecx
mov [Window_SizeY],edx
mov eax,[IPC_table+34] cmp [Window_SizeX],585
mov ebx,[IPC_table+38] jae no_minimum_size_x
mov ecx,[IPC_table+42]
mov edx,[IPC_table+46]
mov [Window_CordinatX],eax
mov [Window_CordinatY],ebx
mov [Window_SizeX],ecx
mov [Window_SizeY],edx
cmp [Window_SizeX],585 mov [Window_SizeX],585
jae no_minimum_size_x mov ecx,[Window_SizeX]
mov [Window_SizeX],585 no_minimum_size_x:
mov ecx,[Window_SizeX] cmp [Window_SizeY],400
jae no_minimum_size_y
no_minimum_size_x: mov [Window_SizeY],400
mov edx,[Window_SizeY]
cmp [Window_SizeY],400 no_minimum_size_y:
jae no_minimum_size_y mov [MaxWorkScreen_SizeX],ecx
mov [MaxWorkScreen_SizeY],edx
sub [MaxWorkScreen_SizeX],20+10+5+10
sub [MaxWorkScreen_SizeY],20+10+15+1+49+20+10
mov [Window_SizeY],400 cmp [MaxWorkScreen_SizeX],0
mov edx,[Window_SizeY] jns no_znak1
no_minimum_size_y: mov [MaxWorkScreen_SizeX],ecx
mov [MaxWorkScreen_SizeX],ecx no_znak1:
mov [MaxWorkScreen_SizeY],edx cmp [MaxWorkScreen_SizeY],0
sub [MaxWorkScreen_SizeX],20+10+5+10 jns no_znak2
sub [MaxWorkScreen_SizeY],20+10+15+1+49+20+10
cmp [MaxWorkScreen_SizeX],0 mov [MaxWorkScreen_SizeY],edx
jns no_znak1
mov [MaxWorkScreen_SizeX],ecx no_znak2:
no_znak1: mcall 12,1
;------------------------------------------------
mov ebx,[Window_CordinatX]
mov ecx,[Window_CordinatY]
shl ebx,16
shl ecx,16
add ebx,[Window_SizeX]
add ecx,[Window_SizeY]
xor esi,esi ;0x805080d0
; xor edi,edi ;0x005080d0
mcall 0,,,0x53aabbcc,,name_of_program
;------------------------------------------------
mov eax,5
mov ebx,20
mov ecx,[Window_SizeX]
mov edx,15
mov esi,6
sub ecx,10
call draw_volume_rectangle ; top menu - file and etc.
cmp [MaxWorkScreen_SizeY],0 mov [counter],7
jns no_znak2 mov edi,panel_text
call print_panel_text
;------------------------------------------------
mov eax,5
mov ebx,20+15+1
mov ecx,[Window_SizeX]
mov edx,50
mov esi,1
sub ecx,10
call draw_volume_rectangle ; tools panel
call draw_icons
call PrintMousePos
;------------------------------------------------
mov ecx,[k]
and [PosX],0
and [PosY],0
call MovePictureToWorkScreen
;------------------------------------------------
mov ebx,[WorkScreen_SizeX]
add ebx,5+3
mov edx,[Window_SizeX]
sub edx,ebx
sub edx,25+10-3
shl ebx,16
mov bx,dx
mov ecx,20+15+1+49+2
mov edx,[Window_SizeY]
mov eax,[WorkScreen_SizeY]
shr eax,16
sub edx,eax
sub edx,20+15+1+49+2+25+10
shl ecx,16
mov cx,dx
mov [MaxWorkScreen_SizeY],edx mcall 13,,,0xc7cbcf
;------------------------------------------------
mcall ,<5,3>
;------------------------------------------------
mov ebx,5
mov edx,[Window_SizeX]
mov eax,[WorkScreen_SizeX]
shr eax,16
sub edx,eax
sub edx,25+10
shl ebx,16
mov bx,dx
no_znak2: mov ecx,[WorkScreen_SizeY]
add ecx,20+15+1+49+2+3
mov edx,[Window_SizeY]
sub edx,ecx
sub edx,25+10-3
shl ecx,16
mov cx,dx
mov eax,12 mcall 13,,,0xc7cbcf
mov ebx,1 ;------------------------------------------------
mcall mcall ,,<20+15+1+49+2,3>
;------------------------------------------------
; draw_volume_rectangle
; eax - start X
; ebx - start Y
; ecx - size X
; edx - size Y
and eax,0 mov eax,5
mov ebx,[Window_CordinatX] mov ebx,[Window_SizeY]
mov ecx,[Window_CordinatY] mov ecx,[Window_SizeX]
shl ebx,16 mov edx,20+10
shl ecx,16 mov esi,3
add ebx,[Window_SizeX] sub ecx,30
add ecx,[Window_SizeY] sub ebx,25+10
mov edx,0x43aabbcc call draw_volume_rectangle ; horizontal scrollbar
xor esi,esi ;0x805080d0 ;------------------------------------------------
xor edi,edi ;0x005080d0 mov eax,[Window_SizeX]
mcall mov ebx,20+15+1+49+2
mov ecx,20+10
call draw_panel mov edx,[Window_SizeY]
call PrintMousePos mov esi,3
sub eax,25+10
mov [counter],7 sub edx,20+15+1+49+5+20
mov edi,panel_text call draw_volume_rectangle ; vertical scrollbar
call print_panel_text call draw_scrollers
;------------------------------------------------
;>>>>>>Leency mov eax,[Window_SizeX]
;mov eax,10 mov ebx,[Window_SizeY]
;mov ebx,5 mov ecx,20+10
;mov ecx,0xffffff mov edx,20+10
;mov edx,name_of_program mov esi,6
;mov esi,34 sub eax,25+10
;call print_text sub ebx,25+10
call draw_volume_rectangle ; down and right small area
mov eax,71 ;------------------------------------------------
mov ebx,1 mcall 12,2
mov ecx,name_of_program ret
int 40h ;-----------------------------------------------------------------------------
;Leency<<<<<<<
mov eax,12
mov ebx,2
mcall
mov ecx,[k]
and [PosX],0
and [PosY],0
call MovePictureToWorkScreen
call draw_scrollers
call draw_icons
ret

View File

@ -1,30 +1,21 @@
;--------------------------------------------------------- ;---------------------------------------------------------
;--------initializate data and params of program---------- ;--------initializate data and params of program----------
;--------------------------------------------------------- ;---------------------------------------------------------
mov [Scroll1CoordinatX],8+1 mov [Scroll1CoordinatX],8+1
mov [Scroll2CoordinatY],20+15+1+50+3 mov [Scroll2CoordinatY],20+15+1+50+3
mov [Window_SizeX],640 mov [Window_SizeX],640
mov [Window_SizeY],220 mov [Window_SizeY],220
mov [Window_CordinatX],50 mov [Window_CordinatX],50
mov [Window_CordinatY],50 mov [Window_CordinatY],50
mov [WorkScreen_SizeX],100 mov [WorkScreen_SizeX],100
mov [WorkScreen_SizeY],100 mov [WorkScreen_SizeY],100
mov [MaxWorkScreen_SizeX],100 mov [MaxWorkScreen_SizeX],100
mov [MaxWorkScreen_SizeY],100 mov [MaxWorkScreen_SizeY],100
and [PosX],0 and [PosX],0
and [PosY],0 and [PosY],0
mov [Picture_SizeX],640;400 mov [Picture_SizeX],640;400
mov [Picture_SizeY],400;280 mov [Picture_SizeY],400;280
mov [k],1 mov [k],1
; mov [ScreenPointer],0x19000
; mov [PointerToPicture],0x19000+(1200*1000*3)+50*(20*20*3)+500000
; mov [PointerToCopyPicture],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)
; mov [PointerToCopyPicture2],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*2
; mov [PointerToEditBufer],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*3
; mov [PointerToSpriteBufer],0x19000+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*4
; mov [PointerToPalette],0x19000+(1200*100*3)+50*(20*20*3)+1
; mov [ReserveArray],0x19000+(1200*1000)*3+50*(20*20*3)+8
; mov [ScreenPointer],I_END ; S = 0, L = 3600000 + 60000 + 500000 = 4160000 = 3,97 Mb ; mov [ScreenPointer],I_END ; S = 0, L = 3600000 + 60000 + 500000 = 4160000 = 3,97 Mb
; mov [PointerToPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000 ; S = 4160000, L = 768000 = 750 Kb ; mov [PointerToPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000 ; S = 4160000, L = 768000 = 750 Kb
@ -38,25 +29,12 @@
mcall 68,12,4096 mcall 68,12,4096
mov [ScreenPointer],eax mov [ScreenPointer],eax
and [save_flag],0 and [save_flag],0
mov [line_width],1 mov [line_width],1
mov [lastik_is_active],0 mov [lastik_is_active],0
and [crossing],0 and [crossing],0
and [finishing_crossing],0 and [finishing_crossing],0
and [number_undo],0 and [number_undo],0
and [instrument_used],0 and [instrument_used],0
and [DrawSprite_flag],0 and [DrawSprite_flag],0
; and [extended_memory],0 finit
;mov eax,68
;mov ebx,11
;mcall
;mov eax,68
;mov ebx,12
;mov ecx,60000
;mcall
;mov [PointerToIcons],eax
finit

View File

@ -1,125 +1,88 @@
;loading file from parameters if parametrs <> 0
;IN
; eax- pointer to parameters
; ebx- pointer to path of file
;OUT
;value not returned
;check_loading_from_parameters:
; cmp [eax],byte 0
; jz no_parameters
;copy file name
; mov esi,eax
; mov edi,ebx
; mov ecx,256
; rep movsb
;load file in memory
; call load_picture
; no_parameters:
; ret
; load picture from file to memory ; load picture from file to memory
load_picture: load_picture:
mov eax,file_path
mov ebx,[ScreenPointer]
add ebx,0x10000
mov eax,file_path call load_heading_of_file
mov ebx,[ScreenPointer]
add ebx,0x10000
call load_heading_of_file mov esi,[ScreenPointer]
add esi,0x10000
;-------------is this BMP file ?----------------
xor eax,eax
mov ax,[esi]
mov [type],ax
mov esi,[ScreenPointer] cmp [type],word 'BM'
add esi,0x10000 jne no_bmp_file_1
;-------------is this BMP file ?----------------
xor eax,eax
mov ax,[esi]
mov [type],ax
cmp [type],word 'BM' xor eax,eax
jne no_bmp_file_1 xor ebx,ebx
mov eax,[esi+18]
mov ebx,[esi+22]
mov [Picture_SizeX],eax
mov [Picture_SizeY],ebx
jmp exit_type_1
xor eax,eax no_bmp_file_1:
xor ebx,ebx ;-------------is this GIF file ?----------------
mov eax,[esi+18] xor eax,eax
mov ebx,[esi+22] mov ax,[esi]
mov [Picture_SizeX],eax mov [type],ax
mov [Picture_SizeY],ebx cmp [type],'GI'
jne no_gif_file_1
jmp exit_type_1 add esi,6
xor eax,eax
xor ebx,ebx
mov ax,word[esi]
mov bx,word[esi+2]
mov [Picture_SizeX],eax
mov [Picture_SizeY],ebx
jmp exit_type_1
no_bmp_file_1: no_gif_file_1:
jmp no_unpakcing_file_1
;-------------is this GIF file ?---------------- exit_type_1:
xor eax,eax ;----------------------------------------------------------
mov ax,[esi] ;Get momory for unpacking picture and for picture's bufers
mov [type],ax ;----------------------------------------------------------
call GetMemory
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
cmp [type],'GI' mov eax,file_path
jne no_gif_file_1 mov ebx,[PointerToCopyPicture]
add ebx,1000
call load_file
add esi,6 ;----------------------------------------------------------
xor eax,eax ;-------------------Unpacking picture----------------------
xor ebx,ebx ;----------------------------------------------------------
mov ax,word[esi] mov esi,[PointerToCopyPicture]
mov bx,word[esi+2] add esi,1000
mov [Picture_SizeX],eax mov edi,[PointerToPicture]
mov [Picture_SizeY],ebx mov eax,[ScreenPointer]
cmp [type],'BM'
jne no_unpakcing_bmp_file_1
;BMP DECODER
call bmptoimg
mov [save_flag],1
jmp no_unpakcing_file_1
jmp exit_type_1 no_unpakcing_bmp_file_1:
cmp [type],'GI'
jne no_unpakcing_file_1
;GIF DECODER
sub edi,8
call ReadGIF
mov [save_flag],1
no_gif_file_1: no_unpakcing_file_1:
call MovePictureToWorkScreen
jmp no_unpakcing_file_1 mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
exit_type_1: ret
;----------------------------------------------------------
;Get momory for unpacking picture and for picture's bufers
;----------------------------------------------------------
call GetMemory
;----------------------------------------------------------
;--------------------Load file in memory-------------------
;----------------------------------------------------------
mov eax,file_path
mov ebx,[PointerToCopyPicture]
add ebx,1000
call load_file
;----------------------------------------------------------
;-------------------Unpacking picture----------------------
;----------------------------------------------------------
mov esi,[PointerToCopyPicture]
add esi,1000
mov edi,[PointerToPicture]
mov eax,[ScreenPointer]
cmp [type],'BM'
jne no_unpakcing_bmp_file_1
;BMP DECODER
call bmptoimg
mov [save_flag],1
no_unpakcing_bmp_file_1:
cmp [type],'GI'
jne no_unpakcing_file_1
;GIF DECODER
sub edi,8
call ReadGIF
mov [save_flag],1
no_unpakcing_file_1:
call MovePictureToWorkScreen
mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89
ret

View File

@ -1,30 +1,8 @@
;---------------------------------------------------------- ;----------------------------------------------------------
;--------change size of memory which use program----------- ;--------change size of memory which use program-----------
;---------------------------------------------------------- ;----------------------------------------------------------
;GetMemory:
; pushad
; mov eax,64
; mov ebx,1
; mov ecx,[Picture_SizeX]
; mov edx,[Picture_SizeY]
; imul ecx,edx
; lea ecx,[ecx+ecx*2]
; lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5
; add ecx,[ScreenPointer]
; add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 ; 4192384
; add ecx,[extended_memory]
; mcall
; test eax,eax
; jz have_new_memory
; mov esi,sound_havent_memory
; call sound
; jmp still
;have_new_memory:
; popad
; ret
GetMemory: GetMemory:
pushad pusha
mov ecx,[Picture_SizeX] mov ecx,[Picture_SizeX]
mov edx,[Picture_SizeY] mov edx,[Picture_SizeY]
imul ecx,edx imul ecx,edx
@ -36,13 +14,14 @@ GetMemory:
jnz have_new_memory jnz have_new_memory
mov esi,sound_havent_memory mov esi,sound_havent_memory
call sound call sound
pushad popa
add esp,4
jmp still jmp still
have_new_memory: have_new_memory:
mov [ScreenPointer],eax mov [ScreenPointer],eax
call prepare_data_pointers call prepare_data_pointers
popad popa
ret ret
;--------------------------------------------------------- ;---------------------------------------------------------
prepare_data_pointers: prepare_data_pointers:
@ -72,5 +51,13 @@ prepare_data_pointers:
add [PointerToSpriteBufer],eax add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax add [PointerToSpriteBufer],eax
add [PointerToSpriteBufer],eax add [PointerToSpriteBufer],eax
mov eax,[ScreenPointer]
add eax,(1200*100*3)+50*(20*20*3)+1
mov [PointerToPalette],eax
mov eax,[ScreenPointer]
add eax,(1200*1000)*3+50*(20*20*3)+8
mov [ReserveArray],eax
ret ret
;--------------------------------------------------------- ;---------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -2,55 +2,53 @@
;-------analizing picture to palette------------------------ ;-------analizing picture to palette------------------------
;----------------------------------------------------------- ;-----------------------------------------------------------
analizing_picture_to_palette: analizing_picture_to_palette:
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
imul eax,ebx
mov ecx,eax
mov edx,[PointerToPicture]
mov esi,1 ;counter colors in palette
mov eax,[Picture_SizeX] ;put firs color of picture how one color in palette
mov ebx,[Picture_SizeY] mov ebp,[PointerToPalette]
imul eax,ebx mov eax,[edx]
mov ecx,eax and eax,0xffffff
mov edx,[PointerToPicture] mov [ebp],eax
mov esi,1 ;counter colors in palette
;put firs color of picture how one color in palette analizing_to_palette:
mov ebp,[PointerToPalette] mov eax,[edx]
mov eax,[edx] and eax,0xffffff
and eax,0xffffff mov edi,esi
mov [ebp],eax mov ebp,[PointerToPalette]
analizing_to_palette: next_color_in_palette:
mov eax,[edx] mov ebx,[ebp]
and eax,0xffffff and ebx,0xffffff
cmp ebx,eax ;this is color have in palette
je exit_loop_palette
mov edi,esi add ebp,4
mov ebp,[PointerToPalette] dec edi
next_color_in_palette: jnz next_color_in_palette
mov ebx,[ebp]
and ebx,0xffffff
cmp ebx,eax ;this is color have in palette
je exit_loop_palette
add ebp,4
dec edi
jnz next_color_in_palette
inc esi inc esi
cmp esi,256 ;256 colors cmp esi,256 ;256 colors
ja more_than_256_colors ja more_than_256_colors
mov ebp,[PointerToPalette]
mov ebx,esi
dec ebx
shl ebx,2
add ebp,ebx
mov [ebp],ax
shr eax,16
mov [ebp+2],al
exit_loop_palette: mov ebp,[PointerToPalette]
mov ebx,esi
dec ebx
shl ebx,2
add ebp,ebx
mov [ebp],ax
shr eax,16
mov [ebp+2],al
add edx,3 exit_loop_palette:
dec ecx add edx,3
jnz analizing_to_palette dec ecx
jnz analizing_to_palette
more_than_256_colors:
more_than_256_colors: mov eax,esi
mov eax,esi ret
ret

View File

@ -1,7 +1,7 @@
;********************************************************** ;**********************************************************
;------------------TEXT DATA------------------------------- ;------------------TEXT DATA-------------------------------
;********************************************************** ;**********************************************************
name_of_program db 'Graphics editor <<ANIMAGE>> V 1.2',0 name_of_program db 'Graphics editor <<ANIMAGE>> V 1.3',0
mouse_pos_x db 'X=' mouse_pos_x db 'X='
mouse_pos_y db 'Y=' mouse_pos_y db 'Y='
new_text1 db 'PICTURE SIZE X' new_text1 db 'PICTURE SIZE X'

View File

@ -2,539 +2,397 @@
;-----interraction panel with user---------------- ;-----interraction panel with user----------------
;------------------------------------------------- ;-------------------------------------------------
panel_interraction: panel_interraction:
;>>>>>>>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>>>>>>>>
mov eax,18 ; mcall 18,14
mov ebx,14
;mcall
and [Panel_flag],0 and [Panel_flag],0
;collision with text on panel ;collision with text on panel
next_columnus_text: next_columnus_text:
mov eax,[edi]
mov ebx,[edi+4]
sub eax,10
sub ebx,3
mov [Icon_text_x],eax
mov [Icon_text_y],ebx
mov eax,[edi] mov esi,[edi+8]
mov ebx,[edi+4] imul esi,10
sub eax,10 mov [button_menu_size_x],esi
sub ebx,3 mov [button_menu_size_y],dword 13
mov [Icon_text_x],eax
mov [Icon_text_y],ebx
mov esi,[edi+8] mov esi,[edi+8]
imul esi,10 add edi,4*3
mov [button_menu_size_x],esi add edi,esi
mov [button_menu_size_y],dword 13
mov esi,[edi+8] mov ecx,[MouseX]
add edi,4*3 mov edx,[MouseY]
add edi,esi
mov ecx,[MouseX] push edi
mov edx,[MouseY] mov edi,[button_menu_size_y]
mov esi,[button_menu_size_x]
call columnus
pop edi
push edi mov esi,7
mov edi,[button_menu_size_y] test eax,eax
mov esi,[button_menu_size_x] jz no_columnus_text
call columnus
pop edi mov esi,1
mov esi,7 mov [Panel_flag],1
call GetMouseClick
test eax,eax
jz no_mouse_pressed
test eax,eax ; mcall 18,14
jz no_columnus_text
mov esi,1 jmp print_panel_menu
mov [Panel_flag],1
call GetMouseClick
test eax,eax no_mouse_pressed:
jz no_mouse_pressed no_columnus_text:
mov eax,[Icon_text_x]
mov ebx,[Icon_text_y]
mov ecx,[button_menu_size_x]
mov edx,[button_menu_size_y]
call draw_volume_rectangle
mov eax,18 push [counter]
mov ebx,14 push edi
;mcall mov [counter],7
mov edi,panel_text
call print_panel_text
pop edi
pop [counter]
call print_panel_menu dec [counter]
jnz next_columnus_text
no_mouse_pressed: jmp still
no_columnus_text:
mov eax,[Icon_text_x]
mov ebx,[Icon_text_y]
mov ecx,[button_menu_size_x] ;-------------------------
mov edx,[button_menu_size_y]
call draw_volume_rectangle
push [counter]
push edi
mov [counter],7
mov edi,panel_text
call print_panel_text
pop edi
pop [counter]
dec [counter]
jnz next_columnus_text
ret
;--------------------------------------------------------- ;---------------------------------------------------------
;-----draw panel menu(main engin of panel)---------------- ;-----draw panel menu(main engin of panel)----------------
;--------------------------------------------------------- ;---------------------------------------------------------
print_panel_menu: print_panel_menu:
push [counter]
;delit main buttons(some time)
mov [counter],10
next_icon_delit1:
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall 8
inc [counter]
cmp [counter],30
jl next_icon_delit1
;delit buttons of brushes
mov [counter],40
next_icon_delit2:
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall 8
inc [counter]
cmp [counter],45
jl next_icon_delit2
;delit buttons of zoom
mov [counter],45
next_icon_delit3:
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall 8
inc [counter]
cmp [counter],50
jl next_icon_delit3
;delit buttons of palette
mov edx,51
add edx,11100000000000000000000000000000b
mcall 8
;delit buttons of color
mov edx,52
add edx,11100000000000000000000000000000b
mcall 8
pop [counter]
push esi
mov esi,[counter]
dec esi
shl esi,4
mov eax,[menu_rectangles+esi]
mov ebx,[menu_rectangles+esi+4]
mov ecx,[menu_rectangles+esi+8]
mov edx,[menu_rectangles+esi+12]
mov esi,1
mov [menu_coordinat_x],eax
mov [menu_size_x],ecx
call draw_volume_rectangle
pop esi
calculate_counter_menu:
;calculate menu counter
mov eax,[counter]
dec eax
shl eax,2
mov ebx,[menu_counters+eax]
mov [counter_menu],ebx
call GetMouseCoordinats
and [menu_counter],0
push esi edi
;ᣫ ¦¨¢ ­¨¥  ­¨¬ æ¨¨ >>>>>>>>>>>>>>>>>>
; mcall 18,4
menu_loop:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[menu_size_x]
mov edi,18
add ebx,[menu_counter]
add eax,2
sub esi,3
inc ebx
call columnus
mov esi,7
test eax,eax
jz no_columnus_menu_text
mov esi,1
no_columnus_menu_text:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[menu_size_x]
mov edx,18
add ebx,[menu_counter]
add eax,2
sub ecx,3
inc ebx
call draw_volume_rectangle
add [menu_counter],20
dec [counter_menu]
jnz menu_loop
;print menu text
push [counter]
mov esi,[counter]
dec esi
shl esi,2
mov edi,[menu_text_en+esi]
mov eax,[menu_counters+esi]
mov [counter],eax
call print_panel_text
pop [counter]
pop edi esi
push [counter] menu_still:
;delit main buttons(some time) mcall 10
mcall 2
mcall 17
call GetMouseClick
test eax,eax
jz calculate_counter_menu
mov [counter],10 call GetMouseCoordinats
;calculate menu counter
mov eax,[counter]
dec eax
shl eax,2
mov ebx,[menu_counters+eax]
mov [counter_menu],ebx
next_icon_delit1: and [menu_counter],0
and [counter_11],0
mov eax,8 push esi edi
mov edx,[counter]
add edx,11100000000000000000000000000000b
mcall
inc [counter]
cmp [counter],30 menu_loop2:
jl next_icon_delit1 mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[menu_size_x]
mov edi,18
add ebx,[menu_counter]
add eax,2
sub esi,3
inc ebx
call columnus
;delit buttons of brushes inc [counter_11]
mov [counter],40 test eax,eax
jz no_columnus_menu_text2
next_icon_delit2: mov esi,[counter_11]
mov [number_menu],esi
mov eax,8 no_columnus_menu_text2:
mov edx,[counter] add [menu_counter],20
add edx,11100000000000000000000000000000b dec [counter_menu]
mcall jnz menu_loop2
inc [counter]
cmp [counter],45 pop edi esi
jl next_icon_delit2
;delit buttons of zoom mcall 5,15
mov [counter],45
next_icon_delit3: push [counter]
pusha
call drawwin
popa
pop [counter]
mov eax,8 mov eax,[counter]
mov edx,[counter] mov [number_panel],eax
add edx,11100000000000000000000000000000b
mcall
inc [counter]
cmp [counter],50 jmp TakeInstruments
jl next_icon_delit3
;delit buttons of palette
mov eax,8
mov edx,51
add edx,11100000000000000000000000000000b
mcall
;delit buttons of color
mov eax,8
mov edx,52
add edx,11100000000000000000000000000000b
mcall
pop [counter]
push esi
mov esi,[counter]
dec esi
shl esi,4
mov eax,[menu_rectangles+esi]
mov ebx,[menu_rectangles+esi+4]
mov ecx,[menu_rectangles+esi+8]
mov edx,[menu_rectangles+esi+12]
mov esi,1
mov [menu_coordinat_x],eax
mov [menu_size_x],ecx
call draw_volume_rectangle
pop esi
calculate_counter_menu:
;calculate menu counter
mov eax,[counter]
dec eax
shl eax,2
mov ebx,[menu_counters+eax]
mov [counter_menu],ebx
call GetMouseCoordinats
and [menu_counter],0
push esi
push edi
;ᣫ ¦¨¢ ­¨¥  ­¨¬ æ¨¨ >>>>>>>>>>>>>>>>>>
mov eax,18
mov ebx,14
;mcall
menu_loop:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[menu_size_x]
mov edi,18
add ebx,[menu_counter]
add eax,2
sub esi,3
inc ebx
call columnus
mov esi,7
test eax,eax
jz no_columnus_menu_text
mov esi,1
no_columnus_menu_text:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[menu_size_x]
mov edx,18
add ebx,[menu_counter]
add eax,2
sub ecx,3
inc ebx
call draw_volume_rectangle
add [menu_counter],20
dec [counter_menu]
jnz menu_loop
;print menu text
push [counter]
mov esi,[counter]
dec esi
shl esi,2
mov edi,[menu_text_en+esi]
mov eax,[menu_counters+esi]
mov [counter],eax
call print_panel_text
pop [counter]
pop edi
pop esi
menu_still:
mov eax,10
mcall
mov eax,2
mcall
mov eax,17
mcall
call GetMouseClick
test eax,eax
jz calculate_counter_menu
call GetMouseCoordinats
;calculate menu counter
mov eax,[counter]
dec eax
shl eax,2
mov ebx,[menu_counters+eax]
mov [counter_menu],ebx
and [menu_counter],0
and [counter_11],0
push esi
push edi
menu_loop2:
mov eax,[menu_coordinat_x]
mov ebx,36
mov ecx,[MouseX]
mov edx,[MouseY]
mov esi,[menu_size_x]
mov edi,18
add ebx,[menu_counter]
add eax,2
sub esi,3
inc ebx
call columnus
inc [counter_11]
test eax,eax
jz no_columnus_menu_text2
mov esi,[counter_11]
mov [number_menu],esi
no_columnus_menu_text2:
add [menu_counter],20
dec [counter_menu]
jnz menu_loop2
pop edi
pop esi
mov eax,5
mov ebx,15
mcall
push [counter]
pushad
call drawwin
popad
pop [counter]
mov eax,[counter]
mov [number_panel],eax
call TakeInstruments
jmp still
;--------------------------------------------------------- ;---------------------------------------------------------
;------print mouse position on panel---------------------- ;------print mouse position on panel----------------------
;--------------------------------------------------------- ;---------------------------------------------------------
PrintMousePos: PrintMousePos:
pushad pushad
mov eax,[Window_SizeX]
sub eax,75
mov ebx,20+15+6
mov ecx,52
mov edx,18
mov esi,4
call draw_volume_rectangle
mov eax,[Window_SizeX] mov eax,[Window_SizeX]
sub eax,75 sub eax,75
mov ebx,20+15+6 mov ebx,20+15+6+18+2
mov ecx,52 mov ecx,52
mov edx,18 mov edx,18
mov esi,4 mov esi,4
call draw_volume_rectangle call draw_volume_rectangle
mov eax,[Window_SizeX] mov eax,[Window_SizeX]
sub eax,75 sub eax,70
mov ebx,20+15+6+18+2 mov ebx,20+15+6+6
mov ecx,52 and ecx,0
mov edx,18 mov edx,mouse_pos_x
mov esi,4 mov esi,2
call draw_volume_rectangle call print_text
mov eax,[Window_SizeX] mov eax,[Window_SizeX]
sub eax,70 sub eax,70
mov ebx,20+15+6+6 mov ebx,20+15+6+6+18+1
and ecx,0 and ecx,0
mov edx,mouse_pos_x mov edx,mouse_pos_y
mov esi,2 mov esi,2
call print_text call print_text
mov eax,[Window_SizeX] mov ecx,[ScreenX]
sub eax,70 add ecx,[PosX]
mov ebx,20+15+6+6+18+1 mov edx,[Window_SizeX]
and ecx,0 sub edx,55
mov edx,mouse_pos_y shl edx,16
mov esi,2 add edx,20+15+6+6
call print_text and esi,0
mcall 47,<4,0>
mov eax,47 mov ecx,[ScreenY]
mov ebx,4*65536 add ecx,[PosY]
mov ecx,[ScreenX] mov edx,[Window_SizeX]
add ecx,[PosX] sub edx,55
mov edx,[Window_SizeX] shl edx,16
sub edx,55 add edx,20+15+6+18+1+6
shl edx,16
add edx,20+15+6+6
and esi,0
mcall
mov eax,47
mov ebx,4*65536
mov ecx,[ScreenY]
add ecx,[PosY]
mov edx,[Window_SizeX]
sub edx,55
shl edx,16
add edx,20+15+6+18+1+6
and esi,0
mcall mcall
popad popad
ret ret
;----------------------------------------------------------
;---------------draw panel in window of program------------
;----------------------------------------------------------
draw_panel:
mov eax,5
mov ebx,20
mov ecx,[Window_SizeX]
mov edx,15
mov esi,6
sub ecx,10
call draw_volume_rectangle ; top menu - file and etc.
;mov eax,5
;mov ebx,20
;mov ecx,[Window_SizeX]
;mov edx,15
;mov esi,6
;sub ecx,10
;call draw_volume_rectangle
mov eax,5
mov ebx,20+15+1
mov ecx,[Window_SizeX]
mov edx,50
mov esi,1
sub ecx,10
call draw_volume_rectangle ; tools panel
mov eax,5
mov ebx,20+15+1+50+1
mov ecx,[Window_SizeX]
mov edx,[Window_SizeY]
mov esi,1
sub ecx,10+20
sub edx,20+15+1+50+1+5+20
call draw_volume_rectangle ; picure area
mov eax,5
mov ebx,[Window_SizeY]
mov ecx,[Window_SizeX]
mov edx,20+10
mov esi,3
sub ecx,30
sub ebx,25+10
call draw_volume_rectangle ; horizontal scrollbar
mov eax,[Window_SizeX]
mov ebx,20+15+1+49+2
mov ecx,20+10
mov edx,[Window_SizeY]
mov esi,3
sub eax,25+10
sub edx,20+15+1+49+5+20
call draw_volume_rectangle ; vertical scrollbar
mov eax,[Window_SizeX]
mov ebx,[Window_SizeY]
mov ecx,20+10
mov edx,20+10
mov esi,6
sub eax,25+10
sub ebx,25+10
call draw_volume_rectangle ; down and right small area
;mov eax,445
;mov ebx,20+15+6
;mov ecx,37
;mov edx,37
;mov esi,4
;call draw_volume_rectangle
ret
;---------------------------------------------------------- ;----------------------------------------------------------
;----------print text on the panel and menu---------------- ;----------print text on the panel and menu----------------
;---------------------------------------------------------- ;----------------------------------------------------------
print_panel_text: print_panel_text:
next_panel_text: next_panel_text:
mov eax,[edi]
mov ebx,[edi+4]
; xor ecx,ecx
mov ecx,0x10000000
mov edx,edi
add edx,12
mov esi,[edi+8]
add edi,esi
add edi,3*4
mov eax,[edi] push edi
mov ebx,[edi+4] call print_text
;xor ecx,ecx pop edi
mov ecx,0x10000000
mov edx,edi
add edx,12
mov esi,[edi+8]
add edi,esi
add edi,3*4
push edi dec [counter]
call print_text jnz next_panel_text
pop edi
dec [counter]
jnz next_panel_text
ret ret
;---------------------------------------------------------- ;----------------------------------------------------------
;------------draw lines of scoll--------------------------- ;------------draw lines of scoll---------------------------
;---------------------------------------------------------- ;----------------------------------------------------------
draw_scrollers: draw_scrollers:
mov edi,[CounterX]
mov eax,[Scroll1CoordinatX]
mov ebx,[Window_SizeY]
sub ebx,22+10
mov ecx,[Window_SizeX]
sub ecx,10+5+20+10+1
mov edx,14+10
mov esi,1
mov [Scroll1CoordinatX],eax
mov [Scroll1CoordinatY],ebx
mov [Scroll1MaxSizeY],edx
mov [Scroll1MaxSizeX],ecx
imul ecx,edi
push eax ebx edx
mov eax,ecx
mov ebx,[Picture_SizeX]
cdq
idiv ebx
mov ecx,eax
pop edx ebx eax
mov [Scroll1SizeX],ecx
mov edi,[Scroll1MaxSizeX]
sub edi,ecx
mov [Scroll1FreeX],edi
call draw_volume_rectangle
mov edi,[CounterX] mov eax,[Window_SizeX]
mov eax,[Scroll1CoordinatX] sub eax,22+10
mov ebx,[Window_SizeY] mov ebx,[Scroll2CoordinatY]
sub ebx,22+10 mov ecx,14+10
mov ecx,[Window_SizeX] mov edx,[Window_SizeY]
sub ecx,10+5+20+10+1 sub edx,20+15+1+49+10+20+11
mov edx,14+10 mov esi,1
mov esi,1 mov [Scroll2CoordinatX],eax
mov [Scroll1CoordinatX],eax mov [Scroll2CoordinatY],ebx
mov [Scroll1CoordinatY],ebx mov [Scroll2MaxSizeX],ecx
mov [Scroll1MaxSizeY],edx mov [Scroll2MaxSizeY],edx
mov [Scroll1MaxSizeX],ecx
imul ecx,edi
push eax
push ebx
push edx
mov eax,ecx
mov ebx,[Picture_SizeX]
cdq
idiv ebx
mov ecx,eax
pop edx
pop ebx
pop eax
mov [Scroll1SizeX],ecx
mov edi,[Scroll1MaxSizeX]
sub edi,ecx
mov [Scroll1FreeX],edi
call draw_volume_rectangle
mov eax,[Window_SizeX] imul edx,[CounterY]
sub eax,22+10 push eax ebx
mov ebx,[Scroll2CoordinatY] mov eax,edx
mov ecx,14+10 mov ebx,[Picture_SizeY]
mov edx,[Window_SizeY] cdq
sub edx,20+15+1+49+10+20+11 idiv ebx
mov esi,1 mov edx,eax
mov [Scroll2CoordinatX],eax pop ebx eax
mov [Scroll2CoordinatY],ebx mov [Scroll2SizeY],edx
mov [Scroll2MaxSizeX],ecx mov edi,[Scroll2MaxSizeY]
mov [Scroll2MaxSizeY],edx sub edi,edx
mov [Scroll2FreeY],edi
imul edx,[CounterY] call draw_volume_rectangle
push eax
push ebx
mov eax,edx
mov ebx,[Picture_SizeY]
cdq
idiv ebx
mov edx,eax
pop ebx
pop eax
mov [Scroll2SizeY],edx
mov edi,[Scroll2MaxSizeY]
sub edi,edx
mov [Scroll2FreeY],edi
call draw_volume_rectangle ret
ret button_menu_size_x dd 0
ret button_menu_size_y dd 0
button_menu_size_x dd 0
button_menu_size_y dd 0

View File

@ -2,351 +2,342 @@
;--------Move picture from array to work screeen----------- ;--------Move picture from array to work screeen-----------
;---------------------------------------------------------- ;----------------------------------------------------------
MovePictureToWorkScreen: MovePictureToWorkScreen:
call cleare_screen
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
mov ecx,[MaxWorkScreen_SizeX]
mov edx,[MaxWorkScreen_SizeY]
mov esi,[k]
imul eax,esi
imul ebx,esi
cmp eax,ecx
jle lab1
call cleare_screen mov eax,[MaxWorkScreen_SizeX]
mov [WorkScreen_SizeX],eax
jmp lab2
mov eax,[Picture_SizeX] lab1:
mov ebx,[Picture_SizeY] mov [WorkScreen_SizeX],eax
mov ecx,[MaxWorkScreen_SizeX]
mov edx,[MaxWorkScreen_SizeY]
mov esi,[k]
imul eax,esi
imul ebx,esi
cmp eax,ecx lab2:
jle lab1 cmp ebx,edx
mov eax,[MaxWorkScreen_SizeX] jle lab3
mov [WorkScreen_SizeX],eax mov ebx,[MaxWorkScreen_SizeY]
jmp lab2 mov [WorkScreen_SizeY],ebx
lab1: jmp lab4
mov [WorkScreen_SizeX],eax
lab2:
cmp ebx,edx lab3:
jle lab3 mov [WorkScreen_SizeY],ebx
mov ebx,[MaxWorkScreen_SizeY]
mov [WorkScreen_SizeY],ebx
jmp lab4
lab3:
mov [WorkScreen_SizeY],ebx
lab4:
mov eax,[WorkScreen_SizeX] lab4:
mov ebx,[k] mov eax,[WorkScreen_SizeX]
mov ebx,[k]
cdq cdq
idiv ebx idiv ebx
mov [CounterX],eax mov [CounterX],eax
mov eax,[WorkScreen_SizeY] mov eax,[WorkScreen_SizeY]
cdq cdq
idiv ebx idiv ebx
mov [CounterY],eax mov [CounterY],eax
mov eax,[WorkScreen_SizeX] mov eax,[WorkScreen_SizeX]
mov ecx,eax mov ecx,eax
mov ebx,[k] mov ebx,[k]
cdq cdq
idiv ebx idiv ebx
imul eax,ebx imul eax,ebx
sub ecx,eax sub ecx,eax
lea ecx,[ecx+ecx*2] lea ecx,[ecx+ecx*2]
;
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
dec ebx
imul eax,ebx
lea eax,[eax+eax*2]
add eax,ecx
mov [OffsetYWorkScreen],eax
mov eax,[WorkScreen_SizeX]
mov ebx,[k]
dec ebx
imul eax,ebx
lea eax,[eax+eax*2]
add eax,ecx
mov [OffsetYWorkScreen],eax
mov ebx,[Picture_SizeX] mov ebx,[Picture_SizeX]
mov eax,[CounterX] mov eax,[CounterX]
sub ebx,eax sub ebx,eax
lea ebx,[ebx+ebx*2] lea ebx,[ebx+ebx*2]
mov [OffsetYPicture],ebx mov [OffsetYPicture],ebx
mov eax,[WorkScreen_SizeX] mov eax,[WorkScreen_SizeX]
mov ebx,[k] mov ebx,[k]
sub eax,ebx sub eax,ebx
lea eax,[eax+eax*2] lea eax,[eax+eax*2]
mov [OffsetYBigPixel],eax mov [OffsetYBigPixel],eax
mov eax,[PosX] mov eax,[PosX]
mov ebx,[PosY] mov ebx,[PosY]
mov ecx,[Picture_SizeX] mov ecx,[Picture_SizeX]
imul ecx,ebx imul ecx,ebx
add eax,ecx add eax,ecx
lea eax,[eax+eax*2] lea eax,[eax+eax*2]
add eax,[PointerToPicture] add eax,[PointerToPicture]
mov ebx,[ScreenPointer]
mov edi,[CounterY]
mov ebx,[ScreenPointer] ;if size of picture natural(mastab is 1) than move picture to work screen
cmp [k],1
jne no_zoom_1_
mov edi,[CounterY] screen_y_1:
mov esi,[CounterX]
;if size of picture natural(mastab is 1) than move picture to work screen screen_x_1:
cmp [k],1 mov ecx,[eax]
jne no_zoom_1_ and ecx,0xffffff
screen_y_1: mov ebp,ecx
mov esi,[CounterX] shr ecx,16
screen_x_1: mov [ebx],bp
mov ecx,[eax] mov [ebx+2],cl
and ecx,0xffffff add ebx,3;
mov ebp,ecx add eax,3
shr ecx,16 dec esi
mov [ebx],bp jnz screen_x_1
mov [ebx+2],cl add eax,[OffsetYPicture]
add ebx,3; add ebx,[OffsetYWorkScreen]
add eax,3 dec edi
dec esi jnz screen_y_1
jnz screen_x_1 jmp fps
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_1
jmp fps
no_zoom_1_:
cmp [k],2 no_zoom_1_:
jne no_zoom_2 cmp [k],2
jne no_zoom_2
screen_y_2: screen_y_2:
mov esi,[CounterX] mov esi,[CounterX]
screen_x_2:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
mov edx,ebx
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
add edx,3*2
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
add edx,3*2
add edx,[OffsetYBigPixel]
add ebx,3*2
add eax,3
dec esi
jnz screen_x_2
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_2
jmp fps
no_zoom_2:
cmp [k],4 screen_x_2:
jne no_zoom_4 mov ecx,[eax]
screen_y_4: and ecx,0xffffff
mov esi,[CounterX] mov ebp,ecx
screen_x_4: shr ecx,16
mov ecx,[eax] mov edx,ebx
and ecx,0xffffff mov [edx],bp
mov ebp,ecx mov [edx+2],cl
shr ecx,16 mov [edx+3],bp
mov edx,ebx mov [edx+3+2],cl
mov [edx],bp add edx,3*2
mov [edx+2],cl add edx,[OffsetYBigPixel]
mov [edx+3],bp mov [edx],bp
mov [edx+3+2],cl mov [edx+2],cl
mov [edx+6],bp mov [edx+3],bp
mov [edx+6+2],cl mov [edx+3+2],cl
mov [edx+9],bp add edx,3*2
mov [edx+9+2],cl add edx,[OffsetYBigPixel]
add edx,3*4 add ebx,3*2
add edx,[OffsetYBigPixel] add eax,3
mov [edx],bp dec esi
mov [edx+2],cl jnz screen_x_2
mov [edx+3],bp add eax,[OffsetYPicture]
mov [edx+3+2],cl add ebx,[OffsetYWorkScreen]
mov [edx+6],bp dec edi
mov [edx+6+2],cl jnz screen_y_2
mov [edx+9],bp jmp fps
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
add ebx,4*3
add eax,3
dec esi
jnz screen_x_4
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_4
jmp fps
no_zoom_4:
;if zoom more than 4
screen_y:
mov esi,[CounterX]
screen_x:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
push ebx
push eax
mov edx,[k]
big_pixel_y:
mov eax,[k]
big_pixel_x:
mov [ebx],bp
mov [ebx+2],cl
add ebx,3
dec eax
jnz big_pixel_x
add ebx,[OffsetYBigPixel]
dec edx
jnz big_pixel_y
pop eax
pop ebx
mov edx,[k]
lea edx,[edx+edx*2]
add ebx,edx
add eax,3
dec esi
jnz screen_x
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y
fps: no_zoom_2:
;mov eax,18 cmp [k],4
;mov ebx,14 jne no_zoom_4
;mcall
mov eax,7 screen_y_4:
mov ebx,[ScreenPointer] mov esi,[CounterX]
mov ecx,[WorkScreen_SizeX]
mov edx,[WorkScreen_SizeY]
shl ecx,16
add ecx,edx
mov edx,8*65536+20+15+49+5+1
mcall
ret screen_x_4:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
mov edx,ebx
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
mov [edx],bp
mov [edx+2],cl
mov [edx+3],bp
mov [edx+3+2],cl
mov [edx+6],bp
mov [edx+6+2],cl
mov [edx+9],bp
mov [edx+9+2],cl
add edx,3*4
add edx,[OffsetYBigPixel]
add ebx,4*3
add eax,3
dec esi
jnz screen_x_4
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y_4
jmp fps
no_zoom_4:
;if zoom more than 4
screen_y:
mov esi,[CounterX]
screen_x:
mov ecx,[eax]
and ecx,0xffffff
mov ebp,ecx
shr ecx,16
;---------------------------------------------------------
push ebx eax
mov edx,[k]
big_pixel_y:
mov eax,[k]
big_pixel_x:
mov [ebx],bp
mov [ebx+2],cl
add ebx,3
dec eax
jnz big_pixel_x
add ebx,[OffsetYBigPixel]
dec edx
jnz big_pixel_y
pop eax ebx
;---------------------------------------------------------
mov edx,[k]
lea edx,[edx+edx*2]
add ebx,edx
add eax,3
dec esi
jnz screen_x
add eax,[OffsetYPicture]
add ebx,[OffsetYWorkScreen]
dec edi
jnz screen_y
fps:
;mcall 18,14
mov ebx,[ScreenPointer]
mov ecx,[WorkScreen_SizeX]
mov edx,[WorkScreen_SizeY]
shl ecx,16
add ecx,edx
mov edx,8*65536+20+15+49+5+1
mcall 7
ret
;---------------------------------------------------------- ;----------------------------------------------------------
;--------------------clear screen-------------------------- ;--------------------clear screen--------------------------
;---------------------------------------------------------- ;----------------------------------------------------------
cleare_screen: cleare_screen:
mov eax,[ScreenPointer]
mov ebx,[WorkScreen_SizeX]
imul ebx,[WorkScreen_SizeY]
lea ebx,[ebx+ebx*2]
shr ebx,3
inc ebx
mov esi,0xffffff
mov eax,[ScreenPointer] clear_screen_loop:
mov ebx,[WorkScreen_SizeX] mov [eax],esi
imul ebx,[WorkScreen_SizeY] mov [eax+3],esi
lea ebx,[ebx+ebx*2] mov [eax+6],si
shr ebx,3 add eax,4+4
inc ebx dec ebx
mov esi,0xffffff jnz clear_screen_loop
clear_screen_loop:
mov [eax],esi
mov [eax+3],esi
mov [eax+6],si
add eax,4+4
dec ebx
jnz clear_screen_loop
ret ret
;---------------------------------------------------------- ;----------------------------------------------------------
;-------------cleare work arrea(work screen)--------------- ;-------------cleare work arrea(work screen)---------------
;---------------------------------------------------------- ;----------------------------------------------------------
cleare_work_arrea: cleare_work_arrea:
mov eax,[PointerToPicture]
mov ebx,[Picture_SizeX]
imul ebx,[Picture_SizeY]
lea ebx,[ebx+ebx*2]
shr ebx,3
inc ebx
mov esi,0xffffff
mov eax,[PointerToPicture] clear_work_arrea_loop:
mov ebx,[Picture_SizeX] mov [eax],esi
imul ebx,[Picture_SizeY] mov [eax+3],esi
lea ebx,[ebx+ebx*2] mov [eax+6],si
shr ebx,3 add eax,4+4
inc ebx dec ebx
mov esi,0xffffff jnz clear_work_arrea_loop
clear_work_arrea_loop:
mov [eax],esi
mov [eax+3],esi
mov [eax+6],si
add eax,4+4
dec ebx
jnz clear_work_arrea_loop
ret ret
;----------------------------------------------------------- ;-----------------------------------------------------------
;calculate position work screen on a picture ;calculate position work screen on a picture
;----------------------------------------------------------- ;-----------------------------------------------------------
CalculatePositionScreen: CalculatePositionScreen:
mov eax,[Picture_SizeX]
mov ebx,[Picture_SizeY]
mov ecx,[CounterX]
mov edx,[CounterY]
sub eax,ecx
sub ebx,edx
cmp [PosX],eax
jle no_limit_screen_x
mov [PosX],eax
mov eax,[Picture_SizeX] no_limit_screen_x:
mov ebx,[Picture_SizeY] cmp [PosY],ebx
mov ecx,[CounterX] jle no_limit_screen_y
mov edx,[CounterY] mov [PosY],ebx
sub eax,ecx
sub ebx,edx
cmp [PosX],eax no_limit_screen_y:
jle no_limit_screen_x cmp [PosX],0
mov [PosX],eax jns no_minimum_screen_x
no_limit_screen_x: mov [PosX],0
cmp [PosY],ebx no_minimum_screen_x:
jle no_limit_screen_y cmp [PosY],0
mov [PosY],ebx jns no_minimum_screen_y
no_limit_screen_y: mov [PosY],0
cmp [PosX],0 no_minimum_screen_y:
jns no_minimum_screen_x ret
mov [PosX],0
no_minimum_screen_x:
cmp [PosY],0
jns no_minimum_screen_y
mov [PosY],0
no_minimum_screen_y:
ret
;----------------------------------------------------------- ;-----------------------------------------------------------
;-----------calculate cordinats on work picture-------------- ;-----------calculate cordinats on work picture--------------
;----------------------------------------------------------- ;-----------------------------------------------------------
GetScreenCordinats: GetScreenCordinats:
mov eax,[MouseX]
mov eax,[MouseX] mov ebx,[MouseY]
mov ebx,[MouseY] sub eax,9
sub eax,9 sub ebx,87
sub ebx,87 mov ecx,[k]
mov ecx,[k]
cdq cdq
idiv ecx idiv ecx
mov [ScreenX],eax mov [ScreenX],eax
mov eax,ebx mov eax,ebx
cdq cdq
idiv ecx idiv ecx
mov [ScreenY],eax mov [ScreenY],eax
ret ret