Subversion Repositories Kolibri OS

Rev

Rev 6673 | Go to most recent revision | 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.         jmp .end_t
  30.         .m_fmt db fmt,13,10,0
  31. align 4
  32.         .end_t:
  33. if p1 eq
  34.         stdcall dbg_print,0,.m_fmt
  35. else
  36.         stdcall str_format_dbg, buf_param,.m_fmt,p1
  37. end if
  38. }
  39.  
  40. include 'zlib.inc'
  41. include 'deflate.inc'
  42. include 'zutil.asm'
  43. ;include '../kfar_arc/crc.inc'
  44. include 'crc32.asm'
  45. include 'adler32.asm'
  46. include 'trees.asm'
  47. include 'deflate.asm'
  48.  
  49. align 4
  50. buf_param rb 80
  51.  
  52. align 4
  53. proc dbg_print, fun:dword, mes:dword
  54. pushad
  55.         mov eax,SF_BOARD
  56.         mov ebx,SSF_DEBUG_WRITE
  57.  
  58.         mov esi,[fun]
  59.         cmp esi,0
  60.         je .end0
  61.         @@:
  62.                 mov cl,byte[esi]
  63.                 int 0x40
  64.                 inc esi
  65.                 cmp byte[esi],0
  66.                 jne @b
  67.         mov cl,':'
  68.         int 0x40
  69.         mov cl,' '
  70.         int 0x40
  71.         .end0:
  72.         mov esi,[mes]
  73.         cmp esi,0
  74.         je .end_f
  75.         @@:
  76.                 mov cl,byte[esi]
  77.                 cmp cl,0
  78.                 je .end_f
  79.                 int 0x40
  80.                 inc esi
  81.                 jmp @b
  82.         .end_f:
  83. popad
  84.         ret
  85. endp
  86.  
  87. align 4
  88. proc str_format_dbg, buf:dword, fmt:dword, p1:dword
  89. pushad
  90.         mov esi,[fmt]
  91.         mov edi,[buf]
  92.         mov ecx,80-1
  93.         .cycle0:
  94.                 lodsb
  95.                 cmp al,'%'
  96.                 jne .no_param
  97.                         lodsb
  98.                         dec ecx
  99.                         cmp al,0
  100.                         je .cycle0end
  101.                         cmp al,'d'
  102.                         je @f
  103.                         cmp al,'u'
  104.                         je @f
  105.                         cmp al,'l'
  106.                         je .end1
  107.                                 jmp .end0
  108.                         .end1: ;%lu %lx
  109.                                 lodsb
  110.                                 dec ecx
  111.                                 cmp al,'u'
  112.                                 jne .end0
  113.                         @@:
  114.                                 mov eax,[p1]
  115.                                 stdcall convert_int_to_str,ecx
  116.                                 xor al,al
  117.                                 repne scasb
  118.                                 dec edi
  119.                         .end0:
  120.                         loop .cycle0
  121.                 .no_param:
  122.                 stosb
  123.                 cmp al,0
  124.                 je .cycle0end
  125.                 loop .cycle0
  126.         .cycle0end:
  127.         xor al,al
  128.         stosb
  129.         stdcall dbg_print,0,[buf]
  130. popad
  131.         ret
  132. endp
  133.  
  134. ;input:
  135. ; eax - число
  136. ; edi - буфер для строки
  137. ; len - длинна буфера
  138. ;output:
  139. align 4
  140. proc convert_int_to_str, len:dword
  141. pushad
  142.         mov esi,[len]
  143.         add esi,edi
  144.         dec esi
  145.         call .str
  146. popad
  147.         ret
  148. endp
  149.  
  150. align 4
  151. .str:
  152.         mov ecx,0x0a
  153.         cmp eax,ecx
  154.         jb @f
  155.                 xor edx,edx
  156.                 div ecx
  157.                 push edx
  158.                 call .str
  159.                 pop eax
  160.         @@:
  161.         cmp edi,esi
  162.         jge @f
  163.                 or al,0x30
  164.                 stosb
  165.                 mov byte[edi],0
  166.         @@:
  167.         ret
  168.  
  169.