bzip2i386.inc 912 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. xor edx,edx
  28. lea ebx,[esi+Tbzip2_decode_stream.cftab]
  29. mov ecx,[esi+Tbzip2_decode_stream.tt_count]
  30. push esi
  31. push ebp
  32. mov esi,[esi+Tbzip2_decode_stream.tt]
  33. mov edi,esi
  34. lea ebp,[4*ecx+esi]
  35. jmp @a2
  36. @a1:
  37. movzx eax,byte [esi]
  38. mov ecx,[ebx+4*eax]
  39. inc dword [ebx+4*eax]
  40. or [edi+4*ecx],edx
  41. add edx,$100
  42. add esi,4
  43. @a2:
  44. cmp esi,ebp
  45. jne @a1
  46. pop ebp
  47. pop esi
  48. end ['eax','ebx','ecx','edx','edi'];