fix keys in dialog file -> new,

optimize code,
add memory constants

git-svn-id: svn://kolibrios.org@6342 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-03-15 22:30:18 +00:00
parent 2e10d14758
commit c06136cd31
9 changed files with 105 additions and 166 deletions

View File

@ -43,14 +43,13 @@ include '../../../libio.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load @use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
COLOR_ORDER equ MENUETOS
include 'bmplib.inc' include 'bmplib.inc'
include 'dialog2.inc' include 'dialog2.inc'
include 'design.inc' include 'design.inc'
include 'graphlib.inc' include 'graphlib.inc'
include 'cursors.inc' include 'cursors.inc'
include 'memory.inc'
include 'load_from_parameters.inc' include 'load_from_parameters.inc'
START: START:
@ -159,7 +158,6 @@ include 'string.inc'
include 'palette.inc' include 'palette.inc'
include 'files.inc' include 'files.inc'
include 'time.inc' include 'time.inc'
include 'memory.inc'
;----------------------------------------------------------- ;-----------------------------------------------------------
;------------variables and data of program------------------ ;------------variables and data of program------------------
;----------------------------------------------------------- ;-----------------------------------------------------------

View File

@ -15,28 +15,28 @@ dialog_line:
call print_cursor call print_cursor
opros: opros:
mov eax,10 mcall SF_WAIT_EVENT
mcall
cmp eax,1 cmp eax,1 ;redraw window
je exit_cycle
cmp eax,3 ;press button
je exit_cycle je exit_cycle
cmp eax,2 cmp eax,2 ;press key
jne opros jne opros
mov eax,2 mcall SF_GET_KEY
mcall
shr eax,8 shr eax,8
cmp eax,13 cmp al,13
je exit_cycle je exit_cycle
cmp eax,8 cmp al,8
je backspace je backspace
cmp eax,176 cmp al,176
je left je left
cmp eax,179 cmp al,179
je right je right
cmp eax,32 cmp al,32
je probel je probel
inc [position] inc [position]
@ -99,41 +99,36 @@ dialog_line:
ret ret
;--------------------------------------------------------------- ;---------------------------------------------------------------
print_line: print_line:
mov eax,13 mov ebx,[string_x]
mov ebx,[string_x] mov ecx,[string_y]
mov ecx,[string_y] mov edx,[MaxSizeString]
mov edx,[MaxSizeString] shl ebx,16
shl ebx,16 shl ecx,16
shl ecx,16 imul edx,6
imul edx,6 add ebx,edx
add ebx,edx add ebx,2
add ebx,2 add ecx,10
add ecx,10 mov edx,0xffffff
mov edx,0xffffff mcall SF_DRAW_RECT
mcall mov ebx,[string_x]
mov eax,4 shl ebx,16
mov ebx,[string_x] add ebx,[string_y]
shl ebx,16 mov edx,string_
add ebx,[string_y] mov esi,[MaxSizeString]
mov ecx,0 mcall SF_DRAW_TEXT,,0
mov edx,string_ ret
mov esi,[MaxSizeString]
mcall
ret
print_cursor: print_cursor:
mov eax,13 mov ebx,[position]
mov ebx,[position] mov ecx,[string_y]
mov ecx,[string_y] imul ebx,6
imul ebx,6 add ebx,[string_x]
add ebx,[string_x] shl ebx,16
shl ebx,16 shl ecx,16
shl ecx,16 add ebx,2
add ebx,2 add ecx,8
add ecx,8 mcall SF_DRAW_RECT,,,0xff6c58
mov edx,0xff6c58 ret
mcall
ret
;---------------------------------------------------------- ;----------------------------------------------------------
MinMaxCorrect: MinMaxCorrect:
mov ebx,[MaxSizeString] mov ebx,[MaxSizeString]

View File

