tw1157a.pp 963 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. { %cpu=i386 }
  2. { %FAIL }
  3. { Source provided for Free Pascal Bug Report 1157 }
  4. { Submitted by "Colin Goldie" on 2000-10-06 }
  5. { e-mail: [email protected] }
  6. {$mode tp}
  7. {$asmmode intel}
  8. { @Result in assembler functions where
  9. the function result is not on stack
  10. should be refused in Turbo Pascal mode }
  11. Function GetBLUEfromRGB( color : word ) : byte; assembler;
  12. asm
  13. mov cx,color
  14. and cx,0000000000011111b
  15. mov @Result,cl
  16. end;
  17. {
  18. Does something weird .. to the stack im guessing ... error 206 and 103
  19. errors occur 'File not open' ...
  20. However, if instead of using @Result , i chuck my return value into the
  21. accumulator register , everything thing works hunky dory.
  22. }
  23. Function GetBLUEfromRGB2( color : word ) : byte; assembler;
  24. asm
  25. mov cx,color
  26. and cx,0000000000011111b
  27. mov al,cl
  28. end;
  29. begin
  30. if GetBlueFromRGB2($fff)<>GetBlueFromRGB($fff) then
  31. begin
  32. Writeln('Error in assembler statement');
  33. Halt(1);
  34. end;
  35. end.