start08.lst
来自「在MC68HC908JB8上移植UCOSII成功」· LST 代码 · 共 413 行 · 第 1/2 页
LST
413 行
ANSI-C/cC++ Compiler for HC08 V-5.0.12 ICG, Oct 6 2000
1: /******************************************************************************
2: FILE : start08.c
3: PURPOSE : 68HC08 standard startup code
4: LANGUAGE : ANSI-C / INLINE ASSEMBLER
5: ----------------------------------------------------------------------------
6: HISTORY
7: 22 oct 93 Created.
8: 04/17/97 Also C++ constructors called in Init().
9: ******************************************************************************/
10:
11: #include "hidef.h"
12: #include "start08.h"
13:
14: /**********************************************************************/
15: struct _tagStartup _startupData; /* read-only:
16: _startupData is allocated in ROM and
17: initialized by the linker */
18:
19:
20: #define USE_C_IMPL 0 /* for now, we are using the inline assembler implementation for the startup code */
21:
22: #if !USE_C_IMPL
23: #pragma MESSAGE DISABLE C20001 /* Warning C20001: Different value of stackpointer depending on control-flow */
24: /* the function _COPY_L releases some bytes from the stack internally */
25:
26: #pragma NO_ENTRY
27: #pragma NO_EXIT
28: #pragma NO_FRAME
29: static void near loadByte(void) {
Function: loadByte
Source : C:\motoctest\ucos1\sources\Start08.c
Options : -Cc -EnvGENPATH=C:\motoctest\ucos1;C:\motoctest\ucos1\bin;C:\motoctest\ucos1\cmd;C:\motoctest\ucos1\prm;C:\motoctest\ucos1\sources;C:\Metrowerks\lib\HC08c\LIB;C:\Metrowerks\lib\HC08c\src;C:\Metrowerks\lib\HC08c\INCLUDE -EnvLIBPATH=C:\Metrowerks\lib\HC08c\INCLUDE -EnvOBJPATH=C:\motoctest\ucos1\bin -EnvTEXTPATH=C:\motoctest\ucos1\bin -La=%f.inc -Lasm=%n.lst -ObjN=C:\motoctest\ucos1\ucos1_Data\MMDS-MMEVS\ObjectCode\Start08.c.o -WmsgSd20001
30: asm {
31: PSHH
0000 8b PSHH
32: PSHX
0001 89 PSHX
0002 95 TSX
33: LDA 5,SP
0003 e604 LDA 4,X
34: PSHA
0005 87 PSHA
35: LDX 7,SP
0006 ee05 LDX 5,X
36: PULH
0008 8a PULH
37: LDA 0,X
0009 f6 LDA ,X
38: AIX #1
000a af01 AIX #1
39: STX 6,SP
000c 9eef06 STX 6,SP
40: PSHH
000f 8b PSHH
41: PULX
0010 88 PULX
42: STX 5,SP
0011 9eef05 STX 5,SP
43: PULX
0014 88 PULX
44: PULH
0015 8a PULH
45: RTS
0016 81 RTS
46: }
47: }
48:
49:
50: #endif
51:
52: extern void _COPY_L(void);
53: /* DESC: copy very large structures (>= 256 bytes) in 16 bit address space (stack incl.)
54: IN: TOS count, TOS(2) @dest, H:X @src
55: OUT:
56: WRITTEN: X,H */
57:
58:
59: #ifdef __ELF_OBJECT_FILE_FORMAT__
60: #define toCopyDownBegOffs 0
61: #else
62: #define toCopyDownBegOffs 2 /* for the hiware format, the toCopyDownBeg field is a long. Because the HC08 is big endian, we have to use an offset of 2 */
63: #endif
64: static void Init(void) {
Function: Init
Source : C:\motoctest\ucos1\sources\Start08.c
Options : -Cc -EnvGENPATH=C:\motoctest\ucos1;C:\motoctest\ucos1\bin;C:\motoctest\ucos1\cmd;C:\motoctest\ucos1\prm;C:\motoctest\ucos1\sources;C:\Metrowerks\lib\HC08c\LIB;C:\Metrowerks\lib\HC08c\src;C:\Metrowerks\lib\HC08c\INCLUDE -EnvLIBPATH=C:\Metrowerks\lib\HC08c\INCLUDE -EnvOBJPATH=C:\motoctest\ucos1\bin -EnvTEXTPATH=C:\motoctest\ucos1\bin -La=%f.inc -Lasm=%n.lst -ObjN=C:\motoctest\ucos1\ucos1_Data\MMDS-MMEVS\ObjectCode\Start08.c.o -WmsgSd20001
0000 a7fc AIS #-4
65: /* purpose: 1) zero out RAM-areas where data is allocated
66: 2) init run-time data
67: 3) copy initialization data from ROM to RAM
68: */
69: unsigned int i;
70: int *p;
71: #if USE_C_IMPL /* C implementation of ZERO OUT and COPY Down */
72: int j;
73: char *dst;
74: _Range *r;
75:
76: r = _startupData.pZeroOut;
77:
78: /* zero out */
79: for (i=0; i != _startupData.nofZeroOuts; i++) {
80: dst = r->beg;
81: j = r->size;
82: do {
83: *dst = 0; /* zero out */
84: dst++;
85: j--;
86: } while(j != 0);
87: r++;
88: }
89: #else /* faster and smaller asm implementation for ZERO OUT */
90: asm {
91: ZeroOut: ;
92: LDA _startupData.nofZeroOuts:1 ; nofZeroOuts
0002 c6000b LDA _startupData:11
93: INCA
0005 4c INCA
0006 95 TSX
94: STA i:1 ; i is counter for number of zero outs
0007 e701 STA 1,X
95: LDA _startupData.nofZeroOuts:0 ; nofZeroOuts
0009 c6000a LDA _startupData:10
96: INCA
000c 4c INCA
97: STA i:0
000d f7 STA ,X
98: LDHX _startupData.pZeroOut ; *pZeroOut
000e ce000c LDX _startupData:12
0011 89 PSHX
0012 8a PULH
0013 ce000d LDX _startupData:13
99: BRA Zero_5
0016 201f BRA L37 ;abs = 0037
0018 L18:
100: Zero_3: ;
101: ; CLR i:1 is already 0
102: Zero_4: ;
103: ; { HX == _pZeroOut }
104: PSHX
0018 89 PSHX
105: PSHH
0019 8b PSHH
106: ; { nof bytes in (int)2,X }
107: ; { address in (int)0,X }
108: LDA 0,X
001a f6 LDA ,X
109: PSHA
001b 87 PSHA
110: LDA 2,X
001c e602 LDA 2,X
111: INCA
001e 4c INCA
112: STA p ; p:0 is used for high byte of byte counter
001f 9ee706 STA 6,SP
113: LDA 3,X
0022 e603 LDA 3,X
114: LDX 1,X
0024 ee01 LDX 1,X
115: PULH
0026 8a PULH
116: INCA
0027 4c INCA
117: BRA Zero_0
0028 2003 BRA L2D ;abs = 002d
002a L2A:
118: Zero_1: ;
119: ; CLRA A is already 0, so we don't have to clear it
120: Zero_2: ;
121: CLR 0,X
002a 7f CLR ,X
122: AIX #1
002b af01 AIX #1
002d L2D:
123: Zero_0: ;
124: DBNZA Zero_2
002d 4bfb DBNZA L2A ;abs = 002a
125: Zero_6:
126: DBNZ p, Zero_1
002f 9e6b05f7 DBNZ 5,SP,L2A ;abs = 002a
127: PULH
0033 8a PULH
128: PULX ; restore *pZeroOut
0034 88 PULX
129: AIX #4 ; advance *pZeroOut
0035 af04 AIX #4
0037 L37:
130: Zero_5: ;
131: DBNZ i:1, Zero_4
0037 9e6b02dd DBNZ 2,SP,L18 ;abs = 0018
132: DBNZ i:0, Zero_3
003b 9e6b01d9 DBNZ 1,SP,L18 ;abs = 0018
133: ;
134: CopyDown: ;
135:
136: }
137:
138: #endif
139:
140: /* copy down */
141: /* _startupData.toCopyDownBeg ---> {nof(16) dstAddr(16) {bytes(8)}^nof} Zero(16) */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?