@ -5,7 +5,7 @@ load_icons:
stdcall [img_decode], panel_picture, panel_picture.end-panel_picture, 0 stdcall [img_decode], panel_picture, panel_picture.end-panel_picture, 0
mov ebx,eax mov ebx,eax
mov edi,[ScreenPointer] mov edi,[ScreenPointer]
add edi,(1200*1000*3)+8 add edi,mem_screen
stdcall [img_to_rgb2], ebx,edi ;преобразуем изображение к формату rgb stdcall [img_to_rgb2], ebx,edi ;преобразуем изображение к формату rgb
stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения stdcall [img_destroy], ebx ;удаляем временный буфер с параметрами изображения
ret ret
@ -20,10 +20,9 @@ draw_icons:
shl edx,16 shl edx,16
add edx,[Icon_Y] add edx,[Icon_Y]
mov ebx,[ScreenPointer] mov ebx,[ScreenPointer]
add ebx,(1200*1000*3)+8 add ebx,mem_screen
mov eax,7
mov ecx,417*65536+46 mov ecx,417*65536+46
mcall mcall SF_PUT_IMAGE
;main buttons of instrumnts ;main buttons of instrumnts

View File

@ -169,11 +169,7 @@ TakeButtonInstruments:
and ebx,0xffffff and ebx,0xffffff
mov [Color],ebx mov [Color],ebx
mov eax,13 mcall SF_DRAW_RECT, 136*65536+20, 65*65536+21, [Color]
mov ebx,136*65536+20
mov ecx,65*65536+21
mov edx,[Color]
mcall
jmp still jmp still
no_pipetka: no_pipetka:
@ -341,7 +337,7 @@ TakeButtonInstruments:
lea ecx,[ecx+ecx*2] lea ecx,[ecx+ecx*2]
shl ecx,1 shl ecx,1
cmp ecx,500000 cmp ecx,mem_flood_f
ja normal_size_of_bufer ja normal_size_of_bufer
mov ebx,[ReserveArray] mov ebx,[ReserveArray]
@ -480,7 +476,6 @@ TakeButtonInstruments:
mov edi,256 mov edi,256
xor esi,esi xor esi,esi
next_rectangle: next_rectangle:
mov eax,13
mov ebx,[x] mov ebx,[x]
mov ecx,[y] mov ecx,[y]
mov edx,[palitra+esi] mov edx,[palitra+esi]
@ -489,7 +484,7 @@ TakeButtonInstruments:
shl ecx,16 shl ecx,16
add ebx,13 add ebx,13
add ecx,13 add ecx,13
mcall mcall SF_DRAW_RECT
add [x],15 add [x],15
cmp [x],20+15*32 cmp [x],20+15*32
jl no_new_line jl no_new_line
@ -509,15 +504,13 @@ TakeButtonInstruments:
cmp eax,2 cmp eax,2
jne no_keys jne no_keys
mov eax,2 mcall SF_GET_KEY
mcall
no_keys: no_keys:
cmp eax,3 cmp eax,3
jne no_buttons jne no_buttons
mov eax,17 mcall SF_GET_BUTTON
mcall
no_buttons: no_buttons:
@ -564,9 +557,7 @@ TakeButtonInstruments:
cmp [counter],257 cmp [counter],257
jne next_rectangle_column jne next_rectangle_column
mov eax,5 mcall SF_SLEEP,10
mov ebx,10
mcall
call drawwin call drawwin
@ -592,13 +583,10 @@ TakeButtonInstruments:
mov [OldX],eax mov [OldX],eax
mov [OldY],ebx mov [OldY],ebx
mov [Activate_instrument],1 mov [Activate_instrument],1
mov eax,[ReserveArray] xor eax,eax
mov ecx,60000 mov ecx,mem_flood_f/4
clear_array_line: mov edi,[ReserveArray]
mov [eax],dword 0 rep stosd
add eax,4
dec ecx
jnz clear_array_line
jmp still jmp still
no_new_line_xy: no_new_line_xy:
@ -791,13 +779,10 @@ TakeButtonInstruments:
mov [OldX],eax mov [OldX],eax
mov [OldY],ebx mov [OldY],ebx
mov [Activate_instrument],1 mov [Activate_instrument],1
mov eax,[ReserveArray] xor eax,eax
mov ecx,60000 mov ecx,mem_flood_f/4
clear_array_rectangle: mov edi,[ReserveArray]
mov [eax],dword 0 rep stosd
add eax,4
dec ecx
jnz clear_array_rectangle
jmp still jmp still
no_new_rectangle_xy: no_new_rectangle_xy:
@ -988,13 +973,10 @@ TakeButtonInstruments:
mov [OldX],eax mov [OldX],eax
mov [OldY],ebx mov [OldY],ebx
mov [Activate_instrument],1 mov [Activate_instrument],1
mov eax,[ReserveArray] xor eax,eax
mov ecx,60000 mov ecx,mem_flood_f/4
clear_array_circle: mov edi,[ReserveArray]
mov [eax],dword 0 rep stosd
add eax,4
dec ecx
jnz clear_array_circle
jmp still jmp still
no_new_circle_xy: no_new_circle_xy:
@ -1348,13 +1330,10 @@ TakeButtonInstruments:
mov [instrument_used],1 mov [instrument_used],1
and [crossing],0 and [crossing],0
and [finishing_crossing],0 and [finishing_crossing],0
mov eax,[ReserveArray] xor eax,eax
mov ecx,60000 mov ecx,mem_flood_f/4
clear_array_allocation: mov edi,[ReserveArray]
mov [eax],dword 0 rep stosd
add eax,4
dec ecx
jnz clear_array_allocation
jmp still jmp still
no_new_allocation_xy: no_new_allocation_xy:
instrument_not_finished_work: instrument_not_finished_work:
@ -1931,13 +1910,10 @@ TakeButtonInstruments:
instrument_used_true: instrument_used_true:
mov [Activate_instrument],1 mov [Activate_instrument],1
mov eax,[ReserveArray] xor eax,eax
mov ecx,60000 mov ecx,mem_flood_f/4
clear_array_konture: mov edi,[ReserveArray]
mov [eax],dword 0 rep stosd
add eax,4
dec ecx
jnz clear_array_line
no_new_konture_xy: no_new_konture_xy:
@ -2137,13 +2113,10 @@ TakeButtonInstruments:
mov [OldX],eax mov [OldX],eax
mov [OldY],ebx mov [OldY],ebx
mov [Activate_instrument],1 mov [Activate_instrument],1
mov eax,[ReserveArray] xor eax,eax
mov ecx,60000 mov ecx,mem_flood_f/4
clear_array_ellips: mov edi,[ReserveArray]
mov [eax],dword 0 rep stosd
add eax,4
dec ecx
jnz clear_array_ellips
jmp still jmp still
no_new_ellips_xy: no_new_ellips_xy:

