SYSTEM.LDREG
Posted: Fri Feb 04, 2022 9:07 am
The Astrobe RISC5 compiler creates erroneous code in the following case:
The procedure compiles without error message, but the code created is:
Evidently, the target register number must be a constant, as with SYSTEM.REG, where the compiler does complain. As I understand it, r4 is targeted because the stack-local address of i is 4 (SP + 4).
I am completely out of my depth here, but I think the corresponding case in ORP.StandProc should read:
Code: Select all
PROCEDURE P;
VAR i: INTEGER;
BEGIN
i := 0;
SYSTEM.LDREG(i, 13)
END P;
Code: Select all
4400000DH MOV r4, r0, 13
I am completely out of my depth here, but I think the corresponding case in ORP.StandProc should read:
Code: Select all
IF (npar = nap) OR ((pno IN {0, 1, 4, 10, 11}) & (nap = (npar + 1))) OR ((pno = 9) & (nap = 4)) THEN
CASE pno OF
(* ... *)
| 14: (* LDREG *)
CheckConst(x); CheckInt(x); ORG.LDREG(x, y)
END
END