ASSERT & Error.Mod (version 8.0)
Posted: Mon Oct 25, 2021 8:31 am
Astrobe for RISC v8.0 provides a new module Error.Mod. It is used, for example, in Math.Mod:
That is, to provide an error code for ASSERT via a second parameter (which could be any integer value, does not have to be from Error.Mod).
However, I don't understand how that error code can be used at run-time. The code generated with or without the error code is the same (apart from different positions in the trap instruction):
System.Trap, where the error code could be used, is unchanged in v8.0.
What do I miss here? How can I use the error code given in the ASSERT statement?
Code: Select all
PROCEDURE Sqrt*(x: REAL): REAL;
(* ... *)
BEGIN
ASSERT(x >= 0.0, Error.input);
(* ... *)
END Sqrt;
However, I don't understand how that error code can be used at run-time. The code generated with or without the error code is the same (apart from different positions in the trap instruction):
Code: Select all
PROCEDURE Sqrt*(x: REAL): REAL;
(* ... *)
ASSERT(x >= 0.0, Error.input);
. 3 80E00004H LDW r0, sp, 4
. 4 D507EF7CH BL,LT r12 trap #7, pos: 2031
(* ... *)
Code: Select all
PROCEDURE Sqrt*(x: REAL): REAL;
(* ... *)
ASSERT(x >= 0.0);
. 3 80E00004H LDW r0, sp, 4
. 4 D507E27CH BL,LT r12 trap #7, pos: 2018
(* ... *)
What do I miss here? How can I use the error code given in the ASSERT statement?