📄 start08.lst
字号:
149: /* _startupData.toCopyDownBeg ---> {nof(16) dstAddr(16) {bytes(8)}^nof} Zero(16) */
150: #if USE_C_IMPL /* (optimized) C implementation of COPY DOWN */
151: p = (int*far)_startupData.toCopyDownBeg;
152: for (;;) {
153: i = *p; /* nof */
154: if (i == 0) {
155: break;
156: }
157: dst = (char*far)p[1]; /* dstAddr */
158: p+=2;
159: do {
160: /* p points now into 'bytes' */
161: *dst = *((char*far)p); /* copy byte-wise */
162: ((char*far)p)++;
163: dst++;
164: i--;
165: } while (i!= 0);
166: }
167: #elif defined(__OPTIMIZE_FOR_SIZE__)
168: {
169:
170: asm {
171: #ifdef __HCS08__
172: LDHX _startupData.toCopyDownBeg:toCopyDownBegOffs
173: PSHX
174: PSHH
175: #else
176: LDA _startupData.toCopyDownBeg:(1+toCopyDownBegOffs)
003f c60008 LDA _startupData:8
177: PSHA
0042 87 PSHA
178: LDA _startupData.toCopyDownBeg:(0+toCopyDownBegOffs)
0043 c60007 LDA _startupData:7
179: PSHA
0046 87 PSHA
0047 L47:
180: #endif
181: Loop0:
182: JSR loadByte ; load high byte counter
0047 ad00 BSR loadByte
183: TAX ; save for compare
0049 97 TAX
184: INCA
004a 4c INCA
185: STA i
004b 9ee703 STA 3,SP
186: JSR loadByte ; load low byte counter
004e ad00 BSR loadByte
187: INCA
0050 4c INCA
188: STA i:1
0051 9ee704 STA 4,SP
189: DECA
0054 4a DECA
190: BNE notfinished
0055 2603 BNE L5A ;abs = 005a
191: CBEQX #0, finished
0057 510018 CBEQX #0,L72 ;abs = 0072
005a L5A:
192: notfinished:
193:
194: JSR loadByte ; load high byte ptr
005a ad00 BSR loadByte
195: PSHA
005c 87 PSHA
196: PULH
005d 8a PULH
197: JSR loadByte ; load low byte ptr
005e ad00 BSR loadByte
198: TAX ; HX is now destination pointer
0060 97 TAX
199: BRA Loop1
0061 2005 BRA L68 ;abs = 0068
0063 L63:
200: Loop3:
201: Loop2:
202: JSR loadByte ; load data byte
0063 ad00 BSR loadByte
203: STA 0,X
0065 f7 STA ,X
204: AIX #1
0066 af01 AIX #1
0068 L68:
205: Loop1:
206: DBNZ i:1, Loop2
0068 9e6b04f7 DBNZ 4,SP,L63 ;abs = 0063
207: DBNZ i:0, Loop3
006c 9e6b03f3 DBNZ 3,SP,L63 ;abs = 0063
208: BRA Loop0
0070 20d5 BRA L47 ;abs = 0047
0072 L72:
209:
210: finished:
211: AIS #2
212: }
213: }
214:
215:
216:
217:
218: #else /* optimized asm version. Some bytes (ca 3) larger than C version (when considering the runtime routine too), but about 4 times faster */
219: asm {
220: #ifdef __HCS08__
221: LDHX _startupData.toCopyDownBeg:toCopyDownBegOffs
222: #else
223: LDX _startupData.toCopyDownBeg:(0+toCopyDownBegOffs)
224: PSHX
225: PULH
226: LDX _startupData.toCopyDownBeg:(1+toCopyDownBegOffs)
227: #endif
228: next:
229: LDA 0,X ; list is terminated by 2 zero bytes
230: ORA 1,X
231: BEQ copydone
232: PSHX ; store current position
233: PSHH
234: LDA 3,X ; psh dest low
235: PSHA
236: LDA 2,X ; psh dest high
237: PSHA
238: LDA 1,X ; psh cnt low
239: PSHA
240: LDA 0,X ; psh cnt high
241: PSHA
242: AIX #4
243: JSR _COPY_L ; copy one block
244: PULH
245: PULX
246: TXA
247: ADD 1,X ; add low
248: PSHA
249: PSHH
250: PULA
251: ADC 0,X ; add high
252: PSHA
253: PULH
254: PULX
255: AIX #4
256: BRA next
257: copydone:
258: }
259: #endif
260:
261:
262: /* FuncInits: for C++, this are the global constructors */
263: #ifdef __cplusplus
264: #ifdef __ELF_OBJECT_FILE_FORMAT__
265: i = _startupData.nofInitBodies - 1;
266: while ( i >= 0) {
267: (&_startupData.initBodies->initFunc)[i](); /* call C++ constructors */
268: i--;
269: }
270: #else
271: if (_startupData.mInits != NULL) {
272: _PFunc *fktPtr;
273: fktPtr = _startupData.mInits;
274: while(*fktPtr != NULL) {
275: (**fktPtr)(); /* call constructor */
276: fktPtr++;
277: }
278: }
279: #endif
280: #endif
281: /* LibInits: used only for ROM libraries */
282: }
0072 a706 AIS #6
0074 81 RTS
283:
284: #pragma NO_EXIT
285: #ifdef __cplusplus
286: extern "C"
287: #endif
288: void _Startup (void) { /* To set in the linker parameter file: 'VECTOR 0 _Startup' */
Function: _Startup
Source : D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\src\Start08.c
Options : -Cc -DCW08 -Env"GENPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\cmd;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\src;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\src;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\inc;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\HC08;D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin;C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW08_V3.0\lib\HC08c\INCLUDE" -EnvOBJPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -EnvTEXTPATH=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\bin -F2 -Lasm=%n.lst -N -ObjN=D:\Data\NPI-New_Product_Development\HC908QL4-NitronLIN\AN2633-QL4_SLIC_drivers\LINQL4-C\sample\LINQL4-C_Data\LIN08QL4_slave\ObjectCode\Start08.c.o -Or -Pe -WmsgSd20001
289: /* purpose: 1) initialize the stack
290: 2) initialize run-time, ...
291: initialize the RAM, copy down init dat etc (Init)
292: 3) call main;
293: called from: _PRESTART-code generated by the Linker
294: */
295: #ifdef __ELF_OBJECT_FILE_FORMAT__
296: DisableInterrupts; /* in HIWARE format, this is done in the prestart code */
0000 9b SEI
0001 L1:
297: #endif
298: for (;;) { /* forever: initialize the program; call the root-procedure */
299: if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
0001 c60000 LDA _startupData
0004 a502 BIT #2
0006 2604 BNE LC ;abs = 000c
300: /* initialize the stack pointer */
301: INIT_SP_FROM_STARTUP_DESC();
0008 450000 LDHX @__SEG_END_SSTACK
000b 94 TXS
000c LC:
302: }
303: Init();
000c cd0000 JSR Init
304: (*_startupData.main)();
000f ce0001 LDX _startupData:1
0012 89 PSHX
0013 8a PULH
0014 ce0002 LDX _startupData:2
0017 fd JSR ,X
0018 20e7 BRA L1 ;abs = 0001
305: } /* end loop forever */
306: }
307:
308:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -