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

📄 lib_str.lst

📁 lpc2478开发板基于IAR编译器移植ucos实验例程
💻 LST
📖 第 1 页 / 共 5 页
字号:
   \   0000002C   0100001A           BNE      ??Str_Cat_N_3
    464                  return  ((CPU_CHAR *)0);
   \   00000030   0000A0E3           MOV      R0,#+0
   \   00000034   220000EA           B        ??Str_Cat_N_1
    465              }
    466          
    467          
    468              pstr = pdest;
   \                     ??Str_Cat_N_3:
   \   00000038   03C0B0E1           MOVS     R12,R3
    469              while (( pstr != (CPU_CHAR *)0) &&                          /* Adv to end of cur dest str until NULL ptr ...        */
    470                     (*pstr != (CPU_CHAR  )0)) {                          /* ... or NULL char found..                             */
   \                     ??Str_Cat_N_4:
   \   0000003C   00005CE3           CMP      R12,#+0
   \   00000040   0400000A           BEQ      ??Str_Cat_N_5
   \   00000044   0000DCE5           LDRB     R0,[R12, #+0]
   \   00000048   000050E3           CMP      R0,#+0
   \   0000004C   0100000A           BEQ      ??Str_Cat_N_5
    471                  pstr++;
   \   00000050   01C09CE2           ADDS     R12,R12,#+1
   \   00000054   F8FFFFEA           B        ??Str_Cat_N_4
    472              }
    473              if (pstr == (CPU_CHAR *)0) {                                /* If NULL str overrun, rtn NULL (see Note #2b).        */
   \                     ??Str_Cat_N_5:
   \   00000058   00005CE3           CMP      R12,#+0
   \   0000005C   0100001A           BNE      ??Str_Cat_N_6
    474                  return ((CPU_CHAR *)0);
   \   00000060   0000A0E3           MOV      R0,#+0
   \   00000064   160000EA           B        ??Str_Cat_N_1
    475              }
    476          
    477              pstr_next = pstr;
   \                     ??Str_Cat_N_6:
   \   00000068   0C40B0E1           MOVS     R4,R12
    478              pstr_next++;
   \   0000006C   014094E2           ADDS     R4,R4,#+1
    479              len_cat   = 0;
   \   00000070   0000A0E3           MOV      R0,#+0
   \   00000074   0050B0E1           MOVS     R5,R0
    480          
    481              while (( pstr_next != (CPU_CHAR *)0) &&                     /* Cat str until NULL ptr(s)  (see Note #2c)  ...       */
    482                     ( pstr_cat  != (CPU_CHAR *)0) &&
    483                     (*pstr_cat  != (CPU_CHAR  )0) &&                     /* ... or NULL char found     (see Note #2d); ...       */
    484                     ( len_cat   <  (CPU_SIZE_T)len_max)) {               /* ... or max nbr chars cat'd (see Note #2d).           */
   \                     ??Str_Cat_N_7:
   \   00000078   000054E3           CMP      R4,#+0
   \   0000007C   0D00000A           BEQ      ??Str_Cat_N_8
   \   00000080   000051E3           CMP      R1,#+0
   \   00000084   0B00000A           BEQ      ??Str_Cat_N_8
   \   00000088   0000D1E5           LDRB     R0,[R1, #+0]
   \   0000008C   000050E3           CMP      R0,#+0
   \   00000090   0800000A           BEQ      ??Str_Cat_N_8
   \   00000094   020055E1           CMP      R5,R2
   \   00000098   0600002A           BCS      ??Str_Cat_N_8
    485                 *pstr = *pstr_cat;
   \   0000009C   0000D1E5           LDRB     R0,[R1, #+0]
   \   000000A0   0000CCE5           STRB     R0,[R12, #+0]
    486                  pstr++;
   \   000000A4   01C09CE2           ADDS     R12,R12,#+1
    487                  pstr_next++;
   \   000000A8   014094E2           ADDS     R4,R4,#+1
    488                  pstr_cat++;
   \   000000AC   011091E2           ADDS     R1,R1,#+1
    489                  len_cat++;
   \   000000B0   015095E2           ADDS     R5,R5,#+1
   \   000000B4   EFFFFFEA           B        ??Str_Cat_N_7
    490              }
    491          
    492             *pstr = (CPU_CHAR)0;                                         /* Append NULL char (see Note #2c2).                    */
   \                     ??Str_Cat_N_8:
   \   000000B8   0000A0E3           MOV      R0,#+0
   \   000000BC   0000CCE5           STRB     R0,[R12, #+0]
    493          
    494          
    495              return (pdest);
   \   000000C0   0300B0E1           MOVS     R0,R3
   \                     ??Str_Cat_N_1:
   \   000000C4   3000BDE8           POP      {R4,R5}
   \   000000C8   0EF0A0E1           MOV      PC,LR            ;; return
    496          }
    497          
    498          
    499          /*$PAGE*/
    500          /*
    501          *********************************************************************************************************
    502          *                                              Str_Cmp()
    503          *
    504          * Description : Determine if two strings are identical.
    505          *
    506          * Argument(s) : p1_str      Pointer to first  string (see Note #1).
    507          *
    508          *               p2_str      Pointer to second string (see Note #1).
    509          *
    510          * Return(s)   : 0,              if strings are identical             (see Notes #2a, #2e, & #2f).
    511          *
    512          *               Negative value, if 'p1_str' is less    than 'p2_str' (see Notes #2b, #2g, & #2d).
    513          *
    514          *               Positive value, if 'p1_str' is greater than 'p2_str' (see Notes #2c, #2h, & #2d).
    515          *
    516          * Caller(s)   : various.
    517          *
    518          * Note(s)     : (1) String buffers NOT modified.
    519          *
    520          *               (2) String comparison terminates when :
    521          *
    522          *                   (a) BOTH string pointer(s) are passed NULL pointers.
    523          *                       (1) NULL strings identical; return 0.
    524          *
    525          *                   (b) 'p1_str' passed a NULL pointer.
    526          *                       (1) Return negative value of character pointed to by 'p2_str'.
    527          *
    528          *                   (c) 'p2_str' passed a NULL pointer.
    529          *                       (1) Return positive value of character pointed to by 'p1_str'.
    530          *
    531          *                   (d) Non-matching characters found.
    532          *                       (1) Return signed-integer difference of the character pointed to by 'p2_str'
    533          *                           from the character pointed to by 'p1_str'.
    534          *
    535          *                   (e) Terminating NULL character found in both strings.
    536          *                       (1) Strings identical; return 0.
    537          *                       (2) Only one NULL character test required in conditional since previous condition
    538          *                           tested character equality.
    539          *
    540          *                   (f) BOTH strings point to NULL.
    541          *                       (1) Strings overlap with NULL address.
    542          *                       (2) Strings identical up to but NOT beyond or including the NULL address; return 0.
    543          *
    544          *                   (g) 'p1_str_next' points to NULL.
    545          *                       (1) 'p1_str' overlaps with NULL address.
    546          *                       (2) Strings compared up to but NOT beyond or including the NULL address.
    547          *                       (3) Return  negative value of character pointed to by 'p2_str_next'.
    548          *
    549          *                   (h) 'p2_str_next' points to NULL.
    550          *                       (1) 'p2_str' overlaps with NULL address.
    551          *                       (2) Strings compared up to but NOT beyond or including the NULL address.
    552          *                       (3) Return  positive value of character pointed to by 'p1_str_next'.
    553          *
    554          *               (3) Since 16-bit signed arithmetic is performed to calculate a non-identical comparison
    555          *                   return value, 'CPU_CHAR' native data type size MUST be 8-bit.
    556          *********************************************************************************************************
    557          */
    558          /*$PAGE*/

   \                                 In segment CODE, align 4, keep-with-next
    559          CPU_INT16S  Str_Cmp (CPU_CHAR  *p1_str,
    560                               CPU_CHAR  *p2_str)
    561          {
   \                     Str_Cmp:
   \   00000000   30002DE9           PUSH     {R4,R5}
   \   00000004   0020B0E1           MOVS     R2,R0
    562              CPU_CHAR    *p1_str_next;
    563              CPU_CHAR    *p2_str_next;
    564              CPU_INT16S   cmp_val;
    565          
    566          
    567              if (p1_str == (CPU_CHAR *)0) {
   \   00000008   000052E3           CMP      R2,#+0
   \   0000000C   0A00001A           BNE      ??Str_Cmp_0
    568                  if (p2_str == (CPU_CHAR *)0) {
   \   00000010   000051E3           CMP      R1,#+0
   \   00000014   0100001A           BNE      ??Str_Cmp_1
    569                      return ((CPU_INT16S)0);                             /* If BOTH str ptrs NULL, rtn 0 (see Note #2a).         */
   \   00000018   0000A0E3           MOV      R0,#+0
   \   0000001C   410000EA           B        ??Str_Cmp_2
    570                  }
    571                  cmp_val = (CPU_INT16S)0 - (CPU_INT16S)(*p2_str);
   \                     ??Str_Cmp_1:
   \   00000020   0000D1E5           LDRB     R0,[R1, #+0]
   \   00000024   000070E2           RSBS     R0,R0,#+0
   \   00000028   0030B0E1           MOVS     R3,R0
    572                  return (cmp_val);                                       /* If p1_str NULL, rtn neg p2_str val (see Note #2b).   */
   \   0000002C   0300B0E1           MOVS     R0,R3
   \   00000030   0008A0E1           MOV      R0,R0, LSL #+16
   \   00000034   4008B0E1           MOVS     R0,R0, ASR #+16
   \   00000038   3A0000EA           B        ??Str_Cmp_2
    573              }
    574              if (p2_str == (CPU_CHAR *)0) {
   \                     ??Str_Cmp_0:
   \   0000003C   000051E3           CMP      R1,#+0
   \   00000040   0500001A           BNE      ??Str_Cmp_3
    575                  cmp_val = (CPU_INT16S)(*p1_str);
   \   00000044   0000D2E5           LDRB     R0,[R2, #+0]
   \   00000048   0030B0E1           MOVS     R3,R0
    576                  return (cmp_val);                                       /* If p2_str NULL, rtn pos p1_str val (see Note #2c).   */
   \   0000004C   0300B0E1           MOVS     R0,R3
   \   00000050   0008A0E1           MOV      R0,R0, LSL #+16
   \   00000054   4008B0E1           MOVS     R0,R0, ASR #+16
   \   00000058   320000EA           B        ??Str_Cmp_2
    577              }
    578          
    579          
    580              p1_str_next = p1_str;
   \                     ??Str_Cmp_3:
   \   0000005C   02C0B0E1           MOVS     R12,R2
    581              p2_str_next = p2_str;
   \   00000060   0140B0E1           MOVS     R4,R1
    582              p1_str_next++;
   \   00000064   01C09CE2           ADDS     R12,R12,#+1
    583              p2_str_next++;
   \   00000068   014094E2           ADDS     R4,R4,#+1
    584              while ((*p1_str      == *p2_str)       &&                   /* Cmp strs until non-matching char (see Note #2d) ..   */
    585                     (*p1_str      != (CPU_CHAR  )0) &&                   /* .. or NULL char(s)               (see Note #2e) ..   */
    586                     ( p1_str_next != (CPU_CHAR *)0) &&                   /* .. or NULL ptr(s) found (see Notes #2f, #2g, & #2h). */
    587                     ( p2_str_next != (CPU_CHAR *)0)) {
   \                     ??Str_Cmp_4:
   \   0000006C   0000D2E5           LDRB     R0,[R2, #+0]
   \   00000070   0050D1E5           LDRB     R5,[R1, #+0]
   \   00000074   050050E1           CMP      R0,R5
   \   00000078   0B00001A           BNE      ??Str_Cmp_5
   \   0000007C   0000D2E5           LDRB     R0,[R2, #+0]
   \   00000080   000050E3           CMP      R0,#+0
   \   00000084   0800000A           BEQ      ??Str_Cmp_5
   \   00000088   00005CE3           CMP      R12,#+0
   \   0000008C   0600000A           BEQ      ??Str_Cmp_5
   \   00000090   000054E3           CMP      R4,#+0
   \   00000094   0400000A           BEQ      ??Str_Cmp_5
    588                  p1_str_next++;
   \   00000098   01C09CE2           ADDS     R12,R12,#+1
    589                  p2_str_next++;
   \   0000009C   014094E2           ADDS     R4,R4,#+1
    590                  p1_str++;
   \   000000A0   012092E2           ADDS     R2,R2,#+1

⌨️ 快捷键说明

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