System: Dell M1710 (2,16GHz Duo|2048mb RAM|GeForce Go 7950GTX 512mb)
IDE: Delphi 2006
Lib: none
I trying to make a function that stuffs a single into a string.
A single is 4 bytes, so i thought it would be jsut as easy as stuffing an integer into a string, but i get a compile error ("Operand Size Mismatch") when i try to move the single into EAX. but a single is 4 bytes, and EAX has place for 4 bytes, so why doesent it work? an integer is 4 bytes too, and it works fine.
[pascal]
function IntToRaw(I: Integer): String;
var
S: Array[0..3] of Char;
Int: Integer;
begin
asm
MOV EAX,I //<- Works fine
MOV S,EAX
end;
for int := 3 downto 0 do
Result:= Result+S[int];
end;
function SingleToRaw(SI: Single): String;
var
S: Array[0..3] of Char;
I: Integer;
begin
asm
MOV EAX,SI //<- Operand size mismatch
MOV S,EAX
end;
for I := 3 downto 0 do
Result:= Result+S[I];
end;
[/pascal]
Bookmarks