View File

@ -13,20 +13,11 @@
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
mov [Picture_SizeY],400;280 mov [Picture_SizeY],400
mov [k],1 mov [k],1
; mov [ScreenPointer],I_END ; S = 0, L = 3600000 + 60000 + 500000 = 4160000 = 3,97 Mb mcall SF_SYS_MISC,SSF_MEM_ALLOC,4096
; mov [PointerToPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000 ; S = 4160000, L = 768000 = 750 Kb
; mov [PointerToCopyPicture], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3) ; S = 4928000, L = 768000 = 750 Kb
; mov [PointerToCopyPicture2],I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*2 ; S = 5696000, L = 768000 = 750 Kb
; mov [PointerToEditBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*3 ; S = 6464000, L = 768000 = 750 Kb
; mov [PointerToSpriteBufer], I_END+(1200*1000*3)+50*(20*20*3)+500000+(640*400*3)*4 ; S = 7232000, L = 768000 = 750 Kb
; mov [PointerToPalette], I_END+(1200*100*3)+50*(20*20*3)+1 ; S = 420001
; mov [ReserveArray], I_END+(1200*1000)*3+50*(20*20*3)+8 ; S = 3660008
mcall 68,12,4096
mov [ScreenPointer],eax mov [ScreenPointer],eax
and [save_flag],0 and [save_flag],0

View File

@ -15,11 +15,11 @@ load_picture:
jnz .end_open jnz .end_open
mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах mov ecx,dword[open_b+32] ;+32 qword: размер файла в байтах
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 add ecx,mem_screen+mem_panel_b+mem_flood_f
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer] mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
mov [ScreenPointer],eax mov [ScreenPointer],eax
add eax,0x10000 add eax,mem_screen+mem_panel_b
sub ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 sub ecx,mem_screen+mem_panel_b+mem_flood_f
mov [file_information.Function], SSF_READ_FILE mov [file_information.Function], SSF_READ_FILE
mov [file_information.Position], 0 mov [file_information.Position], 0
mov [file_information.Flags], 0 mov [file_information.Flags], 0
@ -32,7 +32,7 @@ load_picture:
je .end_open je .end_open
;определяем вид изображения и пишем его параметры ;определяем вид изображения и пишем его параметры
mov eax,[ScreenPointer] mov eax,[ScreenPointer]
add eax,0x10000 add eax,mem_screen+mem_panel_b
stdcall [img_decode], eax,ebx,0 stdcall [img_decode], eax,ebx,0
push eax push eax
;определяем размер декодированного изображения ;определяем размер декодированного изображения
@ -42,7 +42,7 @@ load_picture:
mov dword[Picture_SizeY],eax mov dword[Picture_SizeY],eax
imul ecx,eax imul ecx,eax
imul ecx,15 imul ecx,15
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 add ecx,mem_screen+mem_panel_b+mem_flood_f
mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer] mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
mov [ScreenPointer],eax mov [ScreenPointer],eax
call prepare_data_pointers call prepare_data_pointers

