home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Name UTINTFLG -- Change state of maskable hardware
- ; interrupts flag.
- ;
- ; Synopsis were_on = utintflg(want_on);
- ;
- ; int were_on 1 if interrupts were enabled before
- ; the call, 0 if not.
- ; int want_on 1 if interrupts will be enabled
- ; after the call, 0 if not.
- ;
- ; Description This function sets the state of the hardware interrupt
- ; flag.
- ;
- ; Returns were_on 1 if interrupts were enabled before
- ; the call, 0 if not.
- ;
- ; Version 6.00 (C)Copyright Blaise Computing Inc. 1987,1989
-
- include beginasm.mac ; Specifies the compiler and memory model
- beginProg utintflg
-
- want_on equ word ptr [bp + stkoff]
-
- push bp
- mov bp, sp
-
- pushf ; Get flags in AX to examine later--
- pop ax ; Bit 9 of flags is Interrupt flag.
-
- mov bx, want_on
- cmp bx, 0
- jz setoff
-
- seton:
- test ah, 2
- jnz wereon
- mov ax, 0 ; Interrupts were disabled.
- sti ; Enable them.
- jmp short done
-
- wereon:
- mov ax, 1 ; Interrupts were already enabled.
- jmp short done
-
- setoff:
- test ah, 2
- jz wereoff
-
- mov ax, 1 ; Interrupts were enabled.
- cli ; Disable them.
- jmp short done
-
- wereoff:
- mov ax, 0 ; Interrupts were already disabled.
- jmp short done
-
- done:
- cld
- pop bp
- ret
-
- endProg utintflg
- end