2017-03-04 20:30:27 +01:00
|
|
|
|
use32
|
|
|
|
|
org 0
|
2016-10-26 21:35:35 +02:00
|
|
|
|
db 'MENUET01'
|
|
|
|
|
dd 1,START,I_END,MEM,STACKTOP,0,cur_dir_path
|
|
|
|
|
|
|
|
|
|
include '../../../../proc32.inc'
|
|
|
|
|
include '../../../../macros.inc'
|
|
|
|
|
include '../../../../KOSfuncs.inc'
|
2020-11-28 18:05:52 +01:00
|
|
|
|
include '../../../../load_lib.mac'
|
2016-10-26 21:35:35 +02:00
|
|
|
|
|
|
|
|
|
include 'deflate.inc'
|
|
|
|
|
include 'debug.inc'
|
|
|
|
|
include 'zlib.inc'
|
|
|
|
|
|
|
|
|
|
@use_library
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
m0size dd 90 ;ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 㯠<><E3AFA0><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m1size dd 1024 ;ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 㯠<><E3AFA0><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m2size dd 0 ;ࠧ<><E0A0A7><EFBFBD> <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
m0: ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 㯠<><E3AFA0><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
file 'zlib.txt'
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
m1 rb 1024 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> 㯠<><E3AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
m2 dd 0 ;㪠<><E3AAA0>⥫<EFBFBD> <20><> <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
buf rb 1024 ;<3B><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20>뢮<EFBFBD><EBA2AE> ᦠ<><E1A6A0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
strategy dd Z_DEFAULT_STRATEGY ;<3B><><EFBFBD><EFBFBD>⥣<EFBFBD><E2A5A3> ᦠ<><E1A6A0><EFBFBD>
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
START:
|
|
|
|
|
load_libraries l_libs_start,load_lib_end
|
|
|
|
|
mov ebp,lib0
|
|
|
|
|
.test_lib_open:
|
|
|
|
|
cmp dword [ebp+ll_struc_size-4],0
|
|
|
|
|
jz @f
|
|
|
|
|
mcall SF_TERMINATE_PROCESS ;exit not correct
|
|
|
|
|
@@:
|
|
|
|
|
add ebp,ll_struc_size
|
|
|
|
|
cmp ebp,load_lib_end
|
|
|
|
|
jl .test_lib_open
|
|
|
|
|
|
|
|
|
|
; mcall SF_SYS_MISC, SSF_HEAP_INIT
|
|
|
|
|
|
|
|
|
|
call test_code
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
red: ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮢ<EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
call draw_window ; <20><><EFBFBD>뢠<EFBFBD><EBA2A0> <20><><EFBFBD>楤<EFBFBD><E6A5A4><EFBFBD> <20><><EFBFBD><EFBFBD>ᮢ<EFBFBD><E1AEA2> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
still:
|
|
|
|
|
mcall SF_WAIT_EVENT
|
|
|
|
|
cmp eax,1 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ᮢ<EFBFBD><E1AEA2><EFBFBD> <20><><EFBFBD><EFBFBD> ?
|
|
|
|
|
je red
|
|
|
|
|
cmp eax,2 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
|
|
|
|
|
je key
|
|
|
|
|
cmp eax,3 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ?
|
|
|
|
|
je button
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
key:
|
|
|
|
|
mcall SF_GET_KEY
|
|
|
|
|
|
|
|
|
|
cmp ah,178 ;Up
|
|
|
|
|
jne @f
|
|
|
|
|
cmp dword[strategy],0
|
|
|
|
|
jle @f
|
|
|
|
|
dec dword[strategy]
|
|
|
|
|
call test_code
|
|
|
|
|
call draw_window
|
|
|
|
|
@@:
|
|
|
|
|
cmp ah,177 ;Down
|
|
|
|
|
jne @f
|
|
|
|
|
cmp dword[strategy],4
|
|
|
|
|
jge @f
|
|
|
|
|
inc dword[strategy]
|
|
|
|
|
call test_code
|
|
|
|
|
call draw_window
|
|
|
|
|
@@:
|
|
|
|
|
cmp ah,176 ;Left
|
|
|
|
|
jne @f
|
|
|
|
|
cmp dword[m0size],8
|
|
|
|
|
jl @f
|
|
|
|
|
dec dword[m0size]
|
|
|
|
|
call test_code
|
|
|
|
|
call draw_window
|
|
|
|
|
@@:
|
|
|
|
|
cmp ah,179 ;Right
|
|
|
|
|
jne @f
|
|
|
|
|
inc dword[m0size]
|
|
|
|
|
call test_code
|
|
|
|
|
call draw_window
|
|
|
|
|
@@:
|
|
|
|
|
jmp still ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><>砫<EFBFBD> 横<><E6A8AA>
|
|
|
|
|
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
align 4
|
|
|
|
|
button:
|
|
|
|
|
mcall SF_GET_BUTTON
|
|
|
|
|
|
|
|
|
|
cmp ah,1
|
|
|
|
|
jne still
|
|
|
|
|
|
2016-10-31 10:19:36 +01:00
|
|
|
|
.exit: ; <20><><EFBFBD><EFBFBD><EFBFBD> <20>ணࠬ<E0AEA3><E0A0AC>
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mcall SF_SYS_MISC,SSF_MEM_FREE,[m2]
|
2016-10-31 10:19:36 +01:00
|
|
|
|
mcall SF_TERMINATE_PROCESS
|
2016-10-26 21:35:35 +02:00
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
draw_window:
|
2016-12-20 13:12:55 +01:00
|
|
|
|
mcall SF_REDRAW, SSF_BEGIN_DRAW
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mcall SF_STYLE_SETTINGS, SSF_GET_COLORS, sc,sizeof.system_colors
|
|
|
|
|
mov edx, [sc.work] ; 梥<> 䮭<>
|
|
|
|
|
or edx, 0x33000000 ; <20> ⨯ <20><><EFBFBD><EFBFBD> 3
|
|
|
|
|
mcall SF_CREATE_WINDOW, <50,600>, <50,180>, , ,title
|
|
|
|
|
|
|
|
|
|
cStr edx,'Strategy:'
|
|
|
|
|
mcall SF_DRAW_TEXT, <10,10>,0x40f0,,9
|
|
|
|
|
cStr edx,'Input size:'
|
|
|
|
|
mcall , <10,20>,,,11
|
|
|
|
|
cStr edx,'Compr. size:'
|
|
|
|
|
mcall , <10,30>,,,12
|
|
|
|
|
cStr edx,'Outp. size:'
|
|
|
|
|
mcall , <10,120>,,,11
|
|
|
|
|
|
2016-12-20 13:12:55 +01:00
|
|
|
|
mov edx,[strategy]
|
|
|
|
|
imul edx,12
|
|
|
|
|
add edx,capt_strateg
|
|
|
|
|
mcall , <90,10>,0,,12
|
|
|
|
|
|
|
|
|
|
mcall SF_DRAW_NUMBER, (5 shl 16)+1, m0size, <90,20>
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mcall , (5 shl 16)+1, m1size, <90,30>
|
|
|
|
|
mcall , (5 shl 16)+1, m2size, <90,120>
|
|
|
|
|
;mov ecx,(1 shl 31)
|
|
|
|
|
mov esi,[m2size]
|
|
|
|
|
cmp esi,95
|
|
|
|
|
jle @f
|
|
|
|
|
mov esi,95
|
|
|
|
|
@@:
|
|
|
|
|
mcall SF_DRAW_TEXT, <10,130>, 0, [m2]
|
|
|
|
|
|
|
|
|
|
mov esi,7
|
|
|
|
|
mov ebx,(10 shl 16)+45 ;(x shl 16)+y
|
|
|
|
|
mov edx,buf
|
|
|
|
|
.cycle1: ;rows
|
|
|
|
|
mcall SF_DRAW_TEXT,, (1 shl 31)
|
|
|
|
|
add ebx,10
|
|
|
|
|
add edx,32*3
|
|
|
|
|
dec esi
|
|
|
|
|
jnz .cycle1
|
|
|
|
|
|
2016-12-20 13:12:55 +01:00
|
|
|
|
mcall SF_REDRAW, SSF_END_DRAW
|
2016-10-26 21:35:35 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
test_code:
|
|
|
|
|
stdcall [deflateInit2], my_strm,\
|
|
|
|
|
-1, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, [strategy]
|
|
|
|
|
;<3B><><EFBFBD><EFBFBD>⥣<EFBFBD><E2A5A3>:
|
|
|
|
|
; Z_DEFAULT_STRATEGY, Z_FILTERED, Z_HUFFMAN_ONLY, Z_RLE, Z_FIXED
|
|
|
|
|
|
|
|
|
|
mov eax,my_strm
|
|
|
|
|
mov [eax+z_stream.next_in],m0 ;<3B><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᦠ<><E1A6A0><EFBFBD>
|
|
|
|
|
mov ecx,[m0size]
|
2016-11-11 17:57:56 +01:00
|
|
|
|
mov [eax+z_stream.avail_in],ecx ;ࠧ<><E0A0A7><EFBFBD> ᦨ<><E1A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov [eax+z_stream.next_out],m1 ;<3B><>⠭<EFBFBD><E2A0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᦠ<><E1A6A0><EFBFBD>
|
2016-12-14 15:54:51 +01:00
|
|
|
|
mov dword[eax+z_stream.avail_out],1024 ;ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᦠ<><E1A6A0><EFBFBD> (<28><><EFBFBD>ᨬ<EFBFBD><E1A8AC> 16 <20><>)
|
2016-10-31 10:19:36 +01:00
|
|
|
|
|
2017-03-04 20:17:49 +01:00
|
|
|
|
stdcall [deflate], my_strm, Z_FINISH
|
2016-10-26 21:35:35 +02:00
|
|
|
|
|
2016-12-14 15:54:51 +01:00
|
|
|
|
;ࠧ<><E0A0A7><EFBFBD> ᦠ<><E1A6A0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1024-[my_strm.avail_out]
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov ecx,1024
|
2016-12-14 15:54:51 +01:00
|
|
|
|
sub ecx,[my_strm.avail_out]
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov [m1size],ecx
|
|
|
|
|
|
2016-10-31 10:19:36 +01:00
|
|
|
|
;assert(ret != Z_STREAM_ERROR)
|
|
|
|
|
;while (strm.avail_out == 0)
|
2016-10-26 21:35:35 +02:00
|
|
|
|
|
2016-10-31 10:19:36 +01:00
|
|
|
|
;<3B><>ନ<E0ACA8><E0AEA2><EFBFBD><EFBFBD> ⥪<><E2A5AA><EFBFBD> <20><><EFBFBD> <20>⮡ࠦ<E2AEA1><E0A0A6><EFBFBD><EFBFBD> ᦠ<><E1A6A0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
;<3B> 16-<2D><>筮<EFBFBD> <20><><EFBFBD><EFBFBD>, <20>㦭<EFBFBD> ⮫쪮 <20><><EFBFBD> <20>ਬ<EFBFBD><E0A8AC><EFBFBD>
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov ebx,[m1size]
|
|
|
|
|
mov esi,m1
|
|
|
|
|
mov edi,buf
|
|
|
|
|
mov edx,7
|
2016-10-31 10:19:36 +01:00
|
|
|
|
align 4
|
2016-10-26 21:35:35 +02:00
|
|
|
|
.cycle1: ;rows
|
|
|
|
|
mov ecx,32
|
2016-10-31 10:19:36 +01:00
|
|
|
|
align 4
|
2016-10-26 21:35:35 +02:00
|
|
|
|
.cycle0: ;cols
|
|
|
|
|
stdcall hex_in_str, edi,[esi],2
|
|
|
|
|
add edi,2
|
|
|
|
|
inc esi
|
|
|
|
|
mov byte[edi],' ' ;format space
|
|
|
|
|
dec ebx
|
|
|
|
|
jz .cycle1end ;if end file
|
|
|
|
|
inc edi
|
|
|
|
|
loop .cycle0
|
|
|
|
|
mov byte[edi-1],0
|
|
|
|
|
dec edx
|
|
|
|
|
jnz .cycle1
|
|
|
|
|
.cycle1end:
|
|
|
|
|
mov byte[edi],0
|
|
|
|
|
|
2016-10-31 10:19:36 +01:00
|
|
|
|
;㤠<><E3A4A0><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> ࠭<><E0A0AD> <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>묨 <20><><EFBFBD><EFBFBD>묨
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mcall SF_SYS_MISC,SSF_MEM_FREE,[m2]
|
|
|
|
|
|
|
|
|
|
mov eax,[m1size]
|
|
|
|
|
sub eax,2 ;;; 2? or 6?
|
|
|
|
|
mov [m2size],eax
|
|
|
|
|
mov eax,m1
|
|
|
|
|
add eax,2
|
|
|
|
|
stdcall [deflate_unpack],eax,m2size
|
2016-10-31 10:19:36 +01:00
|
|
|
|
mov [m2],eax ;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><>ᯠ<EFBFBD><E1AFA0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-03-04 20:30:27 +01:00
|
|
|
|
mov ecx,[m0size] ;;; ???
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov [m2size],ecx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
proc print_z_struct uses eax ebx
|
|
|
|
|
mov eax,my_strm
|
|
|
|
|
mov ebx,[eax+z_stream.state]
|
|
|
|
|
stdcall debug_fields,eax,sv_2
|
|
|
|
|
stdcall debug_fields,ebx,sv_3
|
|
|
|
|
ret
|
|
|
|
|
endp
|
|
|
|
|
|
2016-12-20 13:12:55 +01:00
|
|
|
|
align 4
|
2016-10-26 21:35:35 +02:00
|
|
|
|
sc system_colors
|
2016-12-20 13:12:55 +01:00
|
|
|
|
align 4
|
2016-10-26 21:35:35 +02:00
|
|
|
|
title db 'Zlib test, press on [Up], [Down], [Left], [Right]',0
|
|
|
|
|
|
2016-12-20 13:12:55 +01:00
|
|
|
|
align 4
|
|
|
|
|
capt_strateg db '0) Default ',0
|
|
|
|
|
db '1) Filtered',0
|
|
|
|
|
db '2) Huffman ',0
|
|
|
|
|
db '3) Rle ',0
|
|
|
|
|
db '4) Fixed ',0
|
|
|
|
|
|
2016-10-26 21:35:35 +02:00
|
|
|
|
align 4
|
|
|
|
|
import_archiver:
|
|
|
|
|
deflate_unpack dd sz_deflate_unpack
|
|
|
|
|
deflateInit dd sz_deflateInit
|
|
|
|
|
deflateInit2 dd sz_deflateInit2
|
|
|
|
|
deflateReset dd sz_deflateReset
|
|
|
|
|
deflate dd sz_deflate
|
|
|
|
|
deflateEnd dd sz_deflateEnd
|
2016-10-31 10:19:36 +01:00
|
|
|
|
calc_crc32 dd sz_calc_crc32
|
2016-10-26 21:35:35 +02:00
|
|
|
|
dd 0,0
|
2016-11-04 20:29:50 +01:00
|
|
|
|
sz_deflate_unpack db 'deflate_unpack',0
|
2016-10-26 21:35:35 +02:00
|
|
|
|
sz_deflateInit db 'deflateInit',0
|
|
|
|
|
sz_deflateInit2 db 'deflateInit2',0
|
|
|
|
|
sz_deflateReset db 'deflateReset',0
|
|
|
|
|
sz_deflate db 'deflate',0
|
|
|
|
|
sz_deflateEnd db 'deflateEnd',0
|
2016-10-31 10:19:36 +01:00
|
|
|
|
sz_calc_crc32 db 'calc_crc32',0
|
|
|
|
|
|
2016-10-26 21:35:35 +02:00
|
|
|
|
;--------------------------------------------------
|
|
|
|
|
system_dir_0 db '/sys/lib/'
|
|
|
|
|
lib_name_0 db 'archiver.obj',0
|
|
|
|
|
|
|
|
|
|
l_libs_start:
|
2020-11-28 18:05:52 +01:00
|
|
|
|
lib0 l_libs lib_name_0, library_path, system_dir_0, import_archiver
|
2016-10-26 21:35:35 +02:00
|
|
|
|
load_lib_end:
|
|
|
|
|
;---------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
align 16
|
|
|
|
|
I_END:
|
|
|
|
|
my_strm z_stream
|
|
|
|
|
rd 4096
|
|
|
|
|
align 16
|
|
|
|
|
STACKTOP:
|
|
|
|
|
cur_dir_path:
|
|
|
|
|
rb 4096
|
|
|
|
|
library_path:
|
|
|
|
|
rb 4096
|
|
|
|
|
MEM:
|