📄 start12.lst
字号:
172: LDX _startupData.initBodies ; load address of first module to initialize
173: nextInit:
174: LEAX 3,X ; increment to next init
175: PSHX ; save address of next function to initialize
176: PSHY ; save cpp counter
177: CALL [-3,X] ; use double indirect call to load the page register also
178: PULY ; restore cpp counter
179: PULX ; restore actual address
180: DEY ; decrement cpp counter
181: BNE nextInit
182: #else /* defined( __BANKED__) || defined(__LARGE__) */
183:
184: LDD _startupData.nofInitBodies; load number of cpp.
185: BEQ done ; if cppcount == 0, goto done
186: LDX _startupData.initBodies ; load address of first module to initialize
187: nextInit:
188: #ifdef __HC12S__
189: LDY 0,X ; load address of first module to initialize
190: LEAX 2,X ; increment pointer
191: #else /* __HC12S__ */
192: LDY 2,X+ ; load address of first module to initialize
193: #endif /* __HC12S__ */
194: PSHD
195: PSHX ; save actual address
196: JSR 0,Y ; call initialization function
197: PULX ; restore actual address
198: PULD ; restore cpp counter
199: #if DO_NOT_USE_TEST_BRANCHES
200: SUBD #1 ; decrement cpp counter
201: BNE nextInit
202: #else
203: DBNE D, nextInit
204: #endif
205: #endif /* defined( __BANKED__) || defined(__LARGE__) */
206: #else /* __ELF_OBJECT_FILE_FORMAT__ */
207: LDX _startupData.mInits ; load address of first module to initialize
208: #if defined( __BANKED__) || defined(__LARGE__)
209: nextInit: LDY 3,X+ ; load address of initialization function
210: BEQ done ; stop when address == 0
211: ; in common environments the offset of a function is never 0, so this test could be avoided
212: #ifdef __InitFunctionsMayHaveOffset0__
213: BRCLR -1,X, done, 0xff ; stop when address == 0
214: #endif /* __InitFunctionsMayHaveOffset0__ */
215: PSHX ; save address of next function to initialize
216: CALL [-3,X] ; use double indirect call to load the page register also
217: #else /* defined( __BANKED__) || defined(__LARGE__) */
218: nextInit:
219: #ifdef __HC12S__
220: LDY 0,X ; load address of first module to initialize
221: LEAX 2,X ; increment pointer
222: #else /* __HC12S__ */
223: LDY 2,X+ ; load address of first module to initialize
224: #endif /* __HC12S__ */
225: BEQ done ; stop when address of function == 0
226: PSHX ; save actual address
227: JSR 0,Y ; call initialization function
228: #endif /* defined( __BANKED__) || defined(__LARGE__) */
229: PULX ; restore actual address
230: BRA nextInit
231: #endif /* __ELF_OBJECT_FILE_FORMAT__ */
232: done:
233: #endif /* __cplusplus */
234: }
235: }
0028 3d [5] RTS
236:
237: #if defined( __ELF_OBJECT_FILE_FORMAT__) && defined(__cplusplus )
238:
239: #if !defined(FAR_DATA) && (defined( __BANKED__) || defined(__LARGE__))
240: static void __far Fini(void)
241: #else
242: static void Fini(void)
243: #endif
244: {
245: // purpose: 1) call global destructors in C++
246: __asm {
247: #if defined( __BANKED__) || defined(__LARGE__)
248:
249: LDY _startupData.nofFiniBodies; load number of cpp.
250: BEQ done ; if cppcount == 0, goto done
251: LDX _startupData.finiBodies ; load address of first module to finalize
252: nextInit2:
253: LEAX 3,X ; increment to next init
254: PSHX ; save address of next function to finalize
255: PSHY ; save cpp counter
256: CALL [-3,X] ; use double indirect call to load the page register also
257: PULY ; restore cpp counter
258: PULX ; restore actual address
259: DEY ; decrement cpp counter
260: BNE nextInit2
261: #else /* defined( __BANKED__) || defined(__LARGE__) */
262:
263: LDD _startupData.nofFiniBodies; load number of cpp.
264: BEQ done ; if cppcount == 0, goto done
265: LDX _startupData.finiBodies ; load address of first module to finalize
266: nextInit2:
267: #ifdef __STAR12__
268: LDY 0,X ; load address of first module to finalize
269: LEAX 2,X ; increment pointer
270: #else /* __STAR12__ */
271: LDY 2,X+ ; load address of first module to finalize
272: #endif /* __STAR12__ */
273: PSHD
274: PSHX ; save actual address
275: JSR 0,Y ; call finalize function
276: PULX ; restore actual address
277: PULD ; restore cpp counter
278: #if DO_NOT_USE_TEST_BRANCHES
279: SUBD #1 ; decrement cpp counter
280: BNE nextInit2
281: #else
282: DBNE D, nextInit2
283: #endif
284: #endif /* defined( __BANKED__) || defined(__LARGE__) */
285: done:;
286: }
287: }
288: #endif
289:
290:
291: #include "non_bank.sgm"
292:
293: #pragma MESSAGE DISABLE C12053 /* Stack-pointer change not in debugging-information */
294: #pragma NO_FRAME
295: #pragma NO_ENTRY
296: #pragma NO_EXIT
297:
298: #ifdef __cplusplus
299: extern "C"
300: #endif
301:
302: /* The function _Startup must be called in order to initialize global variables and to call main */
303: /* You can adapt this function or call it from your startup code to implement a different startup */
304: /* functionality. */
305:
306: /* You should also setup the needed IO registers as WINDEF (HC12A4 only) or the COP registers to run */
307: /* on hardware */
308:
309: /* to set the reset vector several ways are possible : */
310: /* 1. define the function with "interrupt 0" as done below in the first case */
311: /* 2. add the following line to your prm file : VECTOR ADDRESS 0xfffe _Startup */
312: /* of course, even more posibilities exists */
313: /* the reset vector must be set so that the application has a defined entry point */
314:
315: #define STARTUP_FLAGS_NOT_INIT_SP (1<<1)
316:
317: #if defined(__SET_RESET_VECTOR__)
318: void __interrupt 0 _Startup(void) {
319: #else
320: void _Startup(void) {
Function: _Startup
Source : C:\Users\www\Desktop\m68hc12-mw\sources\Start12.c
Options : -Cf -EnvGENPATH=C:\Users\www\Desktop\m68hc12-mw;C:\Users\www\Desktop\m68hc12-mw\bin;C:\Users\www\Desktop\m68hc12-mw\cmd;C:\Users\www\Desktop\m68hc12-mw\prm;C:\Users\www\Desktop\m68hc12-mw\sources;D:\Installed\CodeWarrior\lib\HC12c\LIB;D:\Installed\CodeWarrior\lib\HC12c\SRC;D:\Installed\CodeWarrior\lib\HC12c\INCLUDE -EnvLIBPATH=D:\Installed\CodeWarrior\lib\HC12c\INCLUDE -EnvOBJPATH=C:\Users\www\Desktop\m68hc12-mw\bin -EnvTEXTPATH=C:\Users\www\Desktop\m68hc12-mw\bin -Lasm=%n.lst -Ms -ObjN=C:\Users\www\Desktop\m68hc12-mw\RTOS_Data\Generic\ObjectCode\Start12.c.o -TD4LD4LLD4 -WmsgSd12053
321: #endif
322: /* purpose: 1) initialize the stack
323: 2) initialize the RAM, copy down init data etc (Init)
324: 3) call main;
325: parameters: NONE
326: called from: _PRESTART-code generated by the Linker */
327: for(;;) { /* forever: initialize the program; call the root-procedure */
328: if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
0000 1e00000203 [5] BRSET _startupData,#2,*+8 ;abs = 0008
329: /* initialize the stack pointer */
330: INIT_SP_FROM_STARTUP_DESC(); /* HLI macro definition in hidef.h */
0005 cf0000 [2] LDS #__SEG_END_SSTACK
331: }
332: /* Here user defined code could be inserted, the stack could be used */
333:
334:
335: /* Example : Set up WinDef Register to allow Paging */
336: #ifndef DG128 /* HC12 DG128 derivative has no WINDEF. Instead PPAGE is always enabled */
337: #if (__ENABLE_EPAGE__ != 0 || __ENABLE_DPAGE__ != 0 || __ENABLE_PPAGE__ != 0)
338: WINDEF= __ENABLE_EPAGE__ | __ENABLE_DPAGE__ | __ENABLE_PPAGE__;
339: #endif
340: #endif
341: Init(); /* zero out, copy down, call constructors */
0008 0700 [4] BSR Init
342: /* Here user defined code could be inserted, all global variables are initilized */
343:
344: /* call main() */
345: (*_startupData.main)();
000a 15fb0000 [7] JSR [_startupData:1,PCR]
000e 20f0 [3] BRA *-14 ;abs = 0000
346:
347: /* call destructors. Only done when this file is compiled as C++ and for the ELF object file format */
348: /* the HIWARE object file format does not support this */
349: #if defined( __ELF_OBJECT_FILE_FORMAT__) && defined(__cplusplus )
350: Fini();
351: #endif
352:
353: }; /* end loop forever */
354: }
355:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -