all repos — mgba @ 6e32ade69e61f5240992a53c434ff2d211267813

mGBA Game Boy Advance Emulator

src/util/arm-algo.S (view raw)

 1# r0: Destination
 2# r1: Source
 3# r2: Number of words to copy as halfwords
 4.global _to16Bit
 5_to16Bit:
 6push {r4-r10}
 7mov r8, r0
 8mov r9, r1
 9mov r10, r2
10.L0:
11tst r10, #7
12beq .L1
13ldr r0, [r9], #4
14strh r0, [r8], #2
15sub r10, #1
16b .L0
17.L1:
18ldmia r9!, {r0-r7}
19strh r0, [r8], #2
20strh r1, [r8], #2
21strh r2, [r8], #2
22strh r3, [r8], #2
23strh r4, [r8], #2
24strh r5, [r8], #2
25strh r6, [r8], #2
26strh r7, [r8], #2
27subs r10, #8
28bne .L1
29.L9:
30pop {r4-r10}
31bx lr