<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <!--Converted with LaTeX2HTML 2008 (1.71) original version by: Nikos Drakos, CBLU, University of Leeds * revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan * with significant contributions from: Jens Lippmann, Marek Rouchal, Martin Wilck and others --> <HTML> <HEAD> <TITLE>3.9.4 Z80 Interrupt Service Routines</TITLE> <META NAME="description" CONTENT="3.9.4 Z80 Interrupt Service Routines"> <META NAME="keywords" CONTENT="sdccman"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <META NAME="Generator" CONTENT="LaTeX2HTML v2008"> <META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"> <LINK REL="STYLESHEET" HREF="sdccman.css"> <LINK REL="previous" HREF="node70.html"> <LINK REL="up" HREF="node67.html"> <LINK REL="next" HREF="node72.html"> </HEAD> <BODY > <!--Navigation Panel--> <A NAME="tex2html1748" HREF="node72.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1742" HREF="node67.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1738" HREF="node70.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1744" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1746" HREF="node191.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1749" HREF="node72.html">3.10 Enabling and Disabling</A> <B> Up:</B> <A NAME="tex2html1743" HREF="node67.html">3.9 Interrupt Service Routines</A> <B> Previous:</B> <A NAME="tex2html1739" HREF="node70.html">3.9.3 HC08 Interrupt Service</A> <B> <A NAME="tex2html1745" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html1747" HREF="node191.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION00494000000000000000"> 3.9.4 Z80 Interrupt Service Routines</A> </H2> <P> The Z80<A NAME="1751"></A> uses several different methods for determining the correct interrupt<A NAME="1752"></A> vector depending on the hardware implementation. Therefore, SDCC ignores the optional interrupt number and does not attempt to generate an interrupt vector table. <P> By default, SDCC generates code for a maskable interrupt, which uses a RETI instruction to return from the interrupt. To write an interrupt handler for the non-maskable interrupt, which needs a RETN instruction instead, add the <I>critical</I> keyword: <BLOCKQUOTE> <TT>void nmi_isr (void) critical interrupt</TT> <BR><TT>{ </TT> <BR><TT> ... </TT> <BR><TT>}</TT> </BLOCKQUOTE> However if you need to create a non-interruptable interrupt service routine you would also require the <I>critical</I> keyword. To distinguish between this and an nmi_isr you must provide an interrupt number. <P><P> <BR> <P> <BR><HR> <ADDRESS> 2011-03-20 </ADDRESS> </BODY> </HTML>