prime/asm/Runtime/mbstring.s

107 lines
4.5 KiB
ArmAsm

.include "macros.inc"
.section .text, "ax"
.global wcstombs
wcstombs:
/* 8038D738 0038A698 94 21 FF D0 */ stwu r1, -0x30(r1)
/* 8038D73C 0038A69C 7C 08 02 A6 */ mflr r0
/* 8038D740 0038A6A0 90 01 00 34 */ stw r0, 0x34(r1)
/* 8038D744 0038A6A4 BF 61 00 1C */ stmw r27, 0x1c(r1)
/* 8038D748 0038A6A8 7C 7B 1B 79 */ or. r27, r3, r3
/* 8038D74C 0038A6AC 7C BC 2B 78 */ mr r28, r5
/* 8038D750 0038A6B0 3B C0 00 00 */ li r30, 0
/* 8038D754 0038A6B4 41 82 00 0C */ beq lbl_8038D760
/* 8038D758 0038A6B8 28 04 00 00 */ cmplwi r4, 0
/* 8038D75C 0038A6BC 40 82 00 0C */ bne lbl_8038D768
lbl_8038D760:
/* 8038D760 0038A6C0 38 60 00 00 */ li r3, 0
/* 8038D764 0038A6C4 48 00 00 60 */ b lbl_8038D7C4
lbl_8038D768:
/* 8038D768 0038A6C8 7C 9D 23 78 */ mr r29, r4
/* 8038D76C 0038A6CC 48 00 00 4C */ b lbl_8038D7B8
lbl_8038D770:
/* 8038D770 0038A6D0 A0 9D 00 00 */ lhz r4, 0(r29)
/* 8038D774 0038A6D4 28 04 00 00 */ cmplwi r4, 0
/* 8038D778 0038A6D8 40 82 00 10 */ bne lbl_8038D788
/* 8038D77C 0038A6DC 38 00 00 00 */ li r0, 0
/* 8038D780 0038A6E0 7C 1B F1 AE */ stbx r0, r27, r30
/* 8038D784 0038A6E4 48 00 00 3C */ b lbl_8038D7C0
lbl_8038D788:
/* 8038D788 0038A6E8 38 61 00 08 */ addi r3, r1, 8
/* 8038D78C 0038A6EC 3B BD 00 02 */ addi r29, r29, 2
/* 8038D790 0038A6F0 48 00 00 49 */ bl unicode_to_UTF8
/* 8038D794 0038A6F4 7C 7F 1B 78 */ mr r31, r3
/* 8038D798 0038A6F8 7C 1E FA 14 */ add r0, r30, r31
/* 8038D79C 0038A6FC 7C 00 E0 40 */ cmplw r0, r28
/* 8038D7A0 0038A700 41 81 00 20 */ bgt lbl_8038D7C0
/* 8038D7A4 0038A704 7F E5 FB 78 */ mr r5, r31
/* 8038D7A8 0038A708 7C 7B F2 14 */ add r3, r27, r30
/* 8038D7AC 0038A70C 38 81 00 08 */ addi r4, r1, 8
/* 8038D7B0 0038A710 48 00 29 15 */ bl strncpy
/* 8038D7B4 0038A714 7F DE FA 14 */ add r30, r30, r31
lbl_8038D7B8:
/* 8038D7B8 0038A718 7C 1E E0 40 */ cmplw r30, r28
/* 8038D7BC 0038A71C 40 81 FF B4 */ ble lbl_8038D770
lbl_8038D7C0:
/* 8038D7C0 0038A720 7F C3 F3 78 */ mr r3, r30
lbl_8038D7C4:
/* 8038D7C4 0038A724 BB 61 00 1C */ lmw r27, 0x1c(r1)
/* 8038D7C8 0038A728 80 01 00 34 */ lwz r0, 0x34(r1)
/* 8038D7CC 0038A72C 7C 08 03 A6 */ mtlr r0
/* 8038D7D0 0038A730 38 21 00 30 */ addi r1, r1, 0x30
/* 8038D7D4 0038A734 4E 80 00 20 */ blr
.global unicode_to_UTF8
unicode_to_UTF8:
/* 8038D7D8 0038A738 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8038D7DC 0038A73C 28 03 00 00 */ cmplwi r3, 0
/* 8038D7E0 0038A740 80 02 CF 70 */ lwz r0, lbl_805AEC90@sda21(r2)
/* 8038D7E4 0038A744 90 01 00 08 */ stw r0, 8(r1)
/* 8038D7E8 0038A748 40 82 00 0C */ bne lbl_8038D7F4
/* 8038D7EC 0038A74C 38 60 00 00 */ li r3, 0
/* 8038D7F0 0038A750 48 00 00 84 */ b lbl_8038D874
lbl_8038D7F4:
/* 8038D7F4 0038A754 54 80 04 3E */ clrlwi r0, r4, 0x10
/* 8038D7F8 0038A758 28 00 00 80 */ cmplwi r0, 0x80
/* 8038D7FC 0038A75C 40 80 00 0C */ bge lbl_8038D808
/* 8038D800 0038A760 38 A0 00 01 */ li r5, 1
/* 8038D804 0038A764 48 00 00 18 */ b lbl_8038D81C
lbl_8038D808:
/* 8038D808 0038A768 28 00 08 00 */ cmplwi r0, 0x800
/* 8038D80C 0038A76C 40 80 00 0C */ bge lbl_8038D818
/* 8038D810 0038A770 38 A0 00 02 */ li r5, 2
/* 8038D814 0038A774 48 00 00 08 */ b lbl_8038D81C
lbl_8038D818:
/* 8038D818 0038A778 38 A0 00 03 */ li r5, 3
lbl_8038D81C:
/* 8038D81C 0038A77C 2C 05 00 02 */ cmpwi r5, 2
/* 8038D820 0038A780 7C C3 2A 14 */ add r6, r3, r5
/* 8038D824 0038A784 41 82 00 2C */ beq lbl_8038D850
/* 8038D828 0038A788 40 80 00 10 */ bge lbl_8038D838
/* 8038D82C 0038A78C 2C 05 00 01 */ cmpwi r5, 1
/* 8038D830 0038A790 40 80 00 30 */ bge lbl_8038D860
/* 8038D834 0038A794 48 00 00 3C */ b lbl_8038D870
lbl_8038D838:
/* 8038D838 0038A798 2C 05 00 04 */ cmpwi r5, 4
/* 8038D83C 0038A79C 40 80 00 34 */ bge lbl_8038D870
/* 8038D840 0038A7A0 54 80 06 BE */ clrlwi r0, r4, 0x1a
/* 8038D844 0038A7A4 54 84 D5 BE */ rlwinm r4, r4, 0x1a, 0x16, 0x1f
/* 8038D848 0038A7A8 60 00 00 80 */ ori r0, r0, 0x80
/* 8038D84C 0038A7AC 9C 06 FF FF */ stbu r0, -1(r6)
lbl_8038D850:
/* 8038D850 0038A7B0 54 80 06 BE */ clrlwi r0, r4, 0x1a
/* 8038D854 0038A7B4 54 84 D5 BE */ rlwinm r4, r4, 0x1a, 0x16, 0x1f
/* 8038D858 0038A7B8 60 00 00 80 */ ori r0, r0, 0x80
/* 8038D85C 0038A7BC 9C 06 FF FF */ stbu r0, -1(r6)
lbl_8038D860:
/* 8038D860 0038A7C0 38 61 00 08 */ addi r3, r1, 8
/* 8038D864 0038A7C4 7C 03 28 AE */ lbzx r0, r3, r5
/* 8038D868 0038A7C8 7C 80 03 78 */ or r0, r4, r0
/* 8038D86C 0038A7CC 98 06 FF FF */ stb r0, -1(r6)
lbl_8038D870:
/* 8038D870 0038A7D0 7C A3 2B 78 */ mr r3, r5
lbl_8038D874:
/* 8038D874 0038A7D4 38 21 00 10 */ addi r1, r1, 0x10
/* 8038D878 0038A7D8 4E 80 00 20 */ blr