Rev | Line | |
---|
[9] | 1 | ! memcpy() Author: Kees J. Bot
|
---|
| 2 | ! 27 Jan 1994
|
---|
| 3 | .sect .text; .sect .rom; .sect .data; .sect .bss
|
---|
| 4 |
|
---|
| 5 | ! void *memcpy(void *s1, const void *s2, size_t n)
|
---|
| 6 | ! Copy a chunk of memory.
|
---|
| 7 | ! This routine need not handle overlap, so it does not handle overlap.
|
---|
| 8 | ! One could simply call __memmove, the cost of the overlap check is
|
---|
| 9 | ! negligible, but you are dealing with a programmer who believes that
|
---|
| 10 | ! if anything can go wrong, it should go wrong.
|
---|
| 11 | !
|
---|
| 12 | .sect .text
|
---|
| 13 | .define _memcpy
|
---|
| 14 | _memcpy:
|
---|
| 15 | push bp
|
---|
| 16 | mov bp, sp
|
---|
| 17 | push si
|
---|
| 18 | push di
|
---|
| 19 | mov di, 4(bp) ! String s1
|
---|
| 20 | mov si, 6(bp) ! String s2
|
---|
| 21 | mov cx, 8(bp) ! Length
|
---|
| 22 | ! No overlap check here
|
---|
| 23 | jmp __memcpy ! Call the part of __memmove that copies up
|
---|
Note:
See
TracBrowser
for help on using the repository browser.