Imported Upstream version 2.9.0
[debian/cc1111] / device / lib / _decdptr.c
1 /*-------------------------------------------------------------------------
2
3   _decdptr.c :-  decrement dptr by 1 
4
5              Ecrit par -  Jean-Louis Vern jlvern@writeme.com (1999)
6
7    This program is free software; you can redistribute it and/or modify it
8    under the terms of the GNU 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 program 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 General Public License for more details.
16    
17    You should have received a copy of the GNU 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 /* the return value is already in dph/dpl */
27 void
28 _decdptr (char *gptr)
29 {
30         gptr; /* hush the compiler */
31
32 #ifdef SDCC_ds390
33         __asm
34         orl     dps, #0xc0
35         inc     dptr
36         anl     dps, #0x3f
37         __endasm;
38 #else
39         __asm
40         xch     a,dpl
41         jnz     00001$
42         dec     dph
43 00001$:
44         dec     a
45         xch     a,dpl
46         __endasm;
47 #endif
48 }