2016-10-26 21:35:35 +02:00
|
|
|
|
use32 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 32-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ०<><E0A5A6> <20><>ᥬ<EFBFBD><E1A5AC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
org 0x0 ; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
db 'MENUET01'
|
|
|
|
|
dd 1,START,I_END,MEM,STACKTOP,0,cur_dir_path
|
|
|
|
|
|
|
|
|
|
include '../../../../proc32.inc'
|
|
|
|
|
include '../../../../macros.inc'
|
|
|
|
|
include '../../../../KOSfuncs.inc'
|
|
|
|
|
include '../../../../develop/libraries/box_lib/load_lib.mac'
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
mcall SF_REDRAW, SSF_BEGIN_DRAW ; <20>㭪<EFBFBD><E3ADAA><EFBFBD> 12: ᮮ<><E1AEAE><EFBFBD><EFBFBD><EFBFBD> <20><> <20> <20><>砫<EFBFBD> <20><><EFBFBD><EFBFBD>ᮢ<EFBFBD><E1AEA2>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
mcall SF_DRAW_NUMBER, (1 shl 16)+1, strategy, <90,10>, 0
|
|
|
|
|
mcall , (5 shl 16)+1, m0size, <90,20>
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
mcall SF_REDRAW, SSF_END_DRAW ; <20>㭪<EFBFBD><E3ADAA><EFBFBD> 12.2, <20><><EFBFBD><EFBFBD><EFBFBD>稫<EFBFBD> <20><>ᮢ<EFBFBD><E1AEA2><EFBFBD>
|
|
|
|
|
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]
|
|
|
|
|
mov word[eax+z_stream.avail_in],cx ;ࠧ<><E0A0A7><EFBFBD> ᦨ<><E1A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
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-10-31 10:19:36 +01:00
|
|
|
|
mov word[eax+z_stream.avail_out],1024 ;ࠧ<><E0A0A7><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> ᦠ<><E1A6A0><EFBFBD> (<28><><EFBFBD>ᨬ<EFBFBD><E1A8AC> 16 <20><>)
|
|
|
|
|
|
|
|
|
|
;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>塞 crc <20><><EFBFBD> ᦨ<><E1A6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
stdcall [calc_crc32], 0,m0,ecx
|
|
|
|
|
mov edx,eax
|
2016-10-26 21:35:35 +02:00
|
|
|
|
|
|
|
|
|
;call print_z_struct
|
|
|
|
|
|
|
|
|
|
stdcall [deflate], my_strm, Z_FINISH ;Z_NO_FLUSH
|
|
|
|
|
|
|
|
|
|
;call print_z_struct
|
|
|
|
|
|
2016-10-31 10:19:36 +01:00
|
|
|
|
;ࠧ<><E0A0A7><EFBFBD> ᦠ<><E1A6A0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: 1024-word[my_strm.avail_out]
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov ecx,1024
|
2016-10-31 10:19:36 +01:00
|
|
|
|
sub cx,word[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>⠢<EFBFBD><E2A0A2> crc <20><> ᦠ<><E1A6A0><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
mov ecx,[m1size]
|
|
|
|
|
sub ecx,4
|
|
|
|
|
add ecx,m1
|
|
|
|
|
mov [ecx],edx
|
|
|
|
|
|
|
|
|
|
;<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>
|
2016-10-26 21:35:35 +02:00
|
|
|
|
mov ecx,[m0size] ;;; ???
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
sc system_colors
|
|
|
|
|
|
|
|
|
|
title db 'Zlib test, press on [Up], [Down], [Left], [Right]',0
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
import_archiver:
|
|
|
|
|
deflate_unpack dd sz_deflate_unpack
|
|
|
|
|
dd 0,0
|
|
|
|
|
sz_deflate_unpack db 'deflate_unpack',0
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
import_zlib:
|
|
|
|
|
; dd sz_lib_init
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
; sz_lib_init db 'lib_init',0
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
system_dir_1 db '/sys/lib/'
|
|
|
|
|
lib_name_1 db 'zlib.obj',0
|
|
|
|
|
|
|
|
|
|
err_message_found_lib0 db 'Sorry I cannot load library archiver.obj',0
|
|
|
|
|
err_message_found_lib1 db 'Sorry I cannot load library zlib.obj',0
|
|
|
|
|
head_f_i:
|
|
|
|
|
head_f_l db 'System error',0
|
|
|
|
|
err_message_import0 db 'Error on load import library archiver.obj',0
|
|
|
|
|
err_message_import1 db 'Error on load import library zlib.obj',0
|
|
|
|
|
|
|
|
|
|
l_libs_start:
|
|
|
|
|
lib0 l_libs lib_name_0, cur_dir_path, library_path, system_dir_0,\
|
|
|
|
|
err_message_found_lib0, head_f_l, import_archiver,err_message_import0, head_f_i
|
|
|
|
|
lib1 l_libs lib_name_1, cur_dir_path, library_path, system_dir_1,\
|
|
|
|
|
err_message_found_lib1, head_f_l, import_zlib, err_message_import1, head_f_i
|
|
|
|
|
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:
|