home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c070 / 4.ddi / TOOLS.4 / TCTSRC1.EXE / UTINTFLG.ASM < prev    next >
Encoding:
Assembly Source File  |  1989-03-31  |  1.3 KB  |  65 lines

  1. ;
  2. ; Name        UTINTFLG -- Change state of maskable hardware
  3. ;        interrupts flag.
  4. ;
  5. ; Synopsis    were_on = utintflg(want_on);
  6. ;
  7. ;        int were_on        1 if interrupts were enabled before
  8. ;                      the call, 0 if not.
  9. ;        int want_on        1 if interrupts will be enabled
  10. ;                      after the call, 0 if not.
  11. ;
  12. ; Description    This function sets the state of the hardware interrupt
  13. ;        flag.
  14. ;
  15. ; Returns    were_on         1 if interrupts were enabled before
  16. ;                      the call, 0 if not.
  17. ;
  18. ; Version    6.00 (C)Copyright Blaise Computing Inc.  1987,1989
  19.  
  20.     include beginasm.mac     ; Specifies the compiler and memory model
  21.     beginProg utintflg
  22.  
  23. want_on equ    word ptr [bp + stkoff]
  24.  
  25.     push    bp
  26.     mov    bp, sp
  27.  
  28.     pushf               ; Get flags in AX to examine later--
  29.     pop    ax           ; Bit 9 of flags is Interrupt flag.
  30.  
  31.     mov    bx, want_on
  32.     cmp    bx, 0
  33.     jz    setoff
  34.  
  35. seton:
  36.     test    ah, 2
  37.     jnz    wereon
  38.     mov    ax, 0           ; Interrupts were disabled.
  39.     sti               ; Enable them.
  40.     jmp    short done
  41.  
  42. wereon:
  43.     mov    ax, 1           ; Interrupts were already enabled.
  44.     jmp    short done
  45.  
  46. setoff:
  47.     test    ah, 2
  48.     jz    wereoff
  49.  
  50.     mov    ax, 1           ; Interrupts were enabled.
  51.     cli               ; Disable them.
  52.     jmp    short done
  53.  
  54. wereoff:
  55.     mov    ax, 0           ; Interrupts were already disabled.
  56.     jmp    short done
  57.  
  58. done:
  59.     cld
  60.     pop    bp
  61.     ret
  62.  
  63.     endProg utintflg
  64.     end
  65.