mem_screen equ 1200*1000*3 ;à §¬¥à ¯ ¬ï⨠¤«ï ®¡« á⨠íªà ­ 
mem_panel_but equ 50*(20*20*3) ;¯ ¬ïâì ¤«ï ¯ ­¥«¨ ¨­áâà㬥­â®¢
mem_panel_zoom equ 6*(18*21*3) ;¯ ¬ïâì ¤«ï ¯ ­¥«¨ á ª­®¯ª ¬¨ ¬ áèâ ¡®¢
mem_panel_all equ mem_panel_but+mem_panel_zoom ;à §¬¥à ¯ ¬ï⨠¤«ï
	;¢á¥å ¯ ­¥«¥© ¨­áâà㬥­â®¢
mem_flood_f equ 500000 ;à §¬¥à ¡ãä¥à  ¤«ï § «¨¢ª¨,   â ª¦¥ ¤«ï ¯ «¨âàë
mem_offs_shape equ 4807*4 ;ᬥ饭¨¥ ¤«ï à §¤¥«¥­¨ï ¬ áᨢ  ReserveArray

; ”®à¬ã«ë ¯à¨¬¥à­®£® ¢ëç¨á«¥­¨ï ¯ ¬ï⨠¤«ï । ªâ¨à®¢ ­¨ï:
;
; mem_flood_f ¯à¨¬¥à­® à ¢­® 4*((1200^2+1000^2)^0.5)*3*(1+5*5)
;   ’.¥. 4 ¤¨ £®­ «¨ íªà ­  1200 ­  1000 㬭®¦¥­­ëå ­  26.
;     ª ¦¤ë© ¯¨ªá¥«ì à¨á㥬®© 䨣ãàë ¯à¨å®¤¨âáï â ª¦¥ ®¡« áâì
;   ¯ ¬ï⨠¤«ï § ¯®¬¨­ ­¨ï ä®­®¢®£® ¨§®¡à ¦¥­¨ï, á ãç¥â®¬ ⮣®
;   çâ® ¬ ªá¨¬ «ì­ë© à §¬¥à ª¨á⨠5*5 ¯®«ãç ¥¬ 26 = 1 + 5*5.
;
;  ¬ïâì ReserveArray ¤¥«¨âáï ­  2 ®¡« áâ¨: 1-ï ¤«ï â®ç¥ª
;   à¨á㥬®© 䨣ãàë, 2-ï ¤«ï § ¯®¬¨­ ­¨ï ãç á⪮¢ ä®­  5*5
;   ¯à¨ªà¥¯«¥­­ëå ª ª ¦¤®© â®çª¥ à¨á㥬®© 䨣ãàë.
;    §¤¥«¥­¨¥ í⮩ ¯ ¬ï⨠¯à®¨á室¨â ¢ ¯à®¯®à樨 1 ª 26,
;   çâ® ¯à¨¬¥à­® à ¢­®: mem_flood_f / (1+5*5) ¨«¨ 4807*4.

;----------------------------------------------------------
;--------change size of memory which use program-----------
;----------------------------------------------------------
GetMemory:
	pusha
	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,mem_screen+mem_panel_all+mem_flood_f
	mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
	test eax,eax
	jnz	.have_new_memory
	;mov esi,sound_havent_memory
	;call sound
	notify_window_run txt_not_memory
	popa
	add	esp,4
	jmp	still

.have_new_memory:
	mov	[ScreenPointer],eax
	call prepare_data_pointers
	popa
	ret
;---------------------------------------------------------
prepare_data_pointers:
	mov	eax,[Picture_SizeX]
	mov	ebx,[Picture_SizeY]
	imul	eax,ebx
	lea	eax,[eax+eax*2]
	mov	ebx,[ScreenPointer]
	add	ebx,mem_screen+mem_panel_all+mem_flood_f

	mov	[PointerToPicture],ebx
	mov	[PointerToCopyPicture],ebx
	mov	[PointerToCopyPicture2],ebx
	mov	[PointerToEditBufer],ebx
	mov	[PointerToSpriteBufer],ebx

	add	[PointerToCopyPicture],eax

	add	[PointerToCopyPicture2],eax
	add	[PointerToCopyPicture2],eax

	add	[PointerToEditBufer],eax
	add	[PointerToEditBufer],eax
	add	[PointerToEditBufer],eax

	shl eax,2
	add	[PointerToSpriteBufer],eax

	mov	eax,[ScreenPointer]
	add	eax,mem_screen+mem_panel_all
	mov	[PointerToPalette],eax
	mov	[ReserveArray],eax

	call scrollbar_move_00 ;®¡­ã«¥­¨¥ áªà®««¨­£ 
	ret
;---------------------------------------------------------