For x86, EAX register can be interpreted as EDX:EAX for LONGINT.Josef Templ wrote:Let us look at the SYSTEM.VAL(LONGINT, int reg) TRAP in the center.
A single register cannot be re-interpreted as a pair of registers.
SYSTEM module services is a low level unsafe services and programmer should clearly understand what he is doing. I think that making safety checks for SYSTEM module is unnecessary. Reinterpreting to type larger than source can be useful in some cases, for example:
Code: Select all
MODULE A;
IMPORT S := SYSTEM, W := WinApi, Log := StdLog;
PROCEDURE WritePoint (IN pt: W.POINT);
BEGIN
Log.Int(pt.x); Log.String(", "); Log.Int(pt.y); Log.Ln;
END WritePoint;
PROCEDURE Do* (x, y: INTEGER);
BEGIN
WritePoint(S.VAL(W.POINT, x));
END Do;
END A.
(!)"A.Do(434, 34434)"