TST_IRQ::
;
; It returns carry flag set if interrupts were disabled and
; clear if they were enabled. Also it disables interrupts.
;
;
XOR A ;Push a zero on stack and pop it
PUSH AF ; back off so we can tell if it gets
POP AF ; overwitten with IRQ return address.
LD A,R ;Get IRQ state
DI
RET PE ;Return if interrupts enabled
DEC SP ;If they appear disabled then check
DEC SP ; whether the zero is still below stack
POP AF
OR A ;If not then interrupts must have been
RET NZ ; enabled so return with carry clear.
;
SCF ;Return with carry set to indicate
RET ; that interrupts were disabled.