1 | ;
|
---|
2 | ; TOPPERS/JSP Kernel
|
---|
3 | ; Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
4 | ; Just Standard Profile Kernel
|
---|
5 | ;
|
---|
6 | ; Copyright (C) 2006-2010 by Witz Corporation, JAPAN
|
---|
7 | ;
|
---|
8 | ; The above copyright holders grant permission gratis to use,
|
---|
9 | ; duplicate, modify, or redistribute (hereafter called use) this
|
---|
10 | ; software (including the one made by modifying this software),
|
---|
11 | ; provided that the following four conditions (1) through (4) are
|
---|
12 | ; satisfied.
|
---|
13 | ;
|
---|
14 | ; (1) When this software is used in the form of source code, the above
|
---|
15 | ; copyright notice, this use conditions, and the disclaimer shown
|
---|
16 | ; below must be retained in the source code without modification.
|
---|
17 | ;
|
---|
18 | ; (2) When this software is redistributed in the forms usable for the
|
---|
19 | ; development of other software, such as in library form, the above
|
---|
20 | ; copyright notice, this use conditions, and the disclaimer shown
|
---|
21 | ; below must be shown without modification in the document provided
|
---|
22 | ; with the redistributed software, such as the user manual.
|
---|
23 | ;
|
---|
24 | ; (3) When this software is redistributed in the forms unusable for the
|
---|
25 | ; development of other software, such as the case when the software
|
---|
26 | ; is embedded in a piece of equipment, either of the following two
|
---|
27 | ; conditions must be satisfied:
|
---|
28 | ;
|
---|
29 | ; (a) The above copyright notice, this use conditions, and the
|
---|
30 | ; disclaimer shown below must be shown without modification in
|
---|
31 | ; the document provided with the redistributed software, such as
|
---|
32 | ; the user manual.
|
---|
33 | ;
|
---|
34 | ; (b) How the software is to be redistributed must be reported to the
|
---|
35 | ; TOPPERS Project according to the procedure described
|
---|
36 | ; separately.
|
---|
37 | ;
|
---|
38 | ; (4) The above copyright holders and the TOPPERS Project are exempt
|
---|
39 | ; from responsibility for any type of damage directly or indirectly
|
---|
40 | ; caused from the use of this software and are indemnified by any
|
---|
41 | ; users or end users of this software from any and all causes of
|
---|
42 | ; action whatsoever.
|
---|
43 | ;
|
---|
44 | ; THIS SOFTWARE IS PROVIDED "AS IS." THE ABOVE COPYRIGHT HOLDERS AND
|
---|
45 | ; THE TOPPERS PROJECT DISCLAIM ANY EXPRESS OR IMPLIED WARRANTIES,
|
---|
46 | ; INCLUDING, BUT NOT LIMITED TO, ITS APPLICABILITY TO A PARTICULAR
|
---|
47 | ; PURPOSE. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS AND THE
|
---|
48 | ; TOPPERS PROJECT BE LIABLE FOR ANY TYPE OF DAMAGE DIRECTLY OR
|
---|
49 | ; INDIRECTLY CAUSED FROM THE USE OF THIS SOFTWARE.
|
---|
50 | ;
|
---|
51 | ; ä¸è¨è使¨©è
|
---|
52 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
53 | ; ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»
|
---|
54 | ; åé
|
---|
55 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
56 | ; (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®è使¨©
|
---|
57 | ; 表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼ã¹
|
---|
58 | ; ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
59 | ; (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
60 | ; ã§ããå½¢ã§åé
|
---|
61 | å¸ããå ´åã«ã¯ï¼åé
|
---|
62 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
63 | ã
|
---|
64 | ; ãã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è使¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿
|
---|
65 | ; 証è¦å®ãæ²è¼ãããã¨ï¼
|
---|
66 | ; (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿ç¨
|
---|
67 | ; ã§ããªãå½¢ã§åé
|
---|
68 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºãããã¨ï¼
|
---|
69 | ; (a) åé
|
---|
70 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
71 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½
|
---|
72 | ; 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
73 | ; (b) åé
|
---|
74 | å¸ã®å½¢æ
|
---|
75 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«å ±
|
---|
76 | ; åãããã¨ï¼
|
---|
77 | ; (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³
|
---|
78 | ; ãããï¼ä¸è¨è使¨©è
|
---|
79 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
80 | 責ãããã¨ï¼ã¾ãï¼
|
---|
81 | ; æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãçç±ã«åºã¥
|
---|
82 | ; ãè«æ±ãããï¼ä¸è¨è使¨©è
|
---|
83 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
84 | 責ãããã¨ï¼
|
---|
85 | ;
|
---|
86 | ; æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨è使¨©è
|
---|
87 | ãã
|
---|
88 | ; ã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®çã«å¯¾ã
|
---|
89 | ; ãé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨
|
---|
90 | ; ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæå®³ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè²
|
---|
91 | ; ããªãï¼
|
---|
92 | ;
|
---|
93 | ; @(#) $Id: start.app,v 1.1 2006/04/10 08:19:25 honda Exp $
|
---|
94 | ;
|
---|
95 |
|
---|
96 | $MAXIMUM
|
---|
97 | module start_app
|
---|
98 |
|
---|
99 | ;
|
---|
100 | ; ã«ã¼ãã«ç¨ã®ã¹ã¿ã¼ãã¢ããã¢ã¸ã¥ã¼ã«ï¼TLCS-900ç¨ï¼
|
---|
101 | ;
|
---|
102 | #include "jsp_rename.h"
|
---|
103 | #include "cpu_rename.h"
|
---|
104 | #include "sys_rename.h"
|
---|
105 | #include "tlcs900vec.inc"
|
---|
106 |
|
---|
107 | ; å¤é¨åç
|
---|
108 | §ã·ã³ãã«å®ç¾©
|
---|
109 | extern large __StackTop
|
---|
110 | extern large __AreaRAM
|
---|
111 | extern large __AreaRAM_size
|
---|
112 | extern large __DataRAM
|
---|
113 | extern large __DataRAM_ini
|
---|
114 | extern large __DataRAM_size
|
---|
115 | extern large hardware_init_hook
|
---|
116 | extern large software_init_hook
|
---|
117 | extern large _kernel_start
|
---|
118 |
|
---|
119 | f_code section code large align=1,1
|
---|
120 |
|
---|
121 | public _start
|
---|
122 | _start:
|
---|
123 | ; å²è¾¼ã¿ç¦æ¢
|
---|
124 | di ; ãªã»ããæã¯IFFã«7ãè¨å®ãããããDIç¶æ
|
---|
125 | ã¨ãªã
|
---|
126 | ; ãã¼ãã¦ã§ã¢ãªã»ããæã¯diå½ä»¤ä¸è¦
|
---|
127 | ; ã½ããã«ã¦ jp _start ããå¯è½æ§ãèæ
|
---|
128 | ®ãã³ã¼ããæ®ã
|
---|
129 |
|
---|
130 | ; ã¹ã¿ãã¯åæå
|
---|
131 | ld xsp, __StackTop
|
---|
132 |
|
---|
133 | ; INTNESTã¬ã¸ã¹ã¿åæå
|
---|
134 | ld hl, 0
|
---|
135 | ldc intnest, hl
|
---|
136 |
|
---|
137 | ; hardware_init_hook ãå¼åºãï¼0 ã§ãªãå ´åï¼
|
---|
138 | ; ã¿ã¼ã²ãããã¼ãã¦ã§ã¢ã«ä¾åãã¦å¿
|
---|
139 | è¦ãªåæåå¦çãããå ´å
|
---|
140 | ; ã¯ï¼hardware_init_hook ã¨ãã颿°ãç¨æããï¼
|
---|
141 | ld xhl, hardware_init_hook
|
---|
142 | cp xhl, 0
|
---|
143 | call nz, hardware_init_hook
|
---|
144 |
|
---|
145 | ; åæå¤ç¡ãRAMé åã®ã¯ãªã¢
|
---|
146 | ld xde, __AreaRAM ; å
|
---|
147 | é çªå°ã¨ãµã¤ãºåå¾
|
---|
148 | ld xbc, __AreaRAM_size
|
---|
149 | ld ix, bc ; æä¸ä½bitä¿æ(å¾ã§ä½¿ç¨)
|
---|
150 | srl 1, xbc ; 2byteåä½ã§å¦çãããããµã¤ãº/2
|
---|
151 | jr z, area_clr_byte
|
---|
152 | ld xhl, xde ; å
|
---|
153 | é çªå°ä¿æ(å¾ã§ä½¿ç¨)
|
---|
154 | ldw (xde+), 0 ; å
|
---|
155 | é çªå°ã¯ãªã¢
|
---|
156 | sub xbc, 1 ; ãµã¤ãºãã¯ãªã¡ã³ã
|
---|
157 | jr z, area_clr_byte
|
---|
158 | ldirw (xde+), (xhl+) ; å
|
---|
159 | é çªå°(åã§0è¨å®)ã®å¤ã次çªå°ã¸...
|
---|
160 | ; ã®è¦é ã§BCã¬ã¸ã¹ã¿åãããã¯ãã¼ã
|
---|
161 | cp qbc, 0
|
---|
162 | jr eq, area_clr_byte ; ä¸ä½16bitã0ãªãçµäº
|
---|
163 | ld wa, qbc
|
---|
164 | area_clr_loop: ; ä¸ä½16bit(0x10000åä½)ã§ã®å¦ç
|
---|
165 | ldirw (xde+), (xhl+) ; 0x10000åãããã¯ãã¼ã
|
---|
166 | djnz wa, area_clr_loop
|
---|
167 | area_clr_byte:
|
---|
168 | bit 0, ix ; é åãµã¤ãºã奿°ãªã1byteã¯ãªã¢
|
---|
169 | jr z, area_clr_end
|
---|
170 | ldb (xde), 0
|
---|
171 | area_clr_end:
|
---|
172 |
|
---|
173 | ; åæå¤æãRAMé åã¸ã®ãã¼ã¿ãã¼ã
|
---|
174 | ld xde, __DataRAM ; ãã¼ãå
|
---|
175 | ã»ãã¼ãå
|
---|
176 | çªå°ã¨ãµã¤ãºåå¾
|
---|
177 | ld xhl, __DataRAM_ini
|
---|
178 | ld xbc, __DataRAM_size
|
---|
179 | or xbc, xbc ; ãµã¤ãº0ãªãçµäº
|
---|
180 | jr z, data_ld_end
|
---|
181 | ldirb (xde+), (xhl+) ; BCã¬ã¸ã¹ã¿åãããã¯ãã¼ã
|
---|
182 | cp qbc, 0
|
---|
183 | jr eq, data_ld_end ; ä¸ä½16bitã0ãªãçµäº
|
---|
184 | ld wa, qbc
|
---|
185 | data_ld_loop: ; ä¸ä½16bit(0x10000åä½)ã§ã®å¦ç
|
---|
186 | ldirb (xde+), (xhl+) ; 0x10000åãããã¯ãã¼ã
|
---|
187 | djnz wa, data_ld_loop
|
---|
188 | data_ld_end:
|
---|
189 |
|
---|
190 | ; software_init_hook ãå¼åºãï¼0 ã§ãªãå ´åï¼
|
---|
191 | ; ã½ããã¦ã§ã¢ç°å¢ï¼ç¹ã«ã©ã¤ãã©ãªï¼ã«ä¾åãã¦å¿
|
---|
192 | è¦ãªåæåå¦
|
---|
193 | ; çãããå ´åã¯ï¼software_init_hook ã¨ãã颿°ãç¨æããï¼
|
---|
194 | ld xhl, software_init_hook
|
---|
195 | cp xhl, 0
|
---|
196 | call nz, software_init_hook
|
---|
197 |
|
---|
198 | ; ã«ã¼ãã«èµ·å
|
---|
199 | jp _kernel_start
|
---|
200 |
|
---|
201 | ; EXITã«ã¼ã
|
---|
202 | exit:
|
---|
203 | jr exit
|
---|
204 |
|
---|
205 | end
|
---|