Discussion:
LONGREALs and Assembler code
(too old to reply)
Dewet Diener
2003-10-15 13:16:25 UTC
Permalink
Hi there

I'm hitting my head against a wall; I'm trying to access LONGREALs in a
assembler function, but I keep on hitting error 501: addressing mode
not allowed. This happens when I remove the "VAR" keyword from a
LONGREAL parameter in the function definition.

The following works as expected:
PROCEDURE E*(VAR r: LONGREAL);
CODE {SYSTEM.i386}
MOVE EAX, r[EBP]
END E;

Replacing the first line as follows stops compilation with error 501:
PROCEDURE E*(r: LONGREAL);

Could someone please point me in the right direction?

Thanks,
Dewet
Pieter Muller
2003-10-18 09:35:15 UTC
Permalink
Post by Dewet Diener
I'm hitting my head against a wall; I'm trying to access LONGREALs in a
assembler function, but I keep on hitting error 501: addressing mode
not allowed. This happens when I remove the "VAR" keyword from a
LONGREAL parameter in the function definition.
PROCEDURE E*(VAR r: LONGREAL);
CODE {SYSTEM.i386}
MOVE EAX, r[EBP]
END E;
PROCEDURE E*(r: LONGREAL);
Could someone please point me in the right direction?
LONGREAL is a 64-bit type and EAX is a 32-bit register. With VAR
it works because then r is a pass-by-reference parameter, i.e. a
32-bit address of the 64-bit value.

It depends a bit what you want to do with the 64-bit value.
Perhaps you'll want to load it using a floating point instruction.

-- Pieter

Loading...