Initial revision
[fw/sdcc] / device / lib / small / _strncpy.asm
1 ;--------------------------------------------------------
2 ; File Created by SDCC : FreeWare ANSI-C Compiler
3 ; Version 2.1.9Ga Sun Jan 16 17:31:16 2000
4
5 ;--------------------------------------------------------
6         .module _strncpy
7 ;--------------------------------------------------------
8 ; publics variables in this module
9 ;--------------------------------------------------------
10         .globl _strncpy_PARM_3
11         .globl _strncpy_PARM_2
12         .globl _strncpy
13 ;--------------------------------------------------------
14 ; special function registers
15 ;--------------------------------------------------------
16 ;--------------------------------------------------------
17 ; special function bits 
18 ;--------------------------------------------------------
19 ;--------------------------------------------------------
20 ; internal ram data
21 ;--------------------------------------------------------
22         .area   DSEG    (DATA)
23 ;--------------------------------------------------------
24 ; overlayable items in internal ram 
25 ;--------------------------------------------------------
26         .area _DUMMY
27         .area   OSEG    (OVR,DATA)
28 _strncpy_PARM_2:
29         .ds     0x0003
30 _strncpy_PARM_3:
31         .ds     0x0002
32 _strncpy_d1_1_1:
33         .ds     0x0003
34 ;--------------------------------------------------------
35 ; indirectly addressable internal ram data
36 ;--------------------------------------------------------
37         .area   ISEG    (DATA)
38 ;--------------------------------------------------------
39 ; bit data
40 ;--------------------------------------------------------
41         .area   BSEG    (BIT)
42 ;--------------------------------------------------------
43 ; external ram data
44 ;--------------------------------------------------------
45         .area   XSEG    (XDATA)
46 ;--------------------------------------------------------
47 ; global & static initialisations
48 ;--------------------------------------------------------
49         .area GSINIT (CODE)
50 ;--------------------------------------------------------
51 ; code
52 ;--------------------------------------------------------
53         .area CSEG (CODE)
54         G$strncpy$0$0 ==.
55 ;       _strncpy.c 27
56 ;       -----------------------------------------
57 ;        function strncpy
58 ;       -----------------------------------------
59 _strncpy:
60         ar2 = 0x02
61         ar3 = 0x03
62         ar4 = 0x04
63         ar5 = 0x05
64         ar6 = 0x06
65         ar7 = 0x07
66         ar0 = 0x00
67         ar1 = 0x01
68 ;       _strncpy.c 36
69         mov     r2,dpl
70         mov     r3,dph
71         mov     r4,b
72 ;       _strncpy.c 32
73         mov     _strncpy_d1_1_1,r2
74         mov     (_strncpy_d1_1_1 + 1),r3
75         mov     (_strncpy_d1_1_1 + 2),r4
76 ;       _strncpy.c 34
77 00101$:
78         mov     r5,_strncpy_PARM_3
79         mov     r0,(_strncpy_PARM_3 + 1)
80         dec     _strncpy_PARM_3
81         mov     a,#0xff
82         cjne    a,_strncpy_PARM_3,00108$
83         dec     (_strncpy_PARM_3 + 1)
84 00108$:
85         mov     a,r5
86         orl     a,r0
87 ; Peephole 110   removed ljmp by inverse jump logic
88         jz  00103$
89 00109$:
90 ;       _strncpy.c 35
91         mov     ar5,r2
92         mov     ar0,r3
93         mov     ar1,r4
94         inc     r2
95         cjne    r2,#0x00,00110$
96         inc     r3
97 00110$:
98         mov     dpl,_strncpy_PARM_2
99         mov     dph,(_strncpy_PARM_2 + 1)
100         mov     b,(_strncpy_PARM_2 + 2)
101         inc     _strncpy_PARM_2
102         clr     a
103         cjne    a,_strncpy_PARM_2,00111$
104         inc     (_strncpy_PARM_2 + 1)
105 00111$:
106         lcall   __gptrget
107 ; Peephole 191   removed redundant mov
108         mov  r6,a
109         mov  dpl,r5
110         mov  dph,r0
111         mov  b,r1
112         lcall   __gptrput
113 ; Peephole 132   changed ljmp to sjmp
114         sjmp 00101$
115 00103$:
116 ;       _strncpy.c 36
117         mov     dpl,_strncpy_d1_1_1
118         mov     dph,(_strncpy_d1_1_1 + 1)
119         mov     b,(_strncpy_d1_1_1 + 2)
120 00104$:
121         C$_strncpy.c$37$1$1 ==.
122         XG$strncpy$0$0 ==.
123         ret
124         .area   CSEG    (CODE)