archiver.obj: fix function deflate_rle

kiv: clean code

git-svn-id: svn://kolibrios.org@6801 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2016-12-20 12:12:55 +00:00
parent ee04f7ac02
commit fb9e611d64
3 changed files with 61 additions and 47 deletions

View File

@ -2912,7 +2912,7 @@ align 4
mov esi,[edx+deflate_state.window] mov esi,[edx+deflate_state.window]
add esi,[edx+deflate_state.strstart] add esi,[edx+deflate_state.strstart]
dec esi dec esi
lodsb lodsb ;prev = *scan; ++scan
mov edi,esi mov edi,esi
scasb scasb
jnz .end2 jnz .end2
@ -2925,6 +2925,7 @@ align 4
;ecx = strend-scan ;ecx = strend-scan
mov ecx,MAX_MATCH-2 mov ecx,MAX_MATCH-2
repz scasb repz scasb
dec edi
sub edi,[edx+deflate_state.window] sub edi,[edx+deflate_state.window]
sub edi,[edx+deflate_state.strstart] sub edi,[edx+deflate_state.strstart]
mov [edx+deflate_state.match_length],edi mov [edx+deflate_state.match_length],edi

View File

@ -112,7 +112,7 @@ button:
align 4 align 4
draw_window: draw_window:
mcall SF_REDRAW, SSF_BEGIN_DRAW ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ® ­ ç «¥ ®âà¨á®¢ª¨ mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc,sizeof.system_colors mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc,sizeof.system_colors
mov edx, [sc.work] ; 梥â ä®­  mov edx, [sc.work] ; 梥â ä®­ 
or edx, 0x33000000 ; ¨ ⨯ ®ª­  3 or edx, 0x33000000 ; ¨ ⨯ ®ª­  3
@ -127,8 +127,12 @@ draw_window:
cStr edx,'Outp. size:' cStr edx,'Outp. size:'
mcall , <10,120>,,,11 mcall , <10,120>,,,11
mcall SF_DRAW_NUMBER, (1 shl 16)+1, strategy, <90,10>, 0 mov edx,[strategy]
mcall , (5 shl 16)+1, m0size, <90,20> imul edx,12
add edx,capt_strateg
mcall , <90,10>,0,,12
mcall SF_DRAW_NUMBER, (5 shl 16)+1, m0size, <90,20>
mcall , (5 shl 16)+1, m1size, <90,30> mcall , (5 shl 16)+1, m1size, <90,30>
mcall , (5 shl 16)+1, m2size, <90,120> mcall , (5 shl 16)+1, m2size, <90,120>
;mov ecx,(1 shl 31) ;mov ecx,(1 shl 31)
@ -149,7 +153,7 @@ draw_window:
dec esi dec esi
jnz .cycle1 jnz .cycle1
mcall SF_REDRAW, SSF_END_DRAW ; äã­ªæ¨ï 12.2, § ª®­ç¨«¨ à¨á®¢ âì mcall SF_REDRAW, SSF_END_DRAW
ret ret
align 4 align 4
@ -238,10 +242,18 @@ proc print_z_struct uses eax ebx
ret ret
endp endp
align 4
sc system_colors sc system_colors
align 4
title db 'Zlib test, press on [Up], [Down], [Left], [Right]',0 title db 'Zlib test, press on [Up], [Down], [Left], [Right]',0
align 4
capt_strateg db '0) Default ',0
db '1) Filtered',0
db '2) Huffman ',0
db '3) Rle ',0
db '4) Fixed ',0
align 4 align 4
import_archiver: import_archiver:
deflate_unpack dd sz_deflate_unpack deflate_unpack dd sz_deflate_unpack

View File

