Imported Upstream version 2.9.0
[debian/cc1111] / device / lib / pic16 / libsdcc / fixed16x16 / fps16x162slong.S
1
2 ;
3 ; fps16x162slong.S - convert fixed16x16 to signed char
4 ;
5 ; written by Vangelis Rokas, 2004 <vrokas AT otenet.gr>
6 ;
7 ;
8 ; $Id: fps16x162slong.S 3838 2005-08-10 10:53:34Z tecodev $
9 ;
10
11         radix dec
12
13 ;--------------------------------------------------------
14 ; public variables in this module
15 ;--------------------------------------------------------
16         global ___fps16x162slong
17
18 ;--------------------------------------------------------
19 ;       Equates to used internal registers
20 ;--------------------------------------------------------
21 STATUS  equ     0xfd8
22 WREG    equ     0xfe8
23 FSR0L   equ     0xfe9
24 FSR1L   equ     0xfe1
25 FSR2L   equ     0xfd9
26 POSTDEC1        equ     0xfe5
27 PREINC1 equ     0xfe4
28 PLUSW2  equ     0xfdb
29 PLUSW1  equ     0xfe3
30 PRODL   equ     0xff3
31 PRODH   equ     0xff4
32
33
34 ; Internal registers
35 .registers      udata_ovr       0x0000
36 r0x00   res     1
37 r0x01   res     1
38 r0x02   res     1
39 r0x03   res     1
40
41
42 S_fps16x162slong____fps16x162slong      code
43 ___fps16x162slong:
44
45         movlw   0x04
46         movff   PLUSW1, PRODL
47
48         movlw   0x03
49         movf    PLUSW1, w
50
51         clrf    PRODH
52         clrf    FSR0L
53
54         btfss   PRODL, 7
55         bra     @1
56
57         bcf     PRODL, 7
58         comf    WREG, f
59         comf    PRODL, f
60         comf    PRODH, f
61         comf    FSR0L, f
62         
63         incfsz  WREG, f
64         bra     @1
65         incfsz  PRODL, f
66         bra     @1
67         incfsz  PRODH, f
68         bra     @1
69         incf    FSR0L, f
70
71 @1:
72         return
73
74         end