DISABLE

Abbreviation

None.

Arguments

None.

Default

None.

Description

The DISABLE directive instructs the compiler to generate code that disables all interrupts for the duration of a function. DISABLE must be specified with a #pragma directive immediately before a function declaration. The DISABLE control applies to one function only and must be re-specified for each new function.

NOTES
DISABLE may be specified using the #pragma directive only.

DISABLE can be specified more than once in a source file and must be specified once for each function that is to execute with interrupts disabled.

A function with disabled interrupts cannot return a bit value to the caller.

Example
The following example is a source and code listing of a function using the DISABLE  directive. Note that the EA special function register is cleared at the beginning of the function (JBC EA,?C0002) and restored at the end (MOV EA,C).
.
.
.
stmt level source
1 typedef unsigned char uchar;
2
3 #pragma disable /* Disable Interrupts */
4 uchar dfunc (uchar p1, uchar p2) {
5 1 return (p1 * p2 + p2 * p1);
6 1 }

; FUNCTION _dfunc (BEGIN)
0000 D3 SETB C
0001 10AF01 JBC EA,?C0002
0004 C3 CLR C
0005 ?C0002:
0005 C0D0 PUSH PSW
;---- Variable 'p1' assigned to register 'R7' ----
;---- Variable 'p2' assigned to register 'R5' ----
; SOURCE LINE # 4
; SOURCE LINE # 5
0007 ED MOV A,R5
0008 8FF0 MOV B,R7
000A A4 MUL AB
000B 25E0 ADD A,ACC
000D FF MOV R7,A
; SOURCE LINE # 6
000E ?C0001:
000E D0D0 POP PSW
0010 92AF MOV EA,C
0012 22 RET
; FUNCTION _dfunc (END)
.
.
.