Imported Upstream version 2.9.0
[debian/cc1111] / device / lib / pic16 / libsdcc / lregs / lrrest.c
1 /*-------------------------------------------------------------------------
2
3    lrrest.c :- restore local registers in stack upon function exit
4
5    Written for pic16 port by Vangelis Rokas, 2004 (vrokas@otenet.gr)
6
7    This library is free software; you can redistribute it and/or modify it
8    under the terms of the GNU Library General Public License as published by the
9    Free Software Foundation; either version 2, or (at your option) any
10    later version.
11
12    This library is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU Library General Public License for more details.
16
17    You should have received a copy of the GNU Library General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21    In other words, you are welcome to use, share and improve this program.
22    You are forbidden to forbid anyone else to use, share and improve
23    what you give them.   Help stamp out software-hoarding!
24 -------------------------------------------------------------------------*/
25 /*
26 ** $Id: lrrest.c 3835 2005-08-07 20:09:11Z tecodev $
27 */
28
29 /* FSR0 points to last register to store, WREG holds the register count
30  */
31  
32 extern PREINC1;
33 extern POSTDEC0;
34 extern WREG;
35
36 void _lr_restore(void) __naked
37 {
38   __asm
39 loop:
40     movff       _PREINC1, _POSTDEC0
41     decfsz      _WREG, f
42     bra         loop
43     
44     return
45   __endasm;
46 }