tb0105.pp 925 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. { %CPU=i386 }
  2. { %OPT= -Aas }
  3. { Old file: tbs0124.pp }
  4. { Asm, problem with -Rintel switch and indexing OK 0.99.11 (PM/PFV) }
  5. { this problem comes from the fact that
  6. L is a static variable, not a local one !!
  7. but the static variable symtable is the localst of the
  8. main procedure (PM)
  9. It must be checked if we are at main level or not !! }
  10. var
  11. l : longint;
  12. procedure error;
  13. begin
  14. Writeln('Error in tbs0124');
  15. Halt(1);
  16. end;
  17. begin
  18. {$asmmode direct}
  19. asm
  20. movl $5,l
  21. end;
  22. if l<>5 then error;
  23. {$asmmode att}
  24. asm
  25. movl l,%eax
  26. addl $2,%eax
  27. movl %eax,l
  28. end;
  29. if l<>7 then error;
  30. {$asmmode intel}
  31. { problem here is that l is replaced by BP-offset }
  32. { relative to stack, and the parser thinks all wrong }
  33. { because of this. }
  34. asm
  35. mov eax,l
  36. add eax,5
  37. mov l,eax
  38. end;
  39. if l<>12 then error;
  40. Writeln('tbs0124 OK');
  41. end.