⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start08.lst

📁 汽车电子上现在最火热的总线之一LIN总线的单片机实现。
💻 LST
📖 第 1 页 / 共 2 页
字号:
ANSI-C/cC++ Compiler for HC08 V-5.0.17, Apr 22 2003

    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:  #pragma DATA_SEG FAR _STARTUP
   16:  struct _tagStartup _startupData;    /* read-only:
   17:                                       _startupData is allocated in ROM and
   18:                                       initialized by the linker */
   19:  
   20:  
   21:  #define USE_C_IMPL 0 /* for now, we are using the inline assembler implementation for the startup code */
   22:  
   23:  #if !USE_C_IMPL
   24:  #pragma MESSAGE DISABLE C20001 /* Warning C20001: Different value of stackpointer depending on control-flow */
   25:  /* the function _COPY_L releases some bytes from the stack internally */
   26:  
   27:  #pragma NO_ENTRY
   28:  #pragma NO_EXIT
   29:  #pragma NO_FRAME
   30:  static void near loadByte(void) {

Function: loadByte
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

   31:    asm {
   32:               PSHH
  0000 8b               PSHH  
   33:               PSHX
  0001 89               PSHX  
  0002 95               TSX   
   34:  #ifdef __HCS08__
   35:               LDHX    5,SP
   36:               LDA     0,X
   37:               AIX     #1
   38:               STHX    5,SP
   39:  #else
   40:               LDA     5,SP
  0003 e604             LDA   4,X
   41:               PSHA
  0005 87               PSHA  
   42:               LDX     7,SP
  0006 ee05             LDX   5,X
   43:               PULH
  0008 8a               PULH  
   44:               LDA     0,X
  0009 f6               LDA   ,X
   45:               AIX     #1
  000a af01             AIX   #1
   46:               STX     6,SP
  000c 9eef06           STX   6,SP
   47:               PSHH
  000f 8b               PSHH  
   48:               PULX
  0010 88               PULX  
   49:               STX     5,SP
  0011 9eef05           STX   5,SP
   50:  #endif
   51:               PULX
  0014 88               PULX  
   52:               PULH
  0015 8a               PULH  
   53:               RTS
  0016 81               RTS   
   54:    }
   55:  }
   56:  
   57:  
   58:  #endif
   59:  
   60:  extern void _COPY_L(void);
   61:  /* DESC:    copy very large structures (>= 256 bytes) in 16 bit address space (stack incl.)
   62:     IN:      TOS count, TOS(2) @dest, H:X @src
   63:     OUT:
   64:     WRITTEN: X,H */
   65:  
   66:  
   67:  #ifdef __ELF_OBJECT_FILE_FORMAT__
   68:  #define toCopyDownBegOffs 0
   69:  #else
   70:  #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 */ 
   71:  #endif
   72:  static void Init(void) {

Function: Init
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

  0000 a7fc             AIS   #-4
   73:  /* purpose:     1) zero out RAM-areas where data is allocated
   74:                  2) init run-time data
   75:                  3) copy initialization data from ROM to RAM
   76:   */
   77:    int i;
   78:    int *far p;
   79:  #if USE_C_IMPL   /* C implementation of ZERO OUT and COPY Down */
   80:    int j;
   81:    char *dst;
   82:    _Range *far r;
   83:  
   84:    r = _startupData.pZeroOut;
   85:    
   86:    /* zero out */
   87:    for (i=0; i != _startupData.nofZeroOuts; i++) {
   88:      dst = r->beg;
   89:      j = r->size;
   90:      do {
   91:        *dst = 0; /* zero out */
   92:        dst++;
   93:        j--;
   94:      } while(j != 0);
   95:      r++;
   96:    }
   97:  #else /* faster and smaller asm implementation for ZERO OUT */
   98:    asm {
   99:  ZeroOut:     ;
  100:               LDA    _startupData.nofZeroOuts:1 ; nofZeroOuts
  0002 c60004           LDA   _startupData:4
  101:               INCA
  0005 4c               INCA  
  0006 95               TSX   
  102:               STA    i:1                        ; i is counter for number of zero outs
  0007 e701             STA   1,X
  103:               LDA    _startupData.nofZeroOuts:0 ; nofZeroOuts
  0009 c60003           LDA   _startupData:3
  104:               INCA
  000c 4c               INCA  
  105:               STA    i:0
  000d f7               STA   ,X
  106:               LDHX   _startupData.pZeroOut      ; *pZeroOut
  000e ce0005           LDX   _startupData:5
  0011 89               PSHX  
  0012 8a               PULH  
  0013 ce0006           LDX   _startupData:6
  107:               BRA    Zero_5
  0016 201f             BRA   L37 ;abs = 0037
  0018          L18:    
  108:  Zero_3:    ;
  109:              ; CLR    i:1 is already 0
  110:  Zero_4:    ;
  111:               ; { HX == _pZeroOut }
  112:               PSHX
  0018 89               PSHX  
  113:               PSHH
  0019 8b               PSHH  
  114:               ; { nof bytes in (int)2,X }
  115:               ; { address in (int)0,X   }
  116:               LDA    0,X
  001a f6               LDA   ,X
  117:               PSHA
  001b 87               PSHA  
  118:               LDA    2,X
  001c e602             LDA   2,X
  119:               INCA
  001e 4c               INCA  
  120:               STA    p                  ; p:0 is used for high byte of byte counter
  001f 9ee706           STA   6,SP
  121:               LDA    3,X
  0022 e603             LDA   3,X
  122:               LDX    1,X
  0024 ee01             LDX   1,X
  123:               PULH
  0026 8a               PULH  
  124:               INCA
  0027 4c               INCA  
  125:               BRA    Zero_0
  0028 2003             BRA   L2D ;abs = 002d
  002a          L2A:    
  126:  Zero_1:    ;
  127:             ;  CLRA   A is already 0, so we do not have to clear it
  128:  Zero_2:    ;
  129:               CLR    0,X
  002a 7f               CLR   ,X
  130:               AIX    #1
  002b af01             AIX   #1
  002d          L2D:    
  131:  Zero_0:    ;
  132:               DBNZA  Zero_2
  002d 4bfb             DBNZA L2A ;abs = 002a
  133:  Zero_6:
  134:               DBNZ   p, Zero_1
  002f 9e6b05f7         DBNZ  5,SP,L2A ;abs = 002a
  135:               PULH
  0033 8a               PULH  
  136:               PULX                           ; restore *pZeroOut
  0034 88               PULX  
  137:               AIX    #4                      ; advance *pZeroOut
  0035 af04             AIX   #4
  0037          L37:    
  138:  Zero_5:    ;
  139:               DBNZ   i:1, Zero_4
  0037 9e6b02dd         DBNZ  2,SP,L18 ;abs = 0018
  140:               DBNZ   i:0, Zero_3
  003b 9e6b01d9         DBNZ  1,SP,L18 ;abs = 0018
  141:               ;
  142:  CopyDown:    ;
  143:  
  144:    }
  145:  
  146:  #endif
  147:  
  148:    /* copy down */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -