1 ;--------------------------------------------------------------------------
2 ; crtxinit.asm :- C run-time: copy XINIT to XISEG
4 ; Copyright (C) 2004, Erik Petrich
6 ; This library is free software; you can redistribute it and/or modify it
7 ; under the terms of the GNU General Public License as published by the
8 ; Free Software Foundation; either version 2, or (at your option) any
11 ; This library is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
16 ; You should have received a copy of the GNU General Public License
17 ; along with this library; see the file COPYING. If not, write to the
18 ; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
21 ; As a special exception, if you link this library with other files,
22 ; some of which are compiled with SDCC, to produce an executable,
23 ; this library does not by itself cause the resulting executable to
24 ; be covered by the GNU General Public License. This exception does
25 ; not however invalidate any other reasons why the executable file
26 ; might be covered by the GNU General Public License.
27 ;--------------------------------------------------------------------------
29 ; Set DUAL_DPTR to 1 and reassemble if your derivative has dual data pointers
30 ; Especially useful if movx @Ri cannot go beyond the first 256 bytes of xdata
31 ; due to lack of P2 or _XPAGE
32 ; If the derivative has auto-toggle or auto-increment it can be further optimized
49 .globl _DPS
; assume DPSEL is in DPS bit0
56 mov r2
,#
((l_XINIT
+255) >> 8)
57 orl _DPS
,#
0x01 ; set DPSEL, select DPTR1
58 mov dptr
,#s_XINIT
; DPTR1 for code
59 dec _DPS
; clear DPSEL, select DPTR0
60 mov dptr
,#s_XISEG
; DPTR0 for xdata
62 inc _DPS
; set DPSEL, select DPTR1
65 dec _DPS
; clear DPSEL, select DPTR0
81 mov r2
,#
((l_XINIT
+255) >> 8)
84 mov __XPAGE
,#
(s_XISEG
>> 8)
92 00002$
: djnz r1
,00001$