tw1157b.pp 947 B

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