pic_asm:pic_z80_like_di_and_ei_macros_to_disable_and_enable_interrupts_globally
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
pic_asm/pic_z80_like_di_and_ei_macros_to_disable_and_enable_interrupts_globally.txt · Last modified: 2024/01/19 09:40 by 127.0.0.1