
  PROCEDURE [INLINE] i#mtr_restore_traps (old_te: 0 .. 3);
?? PUSH (LISTEXT := ON) ??

{  The purpose of this procedure is to restore the trap enable flag
{  to the value specified by 'old_te'.
{
{    I#MTR_RESTORE_TRAPS (OLD_TE)
{
{  OLD_TE: (input) Value of trap enabled flag to be restored.
{
{  NOTE - This procedure assumes the caller has 'monitor privilege';
{  this inline can only be used successfully in MONITOR mode.
{

    TYPE
      monitor_mask = RECORD
        CASE boolean OF
        = FALSE =
          mask: mtt$monitor_conditions,
        = TRUE =
          int: 0 .. 0ffff(16),
        CASEND,
      RECEND;

    VAR
      local_monitor_mask: monitor_mask;

    local_monitor_mask.int := #read_register (osc$pr_monitor_mask_reg);
    IF old_te = 0 THEN
      local_monitor_mask.mask := local_monitor_mask.mask - $mtt$monitor_conditions [mtc$mcr_trap_enable_flag];
    ELSE
      local_monitor_mask.mask := local_monitor_mask.mask + $mtt$monitor_conditions [mtc$mcr_trap_enable_flag];
    IFEND;
    #write_register (osc$pr_monitor_mask_reg, local_monitor_mask.int);
    #write_register (0c0(16), old_te);

  PROCEND i#mtr_restore_traps;
*copyc mtt$monitor_conditions
*copyc osc$processor_defined_registers
?? POP ??
