mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-18 21:02:34 +03:00
c06136cd31
optimize code, add memory constants git-svn-id: svn://kolibrios.org@6342 a494cfbc-eb01-0410-851d-a64ba20cac60
63 lines
1.6 KiB
PHP
63 lines
1.6 KiB
PHP
|
||
mem_screen equ 1200*1000*3 ;à §¬¥à ¯ ¬ï⨠¤«ï ®¡« á⨠íªà
|
||
mem_panel_b equ 50*(20*20*3) ;à §¬¥à ¯ ¬ï⨠¤«ï ¯ ¥«¨ ¨áâà㬥⮢
|
||
mem_flood_f equ 500000 ;à §¬¥à ¡ãä¥à ¤«ï § «¨¢ª¨, â ª¦¥ ¤«ï ¯ «¨âàë
|
||
|
||
;----------------------------------------------------------
|
||
;--------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_b+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
|
||
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_b+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_b
|
||
mov [PointerToPalette],eax
|
||
mov [ReserveArray],eax
|
||
ret
|
||
;--------------------------------------------------------- |