2
0

tbug1066b.pp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. {----------------cut here----------------}
  2. {$asmmode intel}
  3. {$inline on}
  4. var
  5. somevar:longint;
  6. procedure wastememory(x,y,color:longint);assembler;inline;
  7. asm
  8. mov edi,x
  9. mov eax,y
  10. cmp edi,0
  11. jl @@wastememoryend
  12. cmp eax,0
  13. jl @@wastememoryend
  14. cmp edi,1023
  15. jg @@wastememoryend
  16. cmp eax,767
  17. jg @@wastememoryend
  18. shl eax,12
  19. mov ebx,color
  20. add eax,somevar
  21. mov [eax+edi*4],ebx
  22. @@wastememoryend:
  23. end ['eax','ebx','edi'];
  24. procedure wastememory2(y,x1,x2,color:longint);assembler;inline;
  25. asm
  26. mov edi,x1
  27. mov ecx,x2
  28. mov eax,y
  29. cmp edi,ecx
  30. jle @@wastememory2dirok
  31. xchg edi,ecx
  32. @@wastememory2dirok:
  33. cmp eax,0
  34. jl @@endwastememory2
  35. cmp eax,767
  36. jg @@endwastememory2
  37. cmp ecx,0
  38. jl @@endwastememory2
  39. cmp edi,1023
  40. jg @@endwastememory2
  41. cmp edi,0
  42. jge @@wastememory2x1ok
  43. mov edi,0
  44. @@wastememory2x1ok:
  45. cmp ecx,1023
  46. jle @@wastememory2x2ok
  47. mov ecx,1023
  48. @@wastememory2x2ok:
  49. sub ecx,edi
  50. shl eax,12
  51. inc ecx
  52. add eax,somevar
  53. cld
  54. lea edi,[eax+4*edi]
  55. mov eax,color
  56. rep stosd
  57. @@endwastememory2:
  58. end ['eax','ecx','edi'];
  59. function str(w:word):string;
  60. var tmp:string;
  61. begin
  62. system.str(w,tmp);
  63. str:=tmp;
  64. end;
  65. function str(l:longint):string;
  66. var tmp:string;
  67. begin
  68. system.str(l,tmp);
  69. str:=tmp;
  70. end;
  71. procedure testcompiler(x0,y0,r,color:longint);
  72. var x,y:longint;
  73. begin
  74. for x:=0 to trunc(r*(sqrt(2)/2))+1 do
  75. begin
  76. y:=round(sqrt(r*r-x*x));
  77. wastememory(x0+x,y0+y,color);
  78. wastememory(x0-x,y0+y,color);
  79. wastememory(x0+x,y0-y,color);
  80. wastememory(x0-x,y0-y,color);
  81. wastememory(x0+y,y0+x,color);
  82. wastememory(x0-y,y0+x,color);
  83. wastememory(x0+y,y0-x,color);
  84. wastememory(x0-y,y0-x,color);
  85. end;
  86. end;
  87. procedure testcompiler2(x0,y0,r,color:longint);
  88. var x,y:longint;
  89. begin
  90. for x:=0 to trunc(r*(sqrt(2)/2))+1 do
  91. begin
  92. y:=round(sqrt(r*r-x*x));
  93. wastememory2(y0+y,x0-x,x0+x,color);
  94. wastememory2(y0-y,x0-x,x0+x,color);
  95. wastememory2(y0+x,x0-y,x0+y,color);
  96. wastememory2(y0-x,x0-y,x0+y,color);
  97. end;
  98. end;
  99. begin
  100. end.