===PIC Z80-like DI and EI macros to Disable and Enable interrupts (globally)=== Globally disable/enable all interrupts. This is fairly blunt and if you are looking to stop only a certain interrupt this isn't for you - you'll still have to hand-crank that. Note that we check the interrupts have actually been disabled. Internals of the PIC mean it might take a few cycles to happen so we just circle (a few times max) until GIE clears. ; disable global irq DI MACRO BCF INTCON,GIE ; disable global interrupt BTFSC INTCON,GIE ; check if disabled... might take a few cycles to settle - can't assume GOTO $-2 ; nope, try again ENDM ; enable global irq EI MACRO BSF INTCON,GIE ; enable global interrupt ENDM