@ -12,6 +12,7 @@ include '../../../config.inc'
include '../../../proc32.inc' include '../../../proc32.inc'
include '../../../macros.inc' include '../../../macros.inc'
include '../../../dll.inc' include '../../../dll.inc'
include '../../../KOSfuncs.inc'
;include '../../../debug.inc' ;include '../../../debug.inc'
include '../../../develop/libraries/libs-dev/libio/libio.inc' include '../../../develop/libraries/libs-dev/libio/libio.inc'
@ -22,7 +23,7 @@ include '../../../develop/libraries/libs-dev/libimg/libimg.inc'
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
START: START:
mcall 68, 11 mcall SF_SYS_MISC, SSF_HEAP_INIT
stdcall dll.Load, @IMPORT stdcall dll.Load, @IMPORT
or eax, eax or eax, eax
@ -58,7 +59,7 @@ START:
mov [slide_key], eax mov [slide_key], eax
invoke ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod invoke ini_get_shortcut, inifilename, aShortcuts, aTglbar, -1, tglbar_mod
mov [tglbar_key], eax mov [tglbar_key], eax
mcall 66, 1, 1 ; set kbd mode to scancodes mcall SF_KEYBOARD, SSF_SET_INPUT_MODE, 1 ; set kbd mode to scancodes
cmp byte [@PARAMS], 0 cmp byte [@PARAMS], 0
jnz params_given jnz params_given
@ -82,7 +83,7 @@ START:
jmp params_given jmp params_given
set_bgr: set_bgr:
mcall 15, 4 mcall SF_BACKGROUND_SET, SSF_MODE_BG
mov eax, @PARAMS + 4 mov eax, @PARAMS + 4
call load_image call load_image
jc exit jc exit
@ -112,7 +113,7 @@ still:
push 10 push 10
pop eax pop eax
jz @f jz @f
mcall 26, 9 mcall SF_SYSTEM_GET, SSF_TIME_COUNT
mov edx, [cur_frame] mov edx, [cur_frame]
mov ebx, [cur_frame_time] mov ebx, [cur_frame_time]
add ebx, [edx + Image.Delay] add ebx, [edx + Image.Delay]
@ -134,12 +135,12 @@ still:
key: key:
xor esi, esi xor esi, esi
keyloop: keyloop:
mcall 2 mcall SF_GET_KEY
test al, al test al, al
jnz keyloopdone jnz keyloopdone
shr eax, 8 shr eax, 8
mov ecx, eax mov ecx, eax
mcall 66, 3 mcall SF_KEYBOARD, SSF_GET_CONTROL_KEYS
mov edx, next_mod mov edx, next_mod
call check_shortcut call check_shortcut
jz .next jz .next
@ -195,14 +196,14 @@ red_update_frame:
mov eax, [image] mov eax, [image]
@@: @@:
mov [cur_frame], eax mov [cur_frame], eax
mcall 26, 9 mcall SF_SYSTEM_GET, SSF_TIME_COUNT
mov [cur_frame_time], eax mov [cur_frame_time], eax
mcall 9, procinfo, -1 mcall SF_THREAD_INFO, procinfo, -1
call draw_cur_frame call draw_cur_frame
jmp still jmp still
button: button:
mcall 17 mcall SF_GET_BUTTON
shr eax, 8 shr eax, 8
; flip horizontally ; flip horizontally
@ -310,7 +311,7 @@ button:
jne still jne still
exit: exit:
mcall -1 mcall SF_TERMINATE_PROCESS
redraw_image = red redraw_image = red
@ -417,9 +418,9 @@ update_image_sizes:
jz .no_resize jz .no_resize
test [wnd_style], 1 SHL 25 test [wnd_style], 1 SHL 25
jz .no_resize jz .no_resize
mcall 48, 4 mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
add esi, eax add esi, eax
mcall 67,-1,-1 mcall SF_CHANGE_WINDOW,-1,-1
.no_resize: .no_resize:
ret ret
@ -427,19 +428,19 @@ set_as_bgr:
mov esi, [image] mov esi, [image]
mov ecx, [esi + Image.Width] mov ecx, [esi + Image.Width]
mov edx, [esi + Image.Height] mov edx, [esi + Image.Height]
mcall 15, 1 mcall SF_BACKGROUND_SET, SSF_SIZE_BG
mcall 15, 6 mcall SF_BACKGROUND_SET, SSF_MAP_BG
test eax, eax test eax, eax
jz @f jz @f
push eax push eax
invoke img.to_rgb2, esi, eax invoke img.to_rgb2, esi, eax
pop ecx pop ecx
mcall 15, 7 mcall SF_BACKGROUND_SET, SSF_UNMAP_BG
@@: @@:
mcall 15, 3 mcall SF_BACKGROUND_SET, SSF_REDRAW_BG
ret ret
slide_show: slide_show:
@ -573,13 +574,13 @@ load_directory:
rep movsb rep movsb
@@: @@:
mov byte [edi], 0 mov byte [edi], 0
mcall 68, 12, 0x1000 mcall SF_SYS_MISC, SSF_MEM_ALLOC, 0x1000
test eax, eax test eax, eax
jz .ret jz .ret
mov ebx, readdir_fileinfo mov ebx, readdir_fileinfo
mov dword [ebx+12], (0x1000 - 32) / 304 mov dword [ebx+12], (0x1000 - 32) / 304
mov dword [ebx+16], eax mov dword [ebx+16], eax
mcall 70 mcall SF_FILE
cmp eax, 6 cmp eax, 6
jz .dirok jz .dirok
test eax, eax test eax, eax
@ -589,11 +590,11 @@ load_directory:
mov [readblocks], ecx mov [readblocks], ecx
imul ecx, 304 imul ecx, 304
add ecx, 32 add ecx, 32
mcall 68, 20 mcall SF_SYS_MISC, SSF_MEM_REALLOC
test eax, eax test eax, eax
jz free_directory jz free_directory
mov [directory_ptr], eax mov [directory_ptr], eax
mcall 70, readdir_fileinfo mcall SF_FILE, readdir_fileinfo
.dirok: .dirok:
cmp ebx, 0 cmp ebx, 0
jle free_directory jle free_directory
@ -704,7 +705,7 @@ load_directory:
ret ret
free_directory: free_directory:
mcall 68, 13, [directory_ptr] mcall SF_SYS_MISC, SSF_MEM_FREE, [directory_ptr]
and [directory_ptr], 0 and [directory_ptr], 0
ret ret
@ -734,7 +735,7 @@ init_frame:
test byte [eax + Image.Flags], Image.IsAnimated test byte [eax + Image.Flags], Image.IsAnimated
jz @f jz @f
push ebx push ebx
mcall 26, 9 mcall SF_SYSTEM_GET, SSF_TIME_COUNT
pop ebx pop ebx
mov [cur_frame_time], eax mov [cur_frame_time], eax
@@: @@:
@ -753,15 +754,15 @@ draw_window:
mov eax, [image] mov eax, [image]
cmp eax, eax cmp eax, eax
call update_image_sizes call update_image_sizes
mcall 48, 4 mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
mov esi, [wnd_height] mov esi, [wnd_height]
add esi, eax add esi, eax
test byte [bTglbar], 1 test byte [bTglbar], 1
jz @f jz @f
mcall 67, -1, -1, [wnd_width], mcall SF_CHANGE_WINDOW, -1, -1, [wnd_width],
jmp .mode_not_changed jmp .mode_not_changed
@@: @@:
mcall 67, [wnd_x], [wnd_y], [wnd_width], mcall SF_CHANGE_WINDOW, [wnd_x], [wnd_y], [wnd_width],
jmp .mode_not_changed jmp .mode_not_changed
.mode_slide: .mode_slide:
mov [bg_color], 0x00000000 mov [bg_color], 0x00000000
@ -769,19 +770,19 @@ draw_window:
mov [wnd_x], eax mov [wnd_x], eax
mov eax, [procinfo.box.top] mov eax, [procinfo.box.top]
mov [wnd_y], eax mov [wnd_y], eax
mcall 14 mcall SF_GET_SCREEN_SIZE
mov edx, eax mov edx, eax
shr edx, 16 shr edx, 16
movzx eax, ax movzx eax, ax
mov esi, eax mov esi, eax
mcall 67, 0, 0, , mcall SF_CHANGE_WINDOW, 0, 0, ,
jmp .posok.slide_show jmp .posok.slide_show
.mode_not_changed: .mode_not_changed:
cmp [bFirstDraw], 0 cmp [bFirstDraw], 0
jz .posok jz .posok
or ecx, -1 or ecx, -1
mcall 9, procinfo mcall SF_THREAD_INFO, procinfo
test byte [procinfo.wnd_state], 0x04 test byte [procinfo.wnd_state], 0x04
jnz .posok jnz .posok
@ -801,14 +802,14 @@ draw_window:
cmp eax, -1 cmp eax, -1
jz @f jz @f
mov ebx, ecx mov ebx, ecx
mcall 67 mcall SF_CHANGE_WINDOW
@@: @@:
.posok: .posok:
test [wnd_style], 1 SHL 25 test [wnd_style], 1 SHL 25
jz .posok.slide_show jz .posok.slide_show
mcall 12, 1 mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall 48, 4 mcall SF_STYLE_SETTINGS, SSF_GET_SKIN_HEIGHT
mov ebp, eax ; save skin height mov ebp, eax ; save skin height
add eax, [wnd_height] add eax, [wnd_height]
mov ebx, [wnd_x] mov ebx, [wnd_x]
@ -817,18 +818,18 @@ draw_window:
mov ecx, [wnd_y] mov ecx, [wnd_y]
shl ecx, 16 shl ecx, 16
add ecx, eax add ecx, eax
mcall 0, , , [wnd_style], 0, real_header mcall SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
jmp .posok.common jmp .posok.common
.posok.slide_show: .posok.slide_show:
mcall 12, 1 mcall SF_REDRAW, SSF_BEGIN_DRAW
mcall 14 mcall SF_GET_SCREEN_SIZE
mov ebx, eax mov ebx, eax
shr ebx, 16 shr ebx, 16
movzx eax, ax movzx eax, ax
mov ecx, eax mov ecx, eax
mcall 0, , , [wnd_style], 0, real_header mcall SF_CREATE_WINDOW, , , [wnd_style], 0, real_header
.posok.common: .posok.common:
mcall 9, procinfo, -1 mcall SF_THREAD_INFO, procinfo, -1
mov eax, [procinfo.client_box.width] mov eax, [procinfo.client_box.width]
sub eax, [image_padding] sub eax, [image_padding]
sub eax, [image_padding] sub eax, [image_padding]
@ -859,7 +860,7 @@ draw_window:
mov ebx, [procinfo.client_box.width] mov ebx, [procinfo.client_box.width]
inc ebx inc ebx
mov ecx, [draw_y] mov ecx, [draw_y]
mcall 13, , , [bg_color] mcall SF_DRAW_RECT, , , [bg_color]
mov ecx, [procinfo.client_box.height] mov ecx, [procinfo.client_box.height]
inc ecx inc ecx
mov esi, [cur_frame] mov esi, [cur_frame]
@ -900,7 +901,7 @@ draw_window:
je .decorations_done je .decorations_done
mov ebx, [procinfo.client_box.width] mov ebx, [procinfo.client_box.width]
push ebx push ebx
mcall 38, , <30, 30>, 0x007F7F7F mcall SF_DRAW_LINE, , <30, 30>, 0x007F7F7F
mcall , <5 + 25 * 1, 5 + 25 * 1>, <0, 30> mcall , <5 + 25 * 1, 5 + 25 * 1>, <0, 30>
mcall , <10 + 25 * 3, 10 + 25 * 3> mcall , <10 + 25 * 3, 10 + 25 * 3>
mcall , <15 + 25 * 5, 15 + 25 * 5> mcall , <15 + 25 * 5, 15 + 25 * 5>
@ -910,7 +911,7 @@ draw_window:
imul ebx, 10001h imul ebx, 10001h
mcall mcall
mcall 8, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h mcall SF_DEFINE_BUTTON, <5 + 25 * 0, 20>, <5, 20>, 'opn'+40000000h
mcall , <10 + 25 * 1, 20>, , 'bck'+40000000h mcall , <10 + 25 * 1, 20>, , 'bck'+40000000h
mcall , <10 + 25 * 2, 20>, , 'fwd'+40000000h mcall , <10 + 25 * 2, 20>, , 'fwd'+40000000h
mcall , <15 + 25 * 3, 20>, , 'bgr'+40000000h mcall , <15 + 25 * 3, 20>, , 'bgr'+40000000h
@ -931,7 +932,7 @@ draw_window:
mov ebp, (numimages-1)*20 mov ebp, (numimages-1)*20
mcall 65, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette mcall SF_PUT_IMAGE_EXT, buttons+openbtn*20, <20, 20>, <5 + 25 * 0, 5>, 8, palette
mcall , buttons+backbtn*20, , <10 + 25 * 1, 5> mcall , buttons+backbtn*20, , <10 + 25 * 1, 5>
mcall , buttons+forwardbtn*20, , <10 + 25 * 2, 5> mcall , buttons+forwardbtn*20, , <10 + 25 * 2, 5>
mcall , buttons+bgrbtn*20, , <15 + 25 * 3, 5> mcall , buttons+bgrbtn*20, , <15 + 25 * 3, 5>
@ -957,7 +958,7 @@ draw_window:
call draw_cur_frame call draw_cur_frame
.nodraw: .nodraw:
mcall 12, 2 mcall SF_REDRAW, SSF_END_DRAW
ret ret