📄 lib_ascii.lst
字号:
\ 00000090 01D1 BNE.N ??ASCII_IsPunct_16
\ ??ASCII_IsPunct_13:
\ 00000092 0120 MOVS R0,#+1
\ 00000094 00E0 B.N ??ASCII_IsPunct_17
\ ??ASCII_IsPunct_16:
\ 00000096 0020 MOVS R0,#+0
\ ??ASCII_IsPunct_17:
\ 00000098 0028 CMP R0,#+0
\ 0000009A 01D1 BNE.N ??ASCII_IsPunct_2
\ 0000009C 0120 MOVS R0,#+1
\ 0000009E 00E0 B.N ??ASCII_IsPunct_18
\ ??ASCII_IsPunct_2:
\ 000000A0 0020 MOVS R0,#+0
509
510 return (punct);
\ ??ASCII_IsPunct_18:
\ 000000A2 C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 000000A4 7047 BX LR ;; return
511 }
512
513
514 /*
515 *********************************************************************************************************
516 * ASCII_IsCtrl()
517 *
518 * Description : Determine whether a character is a control character.
519 *
520 * Argument(s) : c Character to examine.
521 *
522 * Return(s) : DEF_YES, if character is a control character.
523 *
524 * DEF_NO, if character is NOT a control character.
525 *
526 * Caller(s) : Application.
527 *
528 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.4.(2) states that "iscntrl() ... tests for any
529 * control character".
530 *
531 * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US
532 * ASCII character set, ... the control characters are those whose values lie from
533 * 0 (NUL) through 0x1F (US), and the character 0x7F (DEL)".
534 *********************************************************************************************************
535 */
536
\ In section .text, align 2, keep-with-next
537 CPU_BOOLEAN ASCII_IsCtrl (CPU_CHAR c)
538 {
\ ASCII_IsCtrl:
\ 00000000 0100 MOVS R1,R0
539 CPU_BOOLEAN ctrl;
540
541
542 ctrl = ASCII_IS_CTRL(c);
\ 00000002 49B2 SXTB R1,R1 ;; SignExt R1,R1,#+24,#+24
\ 00000004 0029 CMP R1,#+0
\ 00000006 02D4 BMI.N ??ASCII_IsCtrl_0
\ 00000008 C9B2 UXTB R1,R1 ;; ZeroExt R1,R1,#+24,#+24
\ 0000000A 2029 CMP R1,#+32
\ 0000000C 02D3 BCC.N ??ASCII_IsCtrl_1
\ ??ASCII_IsCtrl_0:
\ 0000000E C9B2 UXTB R1,R1 ;; ZeroExt R1,R1,#+24,#+24
\ 00000010 7F29 CMP R1,#+127
\ 00000012 01D1 BNE.N ??ASCII_IsCtrl_2
\ ??ASCII_IsCtrl_1:
\ 00000014 0120 MOVS R0,#+1
\ 00000016 00E0 B.N ??ASCII_IsCtrl_3
\ ??ASCII_IsCtrl_2:
\ 00000018 0020 MOVS R0,#+0
543
544 return (ctrl);
\ ??ASCII_IsCtrl_3:
\ 0000001A C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 0000001C 7047 BX LR ;; return
545 }
546
547
548 /*$PAGE*/
549 /*
550 *********************************************************************************************************
551 * ASCII_ToLower()
552 *
553 * Description : Convert uppercase alphabetic character to its corresponding lowercase alphabetic character.
554 *
555 * Argument(s) : c Character to convert.
556 *
557 * Return(s) : Lowercase equivalent of 'c', if character 'c' is an uppercase character (see Note #1b1).
558 *
559 * Character 'c', otherwise (see Note #1b2).
560 *
561 * Caller(s) : Application.
562 *
563 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.2.1.(2) states that "tolower() ... converts an
564 * uppercase letter to a corresponding lowercase letter".
565 *
566 * (b) ISO/IEC 9899:TC2, Section 7.4.2.1.(3) states that :
567 *
568 * (1) (A) "if the argument is a character for which isupper() is true and there are
569 * one or more corresponding characters ... for which islower() is true," ...
570 * (B) "tolower() ... returns one of the corresponding characters;" ...
571 *
572 * (2) "otherwise, the argument is returned unchanged."
573 *********************************************************************************************************
574 */
575
\ In section .text, align 2, keep-with-next
576 CPU_CHAR ASCII_ToLower (CPU_CHAR c)
577 {
\ ASCII_ToLower:
\ 00000000 0100 MOVS R1,R0
578 CPU_CHAR lower;
579
580
581 lower = ASCII_TO_LOWER(c);
\ 00000002 C9B2 UXTB R1,R1 ;; ZeroExt R1,R1,#+24,#+24
\ 00000004 4129 CMP R1,#+65
\ 00000006 04D3 BCC.N ??ASCII_ToLower_0
\ 00000008 C9B2 UXTB R1,R1 ;; ZeroExt R1,R1,#+24,#+24
\ 0000000A 5B29 CMP R1,#+91
\ 0000000C 01D2 BCS.N ??ASCII_ToLower_0
\ 0000000E 0120 MOVS R0,#+1
\ 00000010 00E0 B.N ??ASCII_ToLower_1
\ ??ASCII_ToLower_0:
\ 00000012 0020 MOVS R0,#+0
\ ??ASCII_ToLower_1:
\ 00000014 0128 CMP R0,#+1
\ 00000016 02D1 BNE.N ??ASCII_ToLower_2
\ 00000018 11F12000 ADDS R0,R1,#+32
\ 0000001C 00E0 B.N ??ASCII_ToLower_3
\ ??ASCII_ToLower_2:
\ 0000001E 0800 MOVS R0,R1
582
583 return (lower);
\ ??ASCII_ToLower_3:
\ 00000020 C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 00000022 7047 BX LR ;; return
584 }
585
586
587 /*
588 *********************************************************************************************************
589 * ASCII_ToUpper()
590 *
591 * Description : Convert lowercase alphabetic character to its corresponding uppercase alphabetic character.
592 *
593 * Argument(s) : c Character to convert.
594 *
595 * Return(s) : Uppercase equivalent of 'c', if character 'c' is a lowercase character (see Note #1b1).
596 *
597 * Character 'c', otherwise (see Note #1b2).
598 *
599 * Caller(s) : Application.
600 *
601 * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.2.2.(2) states that "toupper() ... converts a
602 * lowercase letter to a corresponding uppercase letter".
603 *
604 * (b) ISO/IEC 9899:TC2, Section 7.4.2.2.(3) states that :
605 *
606 * (1) (A) "if the argument is a character for which islower() is true and there are
607 * one or more corresponding characters ... for which isupper() is true," ...
608 * (B) "toupper() ... returns one of the corresponding characters;" ...
609 *
610 * (2) "otherwise, the argument is returned unchanged."
611 *********************************************************************************************************
612 */
613
\ In section .text, align 2, keep-with-next
614 CPU_CHAR ASCII_ToUpper (CPU_CHAR c)
615 {
\ ASCII_ToUpper:
\ 00000000 0100 MOVS R1,R0
616 CPU_CHAR upper;
617
618
619 upper = ASCII_TO_UPPER(c);
\ 00000002 C9B2 UXTB R1,R1 ;; ZeroExt R1,R1,#+24,#+24
\ 00000004 6129 CMP R1,#+97
\ 00000006 04D3 BCC.N ??ASCII_ToUpper_0
\ 00000008 C9B2 UXTB R1,R1 ;; ZeroExt R1,R1,#+24,#+24
\ 0000000A 7B29 CMP R1,#+123
\ 0000000C 01D2 BCS.N ??ASCII_ToUpper_0
\ 0000000E 0120 MOVS R0,#+1
\ 00000010 00E0 B.N ??ASCII_ToUpper_1
\ ??ASCII_ToUpper_0:
\ 00000012 0020 MOVS R0,#+0
\ ??ASCII_ToUpper_1:
\ 00000014 0128 CMP R0,#+1
\ 00000016 02D1 BNE.N ??ASCII_ToUpper_2
\ 00000018 B1F12000 SUBS R0,R1,#+32
\ 0000001C 00E0 B.N ??ASCII_ToUpper_3
\ ??ASCII_ToUpper_2:
\ 0000001E 0800 MOVS R0,R1
620
621 return (upper);
\ ??ASCII_ToUpper_3:
\ 00000020 C0B2 UXTB R0,R0 ;; ZeroExt R0,R0,#+24,#+24
\ 00000022 7047 BX LR ;; return
622 }
623
624
625 /*$PAGE*/
626 /*
627 *********************************************************************************************************
628 * ASCII_Cmp()
629 *
630 * Description : Determine if two characters are identical (case-insensitive).
631 *
632 * Argument(s) : c1 First character.
633 *
634 * c2 Second character.
635 *
636 * Return(s) : DEF_YES, if the characters are identical.
637 *
638 * DEF_NO, if the characters are NOT identical.
639 *
640 * Caller(s) : Application.
641 *
642 * Note(s) : none.
643 *********************************************************************************************************
644 */
645
\ In section .text, align 2, keep-with-next
646 CPU_BOOLEAN ASCII_Cmp (CPU_CHAR c1,
647
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -