beautypg.com

Interrupt functions – Zilog Z80380 User Manual

Page 39

background image

UM004001-COR1103

2–5

C-Compiler Overview

INTERRUPT FUNCTIONS

INTERRUPT FUNCTIONS

Interrupt functions are declared by preceding their definition with #pragma interrupt.
Such functions should not take parameters or return a value. For example:

#include

#include

volatile int gprtCount;

#pragma interrupt

void timer(void)

{

char cDummy;

cDummy = tcr;

cDummy = tmdr0l;

cDummy = tmdr0h;

gprtCount++;

}

The compiler generates the following prologue and epilogue code for interrupt functions:

.align 2

_timer:

ex af,af’

exall

.

.

.

exall

ex af,af’

ei

reti