View File

@ -1,3 +1,8 @@
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----------- ;--------change size of memory which use program-----------
;---------------------------------------------------------- ;----------------------------------------------------------
@ -7,10 +12,10 @@ GetMemory:
mov edx,[Picture_SizeY] mov edx,[Picture_SizeY]
imul ecx,edx imul ecx,edx
lea ecx,[ecx+ecx*2] lea ecx,[ecx+ecx*2]
lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5 lea ecx,[ecx+ecx*4] ;(Picture_SizeX*Picture_SizeY*3)*5
add ecx,(1200*1000)*3+50*(20*20*3)+500000+16000+0x4000 ; 4192384 add ecx,mem_screen+mem_panel_b+mem_flood_f
mcall 68,20,,[ScreenPointer] mcall SF_SYS_MISC,SSF_MEM_REALLOC,,[ScreenPointer]
test eax,eax test eax,eax
jnz have_new_memory jnz have_new_memory
mov esi,sound_havent_memory mov esi,sound_havent_memory
call sound call sound
@ -30,7 +35,7 @@ prepare_data_pointers:
imul eax,ebx imul eax,ebx
lea eax,[eax+eax*2] lea eax,[eax+eax*2]
mov ebx,[ScreenPointer] mov ebx,[ScreenPointer]
add ebx,(1200*1000*3)+50*(20*20*3)+500000 add ebx,mem_screen+mem_panel_b+mem_flood_f
mov [PointerToPicture],ebx mov [PointerToPicture],ebx
mov [PointerToCopyPicture],ebx mov [PointerToCopyPicture],ebx
@ -51,11 +56,8 @@ prepare_data_pointers:
add [PointerToSpriteBufer],eax add [PointerToSpriteBufer],eax
mov eax,[ScreenPointer] mov eax,[ScreenPointer]
add eax,(1200*1000*3)+50*(20*20*3)+1 add eax,mem_screen+mem_panel_b
mov [PointerToPalette],eax mov [PointerToPalette],eax
mov eax,[ScreenPointer]
add eax,(1200*1000*3)+50*(20*20*3)+8
mov [ReserveArray],eax mov [ReserveArray],eax
ret ret
;--------------------------------------------------------- ;---------------------------------------------------------

