Subversion Repositories Kolibri OS

Rev

Rev 6799 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. include '../../../../proc32.inc'
  3. include '../../../../macros.inc'
  4. include '../../../../KOSfuncs.inc'
  5.  
  6. FASTEST equ 0
  7. GEN_TREES_H equ 0
  8. DEBUG equ 0
  9. DYNAMIC_CRC_TABLE equ 1
  10. Z_SOLO equ 0
  11.  
  12. ; define NO_GZIP when compiling if you want to disable gzip header and
  13. ; trailer creation by deflate().  NO_GZIP would be used to avoid linking in
  14. ; the crc code when it is not needed.  For shared libraries, gzip encoding
  15. ; should be left enabled.
  16. GZIP equ 1
  17.  
  18. macro zlib_debug fmt,p1
  19. {
  20. if DEBUG eq 1
  21.         zlib_assert fmt,p1
  22. end if
  23. }
  24.  
  25. macro zlib_assert fmt,p1
  26. {
  27.         local .end_t
  28.         local .m_fmt
  29. pushf
  30.         jmp .end_t
  31.         .m_fmt db fmt,13,10,0
  32. align 4
  33.         .end_t:
  34. if p1 eq
  35.         stdcall dbg_print,0,.m_fmt
  36. else
  37.         stdcall str_format_dbg, buf_param,.m_fmt,p1
  38. end if
  39. popf
  40. }
  41.  
  42. include 'zlib.inc'
  43. include 'deflate.inc'
  44. include 'zutil.asm'
  45. ;include '../kfar_arc/crc.inc'
  46. include 'crc32.asm'
  47. include 'adler32.asm'
  48. include 'trees.asm'
  49. include 'deflate.asm'
  50.  
  51. align 4
  52. buf_param rb 80
  53.  
  54. align 4
  55. proc dbg_print, fun:dword, mes:dword
  56. pushad
  57.         mov eax,SF_BOARD
  58.         mov ebx,SSF_DEBUG_WRITE
  59.  
  60.         mov esi,[fun]
  61.         cmp esi,0
  62.         je .end0
  63.         @@:
  64.                 mov cl,byte[esi]
  65.                 int 0x40
  66.                 inc esi
  67.                 cmp byte[esi],0
  68.                 jne @b
  69.         mov cl,':'
  70.         int 0x40
  71.         mov cl,' '
  72.         int 0x40
  73.         .end0:
  74.         mov esi,[mes]
  75.         cmp esi,0
  76.         je .end_f
  77.         @@:
  78.                 mov cl,byte[esi]
  79.                 cmp cl,0
  80.                 je .end_f
  81.                 int 0x40
  82.                 inc esi
  83.                 jmp @b
  84.         .end_f:
  85. popad
  86.         ret
  87. endp
  88.  
  89. align 4
  90. proc str_format_dbg, buf:dword, fmt:dword, p1:dword
  91. pushad
  92.         mov esi,[fmt]
  93.         mov edi,[buf]
  94.         mov ecx,80-1
  95.         .cycle0:
  96.                 lodsb
  97.                 cmp al,'%'
  98.                 jne .no_param
  99.                         lodsb
  100.                         dec ecx
  101.                         cmp al,0
  102.                         je .cycle0end
  103.                         cmp al,'d'
  104.                         je @f
  105.                         cmp al,'u'
  106.                         je @f
  107.                         cmp al,'l'
  108.                         je .end1
  109.                                 jmp .end0
  110.                         .end1: ;%lu %lx
  111.                                 lodsb
  112.                                 dec ecx
  113.                                 cmp al,'u'
  114.                                 jne .end0
  115.                         @@:
  116.                                 mov eax,[p1]
  117.                                 stdcall convert_int_to_str,ecx
  118.                                 xor al,al
  119.                                 repne scasb
  120.                                 dec edi
  121.                         .end0:
  122.                         loop .cycle0
  123.                 .no_param:
  124.                 stosb
  125.                 cmp al,0
  126.                 je .cycle0end
  127.                 loop .cycle0
  128.         .cycle0end:
  129.         xor al,al
  130.         stosb
  131.         stdcall dbg_print,0,[buf]
  132. popad
  133.         ret
  134. endp
  135.  
  136. ;input:
  137. ; eax - число
  138. ; edi - буфер для строки
  139. ; len - длинна буфера
  140. ;output:
  141. align 4
  142. proc convert_int_to_str, len:dword
  143. pushad
  144.         mov esi,[len]
  145.         add esi,edi
  146.         dec esi
  147.         call .str
  148. popad
  149.         ret
  150. endp
  151.  
  152. align 4
  153. .str:
  154.         mov ecx,0x0a
  155.         cmp eax,ecx
  156.         jb @f
  157.                 xor edx,edx
  158.                 div ecx
  159.                 push edx
  160.                 call .str
  161.                 pop eax
  162.         @@:
  163.         cmp edi,esi
  164.         jge @f
  165.                 or al,0x30
  166.                 stosb
  167.                 mov byte[edi],0
  168.         @@:
  169.         ret
  170.  
  171.