OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib-1.10.0/] [newlib/] [libc/] [machine/] [h8300/] [memcpy.S] - Blame information for rev 1773

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1007 ivang
#include "defines.h"
2
 
3
#ifdef __H8300H__
4
        .h8300h
5
#endif
6
 
7
#ifdef __H8300S__
8
        .h8300s
9
#endif
10
 
11
        .global _memcpy
12
_memcpy:
13
;       MOVP    @(2/4,r7),A0P   ; dst
14
;       MOVP    @(4/8,r7),A1P   ; src
15
;       MOVP    @(6/12,r7),A2P  ; len
16
 
17
        MOVP    A0P,A3P ; keep copy of final dst
18
        ADDP    A2P,A0P ; point to end of dst
19
        CMPP    A0P,A3P ; see if anything to do
20
        beq     quit
21
 
22
        ADDP    A2P,A1P ; point to end of src
23
 
24
        ; lets see if we can do this in words
25
        or      A0L,A2L ; or in the dst address
26
        or      A3L,A2L ; or the length
27
        or      A1L,A2L ; or the src address
28
        btst    #0,A2L  ; see if the lsb is zero
29
        bne     byteloop
30
 
31
wordloop:
32
        subs    #2,A1P          ; point to word
33
        mov.w   @A1P,A2         ; get word
34
        mov.w   A2,@-A0P        ; save word
35
        CMPP    A0P,A3P         ; at the front again ?
36
        bne     wordloop
37
        rts
38
 
39
byteloop:
40
        subs    #1,A1P          ; point to byte
41
        mov.b   @A1P,A2L        ; get byte
42
        mov.b   A2L,@-A0P       ; save byte
43
        CMPP    A0P,A3P         ; at the front again ?
44
        bne     byteloop
45
 
46
        ; return with A0 pointing to dst
47
quit:   rts
48
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.