View File

@ -60,7 +60,7 @@ TakeInstruments:
call print_text call print_text
mov edx,1000000000000000000000000000000b+1000 mov edx,1000000000000000000000000000000b+1000
mcall 8,<177,40>,<115,14>, mcall SF_DEFINE_BUTTON,<177,40>,<115,14>,
mov edx,1000000000000000000000000000000b+1001 mov edx,1000000000000000000000000000000b+1001
mcall ,,<139,14>, mcall ,,<139,14>,
@ -69,7 +69,7 @@ TakeInstruments:
mcall ,<175,40>,<170,15> mcall ,<175,40>,<170,15>
no_activate_space: no_activate_space:
mcall 10 mcall SF_WAIT_EVENT
cmp eax,1 cmp eax,1
je exit_new je exit_new
@ -77,7 +77,7 @@ no_activate_space:
cmp eax,3 cmp eax,3
jne no_activate_space jne no_activate_space
mcall 17 mcall SF_GET_BUTTON
shr eax,8 shr eax,8
cmp eax,1000 cmp eax,1000
@ -130,7 +130,7 @@ no_picture_size_y:
exit_new: exit_new:
mov edx,11100000000000000000000000000000b+1002 mov edx,11100000000000000000000000000000b+1002
mcall 8,<175,40>,<170,15> mcall SF_DEFINE_BUTTON,<175,40>,<170,15>
mov edx,11100000000000000000000000000000b+1001 mov edx,11100000000000000000000000000000b+1001
mcall ,<177,40>,<139,14> mcall ,<177,40>,<139,14>
@ -154,7 +154,6 @@ no_new:
cmp [number_menu],2 cmp [number_menu],2
jne no_open jne no_open
; opendialog drawwin,open_1,open_2,file_path
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
mov [OpenDialog_data.type],0 ; open mov [OpenDialog_data.type],0 ; open
@ -164,13 +163,10 @@ no_new:
cmp [OpenDialog_data.status],1 cmp [OpenDialog_data.status],1
jne still jne still
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;open_1: mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
mcall 40,0x80000027 ; 100111b
call load_picture call load_picture
call drawwin
call load_icons
call drawwin
mov [Scroll1CoordinatX],9 mov [Scroll1CoordinatX],9
mov [Scroll2CoordinatY],89 mov [Scroll2CoordinatY],89
@ -226,7 +222,7 @@ no_save_:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
save1: save1:
save_enter: save_enter:
mcall 40,0x80000027 ; 100111b mcall SF_SET_EVENTS_MASK,0x80000027 ;100111b
call analizing_picture_to_palette call analizing_picture_to_palette

View File

@ -20,13 +20,8 @@ SaveFonForSprite:
mov ecx,[counter] mov ecx,[counter]
next_pixel_sprite_save: next_pixel_sprite_save:
mov eax,[esi] movsw
and eax,0xffffff movsb
mov [edi],ax
shr eax,16
mov [edi+2],al
add esi,3
add edi,3
dec ecx dec ecx
jnz next_pixel_sprite_save jnz next_pixel_sprite_save
@ -57,13 +52,8 @@ PutFonForSprite:
mov ecx,[counter] mov ecx,[counter]
next_pixel_sprite_put: next_pixel_sprite_put:
mov eax,[esi] movsw
and eax,0xffffff movsb
mov [edi],ax
shr eax,16
mov [edi+2],al
add esi,3
add edi,3
dec ecx dec ecx
jnz next_pixel_sprite_put jnz next_pixel_sprite_put
@ -94,13 +84,8 @@ DrawSprite:
mov ecx,[counter] mov ecx,[counter]
next_pixel_sprite_draw: next_pixel_sprite_draw:
mov eax,[esi] movsw
and eax,0xffffff movsb
mov [edi],ax
shr eax,16
mov [edi+2],al
add esi,3
add edi,3
dec ecx dec ecx
jnz next_pixel_sprite_draw jnz next_pixel_sprite_draw