bzip2i386.inc 942 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {$ASMMODE intel}
  2. {$define HAVE_DETRANSFORM}
  3. {
  4. procedure Tbzip2_decode_stream.detransform;
  5. var a:cardinal;
  6. p,q,r:Pcardinal;
  7. begin
  8. a:=0;
  9. p:=@tt^[0];
  10. q:=p+tt_count;
  11. while p<>q do
  12. begin
  13. r:=@tt^[cftab[p^ and $ff]];
  14. inc(cftab[p^ and $ff]);
  15. r^:=r^ or a;
  16. inc(a,256);
  17. inc(p);
  18. end;
  19. end;
  20. }
  21. {const c:cardinal=0;
  22. procedure mcount;external name 'mcount';}
  23. procedure Tbzip2_decode_stream.detransform;assembler;
  24. asm
  25. { mov edx,offset c
  26. call mcount}
  27. push ebx
  28. push edi
  29. xor edx,edx
  30. lea ebx,[eax+Tbzip2_decode_stream.cftab]
  31. mov ecx,[eax+Tbzip2_decode_stream.tt_count]
  32. push esi
  33. push ebp
  34. mov esi,[eax+Tbzip2_decode_stream.tt]
  35. mov edi,esi
  36. lea ebp,[4*ecx+esi]
  37. jmp @a2
  38. @a1:
  39. movzx eax,byte [esi]
  40. mov ecx,[ebx+4*eax]
  41. inc dword [ebx+4*eax]
  42. or [edi+4*ecx],edx
  43. add edx,$100
  44. add esi,4
  45. @a2:
  46. cmp esi,ebp
  47. jne @a1
  48. pop ebp
  49. pop esi
  50. pop edi
  51. pop ebx
  52. end ['eax','ecx','edx'];